diff --git a/base/applications/games/solitaire/lang/bg-BG.rc b/base/applications/games/solitaire/lang/bg-BG.rc index eafedfcd0e9..2714612b1e3 100644 --- a/base/applications/games/solitaire/lang/bg-BG.rc +++ b/base/applications/games/solitaire/lang/bg-BG.rc @@ -18,8 +18,13 @@ BEGIN GROUPBOX "Карти", -1, 7, 7, 90, 40 AUTORADIOBUTTON "Изтегли &една", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "Изтегли &три", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Показване на времето", IDC_OPT_SHOWTIME, 7 ,51 ,100 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Показване на времето", IDC_OPT_SHOWTIME, 7 ,51 ,100 ,10, WS_TABSTOP AUTOCHECKBOX "Лента &състояние", IDC_OPT_STATUSBAR, 7, 66, 100, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "Добре", IDOK, 35, 97, 50, 14 PUSHBUTTON "Отказ", IDCANCEL, 101, 97, 50, 14 END @@ -54,6 +59,8 @@ BEGIN IDS_SOL_QUIT "Да прекратя ли играта?" IDS_SOL_WIN "Поздравления, победихте!!" IDS_SOL_DEAL "Ново раздаване?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/ca-ES.rc b/base/applications/games/solitaire/lang/ca-ES.rc index 12dc410b5f3..3d88376835a 100644 --- a/base/applications/games/solitaire/lang/ca-ES.rc +++ b/base/applications/games/solitaire/lang/ca-ES.rc @@ -18,8 +18,13 @@ BEGIN GROUPBOX "Cartes", -1, 7, 7, 90, 40 AUTORADIOBUTTON "Treu-ne &Una", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "Treu-ne &Tres", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Mostra el temps", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Mostra el temps", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "&Barra d'estat", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "Acceptar", IDOK, 35, 97, 50, 14 PUSHBUTTON "Cancel·lar", IDCANCEL, 101, 97, 50, 14 END @@ -54,6 +59,8 @@ BEGIN IDS_SOL_QUIT "Voleu sortir del joc actual?" IDS_SOL_WIN "Felicitats, heu guanyat!!" IDS_SOL_DEAL "Deal again?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/cs-CZ.rc b/base/applications/games/solitaire/lang/cs-CZ.rc index 49f038f9ca3..64de79d9d56 100644 --- a/base/applications/games/solitaire/lang/cs-CZ.rc +++ b/base/applications/games/solitaire/lang/cs-CZ.rc @@ -16,8 +16,13 @@ BEGIN GROUPBOX "Karty", -1, 7, 7, 90, 40 AUTORADIOBUTTON "Sejmout &jednu", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "Sejmout &tři", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "Zobrazit č&as", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "Zobrazit č&as", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "Stavový řád&ek", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 PUSHBUTTON "Storno", IDCANCEL, 101, 97, 50, 14 END @@ -52,6 +57,8 @@ BEGIN IDS_SOL_QUIT "Ukončit rozehranou hru?" IDS_SOL_WIN "Gratulujeme, zvítězili jste!!" IDS_SOL_DEAL "Rozdat znova?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/de-DE.rc b/base/applications/games/solitaire/lang/de-DE.rc index c5674745e6c..819772c2d53 100644 --- a/base/applications/games/solitaire/lang/de-DE.rc +++ b/base/applications/games/solitaire/lang/de-DE.rc @@ -18,8 +18,13 @@ BEGIN GROUPBOX "Karten", -1, 7, 7, 90, 40 AUTORADIOBUTTON "&Eine ziehen", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "&Drei ziehen", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Zeit anzeigen", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Punkte zählen", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "Ke&ine", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Zeit anzeigen", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "S&tatusleiste", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "P&unkte behalten", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 PUSHBUTTON "Abbrechen",IDCANCEL,101,97,50,14 END @@ -54,6 +59,8 @@ BEGIN IDS_SOL_QUIT "Laufendes Spiel beenden?" IDS_SOL_WIN "Glückwunsch, Sie haben gewonnen!" IDS_SOL_DEAL "Neu geben?" + IDS_SOL_SCORE "Punkte: %d" + IDS_SOL_TIME "Zeit: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/el-GR.rc b/base/applications/games/solitaire/lang/el-GR.rc index 31794e5705c..b84cb5d9225 100644 --- a/base/applications/games/solitaire/lang/el-GR.rc +++ b/base/applications/games/solitaire/lang/el-GR.rc @@ -18,8 +18,13 @@ BEGIN GROUPBOX "Κάρτες", -1, 7, 7, 90, 40 AUTORADIOBUTTON "Ρίξε Έ&να", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "Ρίξε &Τρία", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Εμφάνιση Ώρας", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Εμφάνιση Ώρας", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "Γ&ραμμή κατάστασης", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 PUSHBUTTON "Ακύρωση", IDCANCEL, 101, 97, 50, 14 END @@ -54,6 +59,8 @@ BEGIN IDS_SOL_QUIT "Τερματισμός του πιαχνιδιού αυτού;" IDS_SOL_WIN "Συγχαρητήρια, κερδίσατε!!" IDS_SOL_DEAL "Deal again?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/en-US.rc b/base/applications/games/solitaire/lang/en-US.rc index 42138c63890..9d2c65215b9 100644 --- a/base/applications/games/solitaire/lang/en-US.rc +++ b/base/applications/games/solitaire/lang/en-US.rc @@ -18,8 +18,13 @@ BEGIN GROUPBOX "Cards", -1, 7, 7, 90, 40 AUTORADIOBUTTON "Draw &One", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "Draw &Three", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Show Time", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Show Time", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "S&tatus bar", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 PUSHBUTTON "Cancel", IDCANCEL, 101, 97, 50, 14 END @@ -54,6 +59,8 @@ BEGIN IDS_SOL_QUIT "Quit the current game?" IDS_SOL_WIN "Congratulations, you win!" IDS_SOL_DEAL "Deal again?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/es-ES.rc b/base/applications/games/solitaire/lang/es-ES.rc index 67b2001b837..76d6833bff7 100644 --- a/base/applications/games/solitaire/lang/es-ES.rc +++ b/base/applications/games/solitaire/lang/es-ES.rc @@ -19,8 +19,13 @@ BEGIN GROUPBOX "Cartas", -1, 7, 7, 90, 40 AUTORADIOBUTTON "Sacar &Una", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "Sacar &Tres", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Mostrar tiempo", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Mostrar tiempo", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "&Barra de estado", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "Aceptar", IDOK, 35, 97, 50, 14 PUSHBUTTON "Cancelar", IDCANCEL, 101, 97, 50, 14 END @@ -55,6 +60,8 @@ BEGIN IDS_SOL_QUIT "¿Finalizar el juego actual?" IDS_SOL_WIN "Felicidades, ¡¡Has ganado!!" IDS_SOL_DEAL "¿Repartir de nuevo?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/eu-ES.rc b/base/applications/games/solitaire/lang/eu-ES.rc index 3f29a3ed421..d30ed76cd45 100644 --- a/base/applications/games/solitaire/lang/eu-ES.rc +++ b/base/applications/games/solitaire/lang/eu-ES.rc @@ -18,8 +18,13 @@ BEGIN GROUPBOX "Kartak ", -1, 7, 7, 90, 40 AUTORADIOBUTTON "Banaka &atera", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "Hirunaka &atera", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Denbora erakutsi", IDC_OPT_SHOWTIME, 7 ,51 ,67 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Denbora erakutsi", IDC_OPT_SHOWTIME, 7 ,51 ,67 ,10, WS_TABSTOP AUTOCHECKBOX "&Egoera barra", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "Ados", IDOK, 35, 97, 50, 14 PUSHBUTTON "Utzi", IDCANCEL, 101, 97, 50, 14 END @@ -54,6 +59,8 @@ BEGIN IDS_SOL_QUIT "Uneko jokoa amaitu?" IDS_SOL_WIN "Zorionak, irabazi duzu!!" IDS_SOL_DEAL "Deal again?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/fr-FR.rc b/base/applications/games/solitaire/lang/fr-FR.rc index 3ab493c1a2b..e9a66d5f335 100644 --- a/base/applications/games/solitaire/lang/fr-FR.rc +++ b/base/applications/games/solitaire/lang/fr-FR.rc @@ -18,8 +18,13 @@ BEGIN GROUPBOX "Cartes", -1, 7, 7, 90, 40 AUTORADIOBUTTON "En tirer une", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "En tirer trois", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "Afficher le temp&s", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "Afficher le temp&s", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "Barre de s&tatut", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 PUSHBUTTON "Annuler", IDCANCEL, 101, 97, 50, 14 END @@ -54,6 +59,8 @@ BEGIN IDS_SOL_QUIT "Quitter le jeu actuel ?" IDS_SOL_WIN "Félicitations ! Vous avez gagné !" IDS_SOL_DEAL "Redistribuer ?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/he-IL.rc b/base/applications/games/solitaire/lang/he-IL.rc index 28375736ed4..39cabae99f3 100644 --- a/base/applications/games/solitaire/lang/he-IL.rc +++ b/base/applications/games/solitaire/lang/he-IL.rc @@ -18,8 +18,13 @@ BEGIN GROUPBOX "משיכה", -1, 7, 7, 90, 40 AUTORADIOBUTTON "משוך &אחד", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "משוך &שלושה", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "משחק קצוב בזמן", IDC_OPT_SHOWTIME, 7 ,51 ,72 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "משחק קצוב בזמן", IDC_OPT_SHOWTIME, 7 ,51 ,72 ,10, WS_TABSTOP AUTOCHECKBOX "שורת מצב", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "אישור", IDOK, 35, 97, 50, 14 PUSHBUTTON "ביטול", IDCANCEL, 101, 97, 50, 14 END @@ -54,6 +59,8 @@ BEGIN IDS_SOL_QUIT "להפסיק את המשחק הנוכחי?" IDS_SOL_WIN "כל הכבוד, ניצחת!" IDS_SOL_DEAL "לחלק שוב?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/hu-HU.rc b/base/applications/games/solitaire/lang/hu-HU.rc index 6d17826659a..6bc2723232a 100644 --- a/base/applications/games/solitaire/lang/hu-HU.rc +++ b/base/applications/games/solitaire/lang/hu-HU.rc @@ -18,8 +18,13 @@ BEGIN GROUPBOX "Kártyák", -1, 7, 7, 90, 40 AUTORADIOBUTTON "&Egy lap", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "&Három lap", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Idõ mutatása", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Idõ mutatása", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "Á&llapotsor", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 PUSHBUTTON "Mégsem", IDCANCEL, 101, 97, 50, 14 END @@ -54,6 +59,8 @@ BEGIN IDS_SOL_QUIT "Kilépés ebbõl a játékból?" IDS_SOL_WIN "Gratulálok, Ön nyert!" IDS_SOL_DEAL "Új leosztás?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/id-ID.rc b/base/applications/games/solitaire/lang/id-ID.rc index 55833eb3f63..feed12ac668 100644 --- a/base/applications/games/solitaire/lang/id-ID.rc +++ b/base/applications/games/solitaire/lang/id-ID.rc @@ -18,8 +18,13 @@ BEGIN GROUPBOX "Cards", -1, 7, 7, 90, 40 AUTORADIOBUTTON "Draw &One", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "Draw &Three", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Show Time", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Show Time", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "S&tatus bar", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 PUSHBUTTON "Batal", IDCANCEL, 101, 97, 50, 14 END @@ -54,6 +59,8 @@ BEGIN IDS_SOL_QUIT "Quit the current game?" IDS_SOL_WIN "Congratulations, you win!" IDS_SOL_DEAL "Deal again?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/it-IT.rc b/base/applications/games/solitaire/lang/it-IT.rc index 0419197d78e..464a6b92091 100644 --- a/base/applications/games/solitaire/lang/it-IT.rc +++ b/base/applications/games/solitaire/lang/it-IT.rc @@ -4,6 +4,7 @@ * FILE: base/applications/games/solitaire/lang/it-IT.rc * PURPOSE: Italian Language File for Solitaire * TRANSLATOR: Gabriel Ilardi + * Marco Maria Emanuele Bartucci, 2014-04-19 */ LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL @@ -18,8 +19,13 @@ BEGIN GROUPBOX "Carte", -1, 7, 7, 90, 40 AUTORADIOBUTTON "Girane &Una", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "Girane &Tre", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Visualizza il tempo", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Punteggio", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Visualizza il tempo", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "&Barra di stato", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Mantieni il punteggio", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 PUSHBUTTON "Annulla", IDCANCEL, 101, 97, 50, 14 END @@ -54,6 +60,8 @@ BEGIN IDS_SOL_QUIT "Chiudere la partita in corso?" IDS_SOL_WIN "Congratulazioni, hai vinto!!" IDS_SOL_DEAL "Nuova partita?" + IDS_SOL_SCORE "Punteggio: %d" + IDS_SOL_TIME "Tempo: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/ja-JP.rc b/base/applications/games/solitaire/lang/ja-JP.rc index 370c03089f5..14bd313293d 100644 --- a/base/applications/games/solitaire/lang/ja-JP.rc +++ b/base/applications/games/solitaire/lang/ja-JP.rc @@ -17,8 +17,13 @@ BEGIN GROUPBOX "カード", -1, 7, 7, 90, 40 AUTORADIOBUTTON "1 枚ずつ取る(&O)", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "3 枚ずつ取る(&T)", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "時間を表示する(&S)", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "時間を表示する(&S)", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "ステータスバーを表示する(&T)", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 PUSHBUTTON "キャンセル", IDCANCEL, 101, 97, 50, 14 END @@ -53,6 +58,8 @@ BEGIN IDS_SOL_QUIT "現在のゲームを終了しますか?" IDS_SOL_WIN "おめでとう、あなたの勝ちです!" IDS_SOL_DEAL "もう一度カードを配りますか?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/ko-KR.rc b/base/applications/games/solitaire/lang/ko-KR.rc index 2414a991d68..b5c84f34e29 100644 --- a/base/applications/games/solitaire/lang/ko-KR.rc +++ b/base/applications/games/solitaire/lang/ko-KR.rc @@ -12,8 +12,13 @@ BEGIN GROUPBOX "카드", -1, 7, 7, 90, 40 AUTORADIOBUTTON "한 장씩(&O)", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "세 장씩(&T)", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "시간 보이기(&S)", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "시간 보이기(&S)", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "상태 표시줄(&T)", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "확인", IDOK, 35, 97, 50, 14 PUSHBUTTON "취소", IDCANCEL, 101, 97, 50, 14 END @@ -48,6 +53,8 @@ BEGIN IDS_SOL_QUIT "현재 게임을 끝낼가요?" IDS_SOL_WIN "축하합니다!!" IDS_SOL_DEAL "Deal again?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/lt-LT.rc b/base/applications/games/solitaire/lang/lt-LT.rc index 4200bb0abef..ee60886ae06 100644 --- a/base/applications/games/solitaire/lang/lt-LT.rc +++ b/base/applications/games/solitaire/lang/lt-LT.rc @@ -18,8 +18,13 @@ BEGIN GROUPBOX "Kortos", -1, 7, 7, 90, 40 AUTORADIOBUTTON "Dalinti po &vieną", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "Dalinti po &tris", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Rodyti laiką", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Rodyti laiką", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "&Būsenos juosta", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "Gerai", IDOK, 35, 97, 50, 14 PUSHBUTTON "Atsisakyti", IDCANCEL, 101, 97, 50, 14 END @@ -54,6 +59,8 @@ BEGIN IDS_SOL_QUIT "Baigti žaidimą?" IDS_SOL_WIN "Sveikiname, jūs laimėjote!!" IDS_SOL_DEAL "Dalinti vėl?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/nl-NL.rc b/base/applications/games/solitaire/lang/nl-NL.rc index 9223cf47c98..bb3906ca592 100644 --- a/base/applications/games/solitaire/lang/nl-NL.rc +++ b/base/applications/games/solitaire/lang/nl-NL.rc @@ -18,8 +18,13 @@ BEGIN GROUPBOX "Delen", -1, 7, 7, 90, 40 AUTORADIOBUTTON "&Eén kaart", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "&Drie kaarten", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "Tijd &weergeven", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "Tijd &weergeven", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "S&tatusbalk", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 PUSHBUTTON "Annuleren", IDCANCEL, 101, 97, 50, 14 END @@ -54,6 +59,8 @@ BEGIN IDS_SOL_QUIT "Het huidige spel afsluiten?" IDS_SOL_WIN "Gefeliciteerd, u heeft gewonnen!" IDS_SOL_DEAL "Nogmaals spelen?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/no-NO.rc b/base/applications/games/solitaire/lang/no-NO.rc index f490db18f9e..78ee4941222 100644 --- a/base/applications/games/solitaire/lang/no-NO.rc +++ b/base/applications/games/solitaire/lang/no-NO.rc @@ -10,8 +10,13 @@ BEGIN GROUPBOX "Kort", -1, 7, 7, 90, 40 AUTORADIOBUTTON "Velg &et", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "Velg &tre", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Vis tid", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Vis tid", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "S&tatuslinje", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 PUSHBUTTON "Avbryt", IDCANCEL, 101, 97, 50, 14 END @@ -46,6 +51,8 @@ BEGIN IDS_SOL_QUIT "Slutt nåværende spill?" IDS_SOL_WIN "Gratulerer, du vant!!" IDS_SOL_DEAL "Del ut igjen?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/pl-PL.rc b/base/applications/games/solitaire/lang/pl-PL.rc index 3579a3cf237..8ba4f725869 100644 --- a/base/applications/games/solitaire/lang/pl-PL.rc +++ b/base/applications/games/solitaire/lang/pl-PL.rc @@ -5,6 +5,7 @@ * Updated by Caemyr (olaf_siejka@o2.pl), Nov, 2008 * Updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (Apr, 2011) * UTF-8 conversion by Caemyr (May, 2011) + * updated by Wojciech Kozłowski (wojo664@gmail.com) (April, 2014) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -19,8 +20,13 @@ BEGIN GROUPBOX "Karty", -1, 7, 7, 90, 40 AUTORADIOBUTTON "Rozdaj &jedną", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "Rozdaj &dwie", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Pokazuj czas gry", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Punktowanie", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standardowe", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&Brak", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Pokazuj czas gry", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "Pokazuj pa&sek stanu", IDC_OPT_STATUSBAR, 7, 66, 77, 10, WS_TABSTOP + AUTOCHECKBOX "Pamiętaj punkty", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 PUSHBUTTON "Anuluj", IDCANCEL, 101, 97, 50, 14 END @@ -51,10 +57,12 @@ END STRINGTABLE BEGIN IDS_SOL_NAME "Pasjans" - IDS_SOL_ABOUT "Pasjans by J. Brown\n\nCardLib version 1.0." + IDS_SOL_ABOUT "Pasjans - autor: J. Brown\n\nCardLib wersja 1.0." IDS_SOL_QUIT "Zakończyć aktualną grę?" IDS_SOL_WIN "Gratulacje, wygrałeś!" IDS_SOL_DEAL "Nowe rozdanie?" + IDS_SOL_SCORE "Wynik: %d" + IDS_SOL_TIME "Czas: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/ro-RO.rc b/base/applications/games/solitaire/lang/ro-RO.rc index 18e3b937faa..bf3609e011b 100644 --- a/base/applications/games/solitaire/lang/ro-RO.rc +++ b/base/applications/games/solitaire/lang/ro-RO.rc @@ -18,8 +18,13 @@ BEGIN GROUPBOX "Cărți", -1, 7, 7, 90, 40 AUTORADIOBUTTON "Câte &una", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "Câte t&rei", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Afișează timp", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Afișează timp", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "&Bară de stare", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "Con&firmă", IDOK, 35, 97, 50, 14 PUSHBUTTON "A&nulează", IDCANCEL, 101, 97, 50, 14 END @@ -54,6 +59,8 @@ BEGIN IDS_SOL_QUIT "Abandonați jocul curent?" IDS_SOL_WIN "Felicitări, ați câștigat!" IDS_SOL_DEAL "O nouă rundă?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/ru-RU.rc b/base/applications/games/solitaire/lang/ru-RU.rc index 45900bdddae..ebaebb7896f 100644 --- a/base/applications/games/solitaire/lang/ru-RU.rc +++ b/base/applications/games/solitaire/lang/ru-RU.rc @@ -12,8 +12,13 @@ BEGIN GROUPBOX "Карты", -1, 7, 7, 90, 40 AUTORADIOBUTTON "По &одной", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "По &три", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Показывать время", IDC_OPT_SHOWTIME, 7 ,51 ,75 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Показывать время", IDC_OPT_SHOWTIME, 7 ,51 ,75 ,10, WS_TABSTOP AUTOCHECKBOX "&Строка состояния", IDC_OPT_STATUSBAR, 7, 66, 75, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 PUSHBUTTON "Отмена", IDCANCEL, 101, 97, 50, 14 END @@ -48,6 +53,8 @@ BEGIN IDS_SOL_QUIT "Закончить текущую игру?" IDS_SOL_WIN "Congratulations, you win!!" IDS_SOL_DEAL "Deal again?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Меню */ diff --git a/base/applications/games/solitaire/lang/sk-SK.rc b/base/applications/games/solitaire/lang/sk-SK.rc index f5aaa38dab3..a907a0c0630 100644 --- a/base/applications/games/solitaire/lang/sk-SK.rc +++ b/base/applications/games/solitaire/lang/sk-SK.rc @@ -19,8 +19,13 @@ BEGIN GROUPBOX "Karty", -1, 7, 7, 90, 40 AUTORADIOBUTTON "Ťahať &jednu", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "Ťahať &tri", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "Ča&sový limit", IDC_OPT_SHOWTIME, 7 ,51 ,64 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "Ča&sový limit", IDC_OPT_SHOWTIME, 7 ,51 ,64 ,10, WS_TABSTOP AUTOCHECKBOX "Stavový riad&ok", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 PUSHBUTTON "Zrušiť", IDCANCEL, 101, 97, 50, 14 END @@ -55,6 +60,8 @@ BEGIN IDS_SOL_QUIT "Naozaj chcete skončiť aktuálnu hru?" IDS_SOL_WIN "Blahoželám, vyhrali ste!" IDS_SOL_DEAL "Rozdať znova?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/sq-AL.rc b/base/applications/games/solitaire/lang/sq-AL.rc index 8f55a015c65..f677504c99a 100644 --- a/base/applications/games/solitaire/lang/sq-AL.rc +++ b/base/applications/games/solitaire/lang/sq-AL.rc @@ -19,8 +19,13 @@ BEGIN GROUPBOX "Letra", -1, 7, 7, 90, 40 AUTORADIOBUTTON "Barazim &Nje", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "Barazim &tRE", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Shfaq Kohen", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Shfaq Kohen", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "T&abela e Statusit", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 PUSHBUTTON "Anulo", IDCANCEL, 101, 97, 50, 14 END @@ -55,6 +60,8 @@ BEGIN IDS_SOL_QUIT "Largohu Nga Loja?" IDS_SOL_WIN "Urime, keni fituar!" IDS_SOL_DEAL "Fillo Perseri?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/sv-SE.rc b/base/applications/games/solitaire/lang/sv-SE.rc index 02c9947ec27..795407d6797 100644 --- a/base/applications/games/solitaire/lang/sv-SE.rc +++ b/base/applications/games/solitaire/lang/sv-SE.rc @@ -10,8 +10,13 @@ BEGIN GROUPBOX "Kort", -1, 7, 7, 90, 40 AUTORADIOBUTTON "Dra &En", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "Dra &Tre", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Visa Tid", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Visa Tid", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "&Statusfält", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 PUSHBUTTON "Avbryt", IDCANCEL, 101, 97, 50, 14 END @@ -46,6 +51,8 @@ BEGIN IDS_SOL_QUIT "Avsluta nuvarande spel?" IDS_SOL_WIN "Grattis, du vann!" IDS_SOL_DEAL "Ge igen?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/th-TH.rc b/base/applications/games/solitaire/lang/th-TH.rc index 9bfbec4da3b..0017ad42b18 100644 --- a/base/applications/games/solitaire/lang/th-TH.rc +++ b/base/applications/games/solitaire/lang/th-TH.rc @@ -18,8 +18,13 @@ BEGIN GROUPBOX "Cards", -1, 7, 7, 90, 40 AUTORADIOBUTTON "Draw &One", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "Draw &Three", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Show Time", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Show Time", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "S&tatus bar", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "ตกลง", IDOK, 35, 97, 50, 14 PUSHBUTTON "ยกเลิก", IDCANCEL, 101, 97, 50, 14 END @@ -54,6 +59,8 @@ BEGIN IDS_SOL_QUIT "Quit the current game?" IDS_SOL_WIN "Congratulations, you win!" IDS_SOL_DEAL "Deal again?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/tr-TR.rc b/base/applications/games/solitaire/lang/tr-TR.rc index 5df4d84d81f..d3c6a86ad1e 100644 --- a/base/applications/games/solitaire/lang/tr-TR.rc +++ b/base/applications/games/solitaire/lang/tr-TR.rc @@ -18,8 +18,13 @@ BEGIN GROUPBOX "Kâğıtlar", -1, 7, 7, 90, 40 AUTORADIOBUTTON "&Tekli Çek", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "&Üçlü Çek", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Süreyi Göster", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Süreyi Göster", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "&Durum Çubuğu", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "Tamam", IDOK, 35, 97, 50, 14 PUSHBUTTON "İptal", IDCANCEL, 101, 97, 50, 14 END @@ -54,6 +59,8 @@ BEGIN IDS_SOL_QUIT "Bu oyundan çıkılsın mı?" IDS_SOL_WIN "Tebrikler, kazandınız!" IDS_SOL_DEAL "Yine dağıtılsın mı?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/uk-UA.rc b/base/applications/games/solitaire/lang/uk-UA.rc index 26d6ff3d5cb..bac156f72dd 100644 --- a/base/applications/games/solitaire/lang/uk-UA.rc +++ b/base/applications/games/solitaire/lang/uk-UA.rc @@ -18,8 +18,13 @@ BEGIN GROUPBOX "Карти", -1, 7, 7, 90, 40 AUTORADIOBUTTON "По &одній", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "По &три", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "&Гра за часом", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "&Гра за часом", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "&Рядок стану", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 PUSHBUTTON "Скасувати", IDCANCEL, 101, 97, 50, 14 END @@ -54,6 +59,8 @@ BEGIN IDS_SOL_QUIT "Вийти з поточної гри?" IDS_SOL_WIN "Вітання, Ви виграли!!" IDS_SOL_DEAL "Роздати знову?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/zh-CN.rc b/base/applications/games/solitaire/lang/zh-CN.rc index 665ca20a135..14eb3813a1b 100644 --- a/base/applications/games/solitaire/lang/zh-CN.rc +++ b/base/applications/games/solitaire/lang/zh-CN.rc @@ -18,8 +18,13 @@ BEGIN GROUPBOX "翻牌", -1, 7, 7, 90, 40 AUTORADIOBUTTON "翻一张(&O)", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "翻三张(&T)", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "计时(&S)", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "计时(&S)", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "状态栏(&T)", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "确定", IDOK, 35, 97, 50, 14 PUSHBUTTON "取消", IDCANCEL, 101, 97, 50, 14 END @@ -54,6 +59,8 @@ BEGIN IDS_SOL_QUIT "退出当前游戏?" IDS_SOL_WIN "恭喜你,你赢了!!" IDS_SOL_DEAL "再玩一次?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/lang/zh-TW.rc b/base/applications/games/solitaire/lang/zh-TW.rc index f68a31e008a..f80b9aa53d2 100644 --- a/base/applications/games/solitaire/lang/zh-TW.rc +++ b/base/applications/games/solitaire/lang/zh-TW.rc @@ -18,8 +18,13 @@ BEGIN GROUPBOX "發牌", -1, 7, 7, 90, 40 AUTORADIOBUTTON "發一張牌(&O)", IDC_OPT_DRAWONE, 14, 19, 70, 10, WS_GROUP | WS_TABSTOP AUTORADIOBUTTON "發三張牌(&T)", IDC_OPT_DRAWTHREE, 14, 32, 70, 10 - AUTOCHECKBOX "計時(&S)", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + GROUPBOX "Scoring", -1, 100, 7, 75, 53 + AUTORADIOBUTTON "&Standard", IDC_OPT_STANDARD, 107, 19, 60, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "&Vegas", IDC_OPT_VEGAS, 107, 32, 60, 10 + AUTORADIOBUTTON "&None", IDC_OPT_NOSCORE, 107, 45, 60, 10 + AUTOCHECKBOX "計時(&S)", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP AUTOCHECKBOX "狀態列(&T)", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Keep Score", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP DEFPUSHBUTTON "確定", IDOK, 35, 97, 50, 14 PUSHBUTTON "取消", IDCANCEL, 101, 97, 50, 14 END @@ -54,6 +59,8 @@ BEGIN IDS_SOL_QUIT "退出目前遊戲?" IDS_SOL_WIN "恭喜你,你嬴了!!" IDS_SOL_DEAL "再玩一次?" + IDS_SOL_SCORE "Score: %d" + IDS_SOL_TIME "Time: %d" END /* Menus */ diff --git a/base/applications/games/solitaire/resource.h b/base/applications/games/solitaire/resource.h index 5c0d255fcdb..0b221bc4f9c 100644 --- a/base/applications/games/solitaire/resource.h +++ b/base/applications/games/solitaire/resource.h @@ -20,6 +20,10 @@ #define IDC_OPT_DRAWTHREE 1202 #define IDC_OPT_SHOWTIME 1203 #define IDC_OPT_STATUSBAR 1204 +#define IDC_OPT_STANDARD 1205 +#define IDC_OPT_VEGAS 1206 +#define IDC_OPT_NOSCORE 1207 +#define IDC_OPT_KEEPSCORE 1208 #define IDD_CARDBACK 1250 #define IDC_CARDBACK1 1251 #define IDC_CARDBACK2 1252 @@ -40,3 +44,5 @@ #define IDS_SOL_QUIT 1302 #define IDS_SOL_WIN 1303 #define IDS_SOL_DEAL 1304 +#define IDS_SOL_SCORE 1305 +#define IDS_SOL_TIME 1306 diff --git a/base/applications/games/solitaire/solcreate.cpp b/base/applications/games/solitaire/solcreate.cpp index 6f0f35106e7..1f185713b41 100644 --- a/base/applications/games/solitaire/solcreate.cpp +++ b/base/applications/games/solitaire/solcreate.cpp @@ -38,6 +38,7 @@ void CreateSol() pPile->SetDropRule(CS_DROP_NONE, 0); pPile->SetDblClickProc(PileDblClickProc); pPile->SetRemoveCardProc(PileRemoveProc); + pPile->SetClickProc(PileClickProc); // // Create the suit stacks @@ -50,6 +51,7 @@ void CreateSol() pSuitStack[i]->SetDropRule(CS_DROP_CALLBACK, SuitStackDropProc); pSuitStack[i]->SetDragRule(CS_DRAG_TOP); + pSuitStack[i]->SetClickProc(SuitStackClickProc); pSuitStack[i]->SetAddCardProc(SuitStackAddProc); } diff --git a/base/applications/games/solitaire/solgame.cpp b/base/applications/games/solitaire/solgame.cpp index b34dcc8b91b..58ef8e23622 100644 --- a/base/applications/games/solitaire/solgame.cpp +++ b/base/applications/games/solitaire/solgame.cpp @@ -10,6 +10,7 @@ extern TCHAR MsgWin[128]; extern TCHAR MsgDeal[128]; CardStack activepile; +int LastId; bool fGameStarted = false; void NewGame(void) @@ -17,6 +18,33 @@ void NewGame(void) TRACE("ENTER NewGame()\n"); int i, j; + if (GetScoreMode() == SCORE_VEGAS) + { + if ((dwOptions & OPTION_KEEP_SCORE) && (dwPrevMode == SCORE_VEGAS)) + lScore = lScore - 52; + else + lScore = -52; + + if (dwOptions & OPTION_THREE_CARDS) + dwWasteTreshold = 2; + else + dwWasteTreshold = 0; + + } + else + { + if (dwOptions & OPTION_THREE_CARDS) + dwWasteTreshold = 3; + else + dwWasteTreshold = 0; + + lScore = 0; + } + + dwTime = 0; + dwWasteCount = 0; + LastId = 0; + SolWnd.EmptyStacks(); //create a new card-stack @@ -52,7 +80,13 @@ void NewGame(void) SolWnd.Redraw(); fGameStarted = false; + + dwPrevMode = GetScoreMode(); + + UpdateStatusBar(); + TRACE("EXIT NewGame()\n"); + } // @@ -69,6 +103,8 @@ bool CARDLIBPROC RowStackDragProc(CardRegion &stackobj, int iNumDragCards) int numfacedown; int numcards; + SetPlayTimer(); + stackobj.GetFaceDirection(&numfacedown); numcards = stackobj.NumCards(); @@ -90,6 +126,8 @@ bool CARDLIBPROC RowStackDropProc(CardRegion &stackobj, CardStack &dragcards) TRACE("ENTER RowStackDropProc()\n"); Card dragcard = dragcards[dragcards.NumCards() - 1]; + SetPlayTimer(); + //if we are empty, can only drop a stack with a King at bottom if(stackobj.NumCards() == 0) { @@ -121,6 +159,27 @@ bool CARDLIBPROC RowStackDropProc(CardRegion &stackobj, CardStack &dragcards) fGameStarted = true; + if (LastId == PILE_ID) + { + if (GetScoreMode() == SCORE_STD) + { + lScore = lScore + 5; + } + } + else if ((LastId >= SUIT_ID) && (LastId <= SUIT_ID + 3)) + { + if (GetScoreMode() == SCORE_STD) + { + lScore = lScore >= 15 ? lScore - 15 : 0; + } + else if (GetScoreMode() == SCORE_VEGAS) + { + lScore = lScore >= -47 ? lScore - 5 : -52; + } + } + + UpdateStatusBar(); + TRACE("EXIT RowStackDropProc(true)\n"); return true; } @@ -136,6 +195,8 @@ bool CanDrop(CardRegion &stackobj, Card card) const CardStack &cardstack = stackobj.GetCardStack(); + SetPlayTimer(); + if(cardstack.NumCards() > 0) { if(card.Suit() != cardstack[0].Suit()) @@ -168,6 +229,9 @@ bool CanDrop(CardRegion &stackobj, Card card) bool CARDLIBPROC SuitStackDropProc(CardRegion &stackobj, CardStack &dragcards) { TRACE("ENTER SuitStackDropProc()\n"); + + SetPlayTimer(); + //only drop 1 card at a time if(dragcards.NumCards() != 1) { @@ -177,9 +241,41 @@ bool CARDLIBPROC SuitStackDropProc(CardRegion &stackobj, CardStack &dragcards) bool b = CanDrop(stackobj, dragcards[0]); TRACE("EXIT SuitStackDropProc()\n"); + + if (b) + { + if ((LastId == PILE_ID) || (LastId >= ROW_ID)) + { + if (GetScoreMode() == SCORE_VEGAS) + { + lScore = lScore + 5; + } + else if (GetScoreMode() == SCORE_STD) + { + lScore = lScore + 10; + } + + UpdateStatusBar(); + } + } + return b; } +// +// Single-click on one of the suit-stacks +// +void CARDLIBPROC SuitStackClickProc(CardRegion &stackobj, int iNumClicked) +{ + TRACE("ENTER SuitStackClickProc()\n"); + + fGameStarted = true; + + LastId = stackobj.Id(); + + TRACE("EXIT SuitStackClickProc()\n"); +} + // // Single-click on one of the row-stacks // Turn the top-card over if they are all face-down @@ -197,7 +293,18 @@ void CARDLIBPROC RowStackClickProc(CardRegion &stackobj, int iNumClicked) if(numfacedown > 0) numfacedown--; stackobj.SetFaceDirection(CS_FACE_DOWNUP, numfacedown); stackobj.Redraw(); + + if (GetScoreMode() == SCORE_STD) + { + lScore = lScore + 5; + UpdateStatusBar(); + } } + + LastId = stackobj.Id(); + + fGameStarted = true; + TRACE("EXIT RowStackClickProc()\n"); } @@ -207,6 +314,7 @@ void CARDLIBPROC RowStackClickProc(CardRegion &stackobj, int iNumClicked) CardRegion *FindSuitStackFromCard(Card card) { TRACE("ENTER FindSuitStackFromCard()\n"); + for(int i = 0; i < 4; i++) { if(CanDrop(*pSuitStack[i], card)) @@ -231,17 +339,30 @@ void CARDLIBPROC SuitStackAddProc(CardRegion &stackobj, const CardStack &added) TRACE("ENTER SuitStackAddProc()\n"); bool fGameOver = true; + SetPlayTimer(); + for(int i = 0; i < 4; i++) { if(pSuitStack[i]->NumCards() != 13) { fGameOver = false; + break; } } if(fGameOver) { + KillTimer(hwndMain, IDT_PLAYTIMER); + PlayTimer = 0; + + if ((dwOptions & OPTION_SHOW_TIME) && (GetScoreMode() == SCORE_STD)) + { + lScore = lScore + (700000 / dwTime); + } + + UpdateStatusBar(); + MessageBox(SolWnd, MsgWin, szAppName, MB_OK | MB_ICONINFORMATION); for(int i = 0; i < 4; i++) @@ -272,6 +393,9 @@ void CARDLIBPROC SuitStackAddProc(CardRegion &stackobj, const CardStack &added) void CARDLIBPROC RowStackDblClickProc(CardRegion &stackobj, int iNumClicked) { TRACE("ENTER RowStackDblClickProc()\n"); + + SetPlayTimer(); + //can only move 1 card at a time if(iNumClicked != 1) { @@ -286,6 +410,7 @@ void CARDLIBPROC RowStackDblClickProc(CardRegion &stackobj, int iNumClicked) if(pDest != 0) { fGameStarted = true; + SetPlayTimer(); //stackobj.MoveCards(pDest, 1, true); //use the SimulateDrag funcion, because we get the @@ -295,12 +420,29 @@ void CARDLIBPROC RowStackDblClickProc(CardRegion &stackobj, int iNumClicked) TRACE("EXIT RowStackDblClickProc()\n"); } +// +// Face-up pile single-click +// +void CARDLIBPROC PileClickProc(CardRegion &stackobj, int iNumClicked) +{ + TRACE("ENTER SuitStackClickProc()\n"); + + fGameStarted = true; + + LastId = stackobj.Id(); + + TRACE("EXIT SuitStackClickProc()\n"); +} + // // Face-up pile double-click // void CARDLIBPROC PileDblClickProc(CardRegion &stackobj, int iNumClicked) { TRACE("ENTER PileDblClickProc()\n"); + + SetPlayTimer(); + RowStackDblClickProc(stackobj, iNumClicked); TRACE("EXIT PileDblClickProc()\n"); } @@ -311,6 +453,9 @@ void CARDLIBPROC PileDblClickProc(CardRegion &stackobj, int iNumClicked) void CARDLIBPROC PileRemoveProc(CardRegion &stackobj, int iItems) { TRACE("ENTER PileRemoveProc()\n"); + + SetPlayTimer(); + //modify our "virtual" pile by removing the same card //that was removed from the physical card stack activepile.Pop(iItems); @@ -334,10 +479,14 @@ void CARDLIBPROC PileRemoveProc(CardRegion &stackobj, int iItems) void CARDLIBPROC DeckClickProc(CardRegion &stackobj, int iNumClicked) { TRACE("ENTER DeckClickProc()\n"); + + SetPlayTimer(); + CardStack cardstack = stackobj.GetCardStack(); CardStack pile = pPile->GetCardStack(); fGameStarted = true; + SetPlayTimer(); //reset the face-up pile to represent 3 cards if(dwOptions & OPTION_THREE_CARDS) @@ -345,11 +494,45 @@ void CARDLIBPROC DeckClickProc(CardRegion &stackobj, int iNumClicked) if(cardstack.NumCards() == 0) { - pile.Clear(); + if (GetScoreMode() == SCORE_VEGAS) + { + if (dwWasteCount < dwWasteTreshold) + { + pile.Clear(); - activepile.Reverse(); - cardstack.Push(activepile); - activepile.Clear(); + activepile.Reverse(); + cardstack.Push(activepile); + activepile.Clear(); + } + } + else if (GetScoreMode() == SCORE_STD) + { + if ((dwWasteCount >= dwWasteTreshold) && (activepile.NumCards() != 0)) + { + if (dwOptions & OPTION_THREE_CARDS) + lScore = lScore >= 20 ? lScore - 20 : 0; + else + lScore = lScore >= 100 ? lScore - 100 : 0; + } + + pile.Clear(); + + activepile.Reverse(); + cardstack.Push(activepile); + activepile.Clear(); + + UpdateStatusBar(); + } + else + { + pile.Clear(); + + activepile.Reverse(); + cardstack.Push(activepile); + activepile.Clear(); + } + + dwWasteCount++; } else { diff --git a/base/applications/games/solitaire/solitaire.cpp b/base/applications/games/solitaire/solitaire.cpp index 38087d9c892..7ad7f0f1754 100644 --- a/base/applications/games/solitaire/solitaire.cpp +++ b/base/applications/games/solitaire/solitaire.cpp @@ -14,12 +14,21 @@ HWND hwndStatus; HINSTANCE hInstance; TCHAR szAppName[128]; +TCHAR szScore[64]; +TCHAR szTime[64]; TCHAR MsgQuit[128]; TCHAR MsgAbout[128]; TCHAR MsgWin[128]; TCHAR MsgDeal[128]; DWORD dwOptions = OPTION_THREE_CARDS; +DWORD dwTime; +DWORD dwWasteCount; +DWORD dwWasteTreshold; +DWORD dwPrevMode; +long lScore; +UINT_PTR PlayTimer = 0; + CardWindow SolWnd; typedef struct _CardBack @@ -115,6 +124,60 @@ VOID SaveSettings(VOID) RegCloseKey(hKey); } +// Returns 0 for no points, 1 for Standard and 2 for Vegas +int GetScoreMode(void) +{ + if ((dwOptions & OPTION_SCORE_STD) && (dwOptions & OPTION_SCORE_VEGAS)) + { + return SCORE_NONE; + } + + if (dwOptions & OPTION_SCORE_STD) + { + return SCORE_STD; + } + + if (dwOptions & OPTION_SCORE_VEGAS) + { + return SCORE_VEGAS; + } + + return 0; +} + +void UpdateStatusBar(void) +{ + TCHAR szStatusText[128]; + TCHAR szTempText[64]; + + ZeroMemory(szStatusText, sizeof(szStatusText) / sizeof(TCHAR)); + + if (GetScoreMode() != SCORE_NONE) + { + _stprintf(szStatusText, szScore, lScore); + _tcscat(szStatusText, _T(" ")); + } + + if (dwOptions & OPTION_SHOW_TIME) + { + _stprintf(szTempText, szTime, dwTime); + _tcscat(szStatusText, szTempText); + } + + SendMessage(hwndStatus, SB_SETTEXT, 0 | SBT_NOBORDERS, (LPARAM)(LPTSTR)szStatusText); +} + +void SetPlayTimer(void) +{ + if (dwOptions & OPTION_SHOW_TIME) + { + if (!PlayTimer) + { + PlayTimer = SetTimer(hwndMain, IDT_PLAYTIMER, 1000, NULL); + } + } +} + // // Main entry point // @@ -136,6 +199,9 @@ int WINAPI _tWinMain(HINSTANCE hInst, HINSTANCE hPrev, LPTSTR szCmdLine, int iCm LoadString(hInst, IDS_SOL_WIN, MsgWin, sizeof(MsgWin) / sizeof(MsgWin[0])); LoadString(hInst, IDS_SOL_DEAL, MsgDeal, sizeof(MsgDeal) / sizeof(MsgDeal[0])); + LoadString(hInst, IDS_SOL_SCORE, szScore, sizeof(szScore) / sizeof(TCHAR)); + LoadString(hInst, IDS_SOL_TIME, szTime, sizeof(szTime) / sizeof(TCHAR)); + //Window class for the main application parent window wndclass.style = 0;//CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = WndProc; @@ -160,6 +226,8 @@ int WINAPI _tWinMain(HINSTANCE hInst, HINSTANCE hPrev, LPTSTR szCmdLine, int iCm LoadSettings(); + dwPrevMode = GetScoreMode(); + //Construct the path to our help file MakePath(szHelpPath, MAX_PATH, _T(".hlp")); @@ -178,6 +246,8 @@ int WINAPI _tWinMain(HINSTANCE hInst, HINSTANCE hPrev, LPTSTR szCmdLine, int iCm hwndMain = hwnd; + UpdateStatusBar(); + ShowWindow(hwnd, iCmdShow); UpdateWindow(hwnd); @@ -200,6 +270,8 @@ int WINAPI _tWinMain(HINSTANCE hInst, HINSTANCE hPrev, LPTSTR szCmdLine, int iCm INT_PTR CALLBACK OptionsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { + HWND hCtrl; + switch (uMsg) { case WM_INITDIALOG: @@ -209,11 +281,47 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar CheckDlgButton(hDlg, IDC_OPT_STATUSBAR, (dwOptions & OPTION_SHOW_STATUS) ? BST_CHECKED : BST_UNCHECKED); + + CheckDlgButton(hDlg, + IDC_OPT_SHOWTIME, + (dwOptions & OPTION_SHOW_TIME) ? BST_CHECKED : BST_UNCHECKED); + + CheckDlgButton(hDlg, + IDC_OPT_KEEPSCORE, + (dwOptions & OPTION_KEEP_SCORE) ? BST_CHECKED : BST_UNCHECKED); + + hCtrl = GetDlgItem(hDlg, IDC_OPT_KEEPSCORE); + + if (GetScoreMode() == SCORE_NONE) + { + CheckRadioButton(hDlg, IDC_OPT_STANDARD, IDC_OPT_NOSCORE, IDC_OPT_NOSCORE); + EnableWindow(hCtrl, FALSE); + } + else if (GetScoreMode() == SCORE_STD) + { + CheckRadioButton(hDlg, IDC_OPT_STANDARD, IDC_OPT_NOSCORE, IDC_OPT_STANDARD); + EnableWindow(hCtrl, FALSE); + } + else if (GetScoreMode() == SCORE_VEGAS) + { + CheckRadioButton(hDlg, IDC_OPT_STANDARD, IDC_OPT_NOSCORE, IDC_OPT_VEGAS); + EnableWindow(hCtrl, TRUE); + } return TRUE; case WM_COMMAND: switch(LOWORD(wParam)) { + case IDC_OPT_NOSCORE: + case IDC_OPT_STANDARD: + case IDC_OPT_VEGAS: + hCtrl = GetDlgItem(hDlg, IDC_OPT_KEEPSCORE); + if (wParam == IDC_OPT_VEGAS) + EnableWindow(hCtrl, TRUE); + else + EnableWindow(hCtrl, FALSE); + return TRUE; + case IDOK: dwOptions &= ~OPTION_THREE_CARDS; if (IsDlgButtonChecked(hDlg, IDC_OPT_DRAWTHREE) == BST_CHECKED) @@ -224,6 +332,34 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar else dwOptions &= ~OPTION_SHOW_STATUS; + if (IsDlgButtonChecked(hDlg, IDC_OPT_SHOWTIME) == BST_CHECKED) + dwOptions |= OPTION_SHOW_TIME; + else + dwOptions &= ~OPTION_SHOW_TIME; + + if (IsDlgButtonChecked(hDlg, IDC_OPT_KEEPSCORE) == BST_CHECKED) + dwOptions |= OPTION_KEEP_SCORE; + else + dwOptions &= ~OPTION_KEEP_SCORE; + + if (IsDlgButtonChecked(hDlg, IDC_OPT_STANDARD) == BST_CHECKED) + { + dwOptions |= OPTION_SCORE_STD; + dwOptions &= ~OPTION_SCORE_VEGAS; + } + else if (IsDlgButtonChecked(hDlg, IDC_OPT_VEGAS) == BST_CHECKED) + { + dwOptions |= OPTION_SCORE_VEGAS; + dwOptions &= ~OPTION_SCORE_STD; + } + else if (IsDlgButtonChecked(hDlg, IDC_OPT_NOSCORE) == BST_CHECKED) + { + dwOptions |= OPTION_SCORE_VEGAS; + dwOptions |= OPTION_SCORE_STD; + } + + UpdateStatusBar(); + EndDialog(hDlg, TRUE); return TRUE; @@ -241,9 +377,13 @@ VOID ShowGameOptionsDlg(HWND hwnd) DWORD dwOldOptions = dwOptions; RECT rcMain, rcStatus; + int iOldScoreMode = GetScoreMode(); + if (DialogBox(hInstance, MAKEINTRESOURCE(IDD_OPTIONS), hwnd, OptionsDlgProc)) { - if ((dwOldOptions & OPTION_THREE_CARDS) != (dwOptions & OPTION_THREE_CARDS)) + if (((dwOldOptions & OPTION_THREE_CARDS) != (dwOptions & OPTION_THREE_CARDS)) || + ((dwOldOptions & OPTION_SHOW_TIME) != (dwOptions & OPTION_SHOW_TIME)) || + (iOldScoreMode != GetScoreMode())) NewGame(); if ((dwOldOptions & OPTION_SHOW_STATUS) != (dwOptions & OPTION_SHOW_STATUS)) @@ -458,7 +598,7 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { case WM_CREATE: { - int parts[] = { 100, -1 }; + int parts[] = { 150, -1 }; RECT rcStatus; hwndStatus = CreateStatusWindow(WS_CHILD | WS_VISIBLE | CCS_BOTTOM | SBARS_SIZEGRIP, _T("Ready"), hwnd, 0); @@ -496,6 +636,25 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) PostQuitMessage(0); return 0; + case WM_TIMER: + if (!fGameStarted) + { + KillTimer(hwndMain, IDT_PLAYTIMER); + PlayTimer = 0; + } + else if (dwOptions & OPTION_SHOW_TIME) + { + if (((dwTime + 1) % 10 == 0) && (GetScoreMode() == SCORE_STD)) + { + lScore = lScore >= 2 ? lScore - 2 : 0; + } + + dwTime++; + } + + UpdateStatusBar(); + return 0; + case WM_SIZE: nWidth = LOWORD(lParam); nHeight = HIWORD(lParam); diff --git a/base/applications/games/solitaire/solitaire.h b/base/applications/games/solitaire/solitaire.h index cc9c960f01d..f05b2f4a797 100644 --- a/base/applications/games/solitaire/solitaire.h +++ b/base/applications/games/solitaire/solitaire.h @@ -9,6 +9,10 @@ extern bool fGameStarted; #define OPTION_SHOW_STATUS 4 #define OPTION_THREE_CARDS 8 +#define OPTION_SHOW_TIME 16 +#define OPTION_KEEP_SCORE 32 +#define OPTION_SCORE_STD 64 +#define OPTION_SCORE_VEGAS 128 #define CARDBACK_START IDC_CARDBACK1 #define CARDBACK_END IDC_CARDBACK12 #define NUM_CARDBACKS (CARDBACK_END - CARDBACK_START + 1) @@ -19,6 +23,16 @@ extern bool fGameStarted; extern DWORD dwOptions; +extern DWORD dwTime; +extern DWORD dwWasteCount; +extern DWORD dwWasteTreshold; +extern DWORD dwPrevMode; +extern long lScore; +extern HWND hwndMain; +extern UINT_PTR PlayTimer; + +#define IDT_PLAYTIMER 1000 + void CreateSol(void); void NewGame(void); @@ -28,6 +42,10 @@ void NewGame(void); #define SUIT_ID 4 #define ROW_ID 10 +#define SCORE_NONE 0 +#define SCORE_STD 1 +#define SCORE_VEGAS 2 + // Various metrics used for placing the objects and computing the minimum window size #define X_BORDER 20 #define X_PILE_BORDER 18 @@ -42,18 +60,25 @@ extern CardRegion *pPile; extern CardRegion *pSuitStack[]; extern CardRegion *pRowStack[]; +extern void UpdateStatusBar(void); +extern void SetPlayTimer(void); +extern int GetScoreMode(void); + bool CARDLIBPROC RowStackDragProc(CardRegion &stackobj, int iNumCards); bool CARDLIBPROC RowStackDropProc(CardRegion &stackobj, CardStack &dragcards); bool CARDLIBPROC SuitStackDropProc(CardRegion &stackobj, CardStack &dragcards); void CARDLIBPROC SuitStackAddProc(CardRegion &stackobj, const CardStack &added); +void CARDLIBPROC SuitStackClickProc(CardRegion &stackobj, int iNumClicked); void CARDLIBPROC RowStackClickProc(CardRegion &stackobj, int iNumClicked); void CARDLIBPROC RowStackDblClickProc(CardRegion &stackobj, int iNumClicked); void CARDLIBPROC DeckClickProc(CardRegion &stackobj, int iNumClicked); void CARDLIBPROC PileDblClickProc(CardRegion &stackobj, int iNumClicked); +void CARDLIBPROC PileClickProc(CardRegion &stackobj, int iNumClicked); void CARDLIBPROC PileRemoveProc(CardRegion &stackobj, int iRemoved); + #endif /* _SOL_PCH_ */ diff --git a/base/applications/rapps/lang/pl-PL.rc b/base/applications/rapps/lang/pl-PL.rc index b60efaf3b64..7b1bca716f9 100644 --- a/base/applications/rapps/lang/pl-PL.rc +++ b/base/applications/rapps/lang/pl-PL.rc @@ -1,4 +1,4 @@ -/* +/* * Translated by Caemyr - Olaf Siejka (Aug, 2009) * Use ReactOS forum PM or IRC to contact me * Updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (Apr, 2011) @@ -26,7 +26,7 @@ BEGIN MENUITEM SEPARATOR MENUITEM "O&dśwież", ID_REFRESH MENUITEM SEPARATOR - MENUITEM "Update Da&tabase", ID_RESETDB + MENUITEM "Ak&tualizuj bazę programów", ID_RESETDB END POPUP "Pomoc" BEGIN @@ -56,7 +56,7 @@ BEGIN MENUITEM SEPARATOR MENUITEM "&Odśwież", ID_REFRESH MENUITEM SEPARATOR - MENUITEM "Update Da&tabase", ID_RESETDB + MENUITEM "Ak&tualizuj bazę programów", ID_RESETDB END END @@ -71,7 +71,7 @@ BEGIN AUTOCHECKBOX "Zap&isuj dziennik instalacji i usuwania programów", IDC_LOG_ENABLED, 15, 46, 219, 12 GROUPBOX "Pobieranie", -1, 4, 65, 240, 51 LTEXT "Katalog dla pobranych plików:", -1, 16, 75, 100, 9 - EDITTEXT IDC_DOWNLOAD_DIR_EDIT, 15, 86, 166, 12, WS_CHILD | WS_VISIBLE | WS_GROUP | ES_AUTOHSCROLL + EDITTEXT IDC_DOWNLOAD_DIR_EDIT, 15, 86, 166, 12, WS_CHILD | WS_VISIBLE | WS_GROUP PUSHBUTTON "&Wybierz", IDC_CHOOSE, 187, 85, 50, 14 AUTOCHECKBOX "&Usuń instalatory programów po ich zainstalowaniu", IDC_DEL_AFTER_INSTALL, 16, 100, 218, 12 PUSHBUTTON "Domyślne", IDC_DEFAULT_SETTINGS, 8, 124, 60, 14 diff --git a/base/applications/rapps/rapps/alreader.txt b/base/applications/rapps/rapps/alreader.txt index e50dc1f338d..4dd4561fcff 100644 --- a/base/applications/rapps/rapps/alreader.txt +++ b/base/applications/rapps/rapps/alreader.txt @@ -2,8 +2,7 @@ [Section] Name = AlReader -Version = 110502 -Description = A FB2 eBook Reader. +Description = A FB2 eBook Reader. Read formats: fb2, fbz, txt, epub, html, doc, docx, odt, rtf, mobi, prc (PalmDoc), tcr. Supported ZIP and GZ archives. URLSite = http://www.alreader.com Size = 4.6 MB Category = 6 @@ -11,11 +10,14 @@ URLDownload = http://svn.reactos.org/packages/AlReader2Setup.exe CDPath = none [Section.0407] -Description = Ein FB2 eBook Reader. +Description = Ein FB2 eBook Reader. Unterstützung für folgende Formate: fb2, fbz, txt, epub, html, doc, docx, odt, rtf, mobi, prc (PalmDoc), tcr. ZIP und GZ Archive werden ebenfalls unterstützt. [Section.0410] Description = Un eBook Reader. +[Section.0415] +Description = Czytnik eBooków. Obsługuje formaty: fb2, fbz, txt, epub, html, doc, docx, odt, rtf, mobi, prc (PalmDoc), tcr. Obsługiwane są także pliki w archivach ZIP i GZ. + [Section.0418] Description = Cititor de cărți electronice în format FB2. Size = 4,6 Mo diff --git a/base/applications/rapps/rapps/ants.txt b/base/applications/rapps/rapps/ants.txt index 9710f3f604f..629b5484da0 100644 --- a/base/applications/rapps/rapps/ants.txt +++ b/base/applications/rapps/rapps/ants.txt @@ -1,5 +1,5 @@ ; UTF-8 - +; PL translation by wojo664 [Section] Name = Ants Version = N/A @@ -14,12 +14,16 @@ CDPath = none [Section.0407] Description = Ein strategisches Kartenspiel. Sie bauen Ihr eigenes Schloss und versuchen, die gegnerische Burg zu zerstören. Sie benötigen ein ZIP-Programm, um es zu installieren. +[Section.0415] +Description = Karciana gra strategiczna. Budujesz zamek, przy okazji próbujesz zniszczyć zamek wroga. Wymaga programu archiwizującego do wypakowania. + [Section.0418] Licence = Gratuită Description = Un joc strategic de cărți. Jucătorul își va construi un castel și încerca să distrugă castelele oponenților. Este necesar un utilitar de dezarhivare ZIP pentru a instala acest joc. Size = 632 ko [Section.041f] +Name = Karıncalar Licence = Ücretsiz Description = Bir kartlarla izlem oyunu. Kalenizi bitirmeye veyâ rakip kaleyi yıkmaya çalışın. Yazılımı kurmak için ZIP biçiminde çıkartma yeteneği olan bir yazılım gerekir. Size = 632 KB diff --git a/base/applications/rapps/rapps/bochs.txt b/base/applications/rapps/rapps/bochs.txt index 4073d999e42..4707c75bbca 100644 --- a/base/applications/rapps/rapps/bochs.txt +++ b/base/applications/rapps/rapps/bochs.txt @@ -1,4 +1,5 @@ ; UTF-8 +; PL translation by wojo664 [Section] Name = Bochs @@ -14,6 +15,9 @@ CDPath = none [Section.0407] Description = Bochs ist ein portabler Open-Source IA-32 (x86) PC-Emulator geschrieben in C++, der auf den meisten populären Plattformen läuft. +[Section.0415] +Description = Bochs to przenośny (portable) emulator platformy IA-32 (x86) napisany w C++, działa na wielu popularnych platformach sprzętowych. + [Section.0418] Description = Bochs este un emulator PC (x86) cu surse publice și portabilitate înaltă, scris în C++, compatibil cu majoritatea platformelor. Size = 4,7 Mo diff --git a/base/applications/rapps/rapps/boswars.txt b/base/applications/rapps/rapps/boswars.txt index 9985088fb71..dd3435ea7aa 100644 --- a/base/applications/rapps/rapps/boswars.txt +++ b/base/applications/rapps/rapps/boswars.txt @@ -1,4 +1,5 @@ ; UTF-8 +; PL translation by wojo664 [Section] Name = Bos Wars @@ -17,10 +18,14 @@ Description = Bos Wars ist ein futuristisches Echtzeitstrategiespiel. Um das Spi [Section.0410] Description = Bos Wars è un gioco futuristico di strategia in tempo reale. Per iniziare il gioco, installare Microsoft Visual C + + 2008 runtime. +[Section.0415] +Description = Bos Wars to futurystyczna gra strategiczna czasu rzeczywistego. Aby uruchomić grę, zainstaluj Microsoft Visual C++ 2008 runtime. + [Section.0418] Description = Bos Wars e o strategie în timp real, futuristă. Pentru a porni jocul, instalați Microsoft Visual C++ 2008 Runtime. Size = 62,3 Mo [Section.041f] -Description = Bos Wars, gelecekçi ve gerçek zamanlı bir izlem oyunudur. Oyunu başlatmak için Microsoft Visual C++ 2008 Yürütücüsü'nü kurunuz. +Name = Bos Savaşları +Description = Bos Savaşları, gelecekçi ve gerçek zamanlı bir izlem oyunudur. Oyunu başlatmak için Mikroyazılım Basarî C++ 2008 Yürütücüsü'nü kurunuz. Size = 62,3 MB diff --git a/base/applications/rapps/rapps/boundaround.txt b/base/applications/rapps/rapps/boundaround.txt new file mode 100644 index 00000000000..6c50c4304cf --- /dev/null +++ b/base/applications/rapps/rapps/boundaround.txt @@ -0,0 +1,20 @@ +; UTF-8 + +[Section] +Name = Bound Around (Demo) +Licence = Shareware +Description = A game similar Frozen Fruits. +Size = 1.95 MB +Category = 4 +URLSite = http://www.blueskied.com/boundaround.htm +URLDownload = http://www.blueskied.com/BoundAround_Demo.exe +CDPath = none + +[Section.0407] +Description = Ein Spiel, ähnlich zu Frozen Fruits. + +[Section.041f] +Name = Bound Around (Göstermelik) +Licence = Kısıtlı +Description = Frozen Fruits'e benzeyen bir oyun. +Size = 1,95 MB diff --git a/base/applications/rapps/rapps/christmasbound.txt b/base/applications/rapps/rapps/christmasbound.txt new file mode 100644 index 00000000000..dac37a48392 --- /dev/null +++ b/base/applications/rapps/rapps/christmasbound.txt @@ -0,0 +1,20 @@ +; UTF-8 + +[Section] +Name = Christmas Bound +Version = 1.4 +Licence = Freeware +Description = A game similar Frozen Fruits. +Size = 892 kB +Category = 4 +URLSite = http://www.blueskied.com/xmas/christmas_main.htm +URLDownload = http://www.blueskied.com/xmas/ChristmasBound_setup.exe +CDPath = none + +[Section.0407] +Description = Ein Spiel, ähnlich zu Frozen Fruits. + +[Section.041f] +Licence = Ücretsiz +Description = Frozen Fruits'e benzeyen bir oyun. +Size = 892 KB diff --git a/base/applications/rapps/rapps/chromium.txt b/base/applications/rapps/rapps/chromium.txt index 4caa26e13f6..1ebd82226a8 100644 --- a/base/applications/rapps/rapps/chromium.txt +++ b/base/applications/rapps/rapps/chromium.txt @@ -1,5 +1,5 @@ ; UTF-8 - +; PL translation by wojo664 [Section] Name = Chromium B.S.U. Version = 0.9.13.2 @@ -17,6 +17,9 @@ Description = Chromium B.S.U. ist ein Arcade-Style, Top-Scrolling Space Shooter. [Section.0410] Description = Cromo B.S.U. è sparatutto spaziale. +[Section.0415] +Description = Chromium B.S.U to gra w stylu Arcade, z widokiem z góry. + [Section.0418] Description = Chromium B.S.U. este un joc de vânătoare în spațiul cosmic (arcadă 2D). Size = 2,3 Mo diff --git a/base/applications/rapps/rapps/codeblocks.txt b/base/applications/rapps/rapps/codeblocks.txt new file mode 100644 index 00000000000..a21ed29d735 --- /dev/null +++ b/base/applications/rapps/rapps/codeblocks.txt @@ -0,0 +1,20 @@ +; UTF-8 + +[Section] +Name = Code::Blocks (no compiler) +Version = 13.12 +Licence = GPLv3 +Description = A open source, cross-platform, powerful IDE. It doesn't contain a compiler. +Size = 29.2 MB +Category = 7 +URLSite = http://www.codeblocks.org/ +URLDownload = http://sourceforge.net/projects/codeblocks/files/Binaries/13.12/Windows/codeblocks-13.12-setup.exe +CDPath = none + +[Section.0407] +Description = Eine quelloffene, plattformübergreifende, mächtige IDE. Diese enthält keinen Compiler. + +[Section.041f] +Name = Code::Blocks (Derleyicisiz) +Description = Açık kaynak, çapraz platform, güçlü bir tümleşik geliştirme ortamı. Bir derleyici içermez. +Size = 29,2 MB diff --git a/base/applications/rapps/rapps/codeblocks_gcc.txt b/base/applications/rapps/rapps/codeblocks_gcc.txt new file mode 100644 index 00000000000..8f0f87d8367 --- /dev/null +++ b/base/applications/rapps/rapps/codeblocks_gcc.txt @@ -0,0 +1,20 @@ +; UTF-8 + +[Section] +Name = Code::Blocks TDM-GCC (version 4.7.1, 32 bit) +Version = 13.12 +Licence = GPLv3 +Description = A open source, cross-platform, powerful IDE. It contains TDM-GCC (version 4.7.1, 32 bit) compiler. +Size = 97.8 MB +Category = 7 +URLSite = http://www.codeblocks.org/ +URLDownload = http://sourceforge.net/projects/codeblocks/files/Binaries/13.12/Windows/codeblocks-13.12mingw-setup.exe +CDPath = none + +[Section.0407] +Description = Eine quelloffene, plattformübergreifende, mächtige IDE. Diese enthält den TDM-GCC (version 4.7.1, 32 bit) Compiler. + +[Section.041f] +Name = Code::Blocks TDM-GCC (sürüm 4.7.1, 32 bitlik) +Description = Açık kaynak, çapraz platform, güçlü bir tümleşik geliştirme ortamı. TDM-GCC (sürüm 4.7.1, 32 bitlik) derleyicisini içerir. +Size = 97,8 MB diff --git a/base/applications/rapps/rapps/codeblocks_gcc_2.txt b/base/applications/rapps/rapps/codeblocks_gcc_2.txt new file mode 100644 index 00000000000..20e15bf5dff --- /dev/null +++ b/base/applications/rapps/rapps/codeblocks_gcc_2.txt @@ -0,0 +1,20 @@ +; UTF-8 + +[Section] +Name = Code::Blocks TDM-GCC (version 4.8.1, 32 bit) +Version = 13.12 +Licence = GPLv3 +Description = A open source, cross-platform, powerful IDE. It contains TDM-GCC (version 4.8.1, 32 bit) compiler. +Size = 100 MB +Category = 7 +URLSite = http://www.codeblocks.org/ +URLDownload = http://sourceforge.net/projects/codeblocks/files/Binaries/13.12/Windows/codeblocks-13.12mingw-setup-TDM-GCC-481.exe +CDPath = none + +[Section.0407] +Description = Eine quelloffene, plattformübergreifende, mächtige IDE. Diese enthät den TDM-GCC (version 4.8.1, 32 bit) Compiler. + +[Section.041f] +Name = Code::Blocks TDM-GCC (sürüm 4.8.1, 32 bitlik) +Description = Açık kaynak, çapraz platform, güçlü bir tümleşik geliştirme ortamı. TDM-GCC (sürüm 4.8.1, 32 bitlik) derleyicisini içerir. +Size = 100 MB diff --git a/base/applications/rapps/rapps/devcpp_mingw32.txt b/base/applications/rapps/rapps/devcpp_mingw32.txt new file mode 100644 index 00000000000..de51e041100 --- /dev/null +++ b/base/applications/rapps/rapps/devcpp_mingw32.txt @@ -0,0 +1,19 @@ +; UTF-8 + +[Section] +Name = Orwell Dev-C++ MinGW32 +Version = 5.6.2 +Licence = GPLv2 +Description = A maintained version of Dev-C++. It contains MinGW32 compiler. +Size = 60.2 MB +Category = 7 +URLSite = http://orwelldevcpp.blogspot.com/ +URLDownload = http://sourceforge.net/projects/orwelldevcpp/files/Setup%20Releases/Dev-Cpp%205.6.2%20MinGW%204.8.1%20Setup.exe +CDPath = none + +[Section.0407] +Description = Eine gepflegte Version von Dev-C++. Der MinGW32 Compiler liegt bei. + +[Section.041f] +Description = Dev-C++'nın sürdürülen bir sürümü. MinGW32 derleyicisini içerir. +Size = 60,2 MB diff --git a/base/applications/rapps/rapps/devcpp_tdm_gcc_x64.txt b/base/applications/rapps/rapps/devcpp_tdm_gcc_x64.txt new file mode 100644 index 00000000000..2761f212b10 --- /dev/null +++ b/base/applications/rapps/rapps/devcpp_tdm_gcc_x64.txt @@ -0,0 +1,19 @@ +; UTF-8 + +[Section] +Name = Orwell Dev-C++ TDM GCC x64 +Version = 5.6.2 +Licence = GPLv2 +Description = A maintained version of Dev-C++. It contains 64 bit TDM-GCC compiler. +Size = 44.8 MB +Category = 7 +URLSite = http://orwelldevcpp.blogspot.com/ +URLDownload = http://sourceforge.net/projects/orwelldevcpp/files/Setup%20Releases/Dev-Cpp%205.6.2%20TDM-GCC%20x64%204.8.1%20Setup.exe +CDPath = none + +[Section.0407] +Description = Eine gepflegte Version von Dev-C++. Der 64 bit TDM-GCC Compiler liegt bei. + +[Section.041f] +Description = Dev-C++'nın sürdürülen bir sürümü. 64 bitlik TDM-GCC derleyicisini içerir. +Size = 44,8 MB diff --git a/base/applications/rapps/rapps/doublecommander.txt b/base/applications/rapps/rapps/doublecommander.txt index fe5df184479..422148d8700 100644 --- a/base/applications/rapps/rapps/doublecommander.txt +++ b/base/applications/rapps/rapps/doublecommander.txt @@ -2,13 +2,13 @@ [Section] Name = Double Commander -Version = 0.5.8 Beta +Version = 0.5.9 Beta Licence = GPL Description = Double Commander is an open source file manager with two panels side by side. You need 7-Zip or a similar Utility to extract it. -Size = 7.5 MB +Size = 7.6 MB Category = 12 URLSite = http://doublecmd.sourceforge.net/ -URLDownload = http://download.sourceforge.net/project/doublecmd/DC%20for%20Windows%2032%20bit/Double%20Commander%200.5.8%20beta/doublecmd-0.5.8.i386-win32.exe +URLDownload = http://download.sourceforge.net/project/doublecmd/DC%20for%20Windows%2032%20bit/Double%20Commander%200.5.9%20beta/doublecmd-0.5.9.i386-win32.exe CDPath = none [Section.0407] @@ -25,7 +25,7 @@ Description = Double Commander to menedżer plików, o otwartym źródle, z klas [Section.0418] Description = Double Commander este un gestionar (open-source) de fișiere după modelul «două paneluri alăturate». Este necesar 7-Zip sau un utilitar similar de dezarhivare pentru a-l putea extrage. -Size = 7,5 Mo +Size = 7,6 Mo [Section.0419] Description = Double Commander - это открытый двухпанельный файловый менеджер. Вам нужен 7-Zip или подобная утилита для его распаковки. @@ -33,7 +33,7 @@ Description = Double Commander - это открытый двухпанельн [Section.041f] Version = 0.5.8 Gelişme Description = Double Commander, yan yana duran iki bölmenin bulunduğu bir açık kaynak kütük yöneticisidir. Bunu çıkartmak için 7-Zip ya da 7-Zip benzeri bir yazılım kullanmanız gerekir. -Size = 7,5 MB +Size = 7,6 MB [Section.0422] Description = Double Commander - це відкритий двопанельний файловий менеджер. Вам потрібен 7-Zip або подібна утиліта щоб розпакувати його. diff --git a/base/applications/rapps/rapps/dvdwritenow.txt b/base/applications/rapps/rapps/dvdwritenow.txt index 9d9ce9898d2..c403f526041 100644 --- a/base/applications/rapps/rapps/dvdwritenow.txt +++ b/base/applications/rapps/rapps/dvdwritenow.txt @@ -1,5 +1,5 @@ ; UTF-8 - +; PL translation by wojo664 [Section] Name = DVD Write Now Version = 1.5.12 sp2 @@ -17,6 +17,9 @@ Description = Eine kostenlose CD/DVD Brennsoftware. Sobald es installiert ist, k [Section.0410] Description = Un software di masterizzazione CD/DVD diretto e gratuito. Una volta installato, è possibile utilizzare il CD/DVD RW da flash USB o dischi rigidi rimovibili. Insieme a questo è possibile scrivere CD/DVD RW registrati con filesystem UDF. È anche possibile leggere i dischi UDF creati con altri software. (Microsoft DVD-ROM, dischi RW registrati con InCD Ahead). Il programma ha bisogno di un programma di decompressione ZIP per installarlo. +[Section.0415] +Description = Darmowe oprogramowanie do nagrywania CD/DVD. Po zainstalowaniu, możesz używać płyty CD RW i DVD RW tak, jak dyski przenośne / pendrive. Możesz także zapisywać (i odczytywać dyski utworzone przez inne programy) dane do dysków RW zapisanych w systemie UDF. Wymaga programu archiwizującego do wypakowania i instalacji. + [Section.0418] Licence = Gratuită Description = Un program de înscriere CD/DVD directă. Odată instalat, puteți utiliza CD/DVD ca memorie USB sau disc dur detașabil. Pe lângă aceasta, veți putea scrie pe CD/DVD inscripționate cu sistem de fișiere UDF. Se pot de asemenea citi discuri UDF create cu alte programe. (Microsoft DVD-ROM, discuri RW inscripționate cu Ahead InCD). Este necesar un program de decompresie ZIP pentru a-l instala. @@ -27,6 +30,7 @@ Description = DVD Write Now - бесплатная программа для п URLSite = http://dwn.alter.org.ua/ru/ [Section.041f] +Name = DVD Şimdi Yaz Licence = Ücretsiz -Description = Ücretsiz bir doğrudan CD/DVD kaydedicisi. Kurulur kurulmaz CD/DVD RW'leri çıkartılabilir disk olarak kullanabilirsiniz. Bununla birlikte CD/DVD RW'leri UDF kütük dizgesiyle kaydedebilirsiniz. Ayrıca, Microsoft DVD−ROM'ları, Ahead InCD ile kaydedilen RW diskleri gibi diğer yazılımlarla oluşturulan UDF diskleri okutabilirsiniz. Yazılımı kurmak için ZIP biçiminde çıkartma yeteneği olan bir yazılım gerekir. +Description = Ücretsiz bir doğrudan CD/DVD kaydedicisi. Kurulur kurulmaz CD/DVD RW'leri çıkartılabilir disk olarak kullanabilirsiniz. Bununla birlikte CD/DVD RW'leri UDF kütük dizgesiyle kaydedebilirsiniz. Ayrıca, Mikroyazılım DVD−ROM'ları, Ahead InCD ile kaydedilen RW diskleri gibi diğer yazılımlarla oluşturulan UDF diskleri okutabilirsiniz. Yazılımı kurmak için ZIP biçiminde çıkartma yeteneği olan bir yazılım gerekir. Size = 1,2 MB diff --git a/base/applications/rapps/rapps/fira.txt b/base/applications/rapps/rapps/fira.txt index de6649f3d71..b27dee4a663 100644 --- a/base/applications/rapps/rapps/fira.txt +++ b/base/applications/rapps/rapps/fira.txt @@ -1,4 +1,5 @@ ; UTF-8 +; PL translation by wojo664 [Section] Name = Mozilla Fira Font @@ -15,13 +16,17 @@ CDPath = none Licence = Unbekannt Description = Mozilla Fira Font Pack, Beinhaltet Mono und Sans Schriften. Bitte in den "ReactOS" Ordner entpacken. +[Section.0415] +Description = Pakiet czcionek Mozilla Fira Font, zawiera czcionki Mono i Sans. Wypakuj do folderu "ReactOS". +Licence = Nieznana + [Section.0418] Licence = Nespecificată Description = Pachetul Mozilla Fira Font, include fonturile Mono și Sans. Dezarhivați în dosarul „ReactOS”. Size = 543 ko [Section.041f] -Name = Mozilla Fira Yazı Tipi +Name = Mozilla Fira Yazı Türü Licence = Bilinmiyor -Description = Mozilla Fira Yazı Tipi Paketi, Mono ve Sans yazı tiplerini kapsar. ReactOS dizinine çıkartınız. +Description = Mozilla Fira Yazı Türü Paketi, Mono ve Sans yazı türlerini kapsar. ReactOS'un "Fonts" dizinine çıkartınız. Size = 543 KB diff --git a/base/applications/rapps/rapps/firefox.txt b/base/applications/rapps/rapps/firefox.txt index 32c2681f22a..89df72c9dcf 100644 --- a/base/applications/rapps/rapps/firefox.txt +++ b/base/applications/rapps/rapps/firefox.txt @@ -1,83 +1,83 @@ ; UTF-8 [Section] -Name = Mozilla Firefox 26 -Version = 26.0 +Name = Mozilla Firefox 28 +Version = 28.0 Licence = MPL/GPL/LGPL Description = The most popular and one of the best free Web Browsers out there. Size = 22.9 MB Category = 5 URLSite = http://www.mozilla.org/en-US/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/26.0/win32/en-US/Firefox%20Setup%2026.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/win32/en-US/Firefox%20Setup%2028.0.exe CDPath = none [Section.0407] Description = Der populärste und einer der besten freien Webbrowser. Size = 22.8 MB URLSite = http://www.mozilla.org/de/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/26.0/win32/de/Firefox%20Setup%2026.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/win32/de/Firefox%20Setup%2028.0.exe [Section.040a] Description = El más popular y uno de los mejores navegadores web gratuitos que hay. Size = 22.7 MB URLSite = http://www.mozilla.org/es-ES/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/26.0/win32/es-ES/Firefox%20Setup%2026.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/win32/es-ES/Firefox%20Setup%2028.0.exe [Section.040c] Description = Le navigateur web gratuit le plus populaire et l'un des meilleurs. Size = 23,0 Mo URLSite = http://www.mozilla.org/fr/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/26.0/win32/fr/Firefox%20Setup%2026.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/win32/fr/Firefox%20Setup%2028.0.exe [Section.0410] Description = Il più popolare e uno dei migliori web browser gratuiti. Size = 22.7 MB URLSite = http://www.mozilla.org/it/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/26.0/win32/it/Firefox%20Setup%2026.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/win32/it/Firefox%20Setup%2028.0.exe [Section.0413] Description = De meest populaire en een van de beste gratis Web browsers. Size = 23.4 MB URLSite = http://www.mozilla.org/nl/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/26.0/win32/nl/Firefox%20Setup%2026.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/win32/nl/Firefox%20Setup%2028.0.exe [Section.0414] Description = Mest populære og best også gratis nettleserene der ute. Size = 22.8 MB -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/26.0/win32/nb-NO/Firefox%20Setup%2026.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/win32/nb-NO/Firefox%20Setup%2028.0.exe [Section.0415] Description = Najpopularniejsza i jedna z najlepszych darmowych przeglądarek internetowych. Size = 23.7 MB URLSite = http://www.mozilla.org/pl/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/26.0/win32/pl/Firefox%20Setup%2026.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/win32/pl/Firefox%20Setup%2028.0.exe [Section.0418] Description = Cel mai popular și unul dintre cele mai bune navigatoare web gratuite existente. Size = 23,3 Mo URLSite = http://www.mozilla.org/ro/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/26.0/win32/ro/Firefox%20Setup%2026.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/win32/ro/Firefox%20Setup%2028.0.exe [Section.0419] Description = Один из самых популярных и лучших бесплатных браузеров. Size = 23,2 MB URLSite = http://www.mozilla.org/ru/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/26.0/win32/ru/Firefox%20Setup%2026.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/win32/ru/Firefox%20Setup%2028.0.exe [Section.041b] Description = Najpopulárnejší a jeden z najlepších slobodný webových prehliadačov. Size = 23,4 MB URLSite = http://www.mozilla.org/sk/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/26.0/win32/sk/Firefox%20Setup%2026.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/win32/sk/Firefox%20Setup%2028.0.exe [Section.041f] Description = Özgür Umûmî Ağ tarayıcıları arasında en tutulanı ve en iyisi. Size = 22,8 MB URLSite = http://www.mozilla.org/tr/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/26.0/win32/tr/Firefox%20Setup%2026.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/win32/tr/Firefox%20Setup%2028.0.exe [Section.0422] Description = Найпопулярніший та один з кращих безплатних веб-браузерів. Size = 23,2 MB URLSite = http://www.mozilla.org/uk/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/26.0/win32/uk/Firefox%20Setup%2026.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/win32/uk/Firefox%20Setup%2028.0.exe diff --git a/base/applications/rapps/rapps/globulation2.txt b/base/applications/rapps/rapps/globulation2.txt index 1beb181b9d8..4ecca2c89ca 100644 --- a/base/applications/rapps/rapps/globulation2.txt +++ b/base/applications/rapps/rapps/globulation2.txt @@ -1,5 +1,5 @@ ; UTF-8 - +; PL translation by wojo664 [Section] Name = Globulation2 Version = 0.9.4.4 @@ -17,6 +17,9 @@ Description = Globulation 2 ist ein Echtzeitstrategiespiel. Das Spiel vereinfach [Section.0410] Description = Globulation 2 è un gioco di strategia in tempo reale. +[Section.0415] +Description = Globulation 2 to gra strategiczna czasu rzeczywistego. Gra minimalizuje zarządzanie automatycznie przydzielając zadania jednostkom. + [Section.0418] Description = Globulation 2 este un joc de strategie în timp real. Jocul minimizează microgestiunea prin alocarea automată de sarcini unităților. Size = 13,5 Mo diff --git a/base/applications/rapps/rapps/hover.txt b/base/applications/rapps/rapps/hover.txt index 526b6f66960..d2048ceb54e 100644 --- a/base/applications/rapps/rapps/hover.txt +++ b/base/applications/rapps/rapps/hover.txt @@ -1,4 +1,5 @@ ; UTF-8 +; PL translation by wojo664 [Section] Name = Hover! @@ -16,10 +17,13 @@ Description = Das klassische Hover CTF Spiel, dass auf der Windows 95 CD zu find [Section.0410] Description = Il classico gioco Hover CTF che trovate sul CD di Windows 95. +[Section.0415] +Description = Klasyczna gra Hover CTF znaleziona na dysku Windows 95 + [Section.0418] Description = Jocul clasic Hover CTF, care se găsea pe CD-ul Windows 95. Size = 6,2 Mo [Section.041f] -Description = Windows 95 CD'sinde bulunan bir bayrak kapmaca oyunu. +Description = Pencereler 95 CD'sinde bulunan bir bayrak kapmaca oyunu. Size = 6,2 MB diff --git a/base/applications/rapps/rapps/hxd.txt b/base/applications/rapps/rapps/hxd.txt index f98ce350f0b..9e54d7a5c43 100644 --- a/base/applications/rapps/rapps/hxd.txt +++ b/base/applications/rapps/rapps/hxd.txt @@ -1,4 +1,5 @@ ; UTF-8 +; PL translation by wojo664 [Section] Name = HxD @@ -17,6 +18,9 @@ Size = 854 kB URLSite = http://mh-nexus.de/de/ URLDownload = http://mh-nexus.de/downloads/HxDSetupDE.zip +[Section.0415] +Description = Dobry edytor Hex. Do wypakowania pliku potrzebny jest program archiwizujący np. 7-Zip. + [Section.0418] Licence = Gratuită Description = Un bun editor hexazecimal. E necesar un utilitar de dezarhivare de tip ZIP. diff --git a/base/applications/rapps/rapps/indiftpd.txt b/base/applications/rapps/rapps/indiftpd.txt index a53d9b78773..2f71b9a9570 100644 --- a/base/applications/rapps/rapps/indiftpd.txt +++ b/base/applications/rapps/rapps/indiftpd.txt @@ -1,4 +1,5 @@ ; UTF-8 +; PL translation by wojo664 [Section] Name = IndiFTPD @@ -17,6 +18,9 @@ Description = IndiFTPD ist ein eigenständiger FTP Server in einer einzigen Anwe [Section.0410] Description = IndiFTPD è un server FTP autonomo che funziona come un unico eseguibile. È stato progettato per le situazioni quando un utente non vuole installare / configurare un server sul sistema (o non ha il permesso di farlo), e vuole ottenere rapidamente un server che esegue. +[Section.0415] +Description = IndiFTPD to samodzielny serwer FTP składający sie z jednego pliku wykonywalnego. Zaprojektowany z myślą o użytkownikach, którzy nie chcą instalować / konfigurować serwera w systemie (lub nie mają uprawnień) i chcą szybko uruchomić serwer FTP. + [Section.0418] Description = IndiFTPD este un server FTP de sine stătător, într-un singur executabil. A fost gândit pentru situațiile în care un utilizator nu dorește instalarea/configurarea unui server în sistem (sau nu deține privelegiile necesare) însă dorește obținerea rapidă a unui server funcțional. Size = 556 ko diff --git a/base/applications/rapps/rapps/kyodai.txt b/base/applications/rapps/rapps/kyodai.txt index 9779a6508f9..9b205d52dab 100644 --- a/base/applications/rapps/rapps/kyodai.txt +++ b/base/applications/rapps/rapps/kyodai.txt @@ -1,5 +1,5 @@ ; UTF-8 - +; PL translation by wojo664 [Section] Name = Kyodai Mahjongg Version = 21.42 @@ -16,6 +16,9 @@ Description = Eines der besten Mahjongg Solitaire Spiele im Netz. [Section.0410] Description = Uno dei migliori giochi di Mahjongg Solitaire. +[Section.0415] +Description = Jedna z najlepszych gier Mahjongg Solitaire. + [Section.0418] Licence = Versiune de evaluare Description = Unul dintre cele mai bune jocuri de pasiență Mahjongg. diff --git a/base/applications/rapps/rapps/lazaruside.txt b/base/applications/rapps/rapps/lazaruside.txt index 517eba86618..903f58b2e73 100644 --- a/base/applications/rapps/rapps/lazaruside.txt +++ b/base/applications/rapps/rapps/lazaruside.txt @@ -1,27 +1,31 @@ ; UTF-8 +; PL translation by wojo664 [Section] Name = Lazarus -Version = 1.0.14 +Version = 1.2 Licence = modified LGPL, GPL Description = A cross-platform integrated development environment (IDE) that lets you create visual (GUI) and non-visual Object Pascal programs, and uses the Free Pascal compiler to generate your executable. -Size = 111 MB +Size = 112 MB Category = 7 URLSite = http://www.lazarus.freepascal.org/ -URLDownload = http://download.sourceforge.net/project/lazarus/Lazarus%20Windows%2032%20bits/Lazarus%201.0.14/lazarus-1.0.14-fpc-2.6.2-win32.exe +URLDownload = http://download.sourceforge.net/project/lazarus/Lazarus%20Windows%2032%20bits/Lazarus%201.2/lazarus-1.2.0-fpc-2.6.2-win32.exe CDPath = none [Section.0407] Description = Eine plattformunabhängige, integrierte Entwicklungsumgebung (IDE), mit der man grafische (GUI) und nicht-grafische Pascal-Programme erstellen kann. Es verwendet den Free Pascal Compiler um die Programme zu erzeugen. +[Section.0415] +Description = Wielopratformowe zintegrowane środowisko programistyczne (IDE) które pozwala na tworzenie graficznych (GUI) i niegraficznych (działających w konsoli) programów obiektowych w języku Pascal. Program używa darmowego kompilatora Free Pascal. + [Section.0410] Description = Un ambiente di sviluppo integrato (IDE) cross-platform che consente di creare interfacce grafiche (GUI) e programmi non visivi Object Pascal, e utilizza il compilatore Free Pascal per generare l'eseguibile. [Section.0418] Licence = GPL, LGPL modificată Description = Un mediu integrat de dezvoltare (IDE) multi-platformă care vă permite crearea de programe Object Pascal, atât vizuale (GUI) cât și ne-vizuale, și utilizează compilatorul Free Pascal pentru a genera executabile. -Size = 111 Mo +Size = 112 Mo [Section.041f] Licence = Değiştirilmiş LGPL, GPL -Description = Basarî ve basarî olmayan Nesne Paskal izlenceleri oluşturmayı sağlayan, Özgür Paskal derleyicisini kullanarak çalıştırabilir kütük oluşturan bir çapraz platform tümleşik geliştirme ortamı. +Description = Basarî ve basarî olmayan Nesne Paskal çizeylemleri oluşturmayı sağlayan, Özgür Paskal derleyicisini kullanarak çalıştırabilir kütük oluşturan bir çapraz platform tümleşik geliştirme ortamı. diff --git a/base/applications/rapps/rapps/libreoffice.txt b/base/applications/rapps/rapps/libreoffice.txt index 12359386821..605e24e9b85 100644 --- a/base/applications/rapps/rapps/libreoffice.txt +++ b/base/applications/rapps/rapps/libreoffice.txt @@ -2,13 +2,13 @@ [Section] Name = LibreOffice -Version = 4.1.4 +Version = 4.2.3 Licence = LGPL Description = Former called OpenOffice. Open Source Office Suite. -Size = 205.9 MB +Size = 211.0 MB Category = 6 URLSite = http://www.documentfoundation.org/ -URLDownload = http://download.documentfoundation.org/libreoffice/stable/4.1.4/win/x86/LibreOffice_4.1.4_Win_x86.msi +URLDownload = http://download.documentfoundation.org/libreoffice/stable/4.2.3/win/x86/LibreOffice_4.2.3_Win_x86.msi CDPath = none [Section.0407] @@ -19,7 +19,7 @@ Description = La suite de ofimática de código abierto. [Section.040c] Description = Précédemment appelé OpenOffice. Suite bureautique open source. -Size = 205,9 Mo +Size = 211,0 Mo [Section.0410] Description = Precedentemente chiamato OpenOffice. Open Source Office Suite. @@ -32,11 +32,11 @@ Description = Otwarty pakiet biurowy. [Section.0418] Description = Fostul OpenOffice. Suita de aplicații de birotică open-source. -Size = 205,9 Mo +Size = 211,0 Mo [Section.041f] Description = OpenOffice gibi bir açık kaynak büro takımı. -Size = 205,9 MB +Size = 211,0 MB [Section.0422] Description = Відкритий офісний пакет. diff --git a/base/applications/rapps/rapps/mirandaim.txt b/base/applications/rapps/rapps/mirandaim.txt index 983de88a861..3205655075f 100644 --- a/base/applications/rapps/rapps/mirandaim.txt +++ b/base/applications/rapps/rapps/mirandaim.txt @@ -2,13 +2,13 @@ [Section] Name = Miranda IM -Version = 0.10.21 +Version = 0.10.22 Licence = GPL Description = Open source multiprotocol instant messaging application - May not work completely. -Size = 2.82 MB +Size = 2.8 MB Category = 5 URLSite = http://www.miranda-im.org/ -URLDownload = http://files.miranda-im.org/stable/0.10.21.0/miranda-im-v0.10.21-unicode.exe +URLDownload = http://files.miranda-im.org/stable/0.10.22.0/miranda-im-v0.10.22-unicode.exe CDPath = none [Section.0407] @@ -19,7 +19,7 @@ Description = Aplicación de mensajería instantánea multiprotocolo de código [Section.040c] Description = Application de messagerie instantannée multi-protocoles open source - pourrait ne pas fonctionner complètement. -Size = 2,82 Mo +Size = 2,8 Mo [Section.0410] Description = Multi-protocollo open source per applicazioni di messaggistica istantanea - potrebbe non funzionare del tutto. @@ -32,11 +32,11 @@ Description = Otwarty komunikator internetowy, obsługujący wiele różnych pro [Section.0418] Description = Aplicație de mesagerie instant multiprotocol (open-source) - posibil cu limitări în funcționalitate. -Size = 2,82 Mo +Size = 2,8 Mo [Section.041f] Description = Bir açık kaynak, çoklu iletişim kurallı ve evgin iletileşme yazılımı. Eksiksiz olarak çalışmayabilir. -Size = 2,82 MB +Size = 2,8 MB [Section.0422] Description = Відкрита мультипротокольна програма миттєвих повідомлень - може не працювати повністю. diff --git a/base/applications/rapps/rapps/mpc.txt b/base/applications/rapps/rapps/mpc.txt index d34223602c9..0184f79f16d 100644 --- a/base/applications/rapps/rapps/mpc.txt +++ b/base/applications/rapps/rapps/mpc.txt @@ -2,13 +2,13 @@ [Section] Name = Media Player Classic Home Cinema -Version = 1.7.1 +Version = 1.7.4 Licence = GPL Description = A media player. -Size = 9.8 MB +Size = 10.1 MB Category = 2 URLSite = http://mpc-hc.org/ -URLDownload = http://download.sourceforge.net/project/mpc-hc/MPC%20HomeCinema%20-%20Win32/MPC-HC_v1.7.1_x86/MPC-HC.1.7.1.x86.exe +URLDownload = http://download.sourceforge.net/project/mpc-hc/MPC%20HomeCinema%20-%20Win32/MPC-HC_v1.7.4_x86/MPC-HC.1.7.4.x86.exe CDPath = none [Section.0407] @@ -19,7 +19,7 @@ Description = Reproductor multimedia. [Section.040c] Description = Un lecteur media. -Size = 9,8 Mo +Size = 10,1 Mo [Section.0410] Description = Lettore multimediale. @@ -32,7 +32,7 @@ Description = Odtwarzacz multimediów. [Section.0418] Description = Lector multimedia. -Size = 9,8 Mo +Size = 10,1 Mo [Section.0419] Description = Мультимедийный проигрыватель. @@ -42,7 +42,7 @@ Description = Multimediálny prehrávač. [Section.041f] Description = Bir ortam oynatıcısı. -Size = 9,8 MB +Size = 10,1 MB [Section.0422] Description = Мультимедійний програвач. diff --git a/base/applications/rapps/rapps/mpxplay.txt b/base/applications/rapps/rapps/mpxplay.txt index 1b785603dc4..6246d0a89d4 100644 --- a/base/applications/rapps/rapps/mpxplay.txt +++ b/base/applications/rapps/rapps/mpxplay.txt @@ -1,5 +1,5 @@ ; UTF-8 - +; PL translation by wojo664 [Section] Name = Mpxplay Version = 1.60b @@ -14,6 +14,9 @@ CDPath = none [Section.0407] Description = Mpxplay ist ein konsolenbasierter 32-bit Audio Player für Windows. Zum extrahieren wird 7-Zip oder ein ähnliches Tool benötigt. +[Section.0415] +Description = Mpxplay to 32 bitowy odtwarzacz audio (działający w konsoli) dla Windows. Wymaga programu archiwizującego (np. 7-Zip) do wypakowania. + [Section.0418] Description = Mpxplay este un lector audio de tip consolă, pe 32-biți pentru Windows. E necesar un utilitar de dezarhivare de tip ZIP. Size = 520 ko @@ -22,5 +25,5 @@ Size = 520 ko Description = Mpxplay - 32-разрядный консольный аудиоплеер для Windows. Вам нужен 7-Zip или подобная утилита для его распаковки. [Section.041f] -Description = Mpxplay, Windows için 32 bitlik, konsolluk bir ses oynatıcısıdır. Bunu çıkartmak için 7-Zip ya da 7-Zip benzeri bir yazılım kullanmanız gerekir. +Description = Mpxplay, Pencereler için 32 ikillik, konsolluk bir ses oynatıcısıdır. Bunu çıkartmak için 7-Zip ya da 7-Zip benzeri bir yazılım kullanmanız gerekir. Size = 520 KB diff --git a/base/applications/rapps/rapps/npp.txt b/base/applications/rapps/rapps/npp.txt index 71fcf0bb734..50b7a72e64c 100644 --- a/base/applications/rapps/rapps/npp.txt +++ b/base/applications/rapps/rapps/npp.txt @@ -2,13 +2,13 @@ [Section] Name = Notepad++ -Version = 6.5.3 +Version = 6.5.5 Licence = GPL Description = A text editor. -Size = 7.25 MB +Size = 7.3 MB Category = 6 URLSite = http://notepad-plus-plus.org/ -URLDownload = http://download.tuxfamily.org/notepadplus/6.5.3/npp.6.5.3.Installer.exe +URLDownload = http://download.tuxfamily.org/notepadplus/6.5.5/npp.6.5.5.Installer.exe CDPath = none [Section.0407] @@ -19,7 +19,7 @@ Description = Un editor de text. [Section.040c] Description = Un éditeur de texte. -Size = 7,25 Mo +Size = 7,3 Mo [Section.0410] Description = Un editor di testo. @@ -32,7 +32,7 @@ Description = Edytor tekstu. [Section.0418] Description = Un editor de text. -Size = 7,25 Mo +Size = 7,3 Mo [Section.0419] Description = Текстовый редактор. @@ -42,7 +42,7 @@ Description = Textový editor. [Section.041f] Description = Bir metin düzenleyicisi. -Size = 7,25 MB +Size = 7,3 MB [Section.0422] Description = Текстовый редактор. diff --git a/base/applications/rapps/rapps/opencodecs.txt b/base/applications/rapps/rapps/opencodecs.txt index d44e219e61b..9dbb401462d 100644 --- a/base/applications/rapps/rapps/opencodecs.txt +++ b/base/applications/rapps/rapps/opencodecs.txt @@ -1,4 +1,5 @@ ; UTF-8 +; PL trans by wojo664 [Section] Name = xiph.org OpenCodecs @@ -17,6 +18,9 @@ Description = DirectShow Filter für Ogg Vorbis, Speex, Theora, FLAC, und WebM D [Section.0410] Description = I filtri DirectShow per la Ogg Vorbis, Speex, Theora, FLAC e formati di file WebM. +[Section.0415] +Description = Filtry DirectShow dla Ogg Vorbis, Speex, Theora, FLAC, i plików w formacie WebM. + [Section.0418] Description = Filtrele DirectShow pentru formatele de fișiere Ogg Vorbis, Speex, Theora, FLAC și WebM. Size = 2,53 Mo diff --git a/base/applications/rapps/rapps/openttd.txt b/base/applications/rapps/rapps/openttd.txt index 7f4b0358d6c..cca8069cf2a 100644 --- a/base/applications/rapps/rapps/openttd.txt +++ b/base/applications/rapps/rapps/openttd.txt @@ -2,13 +2,13 @@ [Section] Name = OpenTTD -Version = 1.3.3 +Version = 1.4.0 Licence = GPL v2 Description = Open Source clone of the "Transport Tycoon Deluxe" game engine. You need a copy of Transport Tycoon. -Size = 6.75 MB +Size = 7.0 MB Category = 4 URLSite = http://www.openttd.org/ -URLDownload = http://binaries.openttd.org/releases/1.3.3/openttd-1.3.3-windows-win32.exe +URLDownload = http://binaries.openttd.org/releases/1.4.0/openttd-1.4.0-windows-win32.exe CDPath = none [Section.0407] @@ -19,7 +19,7 @@ Description = Clon del motor de juegos "Transport Tycoon Deluxe" de código abie [Section.040c] Description = Clone open source du moteur de jeu "Transport Tycoon Deluxe". Vous aurez besoin d'une copie de Transport Tycoon. -Size = 6,75 Mo +Size = 7,0 Mo [Section.0410] Description = Clone open source del motore di gioco di "Transport Tycoon Deluxe". Hai bisogno di una copia di Transport Tycoon. @@ -32,11 +32,11 @@ Description = Otwarty klon silnika gry "Transport Tycoon Deluxe". Do poprawnego [Section.0418] Description = Clona (open-source a) motorului de joc "Transport Tycoon Deluxe". Este necesară o copie a jocului Transport Tycoon. -Size = 6,75 Mo +Size = 7,0 Mo [Section.041f] Description = Transport Tycoon Deluxe oyun motorunun bir açık kaynak taklidi. Transport Tycoon'un bir kopyası gerekir. -Size = 6,75 MB +Size = 7,0 MB [Section.0422] Description = Відкритий клон двигуна гри "Transport Tycoon Deluxe". Вам потрібна копія гри Transport Tycoon. diff --git a/base/applications/rapps/rapps/peazip.txt b/base/applications/rapps/rapps/peazip.txt new file mode 100644 index 00000000000..52857bd448c --- /dev/null +++ b/base/applications/rapps/rapps/peazip.txt @@ -0,0 +1,19 @@ +; UTF-8 + +[Section] +Name = PeaZip +Version = 5.3.0 +Licence = LGPL v3, OpenCandy EULA +Description = PeaZip is a free, cross-platform, open source file and archive manager. It supports over 150 archive formats. +Size = 5.8 MB +Category = 12 +URLSite = http://peazip.sourceforge.net/ +URLDownload = http://sourceforge.net/projects/peazip/files/5.3.0/peazip-5.3.0.WINDOWS.exe +CDPath = none + +[Section.0407] +Description = PeaZip ist ein freier, plattformübergreifender, quelloffener Datei- und Archivmanager. Er unterstützt über 150 Archiv-Formate. + +[Section.041f] +Description = PeaZip; ücretsiz, çapraz platform, açık kaynak bir kütük ve belgelik yöneticisidir. 150'den çok belgelikleme biçimini destekler. +Size = 5,8 MB diff --git a/base/applications/rapps/rapps/pengupop.txt b/base/applications/rapps/rapps/pengupop.txt index f69ab6eb7d3..9804859b834 100644 --- a/base/applications/rapps/rapps/pengupop.txt +++ b/base/applications/rapps/rapps/pengupop.txt @@ -1,5 +1,5 @@ ; UTF-8 - +; PL translation by wojo664 [Section] Name = Pengupop Version = 2.2.3 @@ -16,6 +16,9 @@ Description = Das Ziel des Spiels ist es farbige Orbs ins Spielfeld zu feuern, s [Section.0410] Description = Lo scopo di questo gioco è quello di sparare sfere colorate nel vostro campo di gioco, in modo da formare gruppi di tre o più. +[Section.0415] +Description = Celem tej gry jest strzelanie kolorowymi kulkami tak, aby utworzyć rzędy trzech lub więcej kulek w tym samym kolorze. + [Section.0418] Description = Scopul acestui joc este de a arunca globuri colorate în propriul teren pentru a forma grupuri de câte trei sau mai multe. Size = 384 ko diff --git a/base/applications/rapps/rapps/photofiltre.txt b/base/applications/rapps/rapps/photofiltre.txt index 2ed9682f28f..174a39674e8 100644 --- a/base/applications/rapps/rapps/photofiltre.txt +++ b/base/applications/rapps/rapps/photofiltre.txt @@ -1,4 +1,5 @@ ; UTF-8 +; PL translation by wojo664 [Section] Name = PhotoFiltre 7 @@ -14,6 +15,9 @@ CDPath = none [Section.0407] Description = Version mit Layers, aber eingeschänkter als die Studio-X Version. PhotoFiltre Studio ist ein komplettes Bildretuschier-Programm. +[Section.0415] +Description = Ta wersja obsługuje warstwy, ale ma większe ograniczenia od Studio X. PhotoFiltre Studio to program do retuszu zdjęć. + [Section.0418] Licence = Gratuită Description = PhotoFiltre Studio este o aplicație completă de retușare a imaginilor. @@ -21,5 +25,5 @@ Size = 4,99 Mo [Section.041f] Licence = Ücretsiz -Description = Bu sürüm, katmanlarla gelmektedir ancak Studio X sürümünden daha kısıtlıdır. PhotoFiltre Studio, eksiksiz bir resim düzeltme yazılımıdır. +Description = Bu sürüm, katmanlarla gelmektedir ancak Stüdyo X sürümünden daha kısıtlıdır. PhotoFiltre Stüdyo, eksiksiz bir resim düzeltme yazılımıdır. Size = 4,99 MB diff --git a/base/applications/rapps/rapps/pingus.txt b/base/applications/rapps/rapps/pingus.txt index af175849314..6e4208a9162 100644 --- a/base/applications/rapps/rapps/pingus.txt +++ b/base/applications/rapps/rapps/pingus.txt @@ -1,4 +1,5 @@ ; UTF-8 +; PL translation by wojo664 [Section] Name = Pingus @@ -17,10 +18,13 @@ Description = Pingus ist ein freies Lemings-ähnliches Puzzle Spiel. [Section.0410] Description = Pingus è un gioco gratuito simile a Lemmings. +[Section.0415] +Description = Pingus to darmowa gra logiczna podobna do gry Lemmings + [Section.0418] Description = Pingus este un joc-enigmă asemănător cu Lemmings. Size = 16,0 Mo [Section.041f] -Description = Pingus, ücretsiz, Lemmings gibi bir bulmaca oyunudur. +Description = Pingus, ücretsiz, Yaban Sıçanları gibi bir bulmaca oyunudur. Size = 16,0 MB diff --git a/base/applications/rapps/rapps/pspad.txt b/base/applications/rapps/rapps/pspad.txt index 82588542615..1f02aa24c28 100644 --- a/base/applications/rapps/rapps/pspad.txt +++ b/base/applications/rapps/rapps/pspad.txt @@ -1,4 +1,5 @@ ; UTF-8 +; PL translation by wojo664 [Section] Name = PSPad @@ -24,6 +25,9 @@ Size = 4,46 Mo [Section.0410] Description = Un editor di testo. +Section.0415] +Description = Edytor tekstu. + [Section.0413] Description = Een teksteditor. diff --git a/base/applications/rapps/rapps/ptanks.txt b/base/applications/rapps/rapps/ptanks.txt index ef8bfaa0063..220317a01fa 100644 --- a/base/applications/rapps/rapps/ptanks.txt +++ b/base/applications/rapps/rapps/ptanks.txt @@ -1,4 +1,5 @@ ; UTF-8 +; PL translation by wojo664 [Section] Name = Pocket Tanks @@ -14,12 +15,16 @@ CDPath = none [Section.0407] Description = Das schnellste Artillerie-Spiel, das Sie jemals gespielt haben. +[Section.0415] +Description = Szybka gra artyleryjska + [Section.0418] Licence = Versiune de evaluare Description = Cel mai rapid joc de artilerie pe care-l veți juca vreodată. Size = 2,86 Mo [Section.041f] +Name = Küçük Tanklar Licence = Kısıtlı -Description = Bu güne dek oynadığınız en hızlı topçu oyunu. +Description = Bu güne kadar oynadığınız en hızlı topçu oyunu. Size = 2,86 MB diff --git a/base/applications/rapps/rapps/python.txt b/base/applications/rapps/rapps/python.txt index 69d5e276f64..16418b4813b 100644 --- a/base/applications/rapps/rapps/python.txt +++ b/base/applications/rapps/rapps/python.txt @@ -2,13 +2,13 @@ [Section] Name = Python 3 -Version = 3.3.3 +Version = 3.4.0 Licence = GPL/LGPL Description = A remarkably powerful dynamic programming language. -Size = 19.6 MB +Size = 23.4 MB Category = 7 URLSite = http://www.python.org/ -URLDownload = http://www.python.org/ftp/python/3.3.3/python-3.3.3.msi +URLDownload = http://www.python.org/ftp/python/3.4.0/python-3.4.0.msi CDPath = none [Section.0407] @@ -19,7 +19,7 @@ Description = Un lenguaje de programación dinámico sumamente potente. [Section.040c] Description = Un langage de programmation dynamique remarquablement puissant. -Size = 19,6 Mo +Size = 23,4 Mo [Section.0410] Description = Un Linguaggio di programmazione dinamico e potente. @@ -32,11 +32,11 @@ Description = Potęży i dynamiczny język programowania. [Section.0418] Description = Un limbaj de programare dinamic și puternic. -Size = 19,6 Mo +Size = 23,4 Mo [Section.041f] Description = İlgi çekici, güçlü ve devingen bir izlenceleme dili. -Size = 19,6 MB +Size = 23,4 MB [Section.0422] Description = Дуже потужна динамічна мова програмування. diff --git a/base/applications/rapps/rapps/qb64sdl.txt b/base/applications/rapps/rapps/qb64sdl.txt index 91ec3cd06ad..ef97238df67 100644 --- a/base/applications/rapps/rapps/qb64sdl.txt +++ b/base/applications/rapps/rapps/qb64sdl.txt @@ -1,26 +1,29 @@ ; UTF-8 - +; PL translation by wojo664 [Section] Name = QB64 (SDL version) -Version = 0.954 +Version = 0.980 Licence = Freeware Description = QB64 is a self-hosting BASIC compiler for Microsoft Windows, Linux and Mac OS X, designed to be compatible with Microsoft QBasic and Microsoft QuickBASIC. You need 7-Zip or a similar utility to extract it. -Size = 33.1 MB +Size = 39.0 MB Category = 7 URLSite = http://www.qb64.net/ -URLDownload = http://www.qb64.net/qb64v0954-win.7z +URLDownload = http://www.qb64.net/qb64v0980-win.7z CDPath = none [Section.0407] Description = QB64 ist ein Self-Hosting BASIC-Compiler für Microsoft Windows, Linux und Mac OS X, entwickelt, um mit Microsoft QBasic und Microsoft QuickBASIC kompatibel zu sein. Sie müssen 7-Zip oder ein ähnliches Dienstprogramm installiert haben, um es zu extrahieren. +[Section.0415] +Description = QB64 to kompilator BASIC zdolny do kompilacji własnego kodu źródłowego. Działa w systemach Windows, Linux i Mac OS X. Jest kompatybilny z Microsoft QBasic i QuickBASIC. Wymaga programu archiwizującego do wypakowania. + [Section.0418] Licence = Gratuită Description = QB64 este un compilator BASIC auto-compilabil pentru Windows, Linux și Mac OS X, conceput pentru a fi compatibil cu Microsoft QBasic și Microsoft QuickBASIC. Este necesar un utilitar de derarhivare de tip ZIP. -Size = 33,1 Mo +Size = 39,0 Mo [Section.041f] Name = QB64 (SDL Sürümü) Licence = Ücretsiz -Description = QB64; Microsoft Windows, Linux ve Mac OS X için yapılmış, Microsoft QBasic ve Microsoft QuickBASIC ile uyumlu olarak tasarlanan, kendi kendini derleyen bir BASIC derleyicisidir. Bunu çıkartmak için 7-Zip ya da 7-Zip benzeri bir yazılım kullanmanız gerekir. -Size = 33,1 MB +Description = QB64; Mikroyazılım Pencereler, Linux ve Mac OS X için yapılmış, Mikroyazılım QBasic ve Mikroyazılım QuickBASIC ile uyumlu olarak tasarlanan, kendi kendini derleyen bir BASIC derleyicisidir. Bunu çıkartmak için 7-Zip ya da 7-Zip benzeri bir yazılım kullanmanız gerekir. +Size = 39,0 MB diff --git a/base/applications/rapps/rapps/qmmp.txt b/base/applications/rapps/rapps/qmmp.txt index 465f29cda7c..a666c7261c6 100644 --- a/base/applications/rapps/rapps/qmmp.txt +++ b/base/applications/rapps/rapps/qmmp.txt @@ -1,4 +1,5 @@ ; UTF-8 +; PL translation by wojo664 [Section] Name = Qmmp (Qt-based Multimedia Player) @@ -14,6 +15,9 @@ CDPath = none [Section.0407] Description = Qmmp ist ein Audio-Player, der mit Hilfe der Qt Bibliothek geschrieben wurde. Die Benutzeroberfläche ist ähnlich zu WinAMP oder XMMS. Alternative Benutzeroberflächen sind ebenfalls verfügbar. +[Section.0415] +Description = Gmmp to odtwarzacz audio, napisany z pomocą biblioteki Qt. Interfejs podobny jest do Winampa lub XMMS. Dostępnme są także dodatkowe skórki. + [Section.0418] Description = Qmmp este un lector audio, ce utilizează biblioteca QT. Interfața de utilizare e asemănătoare cu cea din WinAMP sau XMMS. De asemenea sunt disponibile interfețe de utilizare alternative. Size = 16,0 Mo @@ -22,6 +26,6 @@ Size = 16,0 Mo Description = Аудиоплеер Qmmp (Qt-based Multimedia Player). [Section.041f] -Name = Qmmp (Qt Tabanlı Çokluortam Oynatıcısı) +Name = Qt Tabanlı Çokluortam Oynatıcısı Description = Qmmp, Qt kitaplığının yardımıyla yazılan bir ses oynatıcısıdır. Kullanıcı arayüzüsü WinAMP'ınkine ve XMMS'ninkine benzer. Ayrıca değişik kullanıcı arayüzleri de vardır. Size = 16,0 MB diff --git a/base/applications/rapps/rapps/reshack.txt b/base/applications/rapps/rapps/reshack.txt index 6751dfe16c3..18e22d6455c 100644 --- a/base/applications/rapps/rapps/reshack.txt +++ b/base/applications/rapps/rapps/reshack.txt @@ -1,4 +1,5 @@ ; UTF-8 +; PL translation by wojo664 [Section] Name = Resource Hacker @@ -14,12 +15,16 @@ CDPath = none [Section.0407] Description = Resource Hacker ist ein Freeware-Tool zum anzeigen, ändern, umbenennen, hinzufügen, löschen und extrahieren von Ressourcen in 32-Bit & 64-Bit-Windows Anwendungen und Ressourcen-Dateien (*. Res). +[Section.0415] +Description = Resource Hacker to darmowe narzędzie do podglądu, modyfikacji, zmiany nazw, dodawania, kasowania i wypakowywania zasobów w plikach wykonywalnych 32bit i 64bit, oraz w plikach zasobów (*.res). + [Section.0418] Licence = Gratuită Description = Resource Hacker este un utilitar gratuit pentru inspectarea, modificarea, redenumirea, adăugarea, ștergerea și extragerea resurselor din fișierele resursă (*.res) și fișierele executabile pe 32 și 64 de biți pentru Windows. Size = 730 ko [Section.041f] +Name = Kaynak Korsancısı Licence = Ücretsiz -Description = Resource Hacker, 32 ya da 64 bitlik Windows çaılştırabilirlerini ve .res uzantılı kaynak kütüklerindeki kaynakları görüntüleyen, değiştiren, yeniden adlandıran, ekleyen, silen ve çıkartan ücretsiz bir araçtır. +Description = Kaynak Korsancısı, 32 ya da 64 ikillik Pencereler çaılştırabilirlerini ve .res uzantılı kaynak kütüklerindeki kaynakları görüntüleyen, değiştiren, yeniden adlandıran, ekleyen, silen ve çıkartan ücretsiz bir araçtır. Size = 730 KB diff --git a/base/applications/rapps/rapps/rocks.txt b/base/applications/rapps/rapps/rocks.txt index 743a9c238ae..5e8f0b29462 100644 --- a/base/applications/rapps/rapps/rocks.txt +++ b/base/applications/rapps/rapps/rocks.txt @@ -1,4 +1,5 @@ ; UTF-8 +; PL translation by wojo664 [Section] Name = Rocks'n'Diamonds @@ -14,10 +15,13 @@ CDPath = none [Section.0407] Description = Arcade-Style Spiel für UNIX, Mac OS X, Windows und DOS in der Tradition von: "Boulder Dash" (C64), "Emerald Mine" (Amiga), "Supaplex" (Amiga / PC), "Sokoban" (PC). Sie benötigen ein ZIP-Programm, um es zu installieren. +Section.0415] +Description = Gra typu Arcade dla UNIX, Mac OS X, Windows i DOS. Bazująca na "Boulder Dash" (C64), "Emerald Mine" (Amiga), "Supaplex" (Amiga/PC), "Sokoban" (PC). Aby zainstalować te grę, potrzebny jest program archiwizujący np. 7-Zip. + [Section.0418] Description = Un joc de tip arcadă pentru UNIX, Mac OS X, Windows și DOS; respectând tradiția: "Boulder Dash" (C64), "Emerald Mine" (Amiga), "Supaplex" (Amiga/PC), "Sokoban" (PC). Size = 2,42 Mo [Section.041f] -Description = UNIX, Mac OS X, Windows ve DOS için yapılmış, atari oyun salonu türünde bir oyun. Şu gelenekleri içerir: "Boulder Dash" (C64), "Emerald Mine" (Amiga), "Supaplex" (Amiga ve PC), "Sokoban" (PC). Yazılımı kurmak için ZIP biçiminde çıkartma yeteneği olan bir yazılım gerekir. +Description = UNIX, Mac OS X, Pencereler ve DOS için yapılmış, atari oyun salonu türünde bir oyun. Şu gelenekleri içerir: "Boulder Dash" (C64), "Zümrüt Mâdeni" (Amiga), "Supaplex" (Amiga ve PC), "Sokoban" (PC). Yazılımı kurmak için ZIP biçiminde çıkartma yeteneği olan bir yazılım gerekir. Size = 2,42 MB diff --git a/base/applications/rapps/rapps/scite.txt b/base/applications/rapps/rapps/scite.txt index 0b4789cbf80..52300c0fb42 100644 --- a/base/applications/rapps/rapps/scite.txt +++ b/base/applications/rapps/rapps/scite.txt @@ -2,13 +2,13 @@ [Section] Name = SciTE -Version = 3.3.7 +Version = 3.4.1 Licence = Freeware Description = SciTE is a SCIntilla based Text Editor. Originally built to demonstrate Scintilla, it has grown to be a generally useful editor with facilities for building and running programs. -Size = 722 kB +Size = 730 kB Category = 7 URLSite = http://www.scintilla.org/ -URLDownload = http://download.sourceforge.net/project/scintilla/SciTE/3.3.7/Sc337.exe +URLDownload = http://download.sourceforge.net/project/scintilla/SciTE/3.4.1/Sc341.exe CDPath = none [Section.0407] @@ -19,7 +19,7 @@ Description = Editor de texto basado en SCIntilla. Originalmente creado para dem [Section.040c] Description = SciTE est un éditeur de texte basé sur SCIntilla. Originelement réalisé pour montrer Scintilla, il a évolué pour devenir un éditeur généralement utile avec des options pour compiler et lancer des programmes. -Size = 722 ko +Size = 730 ko [Section.0410] Description = SciTE è un editor di testo basato scintilla. Originariamente costruito per dimostrare Scintilla, è cresciuto fino a essere un editor generalmente utile con strutture per la creazione e l'esecuzione di programmi. @@ -33,12 +33,12 @@ Description = SciTE to edytor tekstu bazowany na SCIntilla. Oryginalnie stworzon [Section.0418] Licence = Gratuită Description = SciTE este un editor de text bazat pe SCIntilla. Construit inițial pentru a demonstra Scintilla, a crescut ulterior într-un editor de uz general cu funcționalități de compilare și execuție a programelor. -Size = 722 ko +Size = 730 ko [Section.041f] Licence = Ücretsiz Description = SciTE, Scintilla tabanlı bir metin düzenleyicisidir. Başlangıçta, Scintilla'yı göstermek için yapılmıştır ancak umûmiyetle izlenceleri yapmak ve çalıştırmak yetenekleriyle birlikte kullanışlı bir düzenleyici olarak geliştirilmiştir. -Size = 722 KB +Size = 730 KB [Section.0422] Description = Текстовий редактор на основі SCIntilla. Був зібраний як презентація Scintilla, але виріс до редактора загального користування з засобами збирання та запуску програм. diff --git a/base/applications/rapps/rapps/seamonkey.txt b/base/applications/rapps/rapps/seamonkey.txt index 14b2a6b83d7..4355489b8e7 100644 --- a/base/applications/rapps/rapps/seamonkey.txt +++ b/base/applications/rapps/rapps/seamonkey.txt @@ -2,44 +2,44 @@ [Section] Name = Mozilla SeaMonkey -Version = 2.23 +Version = 2.25 Licence = MPL/GPL/LGPL Description = Mozilla Suite is alive. This is the one and only Browser, Mail, Chat, and Composer bundle you will ever need. Size = 23.90 MB Category = 5 URLSite = http://www.seamonkey-project.org/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.23/win32/en-US/SeaMonkey%20Setup%202.23.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.25/win32/en-US/SeaMonkey%20Setup%202.25.exe CDPath = none [Section.0407] Description = Mozilla Suite lebt. Dies ist das einzige Browser-, Mail-, Chat- and Composerwerkzeug-Bundle welches Sie benötigen. Size = 23.80 MB -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.23/win32/de/SeaMonkey%20Setup%202.23.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.25/win32/de/SeaMonkey%20Setup%202.25.exe [Section.040a] Description = La suite de Mozilla está viva. Es el primero y único navegador web, gestor de correo, lector de noticias, Chat y editor HTML que necesitarás. Size = 23.79 MB -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.23/win32/es-ES/SeaMonkey%20Setup%202.23.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.25/win32/es-ES/SeaMonkey%20Setup%202.25.exe [Section.040c] Description = La suite Mozilla est en vie. Ceci est le seul et l'unique package navigateur, client mail, client chat et composer dont vous aurez besoin. Size = 24,06 Mo -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.23/win32/fr/SeaMonkey%20Setup%202.23.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.25/win32/fr/SeaMonkey%20Setup%202.25.exe [Section.0410] Description = Mozilla Suite è vivo. Questo è l'unico e solo Browser, Mail, Chat, e Composer di cui avrete mai bisogno... Size = 23.71 MB -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.23/win32/it/SeaMonkey%20Setup%202.23.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.25/win32/it/SeaMonkey%20Setup%202.25.exe [Section.0413] Description = Mozilla Suite bundelt alle applicaties voor het Web: Browser, Mail, Chat, Composer. Size = 24.40 MB -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.23/win32/nl/SeaMonkey%20Setup%202.23.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.25/win32/nl/SeaMonkey%20Setup%202.25.exe [Section.0415] Description = Pakiet Mozilla żyje. W zestawie: przeglądarka, klient poczty, IRC oraz Edytor HTML - wszystko, czego potrzebujesz. Size = 24.72 MB -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.23/win32/pl/SeaMonkey%20Setup%202.23.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.25/win32/pl/SeaMonkey%20Setup%202.25.exe [Section.0418] Description = Suita Mozilla. Acest pachet ce încorporează navigator, poștă electronică, client IRC și editor HTML, acoperind astfel o arie largă de necesități. @@ -48,14 +48,14 @@ Size = 23,90 Mo [Section.0419] Description = Продолжение Mozilla Suite. Включает браузер, почтовый клиент, IRC-клиент и HTML-редактор. Size = 24.27 MB -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.23/win32/ru/SeaMonkey%20Setup%202.23.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.25/win32/ru/SeaMonkey%20Setup%202.25.exe [Section.041f] Description = Bu; yalnızca Tarayıcı, Mail, Söyleşi ve Yazar'dan oluşan, hiç gereksinim duymayacağınız bir bohçadır. Size = 23,83 MB -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.23/win32/tr/SeaMonkey%20Setup%202.23.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.25/win32/tr/SeaMonkey%20Setup%202.25.exe [Section.0422] Description = Продовження Mozilla Suite. Включає в себе браузер, поштовий клієнт, IRC-клієнт та HTML-редактор. Size = 24.27 MB -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.23/win32/ru/SeaMonkey%20Setup%202.23.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.25/win32/ru/SeaMonkey%20Setup%202.25.exe diff --git a/base/applications/rapps/rapps/smplayer.txt b/base/applications/rapps/rapps/smplayer.txt index 8d8b423e675..b203cb6dad1 100644 --- a/base/applications/rapps/rapps/smplayer.txt +++ b/base/applications/rapps/rapps/smplayer.txt @@ -2,13 +2,13 @@ [Section] Name = SMPlayer -Version = 0.8.6 +Version = 14.3.0 Licence = GPL Description = Graphical Frontend for MPlayer. -Size = 16.98 MB +Size = 20.7 MB Category = 2 URLSite = http://smplayer.sourceforge.net/en/info -URLDownload = http://download.sourceforge.net/project/smplayer/SMPlayer/0.8.6/smplayer-0.8.6-win32.exe +URLDownload = http://download.sourceforge.net/project/smplayer/SMPlayer/14.3.0/smplayer-14.3.0-oc2-win32.exe CDPath = none [Section.0407] @@ -20,7 +20,7 @@ Description = Interfaz gráfico para Mplayer (reproductor multimedia). URLSite = http://smplayer.sourceforge.net/es/info [Section.040c] -Size = 16,98 Mo +Size = 20,7 Mo URLSite = http://smplayer.sourceforge.net/fr/info [Section.0410] @@ -35,11 +35,11 @@ URLSite = http://smplayer.sourceforge.net/pl/info [Section.0418] Description = Lector multimedia (interfață pentru MPlayer). -Size = 16,98 Mo +Size = 20,7 Mo [Section.041f] Description = MPlayer için çizgelik önyüz. -Size = 16,98 MB +Size = 20,7 MB URLSite = http://smplayer.sourceforge.net/tr/info [Section.0422] diff --git a/base/applications/rapps/rapps/snoopy.txt b/base/applications/rapps/rapps/snoopy.txt new file mode 100644 index 00000000000..8ae0a8a6eab --- /dev/null +++ b/base/applications/rapps/rapps/snoopy.txt @@ -0,0 +1,20 @@ +; UTF-8 + +[Section] +Name = Snoopy +Version = 1.0 +Licence = Freeware +Description = The original C64 Snoopy remake. +Size = 704 kB +Category = 4 +URLSite = http://www.blueskied.com/snoopinfo.htm +URLDownload = http://www.blueskied.com/snoop/Snoop_install.exe +CDPath = none + +[Section.0407] +Description = Das Original C64 Snoopy Remake. + +[Section.041f] +Licence = Ücretsiz +Description = Özgün C64 Snoppy'nın yeniden yapılmışı. +Size = 704 KB diff --git a/base/applications/rapps/rapps/stamina.txt b/base/applications/rapps/rapps/stamina.txt index 2fd20f0c050..e2c97693eec 100644 --- a/base/applications/rapps/rapps/stamina.txt +++ b/base/applications/rapps/rapps/stamina.txt @@ -1,8 +1,9 @@ -; UTF-8 +; UTF-8 +; PL translation by wojo664 [Section] Name = Stamina 2.5 -Description = Free typing tutor. To run this program, please install the Microsoft Visual C++ 6 Redistributable Package. +Description = Free typing tutor. URLSite = http://stamina.ru Size = 4.7 MB Category = 8 @@ -10,12 +11,15 @@ URLDownload = http://stamina.ru/files/StaminaSetup.exe CDPath = none [Section.0407] -Description = Ein freies Schreiblernprogramm. Um dieses Programm nutzen zu können, müssen Sie das Microsoft Visual C++ 6 Redistributable Package installieren. +Description = Ein freies Schreiblernprogramm. + +[Section.0415] +Description = Darmowy program do nauki pisania na klawiaturze. [Section.0418] -Description = Tutor gratuit pentru dactilografiere. Pentru a putea lansa acest program, asigurați-vă că aveți instalat pachetul Microsoft Visual C++ 6 Redistributable. +Description = Tutor gratuit pentru dactilografiere. Size = 4,7 Mo [Section.041f] -Description = Ücretsiz bir düğme takımında yazma öğreticisi. Yazılımı çalıştırmk için Microsoft Visual C++ 6 Yeniden Dağıtılabilir Paket'i kurunuz. +Description = Ücretsiz bir düğme takımında yazma öğreticisi. Size = 4,7 MB diff --git a/base/applications/rapps/rapps/summerbound.txt b/base/applications/rapps/rapps/summerbound.txt new file mode 100644 index 00000000000..e17a8d4c813 --- /dev/null +++ b/base/applications/rapps/rapps/summerbound.txt @@ -0,0 +1,20 @@ +; UTF-8 + +[Section] +Name = Summer Bound +Version = 1.4 +Licence = Freeware +Description = A game similar Frozen Fruits. +Size = 764 kB +Category = 4 +URLSite = http://www.blueskied.com/summer_bound.htm +URLDownload = http://www.blueskied.com/summer/SummerBound_setup.exe +CDPath = none + +[Section.0407] +Description = Ein Spiel, ähnlich zu Frozen Fruits. + +[Section.041f] +Licence = Ücretsiz +Description = Frozen Fruits'e benzeyen bir oyun. +Size = 764 KB diff --git a/base/applications/rapps/rapps/superdxb.txt b/base/applications/rapps/rapps/superdxb.txt index 1db2325cadc..370b20b2b0d 100644 --- a/base/applications/rapps/rapps/superdxb.txt +++ b/base/applications/rapps/rapps/superdxb.txt @@ -1,5 +1,5 @@ ; UTF-8 - +; PL translation by wojo664 [Section] Name = Super DX-Ball Version = 1.1 @@ -14,12 +14,16 @@ CDPath = none [Section.0407] Description = Super DX-Ball ist ein lebendiges und buntes Brick-Breaking-Spiel. +[Section.0415] +Description = Super DX-Ball - pełna koloru i animacji gra polegająca na zbijaniu klocków. + [Section.0418] Licence = Versiune de evaluare Description = Un joc ce implică spargerea de cărămizi. Size = 3,8 Mo [Section.041f] +Name = Süper DX-Ball Licence = Kısıtlı -Description = Super DX-Ball, canlı ve renkli bir tuğla kırma oyunudur. +Description = Süper DX-Ball, canlı ve renkli bir tuğla kırma oyunudur. Size = 3,8 MB diff --git a/base/applications/rapps/rapps/supertux.txt b/base/applications/rapps/rapps/supertux.txt index 40c119431fb..6f6cfac8db5 100644 --- a/base/applications/rapps/rapps/supertux.txt +++ b/base/applications/rapps/rapps/supertux.txt @@ -1,5 +1,5 @@ ; UTF-8 - +; PL translation by wojo664 [Section] Name = SuperTux Version = 0.1.3 @@ -17,6 +17,9 @@ Description = SuperTux ist ein zweidimensionales, freies, Open Source Plattforms [Section.0410] Description = SuperTux è un gioco open-source a 2D. +[Section.0415] +Description = SuperTux to darmowa dwu wymiarowa gra platformowa OpenSource. + [Section.0418] Description = SuperTux este un joc gratuit, cu surse publice, pe platformă bi-dimensională. Size = 7,3 Mo diff --git a/base/applications/rapps/rapps/thunderbird.txt b/base/applications/rapps/rapps/thunderbird.txt index 5c8dd295d07..a25ed479ffb 100644 --- a/base/applications/rapps/rapps/thunderbird.txt +++ b/base/applications/rapps/rapps/thunderbird.txt @@ -2,71 +2,71 @@ [Section] Name = Mozilla Thunderbird 24 -Version = 24.2.0 +Version = 24.4.0 Licence = MPL/GPL/LGPL Description = The most popular and one of the best free Mail Clients out there. Size = 21.12 MB Category = 5 URLSite = https://www.mozilla.org/en-US/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.2.0/win32/en-US/Thunderbird%20Setup%2024.2.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.4.0/win32/en-US/Thunderbird%20Setup%2024.4.0.exe CDPath = none [Section.0407] Description = Der populärste und einer der besten freien Mail-Clients. Size = 20.96 MB URLSite = https://www.mozilla.org/de/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.2.0/win32/de/Thunderbird%20Setup%2024.2.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.4.0/win32/de/Thunderbird%20Setup%2024.4.0.exe [Section.040a] Description = El más popular y uno de los mejores clientes mail que hay. Size = 20.92 MB URLSite = https://www.mozilla.org/es-ES/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.2.0/win32/es-ES/Thunderbird%20Setup%2024.2.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.4.0/win32/es-ES/Thunderbird%20Setup%2024.4.0.exe [Section.040c] Description = Le plus populaire et l'un des meilleurs clients mail gratuits disponible. Size = 21,27 Mo URLSite = https://www.mozilla.org/fr/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.2.0/win32/fr/Thunderbird%20Setup%2024.2.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.4.0/win32/fr/Thunderbird%20Setup%2024.4.0.exe [Section.0410] Description = Il più popolare e il migliore Clients mail gratuito. Size = 20.91 MB URLSite = https://www.mozilla.org/it/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.2.0/win32/it/Thunderbird%20Setup%2024.2.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.4.0/win32/it/Thunderbird%20Setup%2024.4.0.exe [Section.0413] Description = De meest populaire en een van de beste gratis e-mail-programma's. Size = 21.61 MB URLSite = https://www.mozilla.org/nl/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.2.0/win32/nl/Thunderbird%20Setup%2024.2.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.4.0/win32/nl/Thunderbird%20Setup%2024.4.0.exe [Section.0415] Description = Najpopularniejszy i jeden z najlepszych darmowych klientów poczty. Size = 21.80 MB URLSite = https://www.mozilla.org/pl/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.2.0/win32/pl/Thunderbird%20Setup%2024.2.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.4.0/win32/pl/Thunderbird%20Setup%2024.4.0.exe [Section.0418] Description = Cel mai popular și unul dintre cele mai bune clientele gratuite de poștă electronică. Size = 21,48 Mo URLSite = https://www.mozilla.org/ro/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.2.0/win32/ro/Thunderbird%20Setup%2024.2.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.4.0/win32/ro/Thunderbird%20Setup%2024.4.0.exe [Section.0419] Description = Один из самых популярных и лучших бесплатных почтовых клиентов. Size = 21.38 MB URLSite = https://www.mozilla.org/ru/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.2.0/win32/ru/Thunderbird%20Setup%2024.2.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.4.0/win32/ru/Thunderbird%20Setup%2024.4.0.exe [Section.041f] Description = Özgür mail istemcileri arasında en tutulanı ve en iyisi. Size = 20,99 MB URLSite = https://www.mozilla.org/tr/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.2.0/win32/tr/Thunderbird%20Setup%2024.2.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.4.0/win32/tr/Thunderbird%20Setup%2024.4.0.exe [Section.0422] Description = Найпопулярніший та один з кращих поштових клієнтів. Size = 21.41 MB URLSite = https://www.mozilla.org/uk/thunderbird/ -URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.2.0/win32/uk/Thunderbird%20Setup%2024.2.0.exe +URLDownload = http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/24.4.0/win32/uk/Thunderbird%20Setup%2024.4.0.exe diff --git a/base/applications/rapps/rapps/totalcommander.txt b/base/applications/rapps/rapps/totalcommander.txt index 9623432847f..0503119ca76 100644 --- a/base/applications/rapps/rapps/totalcommander.txt +++ b/base/applications/rapps/rapps/totalcommander.txt @@ -2,13 +2,13 @@ [Section] Name = Total Commander -Version = 8.01 +Version = 8.50 Licence = Shareware Description = Total Commander is a file manager with two panels side by side. -Size = 3.3 MB +Size = 3.5 MB Category = 12 URLSite = http://www.ghisler.com/ -URLDownload = http://www.slo.ru/download/total_commander/tcm801x32.exe +URLDownload = http://www.slo.ru/download/total_commander/tcm850x32.exe CDPath = none [Section.0407] @@ -26,12 +26,12 @@ Description = Total Commander to popularny menedżer plików z dwoma panelami, u [Section.0418] Licence = Versiune de evaluare Description = Total Commander este un gestionar de fișiere după modelul «două paneluri alăturate». -Size = 3,3 Mo +Size = 3,5 Mo [Section.041f] Licence = Kısıtlı Description = Total Commander, yan yana iki bölmenin bulunduğu bir kütük yöneticisidir. -Size = 3,3 MB +Size = 3,5 MB [Section.0813] Description = Total Commander is een bestandsbeheerder met twee panelen zij aan zij. diff --git a/base/applications/rapps/rapps/utorrent.txt b/base/applications/rapps/rapps/utorrent.txt index 8d179d9f8d8..3a3cb8baf2c 100644 --- a/base/applications/rapps/rapps/utorrent.txt +++ b/base/applications/rapps/rapps/utorrent.txt @@ -2,10 +2,10 @@ [Section] Name = µTorrent -Version = 3.3.2 +Version = 3.4.1 Licence = Freeware for non-commercial uses Description = Small and fast BitTorrent Client. -Size = 1020.58 kB +Size = 1.6 MB Category = 5 URLSite = http://www.utorrent.com/ URLDownload = http://download-new.utorrent.com/endpoint/utorrent/os/windows/track/stable/utorrent.exe @@ -22,7 +22,7 @@ Description = Pequeño y rápido cliente BitTorrent. [Section.040c] Licence = Gratuit pour une utilisation non-commerciale Description = Client BitTorrent petit et rapide. -Size = 1020,58 ko +Size = 1,6 Mo [Section.040c] Licence = Gratita per un uso non-commerciale @@ -43,7 +43,7 @@ Description = Mały i szybki klient BitTorrent. [Section.0418] Licence = Gratuită pentru uz necomercial Description = Client BitTorrent, mic și rapid. -Size = 1020,58 ko +Size = 1,6 Mo [Section.0419] Licence = Бесплатная для некоммерческого использования @@ -52,7 +52,7 @@ Description = Маленький и быстрый клиент BitTorrent. [Section.041f] Licence = Ticârî olmayan kullanımlarda ücretsiz. Description = Küçük ve hızlı bir BitTorrent istemcisi. -Size = 1020,58 KB +Size = 1,6 MB [Section.0422] Licence = Безплатна для некомерційного використання diff --git a/base/applications/rapps/rapps/vlc.txt b/base/applications/rapps/rapps/vlc.txt index cf1f9023d80..6faef05b095 100644 --- a/base/applications/rapps/rapps/vlc.txt +++ b/base/applications/rapps/rapps/vlc.txt @@ -2,13 +2,13 @@ [Section] Name = VLC media player -Version = 2.1.2 +Version = 2.1.3 Licence = GPL Description = A media player. -Size = 23.0 MB +Size = 23.5 MB Category = 2 URLSite = http://www.videolan.org/vlc/ -URLDownload = http://mirror.de.leaseweb.net/videolan/vlc/2.1.2/win32/vlc-2.1.2-win32.exe +URLDownload = http://mirror.de.leaseweb.net/videolan/vlc/2.1.3/win32/vlc-2.1.3-win32.exe CDPath = none [Section.0407] @@ -19,7 +19,7 @@ Description = Reproductor multimedia. [Section.040c] Description = Un lecteur media. -Size = 23,0 Mo +Size = 23,5 Mo [Section.0410] Description = Lettore multimediale. @@ -32,7 +32,7 @@ Description = Odtwarzacz multimediów. [Section.0418] Description = Lector multimedia. -Size = 23,0 Mo +Size = 23,5 Mo [Section.0419] Description = Мультимедийный проигрыватель. @@ -43,7 +43,7 @@ Description = Multimediálny prehrávač. [Section.041f] Name = VLC Ortam Oynatıcısı Description = Bir ortam oynatıcısı. -Size = 23,0 MB +Size = 23,5 MB [Section.0422] Description = Мультимедійний програвач. diff --git a/base/applications/rapps/rapps/zaz.txt b/base/applications/rapps/rapps/zaz.txt index b0c50ad2036..12604c87972 100644 --- a/base/applications/rapps/rapps/zaz.txt +++ b/base/applications/rapps/rapps/zaz.txt @@ -1,4 +1,5 @@ ; UTF-8 +;PL translation by wojo664 [Section] Name = Zaz @@ -17,6 +18,9 @@ Description = Zaz ist ein freies Arcade Action Puzzle Spiel, ein wenig wie Froze [Section.0410] Description = Zaz è un puzzle game gratuito, simile a Frozen Bubble. +[Section.0415] +Description = Zaz to darmowa gra logiczno-zręcznościowa, trochę podobna do gry Frozen Bubble + [Section.0418] Description = Zaz este un joc de acțiune de tip enigmă/arcadă, asemănător cu Frozen Bubble. Size = 21,0 Mo diff --git a/base/applications/regedit/regproc.c b/base/applications/regedit/regproc.c index 8df3199125a..138c2bf0e4a 100644 --- a/base/applications/regedit/regproc.c +++ b/base/applications/regedit/regproc.c @@ -2,9 +2,9 @@ * Registry processing routines. Routines, common for registry * processing frontends. * - * Copyright (C) 1999 Sylvain St-Germain - * Copyright (C) 2002 Andriy Palamarchuk - * Copyright (C) 2008 Alexander N. Sørnes + * Copyright 1999 Sylvain St-Germain + * Copyright 2002 Andriy Palamarchuk + * Copyright 2008 Alexander N. Sørnes * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,6 +24,9 @@ #include "regedit.h" #include +#include +#include +#include #define REG_VAL_BUF_SIZE 4096 @@ -32,25 +35,18 @@ */ #define REG_FILE_HEX_LINE_LEN (2 + 25 * 3) -static const CHAR *reg_class_names[] = -{ - "HKEY_LOCAL_MACHINE", "HKEY_USERS", "HKEY_CLASSES_ROOT", - "HKEY_CURRENT_CONFIG", "HKEY_CURRENT_USER", "HKEY_DYN_DATA" -}; - -#define REG_CLASS_NUMBER (COUNT_OF(reg_class_names)) - -const WCHAR* reg_class_namesW[REG_CLASS_NUMBER] = +const WCHAR* reg_class_namesW[] = { L"HKEY_LOCAL_MACHINE", L"HKEY_USERS", L"HKEY_CLASSES_ROOT", L"HKEY_CURRENT_CONFIG", L"HKEY_CURRENT_USER", L"HKEY_DYN_DATA" }; -static HKEY reg_class_keys[REG_CLASS_NUMBER] = -{ - HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CLASSES_ROOT, - HKEY_CURRENT_CONFIG, HKEY_CURRENT_USER, HKEY_DYN_DATA -}; +static HKEY reg_class_keys[] = { + HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CLASSES_ROOT, + HKEY_CURRENT_CONFIG, HKEY_CURRENT_USER, HKEY_DYN_DATA + }; + +#define REG_CLASS_NUMBER (sizeof(reg_class_keys) / sizeof(reg_class_keys[0])) /* return values */ #define NOT_ENOUGH_MEMORY 1 @@ -154,8 +150,7 @@ static BOOL convertHexToDWord(WCHAR* str, DWORD *dw) char dummy; WideCharToMultiByte(CP_ACP, 0, str, -1, buf, 9, NULL, NULL); - if (lstrlenW(str) > 8 || sscanf(buf, "%lx%c", dw, &dummy) != 1) - { + if (lstrlenW(str) > 8 || sscanf(buf, "%lx%c", dw, &dummy) != 1) { fprintf(stderr,"%S: ERROR, invalid hex value\n", getAppName()); return FALSE; } @@ -178,14 +173,12 @@ static BYTE* convertHexCSVToHex(WCHAR *str, DWORD *size) s = str; d = data; *size=0; - while (*s != '\0') - { + while (*s != '\0') { UINT wc; WCHAR *end; - wc = wcstoul(s,&end, 16); - if (end == s || wc > 0xff || (*end && *end != L',')) - { + wc = strtoulW(s,&end,16); + if (end == s || wc > 0xff || (*end && *end != ',')) { char* strA = GetMultiByteString(s); fprintf(stderr,"%S: ERROR converting CSV hex stream. Invalid value at '%s'\n", getAppName(), strA); @@ -211,13 +204,7 @@ static BYTE* convertHexCSVToHex(WCHAR *str, DWORD *size) */ static DWORD getDataType(LPWSTR *lpValue, DWORD* parse_type) { - struct data_type - { - const WCHAR *tag; - int len; - int type; - int parse_type; - }; + struct data_type { const WCHAR *tag; int len; int type; int parse_type; }; static const WCHAR quote[] = {'"'}; static const WCHAR str[] = {'s','t','r',':','"'}; @@ -227,39 +214,34 @@ static DWORD getDataType(LPWSTR *lpValue, DWORD* parse_type) static const WCHAR hexp[] = {'h','e','x','('}; static const struct data_type data_types[] = { /* actual type */ /* type to assume for parsing */ - { quote, 1, REG_SZ, REG_SZ }, - { str, 5, REG_SZ, REG_SZ }, - { str2, 8, REG_EXPAND_SZ, REG_SZ }, - { hex, 4, REG_BINARY, REG_BINARY }, - { dword, 6, REG_DWORD, REG_DWORD }, - { hexp, 4, -1, REG_BINARY }, - { NULL, 0, 0, 0 } - }; + { quote, 1, REG_SZ, REG_SZ }, + { str, 5, REG_SZ, REG_SZ }, + { str2, 8, REG_EXPAND_SZ, REG_SZ }, + { hex, 4, REG_BINARY, REG_BINARY }, + { dword, 6, REG_DWORD, REG_DWORD }, + { hexp, 4, -1, REG_BINARY }, + { NULL, 0, 0, 0 } + }; const struct data_type *ptr; int type; - for (ptr = data_types; ptr->tag; ptr++) - { - if (wcsncmp(ptr->tag, *lpValue, ptr->len)) + for (ptr = data_types; ptr->tag; ptr++) { + if (strncmpW( ptr->tag, *lpValue, ptr->len )) continue; /* Found! */ *parse_type = ptr->parse_type; type=ptr->type; *lpValue+=ptr->len; - if (type == -1) - { + if (type == -1) { WCHAR* end; /* "hex(xx):" is special */ - type = (int)wcstoul( *lpValue , &end, 16 ); - if (**lpValue=='\0' || *end!=')' || *(end+1)!=':') - { + type = (int)strtoulW( *lpValue , &end, 16 ); + if (**lpValue=='\0' || *end!=')' || *(end+1)!=':') { type=REG_NONE; - } - else - { + } else { *lpValue = end + 2; } } @@ -277,13 +259,10 @@ static void REGPROC_unescape_string(WCHAR* str) int str_idx = 0; /* current character under analysis */ int val_idx = 0; /* the last character of the unescaped string */ int len = lstrlenW(str); - for (str_idx = 0; str_idx < len; str_idx++, val_idx++) - { - if (str[str_idx] == '\\') - { + for (str_idx = 0; str_idx < len; str_idx++, val_idx++) { + if (str[str_idx] == '\\') { str_idx++; - switch (str[str_idx]) - { + switch (str[str_idx]) { case 'n': str[val_idx] = '\n'; break; @@ -292,14 +271,12 @@ static void REGPROC_unescape_string(WCHAR* str) str[val_idx] = str[str_idx]; break; default: - fprintf(stderr,"Warning! Unrecognized escape sequence: \\%C'\n", - str[str_idx]); + fprintf(stderr,"Warning! Unrecognized escape sequence: \\%c'\n", + str[str_idx]); str[val_idx] = str[str_idx]; break; } - } - else - { + } else { str[val_idx] = str[str_idx]; } } @@ -314,11 +291,11 @@ static BOOL parseKeyName(LPWSTR lpKeyName, HKEY *hKey, LPWSTR *lpKeyPath) if (lpKeyName == NULL) return FALSE; - for(i = 0; *(lpKeyName + i) != 0; i++) + for(i = 0; *(lpKeyName+i) != 0; i++) { if(*(lpKeyName+i) == '\\') { - lpSlash = lpKeyName + i; + lpSlash = lpKeyName+i; break; } } @@ -334,11 +311,9 @@ static BOOL parseKeyName(LPWSTR lpKeyName, HKEY *hKey, LPWSTR *lpKeyPath) } *hKey = NULL; - for (i = 0; i < REG_CLASS_NUMBER; i++) - { + for (i = 0; i < REG_CLASS_NUMBER; i++) { if (CompareStringW(LOCALE_USER_DEFAULT, 0, lpKeyName, len, reg_class_namesW[i], len) == CSTR_EQUAL && - len == lstrlenW(reg_class_namesW[i])) - { + len == lstrlenW(reg_class_namesW[i])) { *hKey = reg_class_keys[i]; break; } @@ -347,6 +322,7 @@ static BOOL parseKeyName(LPWSTR lpKeyName, HKEY *hKey, LPWSTR *lpKeyPath) if (*hKey == NULL) return FALSE; + if (*lpSlash != '\0') lpSlash++; *lpKeyPath = lpSlash; @@ -393,6 +369,8 @@ static LONG setValue(WCHAR* val_name, WCHAR* val_data, BOOL is_unicode) * the extra garbage in the registry. */ dwLen = lstrlenW(val_data); + if(val_data[dwLen-1] != '"') + return ERROR_INVALID_DATA; if (dwLen>0 && val_data[dwLen-1]=='"') { dwLen--; @@ -430,12 +408,12 @@ static LONG setValue(WCHAR* val_name, WCHAR* val_data, BOOL is_unicode) } res = RegSetValueExW( - currentKeyHandle, - val_name, - 0, /* Reserved */ - dwDataType, - lpbData, - dwLen); + currentKeyHandle, + val_name, + 0, /* Reserved */ + dwDataType, + lpbData, + dwLen); if (dwParseType == REG_BINARY) HeapFree(GetProcessHeap(), 0, lpbData); return res; @@ -460,16 +438,17 @@ static LONG openKeyW(WCHAR* stdInput) if (!parseKeyName(stdInput, &keyClass, &keyPath)) return ERROR_INVALID_PARAMETER; - res = RegCreateKeyExW(keyClass, /* Class */ - keyPath, /* Sub Key */ - 0, /* MUST BE 0 */ - NULL, /* object type */ - REG_OPTION_NON_VOLATILE, /* option, REG_OPTION_NON_VOLATILE ... */ - KEY_ALL_ACCESS, /* access mask, KEY_ALL_ACCESS */ - NULL, /* security attribute */ - ¤tKeyHandle, /* result */ - &dwDisp); /* disposition, REG_CREATED_NEW_KEY or - REG_OPENED_EXISTING_KEY */ + res = RegCreateKeyExW( + keyClass, /* Class */ + keyPath, /* Sub Key */ + 0, /* MUST BE 0 */ + NULL, /* object type */ + REG_OPTION_NON_VOLATILE, /* option, REG_OPTION_NON_VOLATILE ... */ + KEY_ALL_ACCESS, /* access mask, KEY_ALL_ACCESS */ + NULL, /* security attribute */ + ¤tKeyHandle, /* result */ + &dwDisp); /* disposition, REG_CREATED_NEW_KEY or + REG_OPENED_EXISTING_KEY */ if (res == ERROR_SUCCESS) currentKeyName = GetMultiByteString(stdInput); @@ -509,63 +488,55 @@ static void processSetValue(WCHAR* line, BOOL is_unicode) LONG res; /* get value name */ - while ( iswspace(line[line_idx]) ) line_idx++; - if (line[line_idx] == '@' && line[line_idx + 1] == '=') - { + while ( isspaceW(line[line_idx]) ) line_idx++; + if (line[line_idx] == '@' && line[line_idx + 1] == '=') { line[line_idx] = '\0'; val_name = line; line_idx++; - } - else if (line[line_idx] == '\"') - { + } else if (line[line_idx] == '\"') { line_idx++; val_name = line + line_idx; - while (TRUE) - { + while (line[line_idx]) { if (line[line_idx] == '\\') /* skip escaped character */ { line_idx += 2; - } - else - { - if (line[line_idx] == '\"') - { + } else { + if (line[line_idx] == '\"') { line[line_idx] = '\0'; line_idx++; break; - } - else - { + } else { line_idx++; } } } - while ( iswspace(line[line_idx]) ) line_idx++; - if (line[line_idx] != '=') - { + while ( isspaceW(line[line_idx]) ) line_idx++; + if (!line[line_idx]) { + fprintf(stderr, "%S: warning: unexpected EOL\n", getAppName()); + return; + } + if (line[line_idx] != '=') { char* lineA; line[line_idx] = '\"'; lineA = GetMultiByteString(line); - fprintf(stderr,"Warning! unrecognized line:\n%s\n", lineA); + fprintf(stderr,"%S: warning: unrecognized line: '%s'\n", getAppName(), lineA); HeapFree(GetProcessHeap(), 0, lineA); return; } - } - else - { + } else { char* lineA = GetMultiByteString(line); - fprintf(stderr,"Warning! unrecognized line:\n%s\n", lineA); + fprintf(stderr,"%S: warning: unrecognized line: '%s'\n", getAppName(), lineA); HeapFree(GetProcessHeap(), 0, lineA); return; } line_idx++; /* skip the '=' character */ - while ( iswspace(line[line_idx]) ) line_idx++; + while ( isspaceW(line[line_idx]) ) line_idx++; val_data = line + line_idx; /* trim trailing blanks */ - line_idx = lstrlenW(val_data); - while (line_idx > 0 && iswspace(val_data[line_idx-1])) line_idx--; + line_idx = strlenW(val_data); + while (line_idx > 0 && isspaceW(val_data[line_idx-1])) line_idx--; val_data[line_idx] = '\0'; REGPROC_unescape_string(val_name); @@ -575,10 +546,10 @@ static void processSetValue(WCHAR* line, BOOL is_unicode) char* val_nameA = GetMultiByteString(val_name); char* val_dataA = GetMultiByteString(val_data); fprintf(stderr,"%S: ERROR Key %s not created. Value: %s, Data: %s\n", - getAppName(), - currentKeyName, - val_nameA, - val_dataA); + getAppName(), + currentKeyName, + val_nameA, + val_dataA); HeapFree(GetProcessHeap(), 0, val_nameA); HeapFree(GetProcessHeap(), 0, val_dataA); } @@ -595,20 +566,19 @@ static void processRegEntry(WCHAR* stdInput, BOOL isUnicode) * We encountered the end of the file, make sure we * close the opened key and exit */ - if (stdInput == NULL) - { + if (stdInput == NULL) { closeKey(); return; } - if ( stdInput[0] == L'[') /* We are reading a new key */ + if ( stdInput[0] == '[') /* We are reading a new key */ { WCHAR* keyEnd; - closeKey(); /* Close the previous key */ + closeKey(); /* Close the previous key */ /* Get rid of the square brackets */ stdInput++; - keyEnd = wcsrchr(stdInput, L']'); + keyEnd = strrchrW(stdInput, ']'); if (keyEnd) *keyEnd='\0'; @@ -616,22 +586,19 @@ static void processRegEntry(WCHAR* stdInput, BOOL isUnicode) if ( stdInput[0] == '-') { delete_registry_key(stdInput + 1); - } - else if ( openKeyW(stdInput) != ERROR_SUCCESS ) + } else if ( openKeyW(stdInput) != ERROR_SUCCESS ) { char* stdInputA = GetMultiByteString(stdInput); fprintf(stderr,"%S: setValue failed to open key %s\n", - getAppName(), stdInputA); + getAppName(), stdInputA); HeapFree(GetProcessHeap(), 0, stdInputA); } - } - else if( currentKeyHandle && - (( stdInput[0] == '@') || /* reading a default @=data pair */ - ( stdInput[0] == '\"'))) /* reading a new value=data pair */ + } else if( currentKeyHandle && + (( stdInput[0] == '@') || /* reading a default @=data pair */ + ( stdInput[0] == '\"'))) /* reading a new value=data pair */ { processSetValue(stdInput, isUnicode); - } - else + } else { /* Since we are assuming that the file format is valid we must be * reading a blank line which indicates the end of this key processing @@ -642,30 +609,35 @@ static void processRegEntry(WCHAR* stdInput, BOOL isUnicode) /****************************************************************************** * Processes a registry file. - * Correctly processes comments (in # form), line continuation. + * Correctly processes comments (in # and ; form), line continuation. * * Parameters: * in - input stream to read from + * first_chars - beginning of stream, read due to Unicode check */ -static void processRegLinesA(FILE *in) +static void processRegLinesA(FILE *in, char* first_chars) { LPSTR line = NULL; /* line read from input stream */ ULONG lineSize = REG_VAL_BUF_SIZE; line = HeapAlloc(GetProcessHeap(), 0, lineSize); CHECK_ENOUGH_MEMORY(line); + memcpy(line, first_chars, 2); - while (!feof(in)) - { + while (!feof(in)) { LPSTR s; /* The pointer into line for where the current fgets should read */ - LPSTR check; WCHAR* lineW; s = line; - for (;;) + if(first_chars) { + s += 2; + first_chars = NULL; + } + + for (;;) { size_t size_remaining; - int size_to_get; + int size_to_get, i; char *s_eol; /* various local uses */ /* Do we need to expand the buffer ? */ @@ -691,68 +663,79 @@ static void processRegLinesA(FILE *in) */ size_to_get = (size_remaining > INT_MAX ? INT_MAX : size_remaining); - check = fgets (s, size_to_get, in); + /* get a single line. note that `i' must be one past the last + * meaningful character in `s' when this loop exits */ + for(i = 0; i < size_to_get-1; ++i){ + int xchar; - if (check == NULL) - { - if (ferror(in)) - { - perror ("While reading input"); - exit (IO_ERROR); + xchar = fgetc(in); + s[i] = xchar; + if(xchar == EOF){ + if(ferror(in)){ + perror("While reading input"); + exit(IO_ERROR); + }else + assert(feof(in)); + break; } - else - { - assert (feof(in)); - *s = '\0'; - /* It is not clear to me from the definition that the - * contents of the buffer are well defined on detecting - * an eof without managing to read anything. - */ + if(s[i] == '\r'){ + /* read the next character iff it's \n */ + if(i+2 >= size_to_get){ + /* buffer too short, so put back the EOL char to + * read next cycle */ + ungetc('\r', in); + break; + } + s[i+1] = fgetc(in); + if(s[i+1] != '\n'){ + ungetc(s[i+1], in); + i = i+1; + }else + i = i+2; + break; + } + if(s[i] == '\n'){ + i = i+1; + break; } } + s[i] = '\0'; /* If we didn't read the eol nor the eof go around for the rest */ - s_eol = strchr (s, '\n'); - if (!feof (in) && !s_eol) - { + s_eol = strpbrk (s, "\r\n"); + if (!feof (in) && !s_eol) { s = strchr (s, '\0'); - /* It should be s + size_to_get - 1 but this is safer */ continue; } /* If it is a comment line then discard it and go around again */ - if (line [0] == '#') - { + if (line [0] == '#' || line [0] == ';') { s = line; continue; } - /* Remove any line feed. Leave s_eol on the \0 */ - if (s_eol) - { - *s_eol = '\0'; - if (s_eol > line && *(s_eol-1) == '\r') - *--s_eol = '\0'; - } - else + /* Remove any line feed. Leave s_eol on the first \0 */ + if (s_eol) { + if (*s_eol == '\r' && *(s_eol+1) == '\n') + *(s_eol+1) = '\0'; + *s_eol = '\0'; + } else s_eol = strchr (s, '\0'); /* If there is a concatenating \\ then go around again */ - if (s_eol > line && *(s_eol-1) == '\\') - { + if (s_eol > line && *(s_eol-1) == '\\') { int c; s = s_eol-1; do { c = fgetc(in); - } - while(c == ' ' || c == '\t'); + } while(c == ' ' || c == '\t'); if(c == EOF) { fprintf(stderr,"%S: ERROR - invalid continuation.\n", - getAppName()); + getAppName()); } else { @@ -790,8 +773,7 @@ static void processRegLinesW(FILE *in) s = buf; line = buf; - while(!feof(in)) - { + while(!feof(in)) { size_t size_remaining; int size_to_get; WCHAR *s_eol = NULL; /* various local uses */ @@ -823,15 +805,11 @@ static void processRegLinesW(FILE *in) CharsInBuf = fread(s, sizeof(WCHAR), size_to_get - 1, in); s[CharsInBuf] = 0; - if (CharsInBuf == 0) - { - if (ferror(in)) - { + if (CharsInBuf == 0) { + if (ferror(in)) { perror ("While reading input"); exit (IO_ERROR); - } - else - { + } else { assert (feof(in)); *s = '\0'; /* It is not clear to me from the definition that the @@ -844,56 +822,48 @@ static void processRegLinesW(FILE *in) /* If we didn't read the eol nor the eof go around for the rest */ while(1) { - s_eol = wcschr(line, '\n'); + const WCHAR line_endings[] = {'\r','\n',0}; + s_eol = strpbrkW(line, line_endings); - if(!s_eol) - { + if(!s_eol) { /* Move the stub of the line to the start of the buffer so * we get the maximum space to read into, and so we don't * have to recalculate 'line' if the buffer expands */ - MoveMemory(buf, line, (lstrlenW(line) + 1) * sizeof(WCHAR)); + MoveMemory(buf, line, (strlenW(line)+1) * sizeof(WCHAR)); line = buf; - s = wcschr(line, '\0'); + s = strchrW(line, '\0'); break; } /* If it is a comment line then discard it and go around again */ - if (*line == '#') - { - line = s_eol + 1; + if (*line == '#' || *line == ';') { + if (*s_eol == '\r' && *(s_eol+1) == '\n') + line = s_eol + 2; + else + line = s_eol + 1; continue; } /* If there is a concatenating \\ then go around again */ - if ((*(s_eol-1) == '\\') || - (*(s_eol-1) == '\r' && *(s_eol-2) == '\\')) - { - WCHAR* NextLine = s_eol; + if (*(s_eol-1) == '\\') { + WCHAR* NextLine = s_eol + 1; + + if(*s_eol == '\r' && *(s_eol+1) == '\n') + NextLine++; while(*(NextLine+1) == ' ' || *(NextLine+1) == '\t') NextLine++; - NextLine++; - - if(*(s_eol-1) == '\r') - s_eol--; - MoveMemory(s_eol - 1, NextLine, (CharsInBuf - (NextLine - s) + 1)*sizeof(WCHAR)); CharsInBuf -= NextLine - s_eol + 1; s_eol = 0; continue; } - /* Remove any line feed. Leave s_eol on the \0 */ - if (s_eol) - { - *s_eol = '\0'; - if (s_eol > buf && *(s_eol-1) == '\r') - *(s_eol-1) = '\0'; - } - - if(!s_eol) - break; + /* Remove any line feed. Leave s_eol on the last \0 */ + if (*s_eol == '\r' && *(s_eol + 1) == '\n') + *s_eol++ = '\0'; + *s_eol = '\0'; processRegEntry(line, TRUE); line = s_eol + 1; @@ -920,12 +890,11 @@ static void REGPROC_print_error(void) int status; error_code = GetLastError (); - status = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, error_code, 0, (LPTSTR) &lpMsgBuf, 0, NULL); - if (!status) - { + status = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, error_code, 0, (LPSTR) &lpMsgBuf, 0, NULL); + if (!status) { fprintf(stderr,"%S: Cannot display message for error %ld, status %ld\n", - getAppName(), error_code, GetLastError()); + getAppName(), error_code, GetLastError()); exit(1); } puts(lpMsgBuf); @@ -946,8 +915,7 @@ static void REGPROC_print_error(void) static void REGPROC_resize_char_buffer(WCHAR **buffer, DWORD *len, DWORD required_len) { required_len++; - if (required_len > *len) - { + if (required_len > *len) { *len = required_len; if (!*buffer) *buffer = HeapAlloc(GetProcessHeap(), 0, *len * sizeof(**buffer)); @@ -967,8 +935,7 @@ static void REGPROC_resize_char_buffer(WCHAR **buffer, DWORD *len, DWORD require */ static void REGPROC_resize_binary_buffer(BYTE **buffer, DWORD *size, DWORD required_size) { - if (required_size > *size) - { + if (required_size > *size) { *size = required_size; if (!*buffer) *buffer = HeapAlloc(GetProcessHeap(), 0, *size); @@ -990,11 +957,9 @@ static void REGPROC_export_string(WCHAR **line_buf, DWORD *line_buf_size, DWORD /* escaping characters */ pos = *line_len; - for (i = 0; i < str_len; i++) - { + for (i = 0; i < str_len; i++) { WCHAR c = str[i]; - switch (c) - { + switch (c) { case '\n': extra++; REGPROC_resize_char_buffer(line_buf, line_buf_size, *line_len + str_len + extra); @@ -1024,20 +989,17 @@ static void REGPROC_export_binary(WCHAR **line_buf, DWORD *line_buf_size, DWORD const WCHAR *hex_prefix; const WCHAR hex[] = {'h','e','x',':',0}; WCHAR hex_buf[17]; - const WCHAR concat[] = {'\\','\n',' ',' ',0}; + const WCHAR concat[] = {'\\','\r','\n',' ',' ',0}; DWORD concat_prefix, concat_len; - const WCHAR newline[] = {'\n',0}; + const WCHAR newline[] = {'\r','\n',0}; CHAR* value_multibyte = NULL; - if (type == REG_BINARY) - { + if (type == REG_BINARY) { hex_prefix = hex; - } - else - { - const WCHAR hex_format[] = {'h','e','x','(','%','u',')',':',0}; + } else { + const WCHAR hex_format[] = {'h','e','x','(','%','x',')',':',0}; hex_prefix = hex_buf; - wsprintfW(hex_buf, hex_format, type); + sprintfW(hex_buf, hex_format, type); if ((type == REG_SZ || type == REG_EXPAND_SZ || type == REG_MULTI_SZ) && !unicode) { value_multibyte = GetMultiByteStringN((WCHAR*)value, value_size / sizeof(WCHAR), &value_size); @@ -1055,12 +1017,13 @@ static void REGPROC_export_binary(WCHAR **line_buf, DWORD *line_buf_size, DWORD /* - The 2 spaces that concat places at the start of the * line effectively reduce the space available for data. * - If the value name and hex prefix are very long - * ( > REG_FILE_HEX_LINE_LEN) then we may overestimate + * ( > REG_FILE_HEX_LINE_LEN) or *line_len divides + * without a remainder then we may overestimate * the needed number of lines by one. But that's ok. - * - The trailing linefeed takes the place of a comma so - * it's accounted for already. + * - The trailing '\r' takes the place of a comma so + * we only need to add 1 for the trailing '\n' */ - *line_len += *line_len / (REG_FILE_HEX_LINE_LEN - concat_prefix) * concat_len; + *line_len += *line_len / (REG_FILE_HEX_LINE_LEN - concat_prefix) * concat_len + 1; REGPROC_resize_char_buffer(line_buf, line_buf_size, *line_len); lstrcpyW(*line_buf + hex_pos, hex_prefix); if (value_size) @@ -1072,7 +1035,7 @@ static void REGPROC_export_binary(WCHAR **line_buf, DWORD *line_buf_size, DWORD i = 0; while (1) { - wsprintfW(*line_buf + data_pos, format, (unsigned int)value[i]); + sprintfW(*line_buf + data_pos, format, (unsigned int)value[i]); data_pos += 2; if (++i == value_size) break; @@ -1081,8 +1044,7 @@ static void REGPROC_export_binary(WCHAR **line_buf, DWORD *line_buf_size, DWORD column += 3; /* wrap the line */ - if (column >= REG_FILE_HEX_LINE_LEN) - { + if (column >= REG_FILE_HEX_LINE_LEN) { lstrcpyW(*line_buf + data_pos, concat); data_pos += concat_len; column = concat_prefix; @@ -1098,17 +1060,10 @@ static void REGPROC_export_binary(WCHAR **line_buf, DWORD *line_buf_size, DWORD */ static void REGPROC_write_line(FILE *file, const WCHAR* str, BOOL unicode) { - int i; - if (unicode) + if(unicode) { - for(i = 0; str[i]; i++) - { - if (str[i] == L'\n') - fputwc(L'\r', file); - fputwc(str[i], file); - } - } - else + fwrite(str, sizeof(WCHAR), lstrlenW(str), file); + } else { char* strA = GetMultiByteString(str); fputs(strA, file); @@ -1133,11 +1088,11 @@ static void REGPROC_write_line(FILE *file, const WCHAR* str, BOOL unicode) * val_size - size of the buffer for storing values in bytes. */ static void export_hkey(FILE *file, HKEY key, -WCHAR **reg_key_name_buf, DWORD *reg_key_name_size, -WCHAR **val_name_buf, DWORD *val_name_size, -BYTE **val_buf, DWORD *val_size, -WCHAR **line_buf, DWORD *line_buf_size, -BOOL unicode) + WCHAR **reg_key_name_buf, DWORD *reg_key_name_size, + WCHAR **val_name_buf, DWORD *val_name_size, + BYTE **val_buf, DWORD *val_size, + WCHAR **line_buf, DWORD *line_buf_size, + BOOL unicode) { DWORD max_sub_key_len; DWORD max_val_name_len; @@ -1146,58 +1101,49 @@ BOOL unicode) DWORD i; BOOL more_data; LONG ret; - WCHAR key_format[] = {'\n','[','%','s',']','\n',0}; + WCHAR key_format[] = {'\r','\n','[','%','s',']','\r','\n',0}; /* get size information and resize the buffers if necessary */ if (RegQueryInfoKeyW(key, NULL, NULL, NULL, NULL, - &max_sub_key_len, NULL, - NULL, &max_val_name_len, &max_val_size, NULL, NULL - ) != ERROR_SUCCESS) - { + &max_sub_key_len, NULL, + NULL, &max_val_name_len, &max_val_size, NULL, NULL + ) != ERROR_SUCCESS) { REGPROC_print_error(); } - curr_len = lstrlenW(*reg_key_name_buf); + curr_len = strlenW(*reg_key_name_buf); REGPROC_resize_char_buffer(reg_key_name_buf, reg_key_name_size, - max_sub_key_len + curr_len + 1); + max_sub_key_len + curr_len + 1); REGPROC_resize_char_buffer(val_name_buf, val_name_size, - max_val_name_len); + max_val_name_len); REGPROC_resize_binary_buffer(val_buf, val_size, max_val_size); REGPROC_resize_char_buffer(line_buf, line_buf_size, lstrlenW(*reg_key_name_buf) + 4); /* output data for the current key */ - wsprintfW(*line_buf, key_format, *reg_key_name_buf); + sprintfW(*line_buf, key_format, *reg_key_name_buf); REGPROC_write_line(file, *line_buf, unicode); /* print all the values */ i = 0; more_data = TRUE; - while(more_data) - { + while(more_data) { DWORD value_type; DWORD val_name_size1 = *val_name_size; DWORD val_size1 = *val_size; ret = RegEnumValueW(key, i, *val_name_buf, &val_name_size1, NULL, - &value_type, *val_buf, &val_size1); - if (ret == ERROR_MORE_DATA) - { + &value_type, *val_buf, &val_size1); + if (ret == ERROR_MORE_DATA) { /* Increase the size of the buffers and retry */ REGPROC_resize_char_buffer(val_name_buf, val_name_size, val_name_size1); REGPROC_resize_binary_buffer(val_buf, val_size, val_size1); - } - else if (ret != ERROR_SUCCESS) - { + } else if (ret != ERROR_SUCCESS) { more_data = FALSE; - if (ret != ERROR_NO_MORE_ITEMS) - { + if (ret != ERROR_NO_MORE_ITEMS) { REGPROC_print_error(); } - } - else - { + } else { DWORD line_len; i++; - if ((*val_name_buf)[0]) - { + if ((*val_name_buf)[0]) { const WCHAR val_start[] = {'"','%','s','"','=',0}; line_len = 0; @@ -1207,31 +1153,25 @@ BOOL unicode) line_len = 3 + lstrlenW(*val_name_buf); REGPROC_resize_char_buffer(line_buf, line_buf_size, line_len); - wsprintfW(*line_buf, val_start, *val_name_buf); - } - else - { + sprintfW(*line_buf, val_start, *val_name_buf); + } else { const WCHAR std_val[] = {'@','=',0}; line_len = 2; REGPROC_resize_char_buffer(line_buf, line_buf_size, line_len); lstrcpyW(*line_buf, std_val); } - switch (value_type) - { + switch (value_type) { case REG_SZ: { WCHAR* wstr = (WCHAR*)*val_buf; if (val_size1 < sizeof(WCHAR) || val_size1 % sizeof(WCHAR) || - wstr[val_size1 / sizeof(WCHAR) - 1]) - { + wstr[val_size1 / sizeof(WCHAR) - 1]) { REGPROC_export_binary(line_buf, line_buf_size, &line_len, value_type, *val_buf, val_size1, unicode); - } - else - { + } else { const WCHAR start[] = {'"',0}; - const WCHAR end[] = {'"','\n',0}; + const WCHAR end[] = {'"','\r','\n',0}; DWORD len; len = lstrlenW(start); @@ -1240,7 +1180,7 @@ BOOL unicode) line_len += len; /* At this point we know wstr is '\0'-terminated - * so we can substract 1 from the size + * so we can subtract 1 from the size */ REGPROC_export_string(line_buf, line_buf_size, &line_len, wstr, val_size1 / sizeof(WCHAR) - 1); @@ -1252,10 +1192,10 @@ BOOL unicode) case REG_DWORD: { - WCHAR format[] = {'d','w','o','r','d',':','%','0','8','x','\n',0}; + WCHAR format[] = {'d','w','o','r','d',':','%','0','8','x','\r','\n',0}; REGPROC_resize_char_buffer(line_buf, line_buf_size, line_len + 15); - wsprintfW(*line_buf + line_len, format, *((DWORD *)*val_buf)); + sprintfW(*line_buf + line_len, format, *((DWORD *)*val_buf)); break; } @@ -1264,14 +1204,14 @@ BOOL unicode) char* key_nameA = GetMultiByteString(*reg_key_name_buf); char* value_nameA = GetMultiByteString(*val_name_buf); fprintf(stderr,"%S: warning - unsupported registry format '%ld', " - "treat as binary\n", - getAppName(), value_type); + "treat as binary\n", + getAppName(), value_type); fprintf(stderr,"key name: \"%s\"\n", key_nameA); fprintf(stderr,"value name:\"%s\"\n\n", value_nameA); HeapFree(GetProcessHeap(), 0, key_nameA); HeapFree(GetProcessHeap(), 0, value_nameA); } - /* falls through */ + /* falls through */ case REG_EXPAND_SZ: case REG_MULTI_SZ: /* falls through */ @@ -1285,40 +1225,30 @@ BOOL unicode) i = 0; more_data = TRUE; (*reg_key_name_buf)[curr_len] = '\\'; - while(more_data) - { + while(more_data) { DWORD buf_size = *reg_key_name_size - curr_len - 1; ret = RegEnumKeyExW(key, i, *reg_key_name_buf + curr_len + 1, &buf_size, - NULL, NULL, NULL, NULL); - if (ret == ERROR_MORE_DATA) - { + NULL, NULL, NULL, NULL); + if (ret == ERROR_MORE_DATA) { /* Increase the size of the buffer and retry */ REGPROC_resize_char_buffer(reg_key_name_buf, reg_key_name_size, curr_len + 1 + buf_size); - } - else if (ret != ERROR_SUCCESS) - { + } else if (ret != ERROR_SUCCESS) { more_data = FALSE; - if (ret != ERROR_NO_MORE_ITEMS) - { + if (ret != ERROR_NO_MORE_ITEMS) { REGPROC_print_error(); } - } - else - { + } else { HKEY subkey; i++; if (RegOpenKeyW(key, *reg_key_name_buf + curr_len + 1, - &subkey) == ERROR_SUCCESS) - { + &subkey) == ERROR_SUCCESS) { export_hkey(file, subkey, reg_key_name_buf, reg_key_name_size, - val_name_buf, val_name_size, val_buf, val_size, - line_buf, line_buf_size, unicode); + val_name_buf, val_name_size, val_buf, val_size, + line_buf, line_buf_size, unicode); RegCloseKey(subkey); - } - else - { + } else { REGPROC_print_error(); } } @@ -1327,40 +1257,37 @@ BOOL unicode) } /****************************************************************************** - * Open file for export. + * Open file in binary mode for export. */ static FILE *REGPROC_open_export_file(WCHAR *file_name, BOOL unicode) { FILE *file; WCHAR dash = '-'; - if (wcsncmp(file_name, &dash, 1) == 0) - file = stdout; - else + if (strncmpW(file_name,&dash,1)==0) { + file=stdout; + _setmode(_fileno(file), _O_BINARY); + } else { - if (unicode) - file = _wfopen(file_name, L"wb"); - else - file = _wfopen(file_name, L"w"); - if (!file) - { - CHAR* file_nameA = GetMultiByteString(file_name); + CHAR* file_nameA = GetMultiByteString(file_name); + file = fopen(file_nameA, "wb"); + if (!file) { perror(""); fprintf(stderr,"%S: Can't open file \"%s\"\n", getAppName(), file_nameA); HeapFree(GetProcessHeap(), 0, file_nameA); exit(1); } + HeapFree(GetProcessHeap(), 0, file_nameA); } - if (unicode) + if(unicode) { const BYTE unicode_seq[] = {0xff,0xfe}; - const WCHAR header[] = L"Windows Registry Editor Version 5.00\r\n"; - fwrite(unicode_seq, sizeof(BYTE), COUNT_OF(unicode_seq), file); - fwrite(header, sizeof(WCHAR), lstrlenW(header), file); - } - else + const WCHAR header[] = {'W','i','n','d','o','w','s',' ','R','e','g','i','s','t','r','y',' ','E','d','i','t','o','r',' ','V','e','r','s','i','o','n',' ','5','.','0','0','\r','\n'}; + fwrite(unicode_seq, sizeof(BYTE), sizeof(unicode_seq)/sizeof(unicode_seq[0]), file); + fwrite(header, sizeof(WCHAR), sizeof(header)/sizeof(header[0]), file); + } else { - fputs("REGEDIT4\n", file); + fputs("REGEDIT4\r\n", file); } return file; @@ -1388,87 +1315,75 @@ BOOL export_registry_key(WCHAR *file_name, WCHAR *reg_key_name, DWORD format) BOOL unicode = (format == REG_FORMAT_5); reg_key_name_buf = HeapAlloc(GetProcessHeap(), 0, - reg_key_name_size * sizeof(*reg_key_name_buf)); + reg_key_name_size * sizeof(*reg_key_name_buf)); val_name_buf = HeapAlloc(GetProcessHeap(), 0, - val_name_size * sizeof(*val_name_buf)); + val_name_size * sizeof(*val_name_buf)); val_buf = HeapAlloc(GetProcessHeap(), 0, val_size); line_buf = HeapAlloc(GetProcessHeap(), 0, line_buf_size * sizeof(*line_buf)); CHECK_ENOUGH_MEMORY(reg_key_name_buf && val_name_buf && val_buf && line_buf); - if (reg_key_name && reg_key_name[0]) - { + if (reg_key_name && reg_key_name[0]) { HKEY reg_key_class; WCHAR *branch_name = NULL; HKEY key; REGPROC_resize_char_buffer(®_key_name_buf, ®_key_name_size, - lstrlenW(reg_key_name)); + lstrlenW(reg_key_name)); lstrcpyW(reg_key_name_buf, reg_key_name); /* open the specified key */ - if (!parseKeyName(reg_key_name, ®_key_class, &branch_name)) - { + if (!parseKeyName(reg_key_name, ®_key_class, &branch_name)) { CHAR* key_nameA = GetMultiByteString(reg_key_name); fprintf(stderr,"%S: Incorrect registry class specification in '%s'\n", - getAppName(), key_nameA); + getAppName(), key_nameA); HeapFree(GetProcessHeap(), 0, key_nameA); exit(1); } - if (!branch_name[0]) - { + if (!branch_name[0]) { /* no branch - registry class is specified */ file = REGPROC_open_export_file(file_name, unicode); export_hkey(file, reg_key_class, - ®_key_name_buf, ®_key_name_size, - &val_name_buf, &val_name_size, - &val_buf, &val_size, &line_buf, - &line_buf_size, unicode); - } - else if (RegOpenKeyW(reg_key_class, branch_name, &key) == ERROR_SUCCESS) - { + ®_key_name_buf, ®_key_name_size, + &val_name_buf, &val_name_size, + &val_buf, &val_size, &line_buf, + &line_buf_size, unicode); + } else if (RegOpenKeyW(reg_key_class, branch_name, &key) == ERROR_SUCCESS) { file = REGPROC_open_export_file(file_name, unicode); export_hkey(file, key, - ®_key_name_buf, ®_key_name_size, - &val_name_buf, &val_name_size, - &val_buf, &val_size, &line_buf, - &line_buf_size, unicode); + ®_key_name_buf, ®_key_name_size, + &val_name_buf, &val_name_size, + &val_buf, &val_size, &line_buf, + &line_buf_size, unicode); RegCloseKey(key); - } - else - { + } else { CHAR* key_nameA = GetMultiByteString(reg_key_name); fprintf(stderr,"%S: Can't export. Registry key '%s' does not exist!\n", - getAppName(), key_nameA); + getAppName(), key_nameA); HeapFree(GetProcessHeap(), 0, key_nameA); REGPROC_print_error(); } - } - else - { + } else { unsigned int i; /* export all registry classes */ file = REGPROC_open_export_file(file_name, unicode); - for (i = 0; i < REG_CLASS_NUMBER; i++) - { + for (i = 0; i < REG_CLASS_NUMBER; i++) { /* do not export HKEY_CLASSES_ROOT */ if (reg_class_keys[i] != HKEY_CLASSES_ROOT && - reg_class_keys[i] != HKEY_CURRENT_USER && - reg_class_keys[i] != HKEY_CURRENT_CONFIG && - reg_class_keys[i] != HKEY_DYN_DATA) - { + reg_class_keys[i] != HKEY_CURRENT_USER && + reg_class_keys[i] != HKEY_CURRENT_CONFIG && + reg_class_keys[i] != HKEY_DYN_DATA) { lstrcpyW(reg_key_name_buf, reg_class_namesW[i]); export_hkey(file, reg_class_keys[i], - ®_key_name_buf, ®_key_name_size, - &val_name_buf, &val_name_size, - &val_buf, &val_size, &line_buf, - &line_buf_size, unicode); + ®_key_name_buf, ®_key_name_size, + &val_name_buf, &val_name_size, + &val_buf, &val_size, &line_buf, + &line_buf_size, unicode); } } } - if (file) - { + if (file) { fclose(file); } HeapFree(GetProcessHeap(), 0, reg_key_name); @@ -1491,11 +1406,9 @@ BOOL import_registry_file(FILE* reg_file) if (s[0] == 0xff && s[1] == 0xfe) { processRegLinesW(reg_file); - } - else + } else { - fseek(reg_file, 0, SEEK_SET); - processRegLinesA(reg_file); + processRegLinesA(reg_file, (char*)s); } } return TRUE; @@ -1518,19 +1431,17 @@ void delete_registry_key(WCHAR *reg_key_name) if (!reg_key_name || !reg_key_name[0]) return; - if (!parseKeyName(reg_key_name, &key_class, &key_name)) - { + if (!parseKeyName(reg_key_name, &key_class, &key_name)) { char* reg_key_nameA = GetMultiByteString(reg_key_name); fprintf(stderr,"%S: Incorrect registry class specification in '%s'\n", - getAppName(), reg_key_nameA); + getAppName(), reg_key_nameA); HeapFree(GetProcessHeap(), 0, reg_key_nameA); exit(1); } - if (!*key_name) - { + if (!*key_name) { char* reg_key_nameA = GetMultiByteString(reg_key_name); fprintf(stderr,"%S: Can't delete registry class '%s'\n", - getAppName(), reg_key_nameA); + getAppName(), reg_key_nameA); HeapFree(GetProcessHeap(), 0, reg_key_nameA); exit(1); } diff --git a/base/applications/regedit/regproc.h b/base/applications/regedit/regproc.h index b78a39c3900..a2a2d5033e8 100644 --- a/base/applications/regedit/regproc.h +++ b/base/applications/regedit/regproc.h @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #pragma once @@ -25,7 +25,7 @@ #define REG_FORMAT_4 2 BOOL export_registry_key(WCHAR *file_name, WCHAR *reg_key_name, DWORD format); -BOOL import_registry_file(FILE* reg_file); -void delete_registry_key(LPTSTR reg_key_name); +BOOL import_registry_file(FILE *in); +void delete_registry_key(WCHAR *reg_key_name); WCHAR* GetWideString(const char* strA); CHAR* GetMultiByteString(const WCHAR* strW); diff --git a/base/applications/taskmgr/lang/ru-RU.rc b/base/applications/taskmgr/lang/ru-RU.rc index c24544221c8..476189cf438 100644 --- a/base/applications/taskmgr/lang/ru-RU.rc +++ b/base/applications/taskmgr/lang/ru-RU.rc @@ -111,7 +111,7 @@ IDR_PROCESS_PAGE_CONTEXT MENU BEGIN POPUP "DUMMY" BEGIN - MENUITEM "&Заверщить процесс", ID_PROCESS_PAGE_ENDPROCESS + MENUITEM "&Завершить процесс", ID_PROCESS_PAGE_ENDPROCESS MENUITEM "З&авершить дерево процессов", ID_PROCESS_PAGE_ENDPROCESSTREE MENUITEM "&Отладка", ID_PROCESS_PAGE_DEBUG MENUITEM SEPARATOR diff --git a/base/setup/usetup/interface/usetup.c b/base/setup/usetup/interface/usetup.c index b1a09be80dc..8ba4d858be9 100644 --- a/base/setup/usetup/interface/usetup.c +++ b/base/setup/usetup/interface/usetup.c @@ -1524,6 +1524,8 @@ SelectPartitionPage(PINPUT_RECORD Ir) MaxSize, TRUE); + DestinationDriveLetter = (WCHAR)PartitionList->CurrentPartition->DriveLetter[0]; + return SELECT_FILE_SYSTEM_PAGE; } } @@ -1535,6 +1537,8 @@ SelectPartitionPage(PINPUT_RECORD Ir) return SELECT_PARTITION_PAGE; /* let the user select another partition */ } + DestinationDriveLetter = (WCHAR)PartitionList->CurrentPartition->DriveLetter[0]; + return SELECT_FILE_SYSTEM_PAGE; } } @@ -2392,8 +2396,10 @@ FormatPartitionPage(PINPUT_RECORD Ir) } } } +#if 0 else if (wcscmp(FileSystemList->Selected->FileSystem, L"EXT2") == 0) PartEntry->PartInfo[PartNum].PartitionType = PARTITION_EXT2; +#endif else if (!FileSystemList->Selected->FormatFunc) return QUIT_PAGE; diff --git a/base/setup/usetup/native/fslist.c b/base/setup/usetup/native/fslist.c index c4d6ec91bd5..c1211c874ec 100644 --- a/base/setup/usetup/native/fslist.c +++ b/base/setup/usetup/native/fslist.c @@ -5,7 +5,9 @@ NATIVE_CreateFileSystemList( IN PFILE_SYSTEM_LIST List) { FS_AddProvider(List, L"FAT", VfatFormat, VfatChkdsk); +#if 0 FS_AddProvider(List, L"EXT2", Ext2Format, Ext2Chkdsk); +#endif return TRUE; } diff --git a/boot/bootdata/txtsetup.sif b/boot/bootdata/txtsetup.sif index d2675d94f39..555365a0642 100644 --- a/boot/bootdata/txtsetup.sif +++ b/boot/bootdata/txtsetup.sif @@ -132,32 +132,32 @@ DefaultLanguage = 00000409 [Computer] pci_up = "Standard PC Uniprocessor" -pci_mp = "Standard PC Multiprocessor" +;pci_mp = "Standard PC Multiprocessor" acpi_up = "ACPI PC Uniprocessor" -acpi_mp = "ACPI PC Multiprocessor" +;acpi_mp = "ACPI PC Multiprocessor" [Map.Computer] ; = pci_up = "PC UP" -pci_mp = "PC MP" +;pci_mp = "PC MP" acpi_up = "ACPI UP" -acpi_mp = "ACPI MP" +;acpi_mp = "ACPI MP" [Files.pci_up] ntoskrnl.exe=,,,,,,,,,,,,2 hal.dll=,,,,,,,,,,,,2 -[Files.pci_mp] -ntkrnlmp.exe=,,,,,,,,,,ntoskrnl.exe,,2 -halmps.dll=,,,,,,,,,,hal.dll,,2 +;[Files.pci_mp] +;ntkrnlmp.exe=,,,,,,,,,,ntoskrnl.exe,,2 +;halmps.dll=,,,,,,,,,,hal.dll,,2 [Files.acpi_up] ntoskrnl.exe=,,,,,,,,,,,,2 halacpi.dll=,,,,,,,,,,hal.dll,,2 -[Files.acpi_mp] -ntkrnlmp.exe=,,,,,,,,,,ntoskrnl.exe,,2 -halacpi.dll=,,,,,,,,,,hal.dll,,2 +;[Files.acpi_mp] +;ntkrnlmp.exe=,,,,,,,,,,ntoskrnl.exe,,2 +;halacpi.dll=,,,,,,,,,,hal.dll,,2 [Display] ; = ,,,,, diff --git a/cmake/gcc.cmake b/cmake/gcc.cmake index 7f4f84f66e0..c6da9b8c19e 100644 --- a/cmake/gcc.cmake +++ b/cmake/gcc.cmake @@ -324,6 +324,7 @@ set(PSEH_LIB "pseh") # Macros if(PCH) + add_compile_flags("-Winvalid-pch -Werror=invalid-pch") macro(add_pch _target _pch _sources) # When including x.h GCC looks for x.h.gch first set(_pch_final_name "${_target}_pch.h") @@ -351,7 +352,7 @@ if(PCH) # Include the gch in the specified source files, skipping the pch file itself list(REMOVE_ITEM ${_sources} ${_pch}) foreach(_src ${${_sources}}) - set_property(SOURCE ${_src} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_ccache_flag} -Winvalid-pch -Werror=invalid-pch -include ${_pch_final_name}") + set_property(SOURCE ${_src} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_ccache_flag} -include ${_pch_final_name}") set_property(SOURCE ${_src} APPEND PROPERTY OBJECT_DEPENDS ${_gch}) endforeach() endmacro() diff --git a/cmake/msvc.cmake b/cmake/msvc.cmake index 7d3cedd4522..18121baf88c 100644 --- a/cmake/msvc.cmake +++ b/cmake/msvc.cmake @@ -56,8 +56,7 @@ add_compile_flags("/wd4290") # - C4163: 'identifier': not available as an intrinsic function # - C4229: modifiers on data are ignored # - C4700: uninitialized variable usage -# - C4603: macro is not defined or definition is different after precompiled header use -add_compile_flags("/we4013 /we4020 /we4022 /we4047 /we4098 /we4113 /we4129 /we4163 /we4229 /we4700 /we4603") +add_compile_flags("/we4013 /we4020 /we4022 /we4047 /we4098 /we4113 /we4129 /we4163 /we4229 /we4700") # Enable warnings above the default level, but don't treat them as errors: # - C4115: named type definition in parentheses diff --git a/configure.cmd b/configure.cmd index db8ac5d91f8..bdc66fd20e8 100755 --- a/configure.cmd +++ b/configure.cmd @@ -15,7 +15,7 @@ if /I "%1" == "arm_hosttools" ( call %2 x86 :: Configure host tools for x86 - cmake -G %3 -DARCH=i386 %~dp0 + cmake -G %3 -DARCH:STRING=i386 %~dp0 exit ) @@ -148,7 +148,7 @@ if "%ARCH%" == "arm" ( :: Launch new script instance for x86 host tools configuration start "Preparing host tools for ARM cross build..." /I /B /WAIT %~dp0configure.cmd arm_hosttools "%VSINSTALLDIR%VC\vcvarsall.bat" %CMAKE_GENERATOR% ) else ( - cmake -G %CMAKE_GENERATOR% -DARCH=%ARCH% "%REACTOS_SOURCE_DIR%" + cmake -G %CMAKE_GENERATOR% -DARCH:STRING=%ARCH% "%REACTOS_SOURCE_DIR%" ) cd.. @@ -160,11 +160,11 @@ if EXIST CMakeCache.txt ( ) if "%BUILD_ENVIRONMENT%" == "MinGW" ( - cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE=0 -DCMAKE_TOOLCHAIN_FILE=toolchain-gcc.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" "%REACTOS_SOURCE_DIR%" + cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE:BOOL=0 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-gcc.cmake -DARCH:STRING=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:PATH="%REACTOS_BUILD_TOOLS_DIR%" "%REACTOS_SOURCE_DIR%" ) else if "%BUILD_ENVIRONMENT%" == "Clang" ( - cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE=0 -DCMAKE_TOOLCHAIN_FILE=toolchain-clang.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" "%REACTOS_SOURCE_DIR%" + cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE:BOOL=0 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-clang.cmake -DARCH:STRING=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:PATH="%REACTOS_BUILD_TOOLS_DIR%" "%REACTOS_SOURCE_DIR%" ) else ( - cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" "%REACTOS_SOURCE_DIR%" + cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:PATH="%REACTOS_BUILD_TOOLS_DIR%" "%REACTOS_SOURCE_DIR%" ) cd.. diff --git a/configure.sh b/configure.sh index 3f7485df786..6ba64a44cd5 100755 --- a/configure.sh +++ b/configure.sh @@ -53,12 +53,12 @@ cd host-tools rm -f CMakeCache.txt REACTOS_BUILD_TOOLS_DIR="$PWD" -cmake -G "$CMAKE_GENERATOR" -DARCH=$ARCH $ROS_CMAKEOPTS "$REACTOS_SOURCE_DIR" +cmake -G "$CMAKE_GENERATOR" -DARCH:STRING=$ARCH $ROS_CMAKEOPTS "$REACTOS_SOURCE_DIR" echo Preparing reactos... cd ../reactos rm -f CMakeCache.txt -cmake -G "$CMAKE_GENERATOR" -DENABLE_CCACHE=0 -DCMAKE_TOOLCHAIN_FILE=toolchain-gcc.cmake -DARCH=$ARCH -DREACTOS_BUILD_TOOLS_DIR="$REACTOS_BUILD_TOOLS_DIR" $ROS_CMAKEOPTS "$REACTOS_SOURCE_DIR" +cmake -G "$CMAKE_GENERATOR" -DENABLE_CCACHE:BOOL=1 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-gcc.cmake -DARCH:STRING=$ARCH -DREACTOS_BUILD_TOOLS_DIR:PATH="$REACTOS_BUILD_TOOLS_DIR" $ROS_CMAKEOPTS "$REACTOS_SOURCE_DIR" echo Configure script complete! Enter directories and execute appropriate build commands \(ex: ninja, make, makex, etc...\). diff --git a/dll/3rdparty/libxslt/CMakeLists.txt b/dll/3rdparty/libxslt/CMakeLists.txt index 9a55a10adb9..988a7ca3c29 100644 --- a/dll/3rdparty/libxslt/CMakeLists.txt +++ b/dll/3rdparty/libxslt/CMakeLists.txt @@ -1,6 +1,6 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR} - ${REACTOS_SOURCE_DIR}/include/reactos/libs/libxslt) +include_directories(${REACTOS_SOURCE_DIR}/include/reactos/libs/libxslt + ${REACTOS_SOURCE_DIR}/lib/3rdparty/libwin-iconv) add_definitions( -DHAVE_CONFIG_H @@ -37,7 +37,7 @@ list(APPEND SOURCE add_library(libxslt SHARED ${SOURCE}) set_module_type(libxslt win32dll) -target_link_libraries(libxslt libxml2 iconv-static) +target_link_libraries(libxslt libxml2 iconv-static zlib) add_importlibs(libxslt msvcrt ws2_32 kernel32) if(MSVC) add_importlibs(libxslt ntdll) diff --git a/dll/cpl/sysdm/general.c b/dll/cpl/sysdm/general.c index 3060314d390..33e209acbd9 100644 --- a/dll/cpl/sysdm/general.c +++ b/dll/cpl/sysdm/general.c @@ -22,12 +22,14 @@ typedef struct _IMGINFO HBITMAP hBitmap; INT cxSource; INT cySource; + INT iPLanes; + INT iBits; } IMGINFO, *PIMGINFO; PIMGINFO pImgInfo = NULL; +BLENDFUNCTION BlendFunc = {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA}; -void -ShowLastWin32Error(HWND hWndOwner) +VOID ShowLastWin32Error(HWND hWndOwner) { LPTSTR lpMsg; DWORD LastError; @@ -53,39 +55,86 @@ ShowLastWin32Error(HWND hWndOwner) } -static VOID -InitImageInfo(PIMGINFO ImgInfo) +static VOID InitLogo(HWND hwndDlg) { - BITMAP bitmap; + BITMAP logoBitmap; + BITMAP maskBitmap; + BITMAPINFO bmpi; + HDC hDC = GetDC(hwndDlg); + HDC hDCLogo = CreateCompatibleDC(NULL); + HDC hDCMask = CreateCompatibleDC(NULL); + HBITMAP hMask, hLogo, hAlphaLogo = NULL; + COLORREF *pBits; + INT line, column; - ZeroMemory(ImgInfo, sizeof(*ImgInfo)); + ZeroMemory(pImgInfo, sizeof(*pImgInfo)); + ZeroMemory(&bmpi, sizeof(bmpi)); - ImgInfo->hBitmap = LoadImage(hApplet, - MAKEINTRESOURCE(IDB_ROSBMP), - IMAGE_BITMAP, - 0, - 0, - LR_DEFAULTCOLOR); + hLogo = (HBITMAP)LoadImage(hApplet, MAKEINTRESOURCE(IDB_ROSBMP), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); + hMask = (HBITMAP)LoadImage(hApplet, MAKEINTRESOURCE(IDB_ROSMASK), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); - if (ImgInfo->hBitmap != NULL) + if (hLogo != NULL && hMask != NULL) { - GetObject(ImgInfo->hBitmap, sizeof(BITMAP), &bitmap); + GetObject(hLogo, sizeof(BITMAP), &logoBitmap); + GetObject(hMask, sizeof(BITMAP), &maskBitmap); - ImgInfo->cxSource = bitmap.bmWidth; - ImgInfo->cySource = bitmap.bmHeight; + if(logoBitmap.bmHeight != maskBitmap.bmHeight || logoBitmap.bmWidth != maskBitmap.bmWidth) + return; + + pImgInfo->cxSource = logoBitmap.bmWidth; + pImgInfo->cySource = logoBitmap.bmHeight; + + bmpi.bmiHeader.biSize = sizeof(BITMAPINFO); + bmpi.bmiHeader.biWidth = logoBitmap.bmWidth; + bmpi.bmiHeader.biHeight = logoBitmap.bmHeight; + bmpi.bmiHeader.biPlanes = 1; + bmpi.bmiHeader.biBitCount = 32; + bmpi.bmiHeader.biCompression = BI_RGB; + bmpi.bmiHeader.biSizeImage = 4 * logoBitmap.bmWidth * logoBitmap.bmHeight; + + hAlphaLogo = CreateDIBSection(hDC, &bmpi, DIB_RGB_COLORS, (PVOID*)&pBits, 0, 0); + + if(!hAlphaLogo) + return; + + SelectObject(hDCLogo, hLogo); + SelectObject(hDCMask, hMask); + + for(line = logoBitmap.bmHeight - 1; line >= 0; line--) + { + for(column = 0; column < logoBitmap.bmWidth; column++) + { + COLORREF alpha = GetPixel(hDCMask, column, line) & 0xFF; + COLORREF Color = GetPixel(hDCLogo, column, line); + DWORD r, g, b; + + r = GetRValue(Color) * alpha / 255; + g = GetGValue(Color) * alpha / 255; + b = GetBValue(Color) * alpha / 255; + + *pBits++ = b | g << 8 | r << 16 | alpha << 24; + } + } } + + pImgInfo->hBitmap = hAlphaLogo; + pImgInfo->cxSource = logoBitmap.bmWidth; + pImgInfo->cySource = logoBitmap.bmHeight; + pImgInfo->iBits = logoBitmap.bmBitsPixel; + pImgInfo->iPLanes = logoBitmap.bmPlanes; + + DeleteObject(hLogo); + DeleteObject(hMask); + DeleteDC(hDCLogo); + DeleteDC(hDCMask); + } LRESULT CALLBACK RosImageProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { static UINT timerid = 0, top = 0, offset; - static HBITMAP hBitmap2; - RECT r; - NONCLIENTMETRICS ncm; - HFONT hfont; - BITMAP bitmap; - HDC dc, sdc; - TCHAR devtext[2048]; + static HBITMAP hCreditsBitmap; + switch (uMsg) { case WM_LBUTTONDBLCLK: @@ -93,51 +142,65 @@ LRESULT CALLBACK RosImageProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam { if (timerid == 0) { - top = 0; // Set top + HDC hCreditsDC, hLogoDC; + HFONT hFont; + NONCLIENTMETRICS ncm; + RECT rcCredits; + TCHAR szCredits[2048]; + INT iDevsHeight; - // Build new bitmap - GetObject(pImgInfo->hBitmap, sizeof(BITMAP), &bitmap); - dc = CreateCompatibleDC(GetDC(NULL)); - if (dc == NULL) - { + top = 0; + offset = 0; + hCreditsDC = CreateCompatibleDC(GetDC(NULL)); + hLogoDC = CreateCompatibleDC(hCreditsDC); + + if (hCreditsDC == NULL || hLogoDC == NULL) break; - } - sdc = CreateCompatibleDC(dc); - if (sdc == NULL) - { - DeleteDC(dc); - break; - } + + SetRect(&rcCredits, 0, 0, 0, 0); + ncm.cbSize = sizeof(NONCLIENTMETRICS); SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0); - hfont = CreateFontIndirect(&ncm.lfMessageFont); - SelectObject(dc, hfont); - SetRect(&r, 0, 0, 0, 0); - LoadString(hApplet, IDS_DEVS, devtext, sizeof(devtext) / sizeof(TCHAR)); - DrawText(dc, devtext, -1, &r, DT_CALCRECT); - hBitmap2 = CreateBitmap(pImgInfo->cxSource, (2 * pImgInfo->cySource) + (r.bottom + 1 - r.top), bitmap.bmPlanes, bitmap.bmBitsPixel, NULL); - SelectObject(sdc, pImgInfo->hBitmap); - SelectObject(dc, hBitmap2); - offset = 0; - BitBlt(dc, 0, offset, bitmap.bmWidth, bitmap.bmHeight, sdc, 0, 0, SRCCOPY); - offset += bitmap.bmHeight; + hFont = CreateFontIndirect(&ncm.lfMessageFont); + SelectObject(hCreditsDC, hFont); - SetRect(&r, 0, offset, bitmap.bmWidth, offset + (r.bottom - r.top) + 1); - FillRect(dc, &r, GetSysColorBrush(COLOR_3DFACE)); - SetBkMode(dc, TRANSPARENT); - OffsetRect(&r, 1, 1); - SetTextColor(dc, GetSysColor(COLOR_BTNSHADOW)); - DrawText(dc, devtext, -1, &r, DT_CENTER); - OffsetRect(&r, -1, -1); - SetTextColor(dc, GetSysColor(COLOR_WINDOWTEXT)); - DrawText(dc, devtext, -1, &r, DT_CENTER); - offset += r.bottom - r.top; + LoadString(hApplet, IDS_DEVS, szCredits, sizeof(szCredits) / sizeof(TCHAR)); + DrawText(hCreditsDC, szCredits, -1, &rcCredits, DT_CALCRECT); - BitBlt(dc, 0, offset, bitmap.bmWidth, bitmap.bmHeight, sdc, 0, 0, SRCCOPY); - offset += bitmap.bmHeight; - DeleteDC(sdc); - DeleteDC(dc); + iDevsHeight = rcCredits.bottom - rcCredits.top; + + hCreditsBitmap = CreateBitmap(pImgInfo->cxSource, (2 * pImgInfo->cySource) + iDevsHeight + 1, pImgInfo->iPLanes, pImgInfo->iBits, NULL); + + if(!hCreditsBitmap) + break; + + SelectObject(hLogoDC, pImgInfo->hBitmap); + SelectObject(hCreditsDC, hCreditsBitmap); + + offset += pImgInfo->cySource; + + SetRect(&rcCredits, 0, 0, pImgInfo->cxSource, (2 * pImgInfo->cySource) + iDevsHeight + 1); + FillRect(hCreditsDC, &rcCredits, GetSysColorBrush(COLOR_3DFACE)); + + SetRect(&rcCredits, 0, offset, pImgInfo->cxSource, offset + iDevsHeight + 1); + SetBkMode(hCreditsDC, TRANSPARENT); + + OffsetRect(&rcCredits, 1, 1); + SetTextColor(hCreditsDC, GetSysColor(COLOR_BTNSHADOW)); + DrawText(hCreditsDC, szCredits, -1, &rcCredits, DT_CENTER); + + OffsetRect(&rcCredits, -1, -1); + SetTextColor(hCreditsDC, GetSysColor(COLOR_WINDOWTEXT)); + DrawText(hCreditsDC, szCredits, -1, &rcCredits, DT_CENTER); + + offset += iDevsHeight; + + AlphaBlend(hCreditsDC, 0, 0, pImgInfo->cxSource, pImgInfo->cySource, hLogoDC, 0, 0, pImgInfo->cxSource, pImgInfo->cySource, BlendFunc); + AlphaBlend(hCreditsDC, 0, offset, pImgInfo->cxSource, pImgInfo->cySource, hLogoDC, 0, 0, pImgInfo->cxSource, pImgInfo->cySource, BlendFunc); + + DeleteDC(hLogoDC); + DeleteDC(hCreditsDC); timerid = SetTimer(hwnd, 1, ANIM_TIME, NULL); } @@ -146,22 +209,40 @@ LRESULT CALLBACK RosImageProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam case WM_LBUTTONDOWN: if (timerid) { + RECT rcCredits; + HDC hDC = GetDC(hwnd); + + GetClientRect(hwnd, &rcCredits); + SetRect(&rcCredits, 0, 0, rcCredits.right, pImgInfo->cySource); + FillRect(hDC, &rcCredits, GetSysColorBrush(COLOR_3DFACE)); + KillTimer(hwnd, timerid); + DeleteObject(hCreditsBitmap); + InvalidateRect(hwnd, NULL, FALSE); + top = 0; timerid = 0; - DeleteObject(hBitmap2); - InvalidateRect(hwnd, NULL, FALSE); } break; case WM_TIMER: top += ANIM_STEP; - if (top > offset - pImgInfo->cySource) + + if (top > offset) { + RECT rcCredits; + HDC hDC = GetDC(hwnd); + + GetClientRect(hwnd, &rcCredits); + SetRect(&rcCredits, 0, 0, rcCredits.right, pImgInfo->cySource); + FillRect(hDC, &rcCredits, GetSysColorBrush(COLOR_3DFACE)); + KillTimer(hwnd, timerid); + DeleteObject(hCreditsBitmap); + top = 0; timerid = 0; - DeleteObject(hBitmap2); } + InvalidateRect(hwnd, NULL, FALSE); break; case WM_PAINT: @@ -169,15 +250,10 @@ LRESULT CALLBACK RosImageProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam PAINTSTRUCT PS; HDC hdcMem, hdc; LONG left; - if (wParam != 0) - { - hdc = (HDC)wParam; - } - else - { - hdc = BeginPaint(hwnd,&PS); - } - GetClientRect(hwnd,&PS.rcPaint); + + hdc = wParam != 0 ? (HDC)wParam : BeginPaint(hwnd, &PS); + + GetClientRect(hwnd, &PS.rcPaint); /* Position image in center of dialog */ left = (PS.rcPaint.right - pImgInfo->cxSource) / 2; @@ -185,16 +261,17 @@ LRESULT CALLBACK RosImageProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam if (hdcMem != NULL) { - SelectObject(hdcMem, timerid ? hBitmap2 : pImgInfo->hBitmap); - BitBlt(hdc, - left, - PS.rcPaint.top, - PS.rcPaint.right - PS.rcPaint.left, - PS.rcPaint.top + pImgInfo->cySource, - hdcMem, - 0, - top, - SRCCOPY); + if(timerid != 0) + { + SelectObject(hdcMem, hCreditsBitmap); + BitBlt(hdc, left, PS.rcPaint.top, PS.rcPaint.right - PS.rcPaint.left, PS.rcPaint.top + pImgInfo->cySource, hdcMem, 0, top, SRCCOPY); + } + else + { + SelectObject(hdcMem, pImgInfo->hBitmap); + AlphaBlend(hdc, left, PS.rcPaint.top, pImgInfo->cxSource, pImgInfo->cySource, hdcMem, 0, 0, pImgInfo->cxSource, pImgInfo->cySource, BlendFunc); + } + DeleteDC(hdcMem); } @@ -206,53 +283,27 @@ LRESULT CALLBACK RosImageProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam return TRUE; } -static VOID -SetRegTextData(HWND hwnd, - HKEY hKey, - LPTSTR Value, - UINT uID) +static VOID SetRegTextData(HWND hwnd, HKEY hKey, LPTSTR Value, UINT uID) { LPTSTR lpBuf = NULL; DWORD BufSize = 0; DWORD Type; - if (RegQueryValueEx(hKey, - Value, - NULL, - &Type, - NULL, - &BufSize) == ERROR_SUCCESS) + if (RegQueryValueEx(hKey, Value, NULL, &Type, NULL, &BufSize) == ERROR_SUCCESS) { - lpBuf = HeapAlloc(GetProcessHeap(), - 0, - BufSize); + lpBuf = HeapAlloc(GetProcessHeap(), 0, BufSize); + if (!lpBuf) return; - if (RegQueryValueEx(hKey, - Value, - NULL, - &Type, - (PBYTE)lpBuf, - &BufSize) == ERROR_SUCCESS) - { - SetDlgItemText(hwnd, - uID, - lpBuf); - } + if (RegQueryValueEx(hKey, Value, NULL, &Type, (PBYTE)lpBuf, &BufSize) == ERROR_SUCCESS) + SetDlgItemText(hwnd, uID, lpBuf); - HeapFree(GetProcessHeap(), - 0, - lpBuf); + HeapFree(GetProcessHeap(), 0, lpBuf); } } -static INT -SetProcNameString(HWND hwnd, - HKEY hKey, - LPTSTR Value, - UINT uID1, - UINT uID2) +static INT SetProcNameString(HWND hwnd, HKEY hKey, LPTSTR Value, UINT uID1, UINT uID2) { LPTSTR lpBuf = NULL; DWORD BufSize = 0; @@ -262,25 +313,14 @@ SetProcNameString(HWND hwnd, TCHAR* szLastSpace; INT LastSpace = 0; - if (RegQueryValueEx(hKey, - Value, - NULL, - &Type, - NULL, - &BufSize) == ERROR_SUCCESS) + if (RegQueryValueEx(hKey, Value, NULL, &Type, NULL, &BufSize) == ERROR_SUCCESS) { - lpBuf = HeapAlloc(GetProcessHeap(), - 0, - BufSize); + lpBuf = HeapAlloc(GetProcessHeap(), 0, BufSize); + if (!lpBuf) return 0; - if (RegQueryValueEx(hKey, - Value, - NULL, - &Type, - (PBYTE)lpBuf, - &BufSize) == ERROR_SUCCESS) + if (RegQueryValueEx(hKey, Value, NULL, &Type, (PBYTE)lpBuf, &BufSize) == ERROR_SUCCESS) { if (BufSize > ((30 + 1) * sizeof(TCHAR))) { @@ -308,39 +348,26 @@ SetProcNameString(HWND hwnd, _tcsncpy(szBuf, lpBuf, LastSpace); - SetDlgItemText(hwnd, - uID1, - szBuf); - - SetDlgItemText(hwnd, - uID2, - lpBuf+LastSpace+1); + SetDlgItemText(hwnd, uID1, szBuf); + SetDlgItemText(hwnd, uID2, lpBuf+LastSpace+1); /* Return the number of used lines */ Ret = 2; } else { - SetDlgItemText(hwnd, - uID1, - lpBuf); - + SetDlgItemText(hwnd, uID1, lpBuf); Ret = 1; } } - HeapFree(GetProcessHeap(), - 0, - lpBuf); + HeapFree(GetProcessHeap(), 0, lpBuf); } return Ret; } -static VOID -MakeFloatValueString(double* dFloatValue, - LPTSTR szOutput, - LPTSTR szAppend) +static VOID MakeFloatValueString(DOUBLE* dFloatValue, LPTSTR szOutput, LPTSTR szAppend) { TCHAR szDecimalSeparator[4]; @@ -358,32 +385,21 @@ MakeFloatValueString(double* dFloatValue, } } -static VOID -SetProcSpeed(HWND hwnd, - HKEY hKey, - LPTSTR Value, - UINT uID) +static VOID SetProcSpeed(HWND hwnd, HKEY hKey, LPTSTR Value, UINT uID) { TCHAR szBuf[64]; DWORD BufSize = sizeof(DWORD); DWORD Type = REG_SZ; PROCESSOR_POWER_INFORMATION ppi; - ZeroMemory(&ppi, - sizeof(ppi)); + ZeroMemory(&ppi, sizeof(ppi)); if ((CallNtPowerInformation(ProcessorInformation, NULL, 0, (PVOID)&ppi, sizeof(ppi)) == STATUS_SUCCESS && - ppi.CurrentMhz != 0) || - RegQueryValueEx(hKey, - Value, - NULL, - &Type, - (PBYTE)&ppi.CurrentMhz, - &BufSize) == ERROR_SUCCESS) + ppi.CurrentMhz != 0) || RegQueryValueEx(hKey, Value, NULL, &Type, (PBYTE)&ppi.CurrentMhz, &BufSize) == ERROR_SUCCESS) { if (ppi.CurrentMhz < 1000) { @@ -395,14 +411,11 @@ SetProcSpeed(HWND hwnd, MakeFloatValueString(&flt, szBuf, _T("GHz")); } - SetDlgItemText(hwnd, - uID, - szBuf); + SetDlgItemText(hwnd, uID, szBuf); } } -static VOID -GetSystemInformation(HWND hwnd) +static VOID GetSystemInformation(HWND hwnd) { HKEY hKey; TCHAR ProcKey[] = _T("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"); @@ -416,16 +429,9 @@ GetSystemInformation(HWND hwnd) * directly out of the registry instead of via setupapi as it * contains all the info we need, and should remain static */ - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, - ProcKey, - 0, - KEY_READ, - &hKey) == ERROR_SUCCESS) + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, ProcKey, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { - SetRegTextData(hwnd, - hKey, - _T("VendorIdentifier"), - CurMachineLine); + SetRegTextData(hwnd, hKey, _T("VendorIdentifier"), CurMachineLine); CurMachineLine++; CurMachineLine += SetProcNameString(hwnd, @@ -434,16 +440,13 @@ GetSystemInformation(HWND hwnd) CurMachineLine, CurMachineLine + 1); - SetProcSpeed(hwnd, - hKey, - _T("~MHz"), - CurMachineLine); + SetProcSpeed(hwnd, hKey, _T("~MHz"), CurMachineLine); CurMachineLine++; } - /* Get total physical RAM */ MemStat.dwLength = sizeof(MemStat); + if (GlobalMemoryStatusEx(&MemStat)) { TCHAR szStr[32]; @@ -452,11 +455,7 @@ GetSystemInformation(HWND hwnd) if (MemStat.ullTotalPhys > 1024 * 1024 * 1024) { UINT i = 0; - static const UINT uStrId[] = { - IDS_GIGABYTE, - IDS_TERABYTE, - IDS_PETABYTE - }; + static const UINT uStrId[] = { IDS_GIGABYTE, IDS_TERABYTE, IDS_PETABYTE}; // We're dealing with GBs or more MemStat.ullTotalPhys /= 1024 * 1024; @@ -501,13 +500,8 @@ GetSystemInformation(HWND hwnd) /* Property page dialog callback */ -INT_PTR CALLBACK -GeneralPageProc(HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) +INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - UNREFERENCED_PARAMETER(lParam); UNREFERENCED_PARAMETER(wParam); @@ -521,7 +515,7 @@ GeneralPageProc(HWND hwndDlg, return FALSE; } - InitImageInfo(pImgInfo); + InitLogo(hwndDlg); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_ROSIMG), GWL_WNDPROC, (LONG)RosImageProc); GetSystemInformation(hwndDlg); break; @@ -533,10 +527,7 @@ GeneralPageProc(HWND hwndDlg, case WM_COMMAND: if (LOWORD(wParam) == IDC_LICENCE) { - DialogBox(hApplet, - MAKEINTRESOURCE(IDD_LICENCE), - hwndDlg, - LicenceDlgProc); + DialogBox(hApplet, MAKEINTRESOURCE(IDD_LICENCE), hwndDlg, LicenceDlgProc); return TRUE; } @@ -544,8 +535,8 @@ GeneralPageProc(HWND hwndDlg, case WM_DRAWITEM: { - LPDRAWITEMSTRUCT lpDrawItem; - lpDrawItem = (LPDRAWITEMSTRUCT) lParam; + LPDRAWITEMSTRUCT lpDrawItem = (LPDRAWITEMSTRUCT) lParam; + if (lpDrawItem->CtlID == IDC_ROSIMG) { HDC hdcMem; @@ -581,12 +572,7 @@ GeneralPageProc(HWND hwndDlg, { PNMLINK nml = (PNMLINK)nmhdr; - ShellExecuteW(hwndDlg, - L"open", - nml->item.szUrl, - NULL, - NULL, - SW_SHOWNORMAL); + ShellExecuteW(hwndDlg, L"open", nml->item.szUrl, NULL, NULL, SW_SHOWNORMAL); } break; } diff --git a/dll/cpl/sysdm/lang/bg-BG.rc b/dll/cpl/sysdm/lang/bg-BG.rc index d9fd309f8f2..bbd5bca8a30 100644 --- a/dll/cpl/sysdm/lang/bg-BG.rc +++ b/dll/cpl/sysdm/lang/bg-BG.rc @@ -278,5 +278,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/cs-CZ.rc b/dll/cpl/sysdm/lang/cs-CZ.rc index fb6e315fbd2..a8038604979 100644 --- a/dll/cpl/sysdm/lang/cs-CZ.rc +++ b/dll/cpl/sysdm/lang/cs-CZ.rc @@ -273,15 +273,15 @@ BEGIN IDS_USERPROFILE_NAME "Název" IDS_USERPROFILE_SIZE "Velikost" IDS_USERPROFILE_TYPE "Typ" - IDS_USERPROFILE_STATUS "Status" + IDS_USERPROFILE_STATUS "Stav" IDS_USERPROFILE_MODIFIED "Upraveno" IDS_MESSAGEBOXTITLE "Systémový aplet kontrolních panelů" IDS_WARNINITIALSIZE "Zadejte číselnou hodnotu pro úvodní velikost stránkovacího souboru." IDS_WARNMAXIMUMSIZE "Zadejte číselnou hodnotu pro maximální velikost stránkovacího souboru." IDS_WARNINITIALRANGE "Výchozí velikost stránkovacího souboru nesmí být menší než 2 MB a nesmí překročit množství volného místa na zvolené diskové jednotce." IDS_WARNMAXIMUMRANGE "Maximální velikost stránkovacího souboru nesmí být menší než velikost výchozí a nesmí překročit množství volného místa na zvolené diskové jednotce." - IDS_PAGEFILE_NONE "none" - IDS_PAGEFILE_SYSTEM "system managed" - IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_PAGEFILE_NONE "není" + IDS_PAGEFILE_SYSTEM "spravováno systémem" + IDS_INFOREBOOT "Změny se projeví po restartování počítače." + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/da-DK.rc b/dll/cpl/sysdm/lang/da-DK.rc index 49c61680f13..b5e8966e6df 100644 --- a/dll/cpl/sysdm/lang/da-DK.rc +++ b/dll/cpl/sysdm/lang/da-DK.rc @@ -278,5 +278,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/de-DE.rc b/dll/cpl/sysdm/lang/de-DE.rc index ed64877acea..bb39dbfb75d 100644 --- a/dll/cpl/sysdm/lang/de-DE.rc +++ b/dll/cpl/sysdm/lang/de-DE.rc @@ -287,5 +287,5 @@ BEGIN IDS_PAGEFILE_NONE "Keine" IDS_PAGEFILE_SYSTEM "Systemverwaltet" IDS_INFOREBOOT "Sie müssen den Computer neu starten, damit die Änderung wirksam wird." - IDS_DEVS "\nReactOS Team\n\nProjektkoordinator\n\nAleksey Bragin\n\nEntwicklerteam\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Verantwortliche\n\nColin Finck\nZ98\n\nWebseitenteam\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedienteam\n\nMindflyer\nWierd_W\n\nweiterer Dank geht an\n\nalle Mitwirkenden\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nProjektkoordinator\n\nAleksey Bragin\n\nEntwicklerteam\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Verantwortliche\n\nColin Finck\nZ98\n\nWebseitenteam\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedienteam\n\nMindflyer\nWierd_W\n\nweiterer Dank geht an\n\nalle Mitwirkenden\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/el-GR.rc b/dll/cpl/sysdm/lang/el-GR.rc index 04674c5813c..3e88eb36964 100644 --- a/dll/cpl/sysdm/lang/el-GR.rc +++ b/dll/cpl/sysdm/lang/el-GR.rc @@ -278,5 +278,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/en-US.rc b/dll/cpl/sysdm/lang/en-US.rc index b790e8e0fe8..4a5f28edf78 100644 --- a/dll/cpl/sysdm/lang/en-US.rc +++ b/dll/cpl/sysdm/lang/en-US.rc @@ -278,5 +278,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/es-ES.rc b/dll/cpl/sysdm/lang/es-ES.rc index da49c7ab8c8..ad46de66e6e 100644 --- a/dll/cpl/sysdm/lang/es-ES.rc +++ b/dll/cpl/sysdm/lang/es-ES.rc @@ -280,5 +280,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/fr-FR.rc b/dll/cpl/sysdm/lang/fr-FR.rc index bd7a82cdde7..f2f121425bb 100644 --- a/dll/cpl/sysdm/lang/fr-FR.rc +++ b/dll/cpl/sysdm/lang/fr-FR.rc @@ -278,5 +278,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/he-IL.rc b/dll/cpl/sysdm/lang/he-IL.rc index 29c2b8f13ab..e28287fb7c2 100644 --- a/dll/cpl/sysdm/lang/he-IL.rc +++ b/dll/cpl/sysdm/lang/he-IL.rc @@ -280,5 +280,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/hu-HU.rc b/dll/cpl/sysdm/lang/hu-HU.rc index a852ea6bf6e..5a67ae51ff8 100644 --- a/dll/cpl/sysdm/lang/hu-HU.rc +++ b/dll/cpl/sysdm/lang/hu-HU.rc @@ -280,5 +280,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/id-ID.rc b/dll/cpl/sysdm/lang/id-ID.rc index 1e033e31522..55023159ded 100644 --- a/dll/cpl/sysdm/lang/id-ID.rc +++ b/dll/cpl/sysdm/lang/id-ID.rc @@ -278,5 +278,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/it-IT.rc b/dll/cpl/sysdm/lang/it-IT.rc index d87ee3f6592..bd0d3f6f403 100644 --- a/dll/cpl/sysdm/lang/it-IT.rc +++ b/dll/cpl/sysdm/lang/it-IT.rc @@ -278,5 +278,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nCoordinatore\n\nAleksey Bragin\n\nGruppo di sviluppo\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nUlteriori ringraziamenti\n\na tutti i Contributers\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nCoordinatore\n\nAleksey Bragin\n\nGruppo di sviluppo\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nUlteriori ringraziamenti\n\na tutti i Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/ja-JP.rc b/dll/cpl/sysdm/lang/ja-JP.rc index c9419b99fe9..79a13ab1417 100644 --- a/dll/cpl/sysdm/lang/ja-JP.rc +++ b/dll/cpl/sysdm/lang/ja-JP.rc @@ -278,5 +278,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/nl-NL.rc b/dll/cpl/sysdm/lang/nl-NL.rc index e66da432dc0..0c78f71c7ce 100644 --- a/dll/cpl/sysdm/lang/nl-NL.rc +++ b/dll/cpl/sysdm/lang/nl-NL.rc @@ -278,5 +278,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/no-NO.rc b/dll/cpl/sysdm/lang/no-NO.rc index dca5cd7204f..03c1d1f8eac 100644 --- a/dll/cpl/sysdm/lang/no-NO.rc +++ b/dll/cpl/sysdm/lang/no-NO.rc @@ -278,5 +278,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/pl-PL.rc b/dll/cpl/sysdm/lang/pl-PL.rc index 33add887c43..ba0825fa37e 100644 --- a/dll/cpl/sysdm/lang/pl-PL.rc +++ b/dll/cpl/sysdm/lang/pl-PL.rc @@ -4,7 +4,7 @@ * https://sourceforge.net/projects/reactospl * Updated by Caemyr - Olaf Siejka (Jan, 2008) * UTF-8 conversion by Caemyr (May, 2011) - * Updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (August, 2011) + * Updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (April, 2014) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -284,8 +284,8 @@ BEGIN IDS_WARNMAXIMUMSIZE "Wprowadź wielkość dla maksymalnego rozmiaru pliku stronicowania." IDS_WARNINITIALRANGE "Początkowy rozmiar pliku stronicowania nie może być mniejszy niż 2MB i nie może przekraczać dostępnej ilości miejsca w wybranym napędzie." IDS_WARNMAXIMUMRANGE "Maksymalny rozmiar pliku stronicowania nie może być mniejszy niż jego rozmiar początkowy i nie może przekraczać dostępnej ilości miejsca w wybranym napędzie." - IDS_PAGEFILE_NONE "none" - IDS_PAGEFILE_SYSTEM "system managed" - IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nEkipa ReactOS\n\nKoordynator Projektu\n\nAleksey Bragin\n\nEkipa Programistów\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nInżynierowie Wydań\n\nColin Finck\nZ98\n\nEkipa WWW\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nEkipa PR\n\nMindflyer\nWierd_W\n\nPodziękowania dla\n\nwszystkich współpracowników\nEkipy Wine\n\n"//FIXME + IDS_PAGEFILE_NONE "brak" + IDS_PAGEFILE_SYSTEM "Kontrolowany przez system" + IDS_INFOREBOOT "Musisz ponownie uruchomić komputer, aby zastosować zmiany." + IDS_DEVS "\nEkipa ReactOS\n\nKoordynator Projektu\n\nAleksey Bragin\n\nEkipa Programistów\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nInżynierowie Wydań\n\nColin Finck\nZ98\n\nEkipa WWW\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nEkipa PR\n\nMindflyer\nWierd_W\n\nPodziękowania dla\n\nwszystkich współpracowników\nEkipy Wine\n\n"//FIXME END diff --git a/dll/cpl/sysdm/lang/ro-RO.rc b/dll/cpl/sysdm/lang/ro-RO.rc index 6dda9d5769d..5117390ac53 100644 --- a/dll/cpl/sysdm/lang/ro-RO.rc +++ b/dll/cpl/sysdm/lang/ro-RO.rc @@ -280,5 +280,5 @@ BEGIN IDS_PAGEFILE_NONE "nespecificat" IDS_PAGEFILE_SYSTEM "gestionat de sistem" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nEchipa ReactOS\n\nCoordonator de proiect\n\nAleksey Bragin\n\nEchipa de dezvoltare\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nIngineri de distribuție\n\nColin Finck\nZ98\n\nEchipa paginii web\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nEchipa multimedia\n\nMindflyer\nWierd_W\n\nmulțumiri adresate către\n\ntoți Contribuitorii\nEchipa Wine\n\n" + IDS_DEVS "\nEchipa ReactOS\n\nCoordonator de proiect\n\nAleksey Bragin\n\nEchipa de dezvoltare\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nIngineri de distribuție\n\nColin Finck\nZ98\n\nEchipa paginii web\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nEchipa multimedia\n\nMindflyer\nWierd_W\n\nmulțumiri adresate către\n\ntoți Contribuitorii\nEchipa Wine\n\n" END diff --git a/dll/cpl/sysdm/lang/ru-RU.rc b/dll/cpl/sysdm/lang/ru-RU.rc index f2c4fb9c598..e2e2cc44a8b 100644 --- a/dll/cpl/sysdm/lang/ru-RU.rc +++ b/dll/cpl/sysdm/lang/ru-RU.rc @@ -1,4 +1,4 @@ -LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT +LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_PROPPAGEGENERAL DIALOGEX 0, 0, 256, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION @@ -278,5 +278,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nКоманда ReactOS\n\nКоординатор проекта\n\nАлексей Брагин\n\nКоллектив разработчиков\n\nАлексей Брагин\nЭндрю Гринвуд\nАндрей Коротаев\nАрт Йеркс\nКристоф фон Виттих\nКолин Финк\nДаниэль Раймер\nДмитрий Чапышев\nЭрик Коль\nГед Мёрфи\nГрегор Брюнмар\nЭрве Поссино\nДжеймс Тэбор\nДжеффри Морлан\nЙоханнес Андервальд\nKJK::Гиперион\nМаартен Босма\nМагнус Олсен\nМарк Пиулахс\nМаттиас Купфер\nМайк Норделл\nПитер Вард\nПьер Швейцер\nСавелий Третьяков\nСтефан Гинсберг\nСильвейн Петреоль\nТомас Блюмель\nТимо Кройцер\n\nАлекс Ионеску\nФилип Навара\nГуннар Далснес\nМартин Фукс\nРойс Митчелл III\nБрэндон Тёрнер\nБрайан Палмер\nКаспер Хорнструп\nДэвид Велч\nЭмануэль Алиберти\nГе ван Гельдорп\nГрегор Анич\nДжейсон Филби\nЙенс Коллин\nМихаэль Вирт\nНатан Вудс\nРоберт Дикенсон\nРекс Джоллифф\nVizzini\n\nРелиз-инженеры\n\nКолин Финк\nЦзылян Гуо\n\nРазработка веб-сайта\n\nКолин Финк\nЯн Блумквист Кинандер\nКлеменс Фридл\nЦзылян Гуо\n\nГрафический дизайн\n\nMindflyer\nWierd_W\n\nБлагодарности\n\nвсем участникам проекта\nКоманде Wine\n\n" + IDS_DEVS "\nКоманда ReactOS\n\nКоординатор проекта\n\nАлексей Брагин\n\nКоллектив разработчиков\n\nАлексей Брагин\nЭндрю Гринвуд\nАндрей Коротаев\nАрт Йеркс\nКристоф фон Виттих\nКолин Финк\nДаниэль Раймер\nДмитрий Чапышев\nЭрик Коль\nГед Мёрфи\nГрегор Брюнмар\nЭрве Поссино\nДжеймс Тэбор\nДжеффри Морлан\nЙоханнес Андервальд\nKamil Horníček\nKJK::Гиперион\nМаартен Босма\nМагнус Олсен\nМарк Пиулахс\nМаттиас Купфер\nМайк Норделл\nПитер Вард\nПьер Швейцер\nСавелий Третьяков\nСтефан Гинсберг\nСильвейн Петреоль\nТомас Блюмель\nТимо Кройцер\n\nАлекс Ионеску\nФилип Навара\nГуннар Далснес\nМартин Фукс\nРойс Митчелл III\nБрэндон Тёрнер\nБрайан Палмер\nКаспер Хорнструп\nДэвид Велч\nЭмануэль Алиберти\nГе ван Гельдорп\nГрегор Анич\nДжейсон Филби\nЙенс Коллин\nМихаэль Вирт\nНатан Вудс\nРоберт Дикенсон\nРекс Джоллифф\nVizzini\n\nРелиз-инженеры\n\nКолин Финк\nЦзылян Гуо\n\nРазработка веб-сайта\n\nКолин Финк\nЯн Блумквист Кинандер\nКлеменс Фридл\nЦзылян Гуо\n\nГрафический дизайн\n\nMindflyer\nWierd_W\n\nБлагодарности\n\nвсем участникам проекта\nКоманде Wine\n\n" END diff --git a/dll/cpl/sysdm/lang/sk-SK.rc b/dll/cpl/sysdm/lang/sk-SK.rc index 939b2ecb17f..95b10879023 100644 --- a/dll/cpl/sysdm/lang/sk-SK.rc +++ b/dll/cpl/sysdm/lang/sk-SK.rc @@ -286,5 +286,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/sq-AL.rc b/dll/cpl/sysdm/lang/sq-AL.rc index 0accbd9b210..0fda8ba3125 100644 --- a/dll/cpl/sysdm/lang/sq-AL.rc +++ b/dll/cpl/sysdm/lang/sq-AL.rc @@ -278,5 +278,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/sv-SE.rc b/dll/cpl/sysdm/lang/sv-SE.rc index a632ffa0c67..b417d0f2189 100644 --- a/dll/cpl/sysdm/lang/sv-SE.rc +++ b/dll/cpl/sysdm/lang/sv-SE.rc @@ -280,5 +280,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/tr-TR.rc b/dll/cpl/sysdm/lang/tr-TR.rc index d930540931a..69726d81a5a 100644 --- a/dll/cpl/sysdm/lang/tr-TR.rc +++ b/dll/cpl/sysdm/lang/tr-TR.rc @@ -280,5 +280,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Takımı\n\nTasarı Eş Güdümcüsü:\n\nAleksey Bragin\n\nGeliştirme Takımı:\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nSürüm Tasarlayıcıları:\n\nColin Finck\nZ98\n\nUmûmî Ağ Sitesi Takımı:\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedya Takımı:\n\nMindflyer\nWierd_W\n\nAyrıca, diğer tüm katkıda bulunanlara teşekkürler:\nWine Takımı\n\n" + IDS_DEVS "\nReactOS Takımı\n\nTasarı Eş Güdümcüsü:\n\nAleksey Bragin\n\nGeliştirme Takımı:\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nSürüm Tasarlayıcıları:\n\nColin Finck\nZ98\n\nUmûmî Ağ Sitesi Takımı:\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedya Takımı:\n\nMindflyer\nWierd_W\n\nAyrıca, diğer tüm katkıda bulunanlara teşekkürler:\nWine Takımı\n\n" END diff --git a/dll/cpl/sysdm/lang/uk-UA.rc b/dll/cpl/sysdm/lang/uk-UA.rc index 78bb12d09e3..4ec99a0b670 100644 --- a/dll/cpl/sysdm/lang/uk-UA.rc +++ b/dll/cpl/sysdm/lang/uk-UA.rc @@ -286,5 +286,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/lang/zh-CN.rc b/dll/cpl/sysdm/lang/zh-CN.rc index 18a7ce8fcbc..2d6cc6dd13b 100644 --- a/dll/cpl/sysdm/lang/zh-CN.rc +++ b/dll/cpl/sysdm/lang/zh-CN.rc @@ -280,5 +280,5 @@ BEGIN IDS_PAGEFILE_NONE "none" IDS_PAGEFILE_SYSTEM "system managed" IDS_INFOREBOOT "You have to reboot the computer, in order to apply the changes." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKamil Horníček\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/precomp.h b/dll/cpl/sysdm/precomp.h index 417f8432221..5b362c7ed2b 100644 --- a/dll/cpl/sysdm/precomp.h +++ b/dll/cpl/sysdm/precomp.h @@ -52,8 +52,10 @@ typedef struct _PAGEFILE { TCHAR szDrive[3]; LPTSTR pszVolume; - UINT InitialSize; - UINT MaximumSize; + INT OldMinSize; + INT OldMaxSize; + INT NewMinSize; + INT NewMaxSize; UINT FreeSize; BOOL bUsed; } PAGEFILE, *PPAGEFILE; diff --git a/dll/cpl/sysdm/resource.h b/dll/cpl/sysdm/resource.h index 6557c2ced47..caddd705282 100644 --- a/dll/cpl/sysdm/resource.h +++ b/dll/cpl/sysdm/resource.h @@ -10,6 +10,7 @@ #define IDI_DOWN 2501 #define IDB_ROSBMP 55 +#define IDB_ROSMASK 56 #define IDS_CPLSYSTEMNAME 60 #define IDS_CPLSYSTEMDESCRIPTION 61 diff --git a/dll/cpl/sysdm/resources/rosbitmap.bmp b/dll/cpl/sysdm/resources/rosbitmap.bmp index 8a94a6ec9df..ee5891c3ccc 100644 Binary files a/dll/cpl/sysdm/resources/rosbitmap.bmp and b/dll/cpl/sysdm/resources/rosbitmap.bmp differ diff --git a/dll/cpl/sysdm/resources/rosbitmap_mask.bmp b/dll/cpl/sysdm/resources/rosbitmap_mask.bmp new file mode 100644 index 00000000000..9e0ef218561 Binary files /dev/null and b/dll/cpl/sysdm/resources/rosbitmap_mask.bmp differ diff --git a/dll/cpl/sysdm/sysdm.rc b/dll/cpl/sysdm/sysdm.rc index eadf9b35de7..a3447d09001 100644 --- a/dll/cpl/sysdm/sysdm.rc +++ b/dll/cpl/sysdm/sysdm.rc @@ -19,6 +19,7 @@ IDI_DEVMGR ICON "resources/devmgr.ico" IDI_UP ICON "resources/up.ico" IDI_DOWN ICON "resources/down.ico" IDB_ROSBMP BITMAP "resources/rosbitmap.bmp" +IDB_ROSMASK BITMAP "resources/rosbitmap_mask.bmp" RC_LICENSE RTDATA "resources/gpl.txt" diff --git a/dll/cpl/sysdm/virtmem.c b/dll/cpl/sysdm/virtmem.c index d7b2f8d2dd7..af9ce053522 100644 --- a/dll/cpl/sysdm/virtmem.c +++ b/dll/cpl/sysdm/virtmem.c @@ -108,8 +108,8 @@ ParseMemSettings(PVIRTMEM pVirtMem) LPTSTR DrivePtr = szDrives; TCHAR szDrive[3]; // Single drive TCHAR szVolume[MAX_PATH + 1]; - INT InitialSize; - INT MaximumSize; + INT MinSize; + INT MaxSize; INT DriveLen; INT PgCnt = 0; INT Len; @@ -129,19 +129,21 @@ ParseMemSettings(PVIRTMEM pVirtMem) if (GetDriveType(DrivePtr) == DRIVE_FIXED) { - InitialSize = -1; - MaximumSize = -1; + MinSize = -1; + MaxSize = -1; /* Does drive match the one in the registry ? */ if (!_tcsncmp(pVirtMem->szPagingFiles, szDrive, 2)) { GetPageFileSizes(pVirtMem->szPagingFiles, - &InitialSize, - &MaximumSize); + &MinSize, + &MaxSize); } - pVirtMem->Pagefile[PgCnt].InitialSize = InitialSize; - pVirtMem->Pagefile[PgCnt].MaximumSize = MaximumSize; + pVirtMem->Pagefile[PgCnt].OldMinSize = MinSize; + pVirtMem->Pagefile[PgCnt].OldMaxSize = MaxSize; + pVirtMem->Pagefile[PgCnt].NewMinSize = MinSize; + pVirtMem->Pagefile[PgCnt].NewMaxSize = MaxSize; pVirtMem->Pagefile[PgCnt].bUsed = TRUE; lstrcpy(pVirtMem->Pagefile[PgCnt].szDrive, szDrive); @@ -185,14 +187,14 @@ WritePageFileSettings(PVIRTMEM pVirtMem) for (i = 0; i < pVirtMem->Count; ++i) { if (pVirtMem->Pagefile[i].bUsed && - pVirtMem->Pagefile[i].InitialSize != -1 && - pVirtMem->Pagefile[i].MaximumSize != -1) + pVirtMem->Pagefile[i].NewMinSize != -1 && + pVirtMem->Pagefile[i].NewMaxSize != -1) { _stprintf(szText, _T("%s\\pagefile.sys %i %i"), pVirtMem->Pagefile[i].szDrive, - pVirtMem->Pagefile[i].InitialSize, - pVirtMem->Pagefile[i].MaximumSize); + pVirtMem->Pagefile[i].NewMinSize, + pVirtMem->Pagefile[i].NewMaxSize); /* Add it to our overall registry string */ lstrcpy(szPagingFiles + nPos, szText); @@ -229,8 +231,26 @@ WritePageFileSettings(PVIRTMEM pVirtMem) RegCloseKey(hk); } + if (bErr == FALSE) + { + /* Delete obsolete paging files on the next boot */ + for (i = 0; i < 26; i++) + { + if (pVirtMem->Pagefile[i].OldMinSize != -1 && + pVirtMem->Pagefile[i].NewMinSize == -1) + { + _stprintf(szText, + _T("%s\\pagefile.sys"), + pVirtMem->Pagefile[i].szDrive); + + MoveFileEx(szText, NULL, MOVEFILE_DELAY_UNTIL_REBOOT); + } + } + } + if (bErr) ShowLastWin32Error(pVirtMem->hSelf); + } @@ -283,16 +303,16 @@ InitPagefileList(PVIRTMEM pVirtMem) { if (pVirtMem->Pagefile[i].bUsed) { - if ((pVirtMem->Pagefile[i].InitialSize == -1) && - (pVirtMem->Pagefile[i].MaximumSize == -1)) + if ((pVirtMem->Pagefile[i].NewMinSize == -1) && + (pVirtMem->Pagefile[i].NewMaxSize == -1)) { LoadString(hApplet, IDS_PAGEFILE_NONE, szSize, sizeof(szSize) / sizeof(szSize[0])); } - else if ((pVirtMem->Pagefile[i].InitialSize == 0) && - (pVirtMem->Pagefile[i].MaximumSize == 0)) + else if ((pVirtMem->Pagefile[i].NewMinSize == 0) && + (pVirtMem->Pagefile[i].NewMaxSize == 0)) { LoadString(hApplet, IDS_PAGEFILE_SYSTEM, @@ -302,8 +322,8 @@ InitPagefileList(PVIRTMEM pVirtMem) else { _stprintf(szSize, _T("%d - %d"), - pVirtMem->Pagefile[i].InitialSize, - pVirtMem->Pagefile[i].MaximumSize); + pVirtMem->Pagefile[i].NewMinSize, + pVirtMem->Pagefile[i].NewMaxSize); } _stprintf(szDisplayString, @@ -331,16 +351,16 @@ UpdatePagefileEntry(PVIRTMEM pVirtMem, TCHAR szDisplayString[256]; TCHAR szSize[64]; - if ((pVirtMem->Pagefile[DriveIndex].InitialSize == -1) && - (pVirtMem->Pagefile[DriveIndex].MaximumSize == -1)) + if ((pVirtMem->Pagefile[DriveIndex].NewMinSize == -1) && + (pVirtMem->Pagefile[DriveIndex].NewMaxSize == -1)) { LoadString(hApplet, IDS_PAGEFILE_NONE, szSize, sizeof(szSize) / sizeof(szSize[0])); } - else if ((pVirtMem->Pagefile[DriveIndex].InitialSize == 0) && - (pVirtMem->Pagefile[DriveIndex].MaximumSize == 0)) + else if ((pVirtMem->Pagefile[DriveIndex].NewMinSize == 0) && + (pVirtMem->Pagefile[DriveIndex].NewMaxSize == 0)) { LoadString(hApplet, IDS_PAGEFILE_SYSTEM, @@ -351,8 +371,8 @@ UpdatePagefileEntry(PVIRTMEM pVirtMem, { _stprintf(szSize, _T("%d - %d"), - pVirtMem->Pagefile[DriveIndex].InitialSize, - pVirtMem->Pagefile[DriveIndex].MaximumSize); + pVirtMem->Pagefile[DriveIndex].NewMinSize, + pVirtMem->Pagefile[DriveIndex].NewMaxSize); } _stprintf(szDisplayString, @@ -371,8 +391,8 @@ static VOID OnSet(PVIRTMEM pVirtMem) { INT Index; - UINT InitialSize = -1; - UINT MaximumSize = -1; + UINT MinSize = -1; + UINT MaxSize = -1; BOOL bTranslated; INT DriveIndex = 0; @@ -393,10 +413,10 @@ OnSet(PVIRTMEM pVirtMem) if (IsDlgButtonChecked(pVirtMem->hSelf, IDC_CUSTOM) == BST_CHECKED) { - InitialSize = GetDlgItemInt(pVirtMem->hSelf, - IDC_INITIALSIZE, - &bTranslated, - FALSE); + MinSize = GetDlgItemInt(pVirtMem->hSelf, + IDC_INITIALSIZE, + &bTranslated, + FALSE); if (!bTranslated) { ResourceMessageBox(hApplet, @@ -407,10 +427,10 @@ OnSet(PVIRTMEM pVirtMem) return; } - MaximumSize = GetDlgItemInt(pVirtMem->hSelf, - IDC_MAXSIZE, - &bTranslated, - FALSE); + MaxSize = GetDlgItemInt(pVirtMem->hSelf, + IDC_MAXSIZE, + &bTranslated, + FALSE); if (!bTranslated) { ResourceMessageBox(hApplet, @@ -421,9 +441,9 @@ OnSet(PVIRTMEM pVirtMem) return; } - /* Check the valid range of the inial size */ - if (InitialSize < 2 || - InitialSize > pVirtMem->Pagefile[DriveIndex].FreeSize) + /* Check the valid range of the minimum size */ + if (MinSize < 2 || + MinSize > pVirtMem->Pagefile[DriveIndex].FreeSize) { ResourceMessageBox(hApplet, NULL, @@ -434,8 +454,8 @@ OnSet(PVIRTMEM pVirtMem) } /* Check the valid range of the maximum size */ - if (MaximumSize < InitialSize || - MaximumSize > pVirtMem->Pagefile[DriveIndex].FreeSize) + if (MaxSize < MinSize || + MaxSize > pVirtMem->Pagefile[DriveIndex].FreeSize) { ResourceMessageBox(hApplet, NULL, @@ -445,37 +465,31 @@ OnSet(PVIRTMEM pVirtMem) return; } - if ((pVirtMem->Pagefile[DriveIndex].InitialSize != InitialSize) && - (pVirtMem->Pagefile[DriveIndex].MaximumSize != MaximumSize)) - pVirtMem->bModified = TRUE; - - pVirtMem->Pagefile[DriveIndex].InitialSize = InitialSize; - pVirtMem->Pagefile[DriveIndex].MaximumSize = MaximumSize; + pVirtMem->Pagefile[DriveIndex].NewMinSize = MinSize; + pVirtMem->Pagefile[DriveIndex].NewMaxSize = MaxSize; pVirtMem->Pagefile[DriveIndex].bUsed = TRUE; } else if (IsDlgButtonChecked(pVirtMem->hSelf, IDC_NOPAGEFILE) == BST_CHECKED) { - if ((pVirtMem->Pagefile[DriveIndex].InitialSize != InitialSize) && - (pVirtMem->Pagefile[DriveIndex].MaximumSize != MaximumSize)) - pVirtMem->bModified = TRUE; - - /* Set sizes to -1 */ - pVirtMem->Pagefile[DriveIndex].InitialSize = -1; - pVirtMem->Pagefile[DriveIndex].MaximumSize = -1; + /* No pagefile */ + pVirtMem->Pagefile[DriveIndex].NewMinSize = -1; + pVirtMem->Pagefile[DriveIndex].NewMaxSize = -1; pVirtMem->Pagefile[DriveIndex].bUsed = TRUE; } else { - if ((pVirtMem->Pagefile[DriveIndex].InitialSize != InitialSize) && - (pVirtMem->Pagefile[DriveIndex].MaximumSize != MaximumSize)) - pVirtMem->bModified = TRUE; - - pVirtMem->Pagefile[DriveIndex].InitialSize = 0; - pVirtMem->Pagefile[DriveIndex].MaximumSize = 0; + /* System managed size*/ + pVirtMem->Pagefile[DriveIndex].NewMinSize = 0; + pVirtMem->Pagefile[DriveIndex].NewMaxSize = 0; pVirtMem->Pagefile[DriveIndex].bUsed = TRUE; } + /* Set the modified flag if min or max size has changed */ + if ((pVirtMem->Pagefile[DriveIndex].OldMinSize != pVirtMem->Pagefile[DriveIndex].NewMinSize) || + (pVirtMem->Pagefile[DriveIndex].OldMaxSize != pVirtMem->Pagefile[DriveIndex].NewMaxSize)) + pVirtMem->bModified = TRUE; + UpdatePagefileEntry(pVirtMem, Index, DriveIndex); } } @@ -510,8 +524,8 @@ OnSelChange(HWND hwndDlg, PVIRTMEM pVirtMem) SetDlgItemText(hwndDlg, IDC_SPACEAVAIL, szBuffer); } - if (pVirtMem->Pagefile[Index].InitialSize == -1 && - pVirtMem->Pagefile[Index].MaximumSize == -1) + if (pVirtMem->Pagefile[Index].NewMinSize == -1 && + pVirtMem->Pagefile[Index].NewMaxSize == -1) { /* No pagefile */ @@ -520,8 +534,8 @@ OnSelChange(HWND hwndDlg, PVIRTMEM pVirtMem) CheckDlgButton(pVirtMem->hSelf, IDC_NOPAGEFILE, BST_CHECKED); } - else if (pVirtMem->Pagefile[Index].InitialSize == 0 && - pVirtMem->Pagefile[Index].MaximumSize == 0) + else if (pVirtMem->Pagefile[Index].NewMinSize == 0 && + pVirtMem->Pagefile[Index].NewMaxSize == 0) { /* System managed size*/ @@ -540,12 +554,12 @@ OnSelChange(HWND hwndDlg, PVIRTMEM pVirtMem) SetDlgItemInt(pVirtMem->hSelf, IDC_INITIALSIZE, - pVirtMem->Pagefile[Index].InitialSize, + pVirtMem->Pagefile[Index].NewMinSize, FALSE); SetDlgItemInt(pVirtMem->hSelf, IDC_MAXSIZE, - pVirtMem->Pagefile[Index].MaximumSize, + pVirtMem->Pagefile[Index].NewMaxSize, FALSE); CheckDlgButton(pVirtMem->hSelf, @@ -611,8 +625,10 @@ OnInitDialog(HWND hwnd, PVIRTMEM pVirtMem) for (i = 0; i < 26; i++) { pVirtMem->Pagefile[i].bUsed = FALSE; - pVirtMem->Pagefile[i].InitialSize = -1; - pVirtMem->Pagefile[i].MaximumSize = -1; + pVirtMem->Pagefile[i].OldMinSize = -1; + pVirtMem->Pagefile[i].OldMaxSize = -1; + pVirtMem->Pagefile[i].NewMinSize = -1; + pVirtMem->Pagefile[i].NewMaxSize = -1; } /* Load the pagefile systems from the reg */ diff --git a/dll/cpl/usrmgr/lang/pl-PL.rc b/dll/cpl/usrmgr/lang/pl-PL.rc index 20ea393270b..ebe1aa08106 100644 --- a/dll/cpl/usrmgr/lang/pl-PL.rc +++ b/dll/cpl/usrmgr/lang/pl-PL.rc @@ -5,6 +5,7 @@ * http://www.reactos.org * IRC: irc.freenode.net #reactos-pl * UTF-8 conversion by Caemyr (May, 2011) + * Updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (April, 2014) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -18,11 +19,11 @@ FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_USERS_LIST, "SysListView32", LVS_REPORT | LVS_EDITLABELS | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 7, 7, 238, 85, WS_EX_CLIENTEDGE - PUSHBUTTON "A&dd...", IDC_USERS_ADD, 87, 98, 50, 14 - PUSHBUTTON "&Remove", IDC_USERS_REMOVE, 141, 98, 50, 14 - PUSHBUTTON "Pr&operties", IDC_USERS_PROPERTIES, 195, 98, 50, 14 - AUTOCHECKBOX "Require user name and password on system startup.", IDC_USERS_STARTUP_REQUIRE, 10, 118, 200, 14, WS_DISABLED - PUSHBUTTON "Reset Password", IDC_USERS_RESET, 165, 200, 80, 14, WS_DISABLED + PUSHBUTTON "&Dodaj...", IDC_USERS_ADD, 87, 98, 50, 14 + PUSHBUTTON "&Usuń", IDC_USERS_REMOVE, 141, 98, 50, 14 + PUSHBUTTON "Właściw&ości", IDC_USERS_PROPERTIES, 195, 98, 50, 14 + AUTOCHECKBOX "Wymagaj nazwy użytkownika i hasła przy starcie systemu.", IDC_USERS_STARTUP_REQUIRE, 10, 118, 200, 14, WS_DISABLED + PUSHBUTTON "Resetuj hasło", IDC_USERS_RESET, 165, 200, 80, 14, WS_DISABLED END IDD_GROUPS DIALOGEX 0, 0, 252, 223 @@ -32,9 +33,9 @@ FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_GROUPS_LIST, "SysListView32", LVS_REPORT | LVS_EDITLABELS | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 7, 7, 238, 85, WS_EX_CLIENTEDGE - PUSHBUTTON "A&dd...", IDC_GROUPS_ADD, 87, 98, 50, 14 - PUSHBUTTON "&Remove", IDC_GROUPS_REMOVE, 141, 98, 50, 14 - PUSHBUTTON "Pr&operties", IDC_GROUPS_PROPERTIES, 195, 98, 50, 14 + PUSHBUTTON "&Dodaj...", IDC_GROUPS_ADD, 87, 98, 50, 14 + PUSHBUTTON "&Usuń", IDC_GROUPS_REMOVE, 141, 98, 50, 14 + PUSHBUTTON "Właściw&ości", IDC_GROUPS_PROPERTIES, 195, 98, 50, 14 END IDD_EXTRA DIALOGEX 0, 0, 252, 223 diff --git a/dll/directx/wine/amstream/amstream_classes.idl b/dll/directx/wine/amstream/amstream_classes.idl index 064ce00060d..e6bda830b40 100644 --- a/dll/directx/wine/amstream/amstream_classes.idl +++ b/dll/directx/wine/amstream/amstream_classes.idl @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ helpstring("SFilter Class"), threading(both), diff --git a/dll/directx/wine/amstream/mediastreamfilter.c b/dll/directx/wine/amstream/mediastreamfilter.c index 3ec6fcf62cd..4b7a3b3b9cb 100644 --- a/dll/directx/wine/amstream/mediastreamfilter.c +++ b/dll/directx/wine/amstream/mediastreamfilter.c @@ -178,14 +178,13 @@ static HRESULT WINAPI BasePinImp_GetMediaType(BasePin *This, int index, AM_MEDIA return S_OK; } -static const BasePinFuncTable input_BaseFuncTable = { - BasePinImpl_CheckMediaType, - NULL, - BasePinImp_GetMediaTypeVersion, - BasePinImp_GetMediaType -}; - static const BaseInputPinFuncTable input_BaseInputFuncTable = { + { + BasePinImpl_CheckMediaType, + NULL, + BasePinImp_GetMediaTypeVersion, + BasePinImp_GetMediaType + }, NULL }; @@ -354,7 +353,8 @@ static HRESULT WINAPI MediaStreamFilterImpl_AddMediaStream(IMediaStreamFilter* i /* Pin name is "I{guid MSPID_PrimaryVideo or MSPID_PrimaryAudio}" */ info.achName[0] = 'I'; StringFromGUID2(&purpose_id, info.achName + 1, 40); - hr = BaseInputPin_Construct(&MediaStreamFilter_InputPin_Vtbl, &info, &input_BaseFuncTable, &input_BaseInputFuncTable, &This->filter.csFilter, NULL, &This->pins[This->nb_streams]); + hr = BaseInputPin_Construct(&MediaStreamFilter_InputPin_Vtbl, sizeof(BaseInputPin), &info, + &input_BaseInputFuncTable, &This->filter.csFilter, NULL, &This->pins[This->nb_streams]); if (FAILED(hr)) return hr; diff --git a/dll/directx/wine/d3d8/buffer.c b/dll/directx/wine/d3d8/buffer.c index 93a3cf0eff6..e230519dae0 100644 --- a/dll/directx/wine/d3d8/buffer.c +++ b/dll/directx/wine/d3d8/buffer.c @@ -45,7 +45,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_QueryInterface(IDirect3DVertexBuffer8 *i static ULONG WINAPI d3d8_vertexbuffer_AddRef(IDirect3DVertexBuffer8 *iface) { struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface); - ULONG refcount = InterlockedIncrement(&buffer->refcount); + ULONG refcount = InterlockedIncrement(&buffer->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, refcount); @@ -63,7 +63,7 @@ static ULONG WINAPI d3d8_vertexbuffer_AddRef(IDirect3DVertexBuffer8 *iface) static ULONG WINAPI d3d8_vertexbuffer_Release(IDirect3DVertexBuffer8 *iface) { struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface); - ULONG refcount = InterlockedDecrement(&buffer->refcount); + ULONG refcount = InterlockedDecrement(&buffer->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, refcount); @@ -101,52 +101,28 @@ static HRESULT WINAPI d3d8_vertexbuffer_SetPrivateData(IDirect3DVertexBuffer8 *i REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_set_private_data(&buffer->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d8_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer8 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_get_private_data(&buffer->resource, guid, data, data_size); } static HRESULT WINAPI d3d8_vertexbuffer_FreePrivateData(IDirect3DVertexBuffer8 *iface, REFGUID guid) { struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_free_private_data(&buffer->resource, guid); } static DWORD WINAPI d3d8_vertexbuffer_SetPriority(IDirect3DVertexBuffer8 *iface, DWORD priority) @@ -271,7 +247,9 @@ static const IDirect3DVertexBuffer8Vtbl Direct3DVertexBuffer8_Vtbl = static void STDMETHODCALLTYPE d3d8_vertexbuffer_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d8_vertexbuffer *buffer = parent; + d3d8_resource_cleanup(&buffer->resource); + HeapFree(GetProcessHeap(), 0, buffer); } static const struct wined3d_parent_ops d3d8_vertexbuffer_wined3d_parent_ops = @@ -285,7 +263,7 @@ HRESULT vertexbuffer_init(struct d3d8_vertexbuffer *buffer, struct d3d8_device * HRESULT hr; buffer->IDirect3DVertexBuffer8_iface.lpVtbl = &Direct3DVertexBuffer8_Vtbl; - buffer->refcount = 1; + d3d8_resource_init(&buffer->resource); buffer->fvf = fvf; wined3d_mutex_lock(); @@ -340,7 +318,7 @@ static HRESULT WINAPI d3d8_indexbuffer_QueryInterface(IDirect3DIndexBuffer8 *ifa static ULONG WINAPI d3d8_indexbuffer_AddRef(IDirect3DIndexBuffer8 *iface) { struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface); - ULONG refcount = InterlockedIncrement(&buffer->refcount); + ULONG refcount = InterlockedIncrement(&buffer->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, refcount); @@ -358,7 +336,7 @@ static ULONG WINAPI d3d8_indexbuffer_AddRef(IDirect3DIndexBuffer8 *iface) static ULONG WINAPI d3d8_indexbuffer_Release(IDirect3DIndexBuffer8 *iface) { struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface); - ULONG refcount = InterlockedDecrement(&buffer->refcount); + ULONG refcount = InterlockedDecrement(&buffer->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, refcount); @@ -396,52 +374,28 @@ static HRESULT WINAPI d3d8_indexbuffer_SetPrivateData(IDirect3DIndexBuffer8 *ifa REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_set_private_data(&buffer->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d8_indexbuffer_GetPrivateData(IDirect3DIndexBuffer8 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_get_private_data(&buffer->resource, guid, data, data_size); } static HRESULT WINAPI d3d8_indexbuffer_FreePrivateData(IDirect3DIndexBuffer8 *iface, REFGUID guid) { struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_free_private_data(&buffer->resource, guid); } static DWORD WINAPI d3d8_indexbuffer_SetPriority(IDirect3DIndexBuffer8 *iface, DWORD priority) @@ -565,7 +519,9 @@ static const IDirect3DIndexBuffer8Vtbl d3d8_indexbuffer_vtbl = static void STDMETHODCALLTYPE d3d8_indexbuffer_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d8_indexbuffer *buffer = parent; + d3d8_resource_cleanup(&buffer->resource); + HeapFree(GetProcessHeap(), 0, buffer); } static const struct wined3d_parent_ops d3d8_indexbuffer_wined3d_parent_ops = @@ -579,7 +535,7 @@ HRESULT indexbuffer_init(struct d3d8_indexbuffer *buffer, struct d3d8_device *de HRESULT hr; buffer->IDirect3DIndexBuffer8_iface.lpVtbl = &d3d8_indexbuffer_vtbl; - buffer->refcount = 1; + d3d8_resource_init(&buffer->resource); buffer->format = wined3dformat_from_d3dformat(format); wined3d_mutex_lock(); diff --git a/dll/directx/wine/d3d8/d3d8_main.c b/dll/directx/wine/d3d8/d3d8_main.c index 51e59915d40..a4dc5e69e2f 100644 --- a/dll/directx/wine/d3d8/d3d8_main.c +++ b/dll/directx/wine/d3d8/d3d8_main.c @@ -132,3 +132,81 @@ HRESULT WINAPI ValidatePixelShader(DWORD* pixelshader, DWORD* reserved1, BOOL bo } return ret; } + +void d3d8_resource_cleanup(struct d3d8_resource *resource) +{ + wined3d_private_store_cleanup(&resource->private_store); +} + +HRESULT d3d8_resource_free_private_data(struct d3d8_resource *resource, const GUID *guid) +{ + struct wined3d_private_data *entry; + + wined3d_mutex_lock(); + entry = wined3d_private_store_get_private_data(&resource->private_store, guid); + if (!entry) + { + wined3d_mutex_unlock(); + return D3DERR_NOTFOUND; + } + + wined3d_private_store_free_private_data(&resource->private_store, entry); + wined3d_mutex_unlock(); + + return D3D_OK; +} + +HRESULT d3d8_resource_get_private_data(struct d3d8_resource *resource, const GUID *guid, + void *data, DWORD *data_size) +{ + const struct wined3d_private_data *stored_data; + DWORD size_in; + HRESULT hr; + + wined3d_mutex_lock(); + stored_data = wined3d_private_store_get_private_data(&resource->private_store, guid); + if (!stored_data) + { + hr = D3DERR_NOTFOUND; + goto done; + } + + size_in = *data_size; + *data_size = stored_data->size; + if (!data) + { + hr = D3D_OK; + goto done; + } + if (size_in < stored_data->size) + { + hr = D3DERR_MOREDATA; + goto done; + } + + if (stored_data->flags & WINED3DSPD_IUNKNOWN) + IUnknown_AddRef(stored_data->content.object); + memcpy(data, stored_data->content.data, stored_data->size); + hr = D3D_OK; + +done: + wined3d_mutex_unlock(); + return hr; +} + +void d3d8_resource_init(struct d3d8_resource *resource) +{ + resource->refcount = 1; + wined3d_private_store_init(&resource->private_store); +} + +HRESULT d3d8_resource_set_private_data(struct d3d8_resource *resource, const GUID *guid, + const void *data, DWORD data_size, DWORD flags) +{ + HRESULT hr; + + wined3d_mutex_lock(); + hr = wined3d_private_store_set_private_data(&resource->private_store, guid, data, data_size, flags); + wined3d_mutex_unlock(); + return hr; +} diff --git a/dll/directx/wine/d3d8/d3d8_private.h b/dll/directx/wine/d3d8/d3d8_private.h index 9f4c224ab93..a60652d78f3 100644 --- a/dll/directx/wine/d3d8/d3d8_private.h +++ b/dll/directx/wine/d3d8/d3d8_private.h @@ -183,10 +183,24 @@ struct d3d8_device HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wined3d *wined3d, UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters) DECLSPEC_HIDDEN; +struct d3d8_resource +{ + LONG refcount; + struct wined3d_private_store private_store; +}; + +void d3d8_resource_cleanup(struct d3d8_resource *resource) DECLSPEC_HIDDEN; +HRESULT d3d8_resource_free_private_data(struct d3d8_resource *resource, const GUID *guid) DECLSPEC_HIDDEN; +HRESULT d3d8_resource_get_private_data(struct d3d8_resource *resource, const GUID *guid, + void *data, DWORD *data_size) DECLSPEC_HIDDEN; +void d3d8_resource_init(struct d3d8_resource *resource) DECLSPEC_HIDDEN; +HRESULT d3d8_resource_set_private_data(struct d3d8_resource *resource, const GUID *guid, + const void *data, DWORD data_size, DWORD flags) DECLSPEC_HIDDEN; + struct d3d8_volume { IDirect3DVolume8 IDirect3DVolume8_iface; - LONG refcount; + struct d3d8_resource resource; struct wined3d_volume *wined3d_volume; IUnknown *container; IUnknown *forwardReference; @@ -209,7 +223,7 @@ HRESULT d3d8_swapchain_create(struct d3d8_device *device, struct wined3d_swapcha struct d3d8_surface { IDirect3DSurface8 IDirect3DSurface8_iface; - LONG refcount; + struct d3d8_resource resource; struct wined3d_surface *wined3d_surface; IDirect3DDevice8 *parent_device; @@ -227,7 +241,7 @@ struct d3d8_surface *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface struct d3d8_vertexbuffer { IDirect3DVertexBuffer8 IDirect3DVertexBuffer8_iface; - LONG refcount; + struct d3d8_resource resource; struct wined3d_buffer *wined3d_buffer; IDirect3DDevice8 *parent_device; DWORD fvf; @@ -240,7 +254,7 @@ struct d3d8_vertexbuffer *unsafe_impl_from_IDirect3DVertexBuffer8(IDirect3DVerte struct d3d8_indexbuffer { IDirect3DIndexBuffer8 IDirect3DIndexBuffer8_iface; - LONG refcount; + struct d3d8_resource resource; struct wined3d_buffer *wined3d_buffer; IDirect3DDevice8 *parent_device; enum wined3d_format_id format; @@ -253,7 +267,7 @@ struct d3d8_indexbuffer *unsafe_impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBu struct d3d8_texture { IDirect3DBaseTexture8 IDirect3DBaseTexture8_iface; - LONG refcount; + struct d3d8_resource resource; struct wined3d_texture *wined3d_texture; IDirect3DDevice8 *parent_device; }; diff --git a/dll/directx/wine/d3d8/device.c b/dll/directx/wine/d3d8/device.c index 3737a74b2df..c519f80f0ea 100644 --- a/dll/directx/wine/d3d8/device.c +++ b/dll/directx/wine/d3d8/device.c @@ -585,7 +585,7 @@ static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource) } surface = wined3d_resource_get_parent(resource); - if (surface->refcount) + if (surface->resource.refcount) { WARN("Surface %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.\n", surface, resource); return D3DERR_DEVICELOST; diff --git a/dll/directx/wine/d3d8/directx.c b/dll/directx/wine/d3d8/directx.c index 954bf493f04..10b4ea0a2df 100644 --- a/dll/directx/wine/d3d8/directx.c +++ b/dll/directx/wine/d3d8/directx.c @@ -395,7 +395,7 @@ BOOL d3d8_init(struct d3d8 *d3d8) d3d8->refcount = 1; wined3d_mutex_lock(); - d3d8->wined3d = wined3d_create(8, flags); + d3d8->wined3d = wined3d_create(flags); wined3d_mutex_unlock(); if (!d3d8->wined3d) return FALSE; diff --git a/dll/directx/wine/d3d8/surface.c b/dll/directx/wine/d3d8/surface.c index 10abee875b0..116b5b94a12 100644 --- a/dll/directx/wine/d3d8/surface.c +++ b/dll/directx/wine/d3d8/surface.c @@ -59,7 +59,7 @@ static ULONG WINAPI d3d8_surface_AddRef(IDirect3DSurface8 *iface) else { /* No container, handle our own refcounting */ - ULONG ref = InterlockedIncrement(&surface->refcount); + ULONG ref = InterlockedIncrement(&surface->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -91,7 +91,7 @@ static ULONG WINAPI d3d8_surface_Release(IDirect3DSurface8 *iface) else { /* No container, handle our own refcounting */ - ULONG ref = InterlockedDecrement(&surface->refcount); + ULONG ref = InterlockedDecrement(&surface->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -147,52 +147,28 @@ static HRESULT WINAPI d3d8_surface_SetPrivateData(IDirect3DSurface8 *iface, REFG const void *data, DWORD data_size, DWORD flags) { struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_surface_get_resource(surface->wined3d_surface); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_set_private_data(&surface->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d8_surface_GetPrivateData(IDirect3DSurface8 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_surface_get_resource(surface->wined3d_surface); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_get_private_data(&surface->resource, guid, data, data_size); } static HRESULT WINAPI d3d8_surface_FreePrivateData(IDirect3DSurface8 *iface, REFGUID guid) { struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_surface_get_resource(surface->wined3d_surface); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_free_private_data(&surface->resource, guid); } static HRESULT WINAPI d3d8_surface_GetContainer(IDirect3DSurface8 *iface, REFIID riid, void **container) @@ -322,7 +298,9 @@ static const IDirect3DSurface8Vtbl d3d8_surface_vtbl = static void STDMETHODCALLTYPE surface_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d8_surface *surface = parent; + d3d8_resource_cleanup(&surface->resource); + HeapFree(GetProcessHeap(), 0, surface); } static const struct wined3d_parent_ops d3d8_surface_wined3d_parent_ops = @@ -334,7 +312,7 @@ void surface_init(struct d3d8_surface *surface, struct wined3d_surface *wined3d_ struct d3d8_device *device, const struct wined3d_parent_ops **parent_ops) { surface->IDirect3DSurface8_iface.lpVtbl = &d3d8_surface_vtbl; - surface->refcount = 1; + d3d8_resource_init(&surface->resource); wined3d_surface_incref(wined3d_surface); surface->wined3d_surface = wined3d_surface; surface->parent_device = &device->IDirect3DDevice8_iface; diff --git a/dll/directx/wine/d3d8/texture.c b/dll/directx/wine/d3d8/texture.c index 9ea83e7d938..7aadf5b3dab 100644 --- a/dll/directx/wine/d3d8/texture.c +++ b/dll/directx/wine/d3d8/texture.c @@ -56,7 +56,7 @@ static HRESULT WINAPI d3d8_texture_2d_QueryInterface(IDirect3DTexture8 *iface, R static ULONG WINAPI d3d8_texture_2d_AddRef(IDirect3DTexture8 *iface) { struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface); - ULONG ref = InterlockedIncrement(&texture->refcount); + ULONG ref = InterlockedIncrement(&texture->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -74,7 +74,7 @@ static ULONG WINAPI d3d8_texture_2d_AddRef(IDirect3DTexture8 *iface) static ULONG WINAPI d3d8_texture_2d_Release(IDirect3DTexture8 *iface) { struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface); - ULONG ref = InterlockedDecrement(&texture->refcount); + ULONG ref = InterlockedDecrement(&texture->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -110,52 +110,28 @@ static HRESULT WINAPI d3d8_texture_2d_SetPrivateData(IDirect3DTexture8 *iface, REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_set_private_data(&texture->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d8_texture_2d_GetPrivateData(IDirect3DTexture8 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_get_private_data(&texture->resource, guid, data, data_size); } static HRESULT WINAPI d3d8_texture_2d_FreePrivateData(IDirect3DTexture8 *iface, REFGUID guid) { struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_free_private_data(&texture->resource, guid); } static DWORD WINAPI d3d8_texture_2d_SetPriority(IDirect3DTexture8 *iface, DWORD priority) @@ -424,7 +400,7 @@ static HRESULT WINAPI d3d8_texture_cube_QueryInterface(IDirect3DCubeTexture8 *if static ULONG WINAPI d3d8_texture_cube_AddRef(IDirect3DCubeTexture8 *iface) { struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface); - ULONG ref = InterlockedIncrement(&texture->refcount); + ULONG ref = InterlockedIncrement(&texture->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -442,7 +418,7 @@ static ULONG WINAPI d3d8_texture_cube_AddRef(IDirect3DCubeTexture8 *iface) static ULONG WINAPI d3d8_texture_cube_Release(IDirect3DCubeTexture8 *iface) { struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface); - ULONG ref = InterlockedDecrement(&texture->refcount); + ULONG ref = InterlockedDecrement(&texture->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -480,52 +456,28 @@ static HRESULT WINAPI d3d8_texture_cube_SetPrivateData(IDirect3DCubeTexture8 *if REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_set_private_data(&texture->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d8_texture_cube_GetPrivateData(IDirect3DCubeTexture8 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_get_private_data(&texture->resource, guid, data, data_size); } static HRESULT WINAPI d3d8_texture_cube_FreePrivateData(IDirect3DCubeTexture8 *iface, REFGUID guid) { struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_free_private_data(&texture->resource, guid); } static DWORD WINAPI d3d8_texture_cube_SetPriority(IDirect3DCubeTexture8 *iface, DWORD priority) @@ -817,7 +769,7 @@ static HRESULT WINAPI d3d8_texture_3d_QueryInterface(IDirect3DVolumeTexture8 *if static ULONG WINAPI d3d8_texture_3d_AddRef(IDirect3DVolumeTexture8 *iface) { struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface); - ULONG ref = InterlockedIncrement(&texture->refcount); + ULONG ref = InterlockedIncrement(&texture->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -835,7 +787,7 @@ static ULONG WINAPI d3d8_texture_3d_AddRef(IDirect3DVolumeTexture8 *iface) static ULONG WINAPI d3d8_texture_3d_Release(IDirect3DVolumeTexture8 *iface) { struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface); - ULONG ref = InterlockedDecrement(&texture->refcount); + ULONG ref = InterlockedDecrement(&texture->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -871,52 +823,28 @@ static HRESULT WINAPI d3d8_texture_3d_SetPrivateData(IDirect3DVolumeTexture8 *if REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_set_private_data(&texture->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d8_texture_3d_GetPrivateData(IDirect3DVolumeTexture8 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_get_private_data(&texture->resource, guid, data, data_size); } static HRESULT WINAPI d3d8_texture_3d_FreePrivateData(IDirect3DVolumeTexture8 *iface, REFGUID guid) { struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_free_private_data(&texture->resource, guid); } static DWORD WINAPI d3d8_texture_3d_SetPriority(IDirect3DVolumeTexture8 *iface, DWORD priority) @@ -1171,7 +1099,9 @@ struct d3d8_texture *unsafe_impl_from_IDirect3DBaseTexture8(IDirect3DBaseTexture static void STDMETHODCALLTYPE d3d8_texture_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d8_texture *texture = parent; + d3d8_resource_cleanup(&texture->resource); + HeapFree(GetProcessHeap(), 0, texture); } static const struct wined3d_parent_ops d3d8_texture_wined3d_parent_ops = @@ -1187,7 +1117,7 @@ HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device, HRESULT hr; texture->IDirect3DBaseTexture8_iface.lpVtbl = (const IDirect3DBaseTexture8Vtbl *)&Direct3DTexture8_Vtbl; - texture->refcount = 1; + d3d8_resource_init(&texture->resource); desc.resource_type = WINED3D_RTYPE_TEXTURE; desc.format = wined3dformat_from_d3dformat(format); @@ -1228,7 +1158,7 @@ HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *devic HRESULT hr; texture->IDirect3DBaseTexture8_iface.lpVtbl = (const IDirect3DBaseTexture8Vtbl *)&Direct3DCubeTexture8_Vtbl; - texture->refcount = 1; + d3d8_resource_init(&texture->resource); desc.resource_type = WINED3D_RTYPE_CUBE_TEXTURE; desc.format = wined3dformat_from_d3dformat(format); @@ -1268,7 +1198,7 @@ HRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_device *dev HRESULT hr; texture->IDirect3DBaseTexture8_iface.lpVtbl = (const IDirect3DBaseTexture8Vtbl *)&Direct3DVolumeTexture8_Vtbl; - texture->refcount = 1; + d3d8_resource_init(&texture->resource); desc.resource_type = WINED3D_RTYPE_VOLUME_TEXTURE; desc.format = wined3dformat_from_d3dformat(format); diff --git a/dll/directx/wine/d3d8/volume.c b/dll/directx/wine/d3d8/volume.c index d2399d51e4b..6396887e7cf 100644 --- a/dll/directx/wine/d3d8/volume.c +++ b/dll/directx/wine/d3d8/volume.c @@ -58,7 +58,7 @@ static ULONG WINAPI d3d8_volume_AddRef(IDirect3DVolume8 *iface) else { /* No container, handle our own refcounting */ - ULONG ref = InterlockedIncrement(&volume->refcount); + ULONG ref = InterlockedIncrement(&volume->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -88,7 +88,7 @@ static ULONG WINAPI d3d8_volume_Release(IDirect3DVolume8 *iface) else { /* No container, handle our own refcounting */ - ULONG ref = InterlockedDecrement(&volume->refcount); + ULONG ref = InterlockedDecrement(&volume->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -127,52 +127,28 @@ static HRESULT WINAPI d3d8_volume_SetPrivateData(IDirect3DVolume8 *iface, REFGUI const void *data, DWORD data_size, DWORD flags) { struct d3d8_volume *volume = impl_from_IDirect3DVolume8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_volume_get_resource(volume->wined3d_volume); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_set_private_data(&volume->resource, guid, data, data_size, flags); } -static HRESULT WINAPI d3d8_volume_GetPrivateData(IDirect3DVolume8 *iface, REFGUID guid, +static HRESULT WINAPI d3d8_volume_GetPrivateData(IDirect3DVolume8 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d8_volume *volume = impl_from_IDirect3DVolume8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_volume_get_resource(volume->wined3d_volume); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_get_private_data(&volume->resource, guid, data, data_size); } static HRESULT WINAPI d3d8_volume_FreePrivateData(IDirect3DVolume8 *iface, REFGUID guid) { struct d3d8_volume *volume = impl_from_IDirect3DVolume8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_volume_get_resource(volume->wined3d_volume); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_free_private_data(&volume->resource, guid); } static HRESULT WINAPI d3d8_volume_GetContainer(IDirect3DVolume8 *iface, REFIID riid, void **container) @@ -272,7 +248,9 @@ static const IDirect3DVolume8Vtbl d3d8_volume_vtbl = static void STDMETHODCALLTYPE volume_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d8_volume *volume = parent; + d3d8_resource_cleanup(&volume->resource); + HeapFree(GetProcessHeap(), 0, volume); } static const struct wined3d_parent_ops d3d8_volume_wined3d_parent_ops = @@ -284,7 +262,7 @@ void volume_init(struct d3d8_volume *volume, struct wined3d_volume *wined3d_volu const struct wined3d_parent_ops **parent_ops) { volume->IDirect3DVolume8_iface.lpVtbl = &d3d8_volume_vtbl; - volume->refcount = 1; + d3d8_resource_init(&volume->resource); wined3d_volume_incref(wined3d_volume); volume->wined3d_volume = wined3d_volume; diff --git a/dll/directx/wine/d3d9/buffer.c b/dll/directx/wine/d3d9/buffer.c index 92691b26de1..bb91b2aa5dc 100644 --- a/dll/directx/wine/d3d9/buffer.c +++ b/dll/directx/wine/d3d9/buffer.c @@ -47,7 +47,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_QueryInterface(IDirect3DVertexBuffer9 *i static ULONG WINAPI d3d9_vertexbuffer_AddRef(IDirect3DVertexBuffer9 *iface) { struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); - ULONG refcount = InterlockedIncrement(&buffer->refcount); + ULONG refcount = InterlockedIncrement(&buffer->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, refcount); @@ -65,7 +65,7 @@ static ULONG WINAPI d3d9_vertexbuffer_AddRef(IDirect3DVertexBuffer9 *iface) static ULONG WINAPI d3d9_vertexbuffer_Release(IDirect3DVertexBuffer9 *iface) { struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); - ULONG refcount = InterlockedDecrement(&buffer->refcount); + ULONG refcount = InterlockedDecrement(&buffer->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, refcount); @@ -102,52 +102,28 @@ static HRESULT WINAPI d3d9_vertexbuffer_SetPrivateData(IDirect3DVertexBuffer9 *i REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_set_private_data(&buffer->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d9_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer9 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_get_private_data(&buffer->resource, guid, data, data_size); } static HRESULT WINAPI d3d9_vertexbuffer_FreePrivateData(IDirect3DVertexBuffer9 *iface, REFGUID guid) { struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_free_private_data(&buffer->resource, guid); } static DWORD WINAPI d3d9_vertexbuffer_SetPriority(IDirect3DVertexBuffer9 *iface, DWORD priority) @@ -272,7 +248,9 @@ static const IDirect3DVertexBuffer9Vtbl d3d9_vertexbuffer_vtbl = static void STDMETHODCALLTYPE d3d9_vertexbuffer_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d9_vertexbuffer *buffer = parent; + d3d9_resource_cleanup(&buffer->resource); + HeapFree(GetProcessHeap(), 0, buffer); } static const struct wined3d_parent_ops d3d9_vertexbuffer_wined3d_parent_ops = @@ -286,8 +264,8 @@ HRESULT vertexbuffer_init(struct d3d9_vertexbuffer *buffer, struct d3d9_device * HRESULT hr; buffer->IDirect3DVertexBuffer9_iface.lpVtbl = &d3d9_vertexbuffer_vtbl; - buffer->refcount = 1; buffer->fvf = fvf; + d3d9_resource_init(&buffer->resource); wined3d_mutex_lock(); hr = wined3d_buffer_create_vb(device->wined3d_device, size, usage & WINED3DUSAGE_MASK, @@ -341,7 +319,7 @@ static HRESULT WINAPI d3d9_indexbuffer_QueryInterface(IDirect3DIndexBuffer9 *ifa static ULONG WINAPI d3d9_indexbuffer_AddRef(IDirect3DIndexBuffer9 *iface) { struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface); - ULONG refcount = InterlockedIncrement(&buffer->refcount); + ULONG refcount = InterlockedIncrement(&buffer->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, refcount); @@ -359,7 +337,7 @@ static ULONG WINAPI d3d9_indexbuffer_AddRef(IDirect3DIndexBuffer9 *iface) static ULONG WINAPI d3d9_indexbuffer_Release(IDirect3DIndexBuffer9 *iface) { struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface); - ULONG refcount = InterlockedDecrement(&buffer->refcount); + ULONG refcount = InterlockedDecrement(&buffer->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, refcount); @@ -396,52 +374,28 @@ static HRESULT WINAPI d3d9_indexbuffer_SetPrivateData(IDirect3DIndexBuffer9 *ifa REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_set_private_data(&buffer->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d9_indexbuffer_GetPrivateData(IDirect3DIndexBuffer9 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_get_private_data(&buffer->resource, guid, data, data_size); } static HRESULT WINAPI d3d9_indexbuffer_FreePrivateData(IDirect3DIndexBuffer9 *iface, REFGUID guid) { struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_free_private_data(&buffer->resource, guid); } static DWORD WINAPI d3d9_indexbuffer_SetPriority(IDirect3DIndexBuffer9 *iface, DWORD priority) @@ -564,7 +518,9 @@ static const IDirect3DIndexBuffer9Vtbl d3d9_indexbuffer_vtbl = static void STDMETHODCALLTYPE d3d9_indexbuffer_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d9_indexbuffer *buffer = parent; + d3d9_resource_cleanup(&buffer->resource); + HeapFree(GetProcessHeap(), 0, buffer); } static const struct wined3d_parent_ops d3d9_indexbuffer_wined3d_parent_ops = @@ -578,8 +534,8 @@ HRESULT indexbuffer_init(struct d3d9_indexbuffer *buffer, struct d3d9_device *de HRESULT hr; buffer->IDirect3DIndexBuffer9_iface.lpVtbl = &d3d9_indexbuffer_vtbl; - buffer->refcount = 1; buffer->format = wined3dformat_from_d3dformat(format); + d3d9_resource_init(&buffer->resource); wined3d_mutex_lock(); hr = wined3d_buffer_create_ib(device->wined3d_device, size, usage & WINED3DUSAGE_MASK, diff --git a/dll/directx/wine/d3d9/d3d9_main.c b/dll/directx/wine/d3d9/d3d9_main.c index b2a1c68a7f6..c0518562919 100644 --- a/dll/directx/wine/d3d9/d3d9_main.c +++ b/dll/directx/wine/d3d9/d3d9_main.c @@ -158,3 +158,81 @@ void WINAPI D3DPERF_SetRegion(D3DCOLOR color, const WCHAR *name) { FIXME("color 0x%08x, name %s stub!\n", color, debugstr_w(name)); } + +void d3d9_resource_cleanup(struct d3d9_resource *resource) +{ + wined3d_private_store_cleanup(&resource->private_store); +} + +HRESULT d3d9_resource_free_private_data(struct d3d9_resource *resource, const GUID *guid) +{ + struct wined3d_private_data *entry; + + wined3d_mutex_lock(); + entry = wined3d_private_store_get_private_data(&resource->private_store, guid); + if (!entry) + { + wined3d_mutex_unlock(); + return D3DERR_NOTFOUND; + } + + wined3d_private_store_free_private_data(&resource->private_store, entry); + wined3d_mutex_unlock(); + + return D3D_OK; +} + +HRESULT d3d9_resource_get_private_data(struct d3d9_resource *resource, const GUID *guid, + void *data, DWORD *data_size) +{ + const struct wined3d_private_data *stored_data; + DWORD size_in; + HRESULT hr; + + wined3d_mutex_lock(); + stored_data = wined3d_private_store_get_private_data(&resource->private_store, guid); + if (!stored_data) + { + hr = D3DERR_NOTFOUND; + goto done; + } + + size_in = *data_size; + *data_size = stored_data->size; + if (!data) + { + hr = D3D_OK; + goto done; + } + if (size_in < stored_data->size) + { + hr = D3DERR_MOREDATA; + goto done; + } + + if (stored_data->flags & WINED3DSPD_IUNKNOWN) + IUnknown_AddRef(stored_data->content.object); + memcpy(data, stored_data->content.data, stored_data->size); + hr = D3D_OK; + +done: + wined3d_mutex_unlock(); + return hr; +} + +void d3d9_resource_init(struct d3d9_resource *resource) +{ + resource->refcount = 1; + wined3d_private_store_init(&resource->private_store); +} + +HRESULT d3d9_resource_set_private_data(struct d3d9_resource *resource, const GUID *guid, + const void *data, DWORD data_size, DWORD flags) +{ + HRESULT hr; + + wined3d_mutex_lock(); + hr = wined3d_private_store_set_private_data(&resource->private_store, guid, data, data_size, flags); + wined3d_mutex_unlock(); + return hr; +} diff --git a/dll/directx/wine/d3d9/d3d9_private.h b/dll/directx/wine/d3d9/d3d9_private.h index e896c280c41..fb8d1666c9b 100644 --- a/dll/directx/wine/d3d9/d3d9_private.h +++ b/dll/directx/wine/d3d9/d3d9_private.h @@ -172,10 +172,24 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode) DECLSPEC_HIDDEN; +struct d3d9_resource +{ + LONG refcount; + struct wined3d_private_store private_store; +}; + +void d3d9_resource_cleanup(struct d3d9_resource *resource) DECLSPEC_HIDDEN; +HRESULT d3d9_resource_free_private_data(struct d3d9_resource *resource, const GUID *guid) DECLSPEC_HIDDEN; +HRESULT d3d9_resource_get_private_data(struct d3d9_resource *resource, const GUID *guid, + void *data, DWORD *data_size) DECLSPEC_HIDDEN; +void d3d9_resource_init(struct d3d9_resource *resource) DECLSPEC_HIDDEN; +HRESULT d3d9_resource_set_private_data(struct d3d9_resource *resource, const GUID *guid, + const void *data, DWORD data_size, DWORD flags) DECLSPEC_HIDDEN; + struct d3d9_volume { IDirect3DVolume9 IDirect3DVolume9_iface; - LONG refcount; + struct d3d9_resource resource; struct wined3d_volume *wined3d_volume; IUnknown *container; IUnknown *forwardReference; @@ -198,7 +212,7 @@ HRESULT d3d9_swapchain_create(struct d3d9_device *device, struct wined3d_swapcha struct d3d9_surface { IDirect3DSurface9 IDirect3DSurface9_iface; - LONG refcount; + struct d3d9_resource resource; struct wined3d_surface *wined3d_surface; IDirect3DDevice9Ex *parent_device; IUnknown *container; @@ -213,7 +227,7 @@ struct d3d9_surface *unsafe_impl_from_IDirect3DSurface9(IDirect3DSurface9 *iface struct d3d9_vertexbuffer { IDirect3DVertexBuffer9 IDirect3DVertexBuffer9_iface; - LONG refcount; + struct d3d9_resource resource; struct wined3d_buffer *wined3d_buffer; IDirect3DDevice9Ex *parent_device; DWORD fvf; @@ -226,7 +240,7 @@ struct d3d9_vertexbuffer *unsafe_impl_from_IDirect3DVertexBuffer9(IDirect3DVerte struct d3d9_indexbuffer { IDirect3DIndexBuffer9 IDirect3DIndexBuffer9_iface; - LONG refcount; + struct d3d9_resource resource; struct wined3d_buffer *wined3d_buffer; IDirect3DDevice9Ex *parent_device; enum wined3d_format_id format; @@ -239,7 +253,7 @@ struct d3d9_indexbuffer *unsafe_impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBu struct d3d9_texture { IDirect3DBaseTexture9 IDirect3DBaseTexture9_iface; - LONG refcount; + struct d3d9_resource resource; struct wined3d_texture *wined3d_texture; IDirect3DDevice9Ex *parent_device; }; diff --git a/dll/directx/wine/d3d9/device.c b/dll/directx/wine/d3d9/device.c index efff993cfac..7306d0851ba 100644 --- a/dll/directx/wine/d3d9/device.c +++ b/dll/directx/wine/d3d9/device.c @@ -578,7 +578,7 @@ static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource) } surface = wined3d_resource_get_parent(resource); - if (surface->refcount) + if (surface->resource.refcount) { WARN("Surface %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.\n", surface, resource); return D3DERR_INVALIDCALL; @@ -3063,7 +3063,7 @@ static HRESULT WINAPI d3d9_device_ComposeRects(IDirect3DDevice9Ex *iface, return E_NOTIMPL; } -static HRESULT WINAPI d3d9_device_PresentEx(IDirect3DDevice9Ex *iface, +static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_PresentEx(IDirect3DDevice9Ex *iface, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, const RGNDATA *dirty_region, DWORD flags) { @@ -3182,7 +3182,7 @@ static HRESULT WINAPI d3d9_device_CreateDepthStencilSurfaceEx(IDirect3DDevice9Ex return E_NOTIMPL; } -static HRESULT WINAPI d3d9_device_ResetEx(IDirect3DDevice9Ex *iface, +static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_ResetEx(IDirect3DDevice9Ex *iface, D3DPRESENT_PARAMETERS *present_parameters, D3DDISPLAYMODEEX *mode) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); diff --git a/dll/directx/wine/d3d9/directx.c b/dll/directx/wine/d3d9/directx.c index be1917c216c..6b68838ed08 100644 --- a/dll/directx/wine/d3d9/directx.c +++ b/dll/directx/wine/d3d9/directx.c @@ -229,6 +229,10 @@ static HRESULT WINAPI d3d9_CheckDeviceType(IDirect3D9Ex *iface, UINT adapter, D3 TRACE("iface %p, adapter %u, device_type %#x, display_format %#x, backbuffer_format %#x, windowed %#x.\n", iface, adapter, device_type, display_format, backbuffer_format, windowed); + /* Others than that not supported by d3d9, but reported by wined3d for ddraw. Filter them out. */ + if (!windowed && display_format != D3DFMT_X8R8G8B8 && display_format != D3DFMT_R5G6B5) + return WINED3DERR_NOTAVAILABLE; + wined3d_mutex_lock(); hr = wined3d_check_device_type(d3d9->wined3d, adapter, device_type, wined3dformat_from_d3dformat(display_format), wined3dformat_from_d3dformat(backbuffer_format), windowed); @@ -629,12 +633,15 @@ static const struct IDirect3D9ExVtbl d3d9_vtbl = BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended) { - DWORD flags = extended ? 0 : WINED3D_VIDMEM_ACCOUNTING; + DWORD flags = WINED3D_PRESENT_CONVERSION; + + if (!extended) + flags |= WINED3D_VIDMEM_ACCOUNTING; d3d9->IDirect3D9Ex_iface.lpVtbl = &d3d9_vtbl; d3d9->refcount = 1; wined3d_mutex_lock(); - d3d9->wined3d = wined3d_create(9, flags); + d3d9->wined3d = wined3d_create(flags); wined3d_mutex_unlock(); if (!d3d9->wined3d) return FALSE; diff --git a/dll/directx/wine/d3d9/query.c b/dll/directx/wine/d3d9/query.c index 87cc54d8ed3..044a2ad4f9b 100644 --- a/dll/directx/wine/d3d9/query.c +++ b/dll/directx/wine/d3d9/query.c @@ -105,12 +105,17 @@ static D3DQUERYTYPE WINAPI d3d9_query_GetType(IDirect3DQuery9 *iface) static DWORD WINAPI d3d9_query_GetDataSize(IDirect3DQuery9 *iface) { struct d3d9_query *query = impl_from_IDirect3DQuery9(iface); + enum wined3d_query_type type; DWORD ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = wined3d_query_get_data_size(query->wined3d_query); + type = wined3d_query_get_type(query->wined3d_query); + if (type == WINED3D_QUERY_TYPE_TIMESTAMP_DISJOINT) + ret = sizeof(BOOL); + else + ret = wined3d_query_get_data_size(query->wined3d_query); wined3d_mutex_unlock(); return ret; @@ -133,13 +138,25 @@ static HRESULT WINAPI d3d9_query_Issue(IDirect3DQuery9 *iface, DWORD flags) static HRESULT WINAPI d3d9_query_GetData(IDirect3DQuery9 *iface, void *data, DWORD size, DWORD flags) { struct d3d9_query *query = impl_from_IDirect3DQuery9(iface); + enum wined3d_query_type type; HRESULT hr; TRACE("iface %p, data %p, size %u, flags %#x.\n", iface, data, size, flags); wined3d_mutex_lock(); - hr = wined3d_query_get_data(query->wined3d_query, data, size, flags); + type = wined3d_query_get_type(query->wined3d_query); + if (type == WINED3D_QUERY_TYPE_TIMESTAMP_DISJOINT && data) + { + struct wined3d_query_data_timestamp_disjoint data_disjoint; + + hr = wined3d_query_get_data(query->wined3d_query, &data_disjoint, sizeof(data_disjoint), flags); + *(BOOL *)data = data_disjoint.disjoint; + } + else + { + hr = wined3d_query_get_data(query->wined3d_query, data, size, flags); + } wined3d_mutex_unlock(); return hr; diff --git a/dll/directx/wine/d3d9/surface.c b/dll/directx/wine/d3d9/surface.c index 27e6744c80f..785e8604a88 100644 --- a/dll/directx/wine/d3d9/surface.c +++ b/dll/directx/wine/d3d9/surface.c @@ -58,7 +58,7 @@ static ULONG WINAPI d3d9_surface_AddRef(IDirect3DSurface9 *iface) return IUnknown_AddRef(surface->forwardReference); } - refcount = InterlockedIncrement(&surface->refcount); + refcount = InterlockedIncrement(&surface->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, refcount); if (refcount == 1) @@ -86,7 +86,7 @@ static ULONG WINAPI d3d9_surface_Release(IDirect3DSurface9 *iface) return IUnknown_Release(surface->forwardReference); } - refcount = InterlockedDecrement(&surface->refcount); + refcount = InterlockedDecrement(&surface->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, refcount); if (!refcount) @@ -140,52 +140,28 @@ static HRESULT WINAPI d3d9_surface_SetPrivateData(IDirect3DSurface9 *iface, REFG const void *data, DWORD data_size, DWORD flags) { struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_surface_get_resource(surface->wined3d_surface); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_set_private_data(&surface->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d9_surface_GetPrivateData(IDirect3DSurface9 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_surface_get_resource(surface->wined3d_surface); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_get_private_data(&surface->resource, guid, data, data_size); } static HRESULT WINAPI d3d9_surface_FreePrivateData(IDirect3DSurface9 *iface, REFGUID guid) { struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_surface_get_resource(surface->wined3d_surface); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_free_private_data(&surface->resource, guid); } static DWORD WINAPI d3d9_surface_SetPriority(IDirect3DSurface9 *iface, DWORD priority) @@ -382,7 +358,9 @@ static const struct IDirect3DSurface9Vtbl d3d9_surface_vtbl = static void STDMETHODCALLTYPE surface_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d9_surface *surface = parent; + d3d9_resource_cleanup(&surface->resource); + HeapFree(GetProcessHeap(), 0, surface); } static const struct wined3d_parent_ops d3d9_surface_wined3d_parent_ops = @@ -396,7 +374,7 @@ void surface_init(struct d3d9_surface *surface, struct wined3d_surface *wined3d_ struct wined3d_resource_desc desc; surface->IDirect3DSurface9_iface.lpVtbl = &d3d9_surface_vtbl; - surface->refcount = 1; + d3d9_resource_init(&surface->resource); wined3d_resource_get_desc(wined3d_surface_get_resource(wined3d_surface), &desc); switch (d3dformat_from_wined3dformat(desc.format)) diff --git a/dll/directx/wine/d3d9/texture.c b/dll/directx/wine/d3d9/texture.c index 2cddc57e09a..5f14bf25c4a 100644 --- a/dll/directx/wine/d3d9/texture.c +++ b/dll/directx/wine/d3d9/texture.c @@ -58,7 +58,7 @@ static HRESULT WINAPI d3d9_texture_2d_QueryInterface(IDirect3DTexture9 *iface, R static ULONG WINAPI d3d9_texture_2d_AddRef(IDirect3DTexture9 *iface) { struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface); - ULONG ref = InterlockedIncrement(&texture->refcount); + ULONG ref = InterlockedIncrement(&texture->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -76,7 +76,7 @@ static ULONG WINAPI d3d9_texture_2d_AddRef(IDirect3DTexture9 *iface) static ULONG WINAPI d3d9_texture_2d_Release(IDirect3DTexture9 *iface) { struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface); - ULONG ref = InterlockedDecrement(&texture->refcount); + ULONG ref = InterlockedDecrement(&texture->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -112,52 +112,28 @@ static HRESULT WINAPI d3d9_texture_2d_SetPrivateData(IDirect3DTexture9 *iface, REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_set_private_data(&texture->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d9_texture_2d_GetPrivateData(IDirect3DTexture9 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_get_private_data(&texture->resource, guid, data, data_size); } static HRESULT WINAPI d3d9_texture_2d_FreePrivateData(IDirect3DTexture9 *iface, REFGUID guid) { struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_free_private_data(&texture->resource, guid); } static DWORD WINAPI d3d9_texture_2d_SetPriority(IDirect3DTexture9 *iface, DWORD priority) @@ -469,7 +445,7 @@ static HRESULT WINAPI d3d9_texture_cube_QueryInterface(IDirect3DCubeTexture9 *if static ULONG WINAPI d3d9_texture_cube_AddRef(IDirect3DCubeTexture9 *iface) { struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface); - ULONG ref = InterlockedIncrement(&texture->refcount); + ULONG ref = InterlockedIncrement(&texture->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -487,7 +463,7 @@ static ULONG WINAPI d3d9_texture_cube_AddRef(IDirect3DCubeTexture9 *iface) static ULONG WINAPI d3d9_texture_cube_Release(IDirect3DCubeTexture9 *iface) { struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface); - ULONG ref = InterlockedDecrement(&texture->refcount); + ULONG ref = InterlockedDecrement(&texture->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -525,52 +501,28 @@ static HRESULT WINAPI d3d9_texture_cube_SetPrivateData(IDirect3DCubeTexture9 *if REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_set_private_data(&texture->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d9_texture_cube_GetPrivateData(IDirect3DCubeTexture9 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_get_private_data(&texture->resource, guid, data, data_size); } static HRESULT WINAPI d3d9_texture_cube_FreePrivateData(IDirect3DCubeTexture9 *iface, REFGUID guid) { struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_free_private_data(&texture->resource, guid); } static DWORD WINAPI d3d9_texture_cube_SetPriority(IDirect3DCubeTexture9 *iface, DWORD priority) @@ -908,7 +860,7 @@ static HRESULT WINAPI d3d9_texture_3d_QueryInterface(IDirect3DVolumeTexture9 *if static ULONG WINAPI d3d9_texture_3d_AddRef(IDirect3DVolumeTexture9 *iface) { struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface); - ULONG ref = InterlockedIncrement(&texture->refcount); + ULONG ref = InterlockedIncrement(&texture->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -926,7 +878,7 @@ static ULONG WINAPI d3d9_texture_3d_AddRef(IDirect3DVolumeTexture9 *iface) static ULONG WINAPI d3d9_texture_3d_Release(IDirect3DVolumeTexture9 *iface) { struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface); - ULONG ref = InterlockedDecrement(&texture->refcount); + ULONG ref = InterlockedDecrement(&texture->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -962,52 +914,28 @@ static HRESULT WINAPI d3d9_texture_3d_SetPrivateData(IDirect3DVolumeTexture9 *if REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_set_private_data(&texture->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d9_texture_3d_GetPrivateData(IDirect3DVolumeTexture9 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_get_private_data(&texture->resource, guid, data, data_size); } static HRESULT WINAPI d3d9_texture_3d_FreePrivateData(IDirect3DVolumeTexture9 *iface, REFGUID guid) { struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_free_private_data(&texture->resource, guid); } static DWORD WINAPI d3d9_texture_3d_SetPriority(IDirect3DVolumeTexture9 *iface, DWORD priority) @@ -1295,7 +1223,9 @@ struct d3d9_texture *unsafe_impl_from_IDirect3DBaseTexture9(IDirect3DBaseTexture static void STDMETHODCALLTYPE d3d9_texture_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d9_texture *texture = parent; + d3d9_resource_cleanup(&texture->resource); + HeapFree(GetProcessHeap(), 0, texture); } static const struct wined3d_parent_ops d3d9_texture_wined3d_parent_ops = @@ -1311,7 +1241,7 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device, HRESULT hr; texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_2d_vtbl; - texture->refcount = 1; + d3d9_resource_init(&texture->resource); desc.resource_type = WINED3D_RTYPE_TEXTURE; desc.format = wined3dformat_from_d3dformat(format); @@ -1352,7 +1282,7 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic HRESULT hr; texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_cube_vtbl; - texture->refcount = 1; + d3d9_resource_init(&texture->resource); desc.resource_type = WINED3D_RTYPE_CUBE_TEXTURE; desc.format = wined3dformat_from_d3dformat(format); @@ -1392,7 +1322,7 @@ HRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *dev HRESULT hr; texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_3d_vtbl; - texture->refcount = 1; + d3d9_resource_init(&texture->resource); desc.resource_type = WINED3D_RTYPE_VOLUME_TEXTURE; desc.format = wined3dformat_from_d3dformat(format); diff --git a/dll/directx/wine/d3d9/volume.c b/dll/directx/wine/d3d9/volume.c index b0a629080bc..9a3419d295f 100644 --- a/dll/directx/wine/d3d9/volume.c +++ b/dll/directx/wine/d3d9/volume.c @@ -57,7 +57,7 @@ static ULONG WINAPI d3d9_volume_AddRef(IDirect3DVolume9 *iface) return IUnknown_AddRef(volume->forwardReference); } - refcount = InterlockedIncrement(&volume->refcount); + refcount = InterlockedIncrement(&volume->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, refcount); if (refcount == 1) @@ -83,7 +83,7 @@ static ULONG WINAPI d3d9_volume_Release(IDirect3DVolume9 *iface) return IUnknown_Release(volume->forwardReference); } - refcount = InterlockedDecrement(&volume->refcount); + refcount = InterlockedDecrement(&volume->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, refcount); if (!refcount) @@ -120,52 +120,28 @@ static HRESULT WINAPI d3d9_volume_SetPrivateData(IDirect3DVolume9 *iface, REFGUI const void *data, DWORD data_size, DWORD flags) { struct d3d9_volume *volume = impl_from_IDirect3DVolume9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_volume_get_resource(volume->wined3d_volume); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_set_private_data(&volume->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d9_volume_GetPrivateData(IDirect3DVolume9 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d9_volume *volume = impl_from_IDirect3DVolume9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_volume_get_resource(volume->wined3d_volume); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_get_private_data(&volume->resource, guid, data, data_size); } static HRESULT WINAPI d3d9_volume_FreePrivateData(IDirect3DVolume9 *iface, REFGUID guid) { struct d3d9_volume *volume = impl_from_IDirect3DVolume9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_volume_get_resource(volume->wined3d_volume); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_free_private_data(&volume->resource, guid); } static HRESULT WINAPI d3d9_volume_GetContainer(IDirect3DVolume9 *iface, REFIID riid, void **container) @@ -263,7 +239,9 @@ static const struct IDirect3DVolume9Vtbl d3d9_volume_vtbl = static void STDMETHODCALLTYPE volume_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d9_volume *volume = parent; + d3d9_resource_cleanup(&volume->resource); + HeapFree(GetProcessHeap(), 0, volume); } static const struct wined3d_parent_ops d3d9_volume_wined3d_parent_ops = @@ -275,7 +253,7 @@ void volume_init(struct d3d9_volume *volume, struct wined3d_volume *wined3d_volu const struct wined3d_parent_ops **parent_ops) { volume->IDirect3DVolume9_iface.lpVtbl = &d3d9_volume_vtbl; - volume->refcount = 1; + d3d9_resource_init(&volume->resource); wined3d_volume_incref(wined3d_volume); volume->wined3d_volume = wined3d_volume; diff --git a/dll/directx/wine/d3dcompiler_43/asmparser.c b/dll/directx/wine/d3dcompiler_43/asmparser.c index 12d5fc3fa1d..1e7d1072762 100644 --- a/dll/directx/wine/d3dcompiler_43/asmparser.c +++ b/dll/directx/wine/d3dcompiler_43/asmparser.c @@ -497,11 +497,10 @@ static void asmparser_texreg2rgb(struct asm_parser *This, DWORD mod, DWORD shift * go through asmparser_instr). */ -static void asmparser_instr(struct asm_parser *This, DWORD opcode, - DWORD mod, DWORD shift, - BWRITER_COMPARISON_TYPE comp, - const struct shader_reg *dst, - const struct src_regs *srcs, int expectednsrcs) { +static void asmparser_instr(struct asm_parser *This, DWORD opcode, DWORD mod, DWORD shift, + enum bwriter_comparison_type comp, const struct shader_reg *dst, + const struct src_regs *srcs, int expectednsrcs) +{ struct instruction *instr; unsigned int i; BOOL firstreg = TRUE; diff --git a/dll/directx/wine/d3dcompiler_43/asmshader.tab.c b/dll/directx/wine/d3dcompiler_43/asmshader.tab.c index c8d80d3ceef..9c8604b7969 100644 --- a/dll/directx/wine/d3dcompiler_43/asmshader.tab.c +++ b/dll/directx/wine/d3dcompiler_43/asmshader.tab.c @@ -343,12 +343,12 @@ typedef union YYSTYPE DWORD mod; DWORD shift; } modshift; - BWRITER_COMPARISON_TYPE comptype; + enum bwriter_comparison_type comptype; struct { DWORD dclusage; unsigned int regnum; } declaration; - BWRITERSAMPLER_TEXTURE_TYPE samplertype; + enum bwritersampler_texture_type samplertype; struct rel_reg rel_reg; struct src_regs sregs; diff --git a/dll/directx/wine/d3dcompiler_43/asmshader.tab.h b/dll/directx/wine/d3dcompiler_43/asmshader.tab.h index 04e200d4e05..145e94774bb 100644 --- a/dll/directx/wine/d3dcompiler_43/asmshader.tab.h +++ b/dll/directx/wine/d3dcompiler_43/asmshader.tab.h @@ -233,12 +233,12 @@ typedef union YYSTYPE DWORD mod; DWORD shift; } modshift; - BWRITER_COMPARISON_TYPE comptype; + enum bwriter_comparison_type comptype; struct { DWORD dclusage; unsigned int regnum; } declaration; - BWRITERSAMPLER_TEXTURE_TYPE samplertype; + enum bwritersampler_texture_type samplertype; struct rel_reg rel_reg; struct src_regs sregs; diff --git a/dll/directx/wine/d3dcompiler_43/asmshader.y b/dll/directx/wine/d3dcompiler_43/asmshader.y index 4109745a6a8..5948d57d5ed 100644 --- a/dll/directx/wine/d3dcompiler_43/asmshader.y +++ b/dll/directx/wine/d3dcompiler_43/asmshader.y @@ -92,12 +92,12 @@ int asmshader_lex(void); DWORD mod; DWORD shift; } modshift; - BWRITER_COMPARISON_TYPE comptype; + enum bwriter_comparison_type comptype; struct { DWORD dclusage; unsigned int regnum; } declaration; - BWRITERSAMPLER_TEXTURE_TYPE samplertype; + enum bwritersampler_texture_type samplertype; struct rel_reg rel_reg; struct src_regs sregs; } diff --git a/dll/directx/wine/d3dcompiler_43/asmshader.yy.c b/dll/directx/wine/d3dcompiler_43/asmshader.yy.c index 446779b3932..1b31cec460f 100644 --- a/dll/directx/wine/d3dcompiler_43/asmshader.yy.c +++ b/dll/directx/wine/d3dcompiler_43/asmshader.yy.c @@ -360,7 +360,7 @@ void asmshader_free (void * ); /* Begin user sect3 */ -#define asmshader_wrap() 1 +#define asmshader_wrap(n) 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; diff --git a/dll/directx/wine/d3dcompiler_43/compiler.c b/dll/directx/wine/d3dcompiler_43/compiler.c index c5f3bfead9a..9b2ec54d24b 100644 --- a/dll/directx/wine/d3dcompiler_43/compiler.c +++ b/dll/directx/wine/d3dcompiler_43/compiler.c @@ -144,8 +144,10 @@ static char *wpp_lookup_mem(const char *filename, int type, const char *parent_n char *path; int i; + TRACE("Looking for include %s.\n", debugstr_a(filename)); + parent_include = NULL; - if(parent_name[0] != '\0') + if (strcmp(parent_name, initial_filename)) { for(i = 0; i < includes_size; i++) { @@ -157,7 +159,7 @@ static char *wpp_lookup_mem(const char *filename, int type, const char *parent_n } if(parent_include == NULL) { - ERR("Parent include file missing\n"); + ERR("Parent include %s missing.\n", debugstr_a(parent_name)); return NULL; } } @@ -173,6 +175,8 @@ static void *wpp_open_mem(const char *filename, int type) struct mem_file_desc *desc; HRESULT hr; + TRACE("Opening include %s.\n", debugstr_a(filename)); + if(!strcmp(filename, initial_filename)) { current_shader.pos = 0; @@ -184,11 +188,8 @@ static void *wpp_open_mem(const char *filename, int type) if(!desc) return NULL; - hr = ID3DInclude_Open(current_include, - type ? D3D_INCLUDE_LOCAL : D3D_INCLUDE_SYSTEM, - filename, parent_include, (LPCVOID *)&desc->buffer, - &desc->size); - if(FAILED(hr)) + if (FAILED(hr = ID3DInclude_Open(current_include, type ? D3D_INCLUDE_LOCAL : D3D_INCLUDE_SYSTEM, + filename, parent_include, (const void **)&desc->buffer, &desc->size))) { HeapFree(GetProcessHeap(), 0, desc); return NULL; diff --git a/dll/directx/wine/d3dcompiler_43/d3dcompiler_43_main.c b/dll/directx/wine/d3dcompiler_43/d3dcompiler_43_main.c index 983031d5d95..f67f3a63f49 100644 --- a/dll/directx/wine/d3dcompiler_43/d3dcompiler_43_main.c +++ b/dll/directx/wine/d3dcompiler_43/d3dcompiler_43_main.c @@ -21,7 +21,7 @@ #include "d3dcompiler_private.h" -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) +BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, void *reserved) { switch (reason) { diff --git a/dll/directx/wine/d3dcompiler_43/d3dcompiler_private.h b/dll/directx/wine/d3dcompiler_43/d3dcompiler_private.h index c5304899ab3..0e887d0c66a 100644 --- a/dll/directx/wine/d3dcompiler_43/d3dcompiler_private.h +++ b/dll/directx/wine/d3dcompiler_43/d3dcompiler_private.h @@ -57,7 +57,8 @@ enum shader_type ST_PIXEL }; -typedef enum BWRITER_COMPARISON_TYPE { +enum bwriter_comparison_type +{ BWRITER_COMPARISON_NONE, BWRITER_COMPARISON_GT, BWRITER_COMPARISON_EQ, @@ -65,7 +66,7 @@ typedef enum BWRITER_COMPARISON_TYPE { BWRITER_COMPARISON_LT, BWRITER_COMPARISON_NE, BWRITER_COMPARISON_LE -} BWRITER_COMPARISON_TYPE; +}; struct constant { DWORD regnum; @@ -92,7 +93,7 @@ struct instruction { DWORD opcode; DWORD dstmod; DWORD shift; - BWRITER_COMPARISON_TYPE comptype; + enum bwriter_comparison_type comptype; BOOL has_dst; struct shader_reg dst; struct shader_reg *src; @@ -218,9 +219,9 @@ struct asmparser_backend { void (*end)(struct asm_parser *This); - void (*instr)(struct asm_parser *This, DWORD opcode, DWORD mod, DWORD shift, - BWRITER_COMPARISON_TYPE comp, const struct shader_reg *dst, - const struct src_regs *srcs, int expectednsrcs); + void (*instr)(struct asm_parser *parser, DWORD opcode, DWORD mod, DWORD shift, + enum bwriter_comparison_type comp, const struct shader_reg *dst, + const struct src_regs *srcs, int expectednsrcs); }; struct instruction *alloc_instr(unsigned int srcs) DECLSPEC_HIDDEN; @@ -367,11 +368,10 @@ const char *debug_print_opcode(DWORD opcode) DECLSPEC_HIDDEN; /* Used to signal an incorrect swizzle/writemask */ #define SWIZZLE_ERR ~0U -/* - Enumerations and defines used in the bytecode writer - intermediate representation -*/ -typedef enum _BWRITERSHADER_INSTRUCTION_OPCODE_TYPE { +/* Enumerations and defines used in the bytecode writer intermediate + * representation. */ +enum bwritershader_instruction_opcode_type +{ BWRITERSIO_NOP, BWRITERSIO_MOV, BWRITERSIO_ADD, @@ -460,9 +460,10 @@ typedef enum _BWRITERSHADER_INSTRUCTION_OPCODE_TYPE { BWRITERSIO_PHASE, BWRITERSIO_COMMENT, BWRITERSIO_END, -} BWRITERSHADER_INSTRUCTION_OPCODE_TYPE; +}; -typedef enum _BWRITERSHADER_PARAM_REGISTER_TYPE { +enum bwritershader_param_register_type +{ BWRITERSPR_TEMP, BWRITERSPR_INPUT, BWRITERSPR_CONST, @@ -481,14 +482,14 @@ typedef enum _BWRITERSHADER_PARAM_REGISTER_TYPE { BWRITERSPR_MISCTYPE, BWRITERSPR_LABEL, BWRITERSPR_PREDICATE -} BWRITERSHADER_PARAM_REGISTER_TYPE; +}; -typedef enum _BWRITERVS_RASTOUT_OFFSETS +enum bwritervs_rastout_offsets { BWRITERSRO_POSITION, BWRITERSRO_FOG, BWRITERSRO_POINT_SIZE -} BWRITERVS_RASTOUT_OFFSETS; +}; #define BWRITERSP_WRITEMASK_0 0x1 /* .x r */ #define BWRITERSP_WRITEMASK_1 0x2 /* .y g */ @@ -496,25 +497,28 @@ typedef enum _BWRITERVS_RASTOUT_OFFSETS #define BWRITERSP_WRITEMASK_3 0x8 /* .w a */ #define BWRITERSP_WRITEMASK_ALL 0xf /* all */ -typedef enum _BWRITERSHADER_PARAM_DSTMOD_TYPE { +enum bwritershader_param_dstmod_type +{ BWRITERSPDM_NONE = 0, BWRITERSPDM_SATURATE = 1, BWRITERSPDM_PARTIALPRECISION = 2, BWRITERSPDM_MSAMPCENTROID = 4, -} BWRITERSHADER_PARAM_DSTMOD_TYPE; +}; -typedef enum _BWRITERSAMPLER_TEXTURE_TYPE { +enum bwritersampler_texture_type +{ BWRITERSTT_UNKNOWN = 0, BWRITERSTT_1D = 1, BWRITERSTT_2D = 2, BWRITERSTT_CUBE = 3, BWRITERSTT_VOLUME = 4, -} BWRITERSAMPLER_TEXTURE_TYPE; +}; #define BWRITERSI_TEXLD_PROJECT 1 #define BWRITERSI_TEXLD_BIAS 2 -typedef enum _BWRITERSHADER_PARAM_SRCMOD_TYPE { +enum bwritershader_param_srcmod_type +{ BWRITERSPSM_NONE = 0, BWRITERSPSM_NEG, BWRITERSPSM_BIAS, @@ -529,7 +533,7 @@ typedef enum _BWRITERSHADER_PARAM_SRCMOD_TYPE { BWRITERSPSM_ABS, BWRITERSPSM_ABSNEG, BWRITERSPSM_NOT, -} BWRITERSHADER_PARAM_SRCMOD_TYPE; +}; #define BWRITER_SM1_VS 0xfffe #define BWRITER_SM1_PS 0xffff @@ -567,7 +571,8 @@ typedef enum _BWRITERSHADER_PARAM_SRCMOD_TYPE { #define BWRITERVS_SWIZZLE_Z (BWRITERVS_X_Z | BWRITERVS_Y_Z | BWRITERVS_Z_Z | BWRITERVS_W_Z) #define BWRITERVS_SWIZZLE_W (BWRITERVS_X_W | BWRITERVS_Y_W | BWRITERVS_Z_W | BWRITERVS_W_W) -typedef enum _BWRITERDECLUSAGE { +enum bwriterdeclusage +{ BWRITERDECLUSAGE_POSITION, BWRITERDECLUSAGE_BLENDWEIGHT, BWRITERDECLUSAGE_BLENDINDICES, @@ -582,7 +587,7 @@ typedef enum _BWRITERDECLUSAGE { BWRITERDECLUSAGE_FOG, BWRITERDECLUSAGE_DEPTH, BWRITERDECLUSAGE_SAMPLE -} BWRITERDECLUSAGE; +}; /* ps 1.x texture registers mappings */ #define T0_REG 2 diff --git a/dll/directx/wine/d3dcompiler_43/hlsl.yy.c b/dll/directx/wine/d3dcompiler_43/hlsl.yy.c index c6fc3e4a4e2..a3e98d5543c 100644 --- a/dll/directx/wine/d3dcompiler_43/hlsl.yy.c +++ b/dll/directx/wine/d3dcompiler_43/hlsl.yy.c @@ -360,7 +360,7 @@ void hlsl_free (void * ); /* Begin user sect3 */ -#define hlsl_wrap() 1 +#define hlsl_wrap(n) 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; diff --git a/dll/directx/wine/d3dcompiler_43/reflection.c b/dll/directx/wine/d3dcompiler_43/reflection.c index 8cc1fe44f6c..becdee36acc 100644 --- a/dll/directx/wine/d3dcompiler_43/reflection.c +++ b/dll/directx/wine/d3dcompiler_43/reflection.c @@ -69,7 +69,7 @@ struct d3dcompiler_shader_reflection_variable UINT start_offset; UINT size; UINT flags; - LPVOID default_value; + void *default_value; }; struct d3dcompiler_shader_reflection_constant_buffer @@ -179,7 +179,7 @@ static BOOL copy_value(const char *ptr, void **value, DWORD size) *value = HeapAlloc(GetProcessHeap(), 0, size); if (!*value) { - ERR("Failed to allocate vlaue memory.\n"); + ERR("Failed to allocate value memory.\n"); return FALSE; } @@ -442,7 +442,7 @@ static struct ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3dcompil } static struct ID3D11ShaderReflectionConstantBuffer * STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetConstantBufferByName( - ID3D11ShaderReflection *iface, LPCSTR name) + ID3D11ShaderReflection *iface, const char *name) { struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface); unsigned int i; @@ -544,7 +544,7 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetPatchConstantP } static struct ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetVariableByName( - ID3D11ShaderReflection *iface, LPCSTR name) + ID3D11ShaderReflection *iface, const char *name) { struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface); unsigned int i, k; @@ -579,7 +579,7 @@ static struct ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3dcompiler_sha } static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetResourceBindingDescByName( - ID3D11ShaderReflection *iface, LPCSTR name, D3D11_SHADER_INPUT_BIND_DESC *desc) + ID3D11ShaderReflection *iface, const char *name, D3D11_SHADER_INPUT_BIND_DESC *desc) { struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface); unsigned int i; @@ -658,7 +658,7 @@ static BOOL STDMETHODCALLTYPE d3dcompiler_shader_reflection_IsSampleFrequencySha { FIXME("iface %p stub!\n", iface); - return 0; + return FALSE; } static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetNumInterfaceSlots( @@ -764,7 +764,7 @@ static ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3dcompiler_shader_ref } static ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3dcompiler_shader_reflection_constant_buffer_GetVariableByName( - ID3D11ShaderReflectionConstantBuffer *iface, LPCSTR name) + ID3D11ShaderReflectionConstantBuffer *iface, const char *name) { struct d3dcompiler_shader_reflection_constant_buffer *This = impl_from_ID3D11ShaderReflectionConstantBuffer(iface); unsigned int i; @@ -921,7 +921,7 @@ static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflect } static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetMemberTypeByName( - ID3D11ShaderReflectionType *iface, LPCSTR name) + ID3D11ShaderReflectionType *iface, const char *name) { struct d3dcompiler_shader_reflection_type *This = impl_from_ID3D11ShaderReflectionType(iface); unsigned int i; @@ -950,7 +950,7 @@ static ID3D11ShaderReflectionType * STDMETHODCALLTYPE d3dcompiler_shader_reflect return &null_type.ID3D11ShaderReflectionType_iface; } -static LPCSTR STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetMemberTypeName( +static const char * STDMETHODCALLTYPE d3dcompiler_shader_reflection_type_GetMemberTypeName( ID3D11ShaderReflectionType *iface, UINT index) { struct d3dcompiler_shader_reflection_type *This = impl_from_ID3D11ShaderReflectionType(iface); diff --git a/dll/directx/wine/d3dcompiler_43/utils.c b/dll/directx/wine/d3dcompiler_43/utils.c index 001ba8ec55f..daa11b1b3ba 100644 --- a/dll/directx/wine/d3dcompiler_43/utils.c +++ b/dll/directx/wine/d3dcompiler_43/utils.c @@ -1683,7 +1683,7 @@ struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *left, enum parse_assig static int compare_hlsl_types_rb(const void *key, const struct wine_rb_entry *entry) { - const char *name = (const char *)key; + const char *name = key; const struct hlsl_type *type = WINE_RB_ENTRY_VALUE(entry, const struct hlsl_type, scope_entry); if (name == type->name) @@ -1820,7 +1820,7 @@ static int compare_param_hlsl_types(const struct hlsl_type *t1, const struct hls static int compare_function_decl_rb(const void *key, const struct wine_rb_entry *entry) { - const struct list *params = (const struct list *)key; + const struct list *params = key; const struct hlsl_ir_function_decl *decl = WINE_RB_ENTRY_VALUE(entry, const struct hlsl_ir_function_decl, entry); int params_count = params ? list_count(params) : 0; int decl_params_count = decl->parameters ? list_count(decl->parameters) : 0; @@ -1855,7 +1855,7 @@ static const struct wine_rb_functions hlsl_ir_function_decl_rb_funcs = static int compare_function_rb(const void *key, const struct wine_rb_entry *entry) { - const char *name = (const char *)key; + const char *name = key; const struct hlsl_ir_function *func = WINE_RB_ENTRY_VALUE(entry, const struct hlsl_ir_function,entry); return strcmp(name, func->name); diff --git a/dll/directx/wine/d3dx9_24/version.rc b/dll/directx/wine/d3dx9_24/version.rc index 8deff200d3e..80a48cb373d 100644 --- a/dll/directx/wine/d3dx9_24/version.rc +++ b/dll/directx/wine/d3dx9_24/version.rc @@ -17,7 +17,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_24.dll" #define WINE_FILEVERSION 9,5,132,0 #define WINE_FILEVERSION_STR "9.5.132.0" #define WINE_PRODUCTVERSION 9,5,132,0 diff --git a/dll/directx/wine/d3dx9_25/version.rc b/dll/directx/wine/d3dx9_25/version.rc index 922770c5db3..6f89654bbac 100644 --- a/dll/directx/wine/d3dx9_25/version.rc +++ b/dll/directx/wine/d3dx9_25/version.rc @@ -17,7 +17,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_25.dll" #define WINE_FILEVERSION 9,6,168,0 #define WINE_FILEVERSION_STR "9.6.168.0" #define WINE_PRODUCTVERSION 9,6,168,0 diff --git a/dll/directx/wine/d3dx9_26/version.rc b/dll/directx/wine/d3dx9_26/version.rc index 56edd133534..0497ee5473a 100644 --- a/dll/directx/wine/d3dx9_26/version.rc +++ b/dll/directx/wine/d3dx9_26/version.rc @@ -17,7 +17,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_26.dll" #define WINE_FILEVERSION 9,7,239,0 #define WINE_FILEVERSION_STR "9.7.239.0" #define WINE_PRODUCTVERSION 9,7,239,0 diff --git a/dll/directx/wine/d3dx9_27/version.rc b/dll/directx/wine/d3dx9_27/version.rc index 82be05ef485..0ecef4b267d 100644 --- a/dll/directx/wine/d3dx9_27/version.rc +++ b/dll/directx/wine/d3dx9_27/version.rc @@ -17,7 +17,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_27.dll" #define WINE_FILEVERSION 9,8,299,0 #define WINE_FILEVERSION_STR "9.8.299.0" #define WINE_PRODUCTVERSION 9,8,299,0 diff --git a/dll/directx/wine/d3dx9_28/version.rc b/dll/directx/wine/d3dx9_28/version.rc index 0f61f70880e..67f9e5527ef 100644 --- a/dll/directx/wine/d3dx9_28/version.rc +++ b/dll/directx/wine/d3dx9_28/version.rc @@ -17,7 +17,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_28.dll" #define WINE_FILEVERSION 9,10,455,0 #define WINE_FILEVERSION_STR "9.10.455.0" #define WINE_PRODUCTVERSION 9,10,455,0 diff --git a/dll/directx/wine/d3dx9_29/version.rc b/dll/directx/wine/d3dx9_29/version.rc index f6f7b1351d9..8fcd63d7dd9 100644 --- a/dll/directx/wine/d3dx9_29/version.rc +++ b/dll/directx/wine/d3dx9_29/version.rc @@ -17,7 +17,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_29.dll" #define WINE_FILEVERSION 9,11,519,0 #define WINE_FILEVERSION_STR "9.11.519.0" #define WINE_PRODUCTVERSION 9,11,519,0 diff --git a/dll/directx/wine/d3dx9_30/version.rc b/dll/directx/wine/d3dx9_30/version.rc index b10286e6b81..575cbfe715f 100644 --- a/dll/directx/wine/d3dx9_30/version.rc +++ b/dll/directx/wine/d3dx9_30/version.rc @@ -17,7 +17,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_30.dll" #define WINE_FILEVERSION 9,12,589,0 #define WINE_FILEVERSION_STR "9.12.589.0" #define WINE_PRODUCTVERSION 9,12,589,0 diff --git a/dll/directx/wine/d3dx9_31/version.rc b/dll/directx/wine/d3dx9_31/version.rc index eb974540014..b9d5432783e 100644 --- a/dll/directx/wine/d3dx9_31/version.rc +++ b/dll/directx/wine/d3dx9_31/version.rc @@ -17,7 +17,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_31.dll" #define WINE_FILEVERSION 9,15,779,0 #define WINE_FILEVERSION_STR "9.15.779.0" #define WINE_PRODUCTVERSION 9,15,779,0 diff --git a/dll/directx/wine/d3dx9_32/version.rc b/dll/directx/wine/d3dx9_32/version.rc index 330f8be684f..ca1ebdecdba 100644 --- a/dll/directx/wine/d3dx9_32/version.rc +++ b/dll/directx/wine/d3dx9_32/version.rc @@ -17,7 +17,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_32.dll" #define WINE_FILEVERSION 9,16,843,0 #define WINE_FILEVERSION_STR "9.16.843.0" #define WINE_PRODUCTVERSION 9,16,843,0 diff --git a/dll/directx/wine/d3dx9_33/version.rc b/dll/directx/wine/d3dx9_33/version.rc index 06eba53b470..2de5aa08cd2 100644 --- a/dll/directx/wine/d3dx9_33/version.rc +++ b/dll/directx/wine/d3dx9_33/version.rc @@ -17,7 +17,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_33.dll" #define WINE_FILEVERSION 9,18,904,15 #define WINE_FILEVERSION_STR "9.18.904.15" #define WINE_PRODUCTVERSION 9,18,904,15 diff --git a/dll/directx/wine/d3dx9_34/version.rc b/dll/directx/wine/d3dx9_34/version.rc index 5045d8fa852..f5385d14a8c 100644 --- a/dll/directx/wine/d3dx9_34/version.rc +++ b/dll/directx/wine/d3dx9_34/version.rc @@ -17,7 +17,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_34.dll" #define WINE_FILEVERSION 9,19,949,46 #define WINE_FILEVERSION_STR "9.19.949.46" #define WINE_PRODUCTVERSION 9,19,949,46 diff --git a/dll/directx/wine/d3dx9_35/version.rc b/dll/directx/wine/d3dx9_35/version.rc index 6ffaafb4b47..8a6f11ff787 100644 --- a/dll/directx/wine/d3dx9_35/version.rc +++ b/dll/directx/wine/d3dx9_35/version.rc @@ -17,7 +17,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_35.dll" #define WINE_FILEVERSION 9,19,949,1104 #define WINE_FILEVERSION_STR "9.19.949.1104" #define WINE_PRODUCTVERSION 9,19,949,1104 diff --git a/dll/directx/wine/d3dx9_36/core.c b/dll/directx/wine/d3dx9_36/core.c index d0167a4e1b1..51cb53a40de 100644 --- a/dll/directx/wine/d3dx9_36/core.c +++ b/dll/directx/wine/d3dx9_36/core.c @@ -76,7 +76,7 @@ static ULONG WINAPI ID3DXBufferImpl_Release(ID3DXBuffer *iface) return ref; } -static LPVOID WINAPI ID3DXBufferImpl_GetBufferPointer(ID3DXBuffer *iface) +static void * WINAPI ID3DXBufferImpl_GetBufferPointer(ID3DXBuffer *iface) { struct ID3DXBufferImpl *This = impl_from_ID3DXBuffer(iface); diff --git a/dll/directx/wine/d3dx9_36/d3dx9_36_main.c b/dll/directx/wine/d3dx9_36/d3dx9_36_main.c index e85b2150cc7..a335475a3df 100644 --- a/dll/directx/wine/d3dx9_36/d3dx9_36_main.c +++ b/dll/directx/wine/d3dx9_36/d3dx9_36_main.c @@ -25,7 +25,7 @@ /*********************************************************************** * DllMain. */ -BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) +BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, void *reserved) { switch(reason) { diff --git a/dll/directx/wine/d3dx9_36/d3dx9_36_private.h b/dll/directx/wine/d3dx9_36/d3dx9_36_private.h index a505372de5f..fef9ac65742 100644 --- a/dll/directx/wine/d3dx9_36/d3dx9_36_private.h +++ b/dll/directx/wine/d3dx9_36/d3dx9_36_private.h @@ -84,7 +84,7 @@ struct pixel_format_desc { }; HRESULT map_view_of_file(const WCHAR *filename, void **buffer, DWORD *length) DECLSPEC_HIDDEN; -HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, LPVOID *buffer, DWORD *length) DECLSPEC_HIDDEN; +HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, void **buffer, DWORD *length) DECLSPEC_HIDDEN; HRESULT write_buffer_to_file(const WCHAR *filename, ID3DXBuffer *buffer) DECLSPEC_HIDDEN; @@ -104,7 +104,8 @@ void point_filter_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slic const struct pixel_format_desc *dst_format, D3DCOLOR color_key, const PALETTEENTRY *palette) DECLSPEC_HIDDEN; HRESULT load_texture_from_dds(IDirect3DTexture9 *texture, const void *src_data, const PALETTEENTRY *palette, - DWORD filter, D3DCOLOR color_key, const D3DXIMAGE_INFO *src_info) DECLSPEC_HIDDEN; + DWORD filter, D3DCOLOR color_key, const D3DXIMAGE_INFO *src_info, unsigned int skip_levels, + unsigned int *loaded_miplevels) DECLSPEC_HIDDEN; HRESULT load_cube_texture_from_dds(IDirect3DCubeTexture9 *cube_texture, const void *src_data, const PALETTEENTRY *palette, DWORD filter, D3DCOLOR color_key, const D3DXIMAGE_INFO *src_info) DECLSPEC_HIDDEN; HRESULT load_volume_from_dds(IDirect3DVolume9 *dst_volume, const PALETTEENTRY *dst_palette, @@ -114,6 +115,7 @@ HRESULT load_volume_texture_from_dds(IDirect3DVolumeTexture9 *volume_texture, co const PALETTEENTRY *palette, DWORD filter, DWORD color_key, const D3DXIMAGE_INFO *src_info) DECLSPEC_HIDDEN; unsigned short float_32_to_16(const float in) DECLSPEC_HIDDEN; +float float_16_to_32(const unsigned short in) DECLSPEC_HIDDEN; /* debug helpers */ const char *debug_d3dxparameter_class(D3DXPARAMETER_CLASS c) DECLSPEC_HIDDEN; @@ -121,6 +123,7 @@ const char *debug_d3dxparameter_type(D3DXPARAMETER_TYPE t) DECLSPEC_HIDDEN; const char *debug_d3dxparameter_registerset(D3DXREGISTER_SET r) DECLSPEC_HIDDEN; /* parameter type conversion helpers */ -void set_number(LPVOID outdata, D3DXPARAMETER_TYPE outtype, LPCVOID indata, D3DXPARAMETER_TYPE intype) DECLSPEC_HIDDEN; +void set_number(void *outdata, D3DXPARAMETER_TYPE outtype, + const void *indata, D3DXPARAMETER_TYPE intype) DECLSPEC_HIDDEN; #endif /* __WINE_D3DX9_36_PRIVATE_H */ diff --git a/dll/directx/wine/d3dx9_36/effect.c b/dll/directx/wine/d3dx9_36/effect.c index eaaaa16a15c..98d9c43761d 100644 --- a/dll/directx/wine/d3dx9_36/effect.c +++ b/dll/directx/wine/d3dx9_36/effect.c @@ -1,6 +1,6 @@ /* * Copyright 2010 Christian Costa - * Copyright 2011 Rico Schأ¼ller + * Copyright 2011 Rico Schüller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,14 @@ #include "d3dx9_36_private.h" +#include + /* Constants for special INT/FLOAT conversation */ #define INT_FLOAT_MULTI 255.0f #define INT_FLOAT_MULTI_INVERSE (1/INT_FLOAT_MULTI) +#define INITIAL_PARAM_TABLE_SIZE 16 + enum STATE_CLASS { SC_LIGHTENABLE, @@ -83,6 +87,7 @@ enum STATE_TYPE ST_CONSTANT, ST_PARAMETER, ST_FXLC, + ST_ARRAY_SELECTOR, }; struct d3dx_parameter @@ -99,9 +104,21 @@ struct d3dx_parameter UINT member_count; DWORD flags; UINT bytes; + DWORD object_id; + + D3DXHANDLE handle; struct d3dx_parameter *annotations; struct d3dx_parameter *members; + + struct d3dx_parameter *referenced_param; +}; + +struct d3dx_object +{ + UINT size; + void *data; + struct d3dx_parameter *param; }; struct d3dx_state @@ -109,7 +126,7 @@ struct d3dx_state UINT operation; UINT index; enum STATE_TYPE type; - struct d3dx_parameter *parameter; + struct d3dx_parameter parameter; }; struct d3dx_sampler @@ -138,15 +155,25 @@ struct d3dx_technique struct d3dx_pass *passes; }; +struct param_table +{ + struct d3dx_parameter **table; + unsigned int count, size; +}; + struct d3dx9_base_effect { struct ID3DXEffectImpl *effect; UINT parameter_count; UINT technique_count; + UINT object_count; struct d3dx_parameter *parameters; struct d3dx_technique *techniques; + struct d3dx_object *objects; + + struct param_table param_table; }; struct ID3DXEffectImpl @@ -177,8 +204,9 @@ static struct d3dx_parameter *get_parameter_by_name(struct d3dx9_base_effect *ba struct d3dx_parameter *parameter, const char *name); static struct d3dx_parameter *get_annotation_by_name(UINT count, struct d3dx_parameter *parameters, const char *name); -static HRESULT d3dx9_parse_state(struct d3dx_state *state, const char *data, const char **ptr, D3DXHANDLE *objects); -static void free_parameter_state(struct d3dx_parameter *param, BOOL element, BOOL child, enum STATE_TYPE st); +static HRESULT d3dx9_parse_state(struct d3dx9_base_effect *base, struct d3dx_state *state, + const char *data, const char **ptr, struct d3dx_object *objects); +static void free_parameter(struct d3dx_parameter *param, BOOL element, BOOL child); static const struct { @@ -402,14 +430,9 @@ static void skip_dword_unknown(const char **ptr, unsigned int count) } } -static inline struct d3dx_parameter *get_parameter_struct(D3DXHANDLE handle) -{ - return (struct d3dx_parameter *) handle; -} - static inline D3DXHANDLE get_parameter_handle(struct d3dx_parameter *parameter) { - return (D3DXHANDLE) parameter; + return parameter ? parameter->handle : NULL; } static inline D3DXHANDLE get_technique_handle(struct d3dx_technique *technique) @@ -468,81 +491,24 @@ static struct d3dx_pass *get_valid_pass(struct d3dx9_base_effect *base, D3DXHAND return NULL; } -static struct d3dx_parameter *get_valid_sub_parameter(struct d3dx_parameter *param, D3DXHANDLE parameter) -{ - unsigned int i, count; - struct d3dx_parameter *p; - - for (i = 0; i < param->annotation_count; ++i) - { - if (get_parameter_handle(¶m->annotations[i]) == parameter) - return ¶m->annotations[i]; - - p = get_valid_sub_parameter(¶m->annotations[i], parameter); - if (p) return p; - } - - count = param->element_count ? param->element_count : param->member_count; - for (i = 0; i < count; ++i) - { - if (get_parameter_handle(¶m->members[i]) == parameter) - return ¶m->members[i]; - - p = get_valid_sub_parameter(¶m->members[i], parameter); - if (p) return p; - } - - return NULL; -} - static struct d3dx_parameter *get_valid_parameter(struct d3dx9_base_effect *base, D3DXHANDLE parameter) { - unsigned int i, k, m; - struct d3dx_parameter *p; + struct d3dx_parameter **handle_param = (struct d3dx_parameter **)parameter; - for (i = 0; i < base->parameter_count; ++i) - { - if (get_parameter_handle(&base->parameters[i]) == parameter) - return &base->parameters[i]; - - p = get_valid_sub_parameter(&base->parameters[i], parameter); - if (p) return p; - } - - for (i = 0; i < base->technique_count; ++i) - { - struct d3dx_technique *technique = &base->techniques[i]; - - for (k = 0; k < technique->pass_count; ++k) - { - struct d3dx_pass *pass = &technique->passes[k]; - - for (m = 0; m < pass->annotation_count; ++m) - { - if (get_parameter_handle(&pass->annotations[m]) == parameter) - return &pass->annotations[m]; - - p = get_valid_sub_parameter(&pass->annotations[m], parameter); - if (p) return p; - } - } - - for (k = 0; k < technique->annotation_count; ++k) - { - if (get_parameter_handle(&technique->annotations[k]) == parameter) - return &technique->annotations[k]; - - p = get_valid_sub_parameter(&technique->annotations[k], parameter); - if (p) return p; - } - } + if (handle_param >= base->param_table.table && handle_param < base->param_table.table + base->param_table.count) + return *handle_param; return get_parameter_by_name(base, NULL, parameter); } static void free_state(struct d3dx_state *state) { - free_parameter_state(state->parameter, FALSE, FALSE, state->type); + free_parameter(&state->parameter, FALSE, FALSE); +} + +static void free_object(struct d3dx_object *object) +{ + HeapFree(GetProcessHeap(), 0, object->data); } static void free_sampler(struct d3dx_sampler *sampler) @@ -557,16 +523,11 @@ static void free_sampler(struct d3dx_sampler *sampler) } static void free_parameter(struct d3dx_parameter *param, BOOL element, BOOL child) -{ - free_parameter_state(param, element, child, ST_CONSTANT); -} - -static void free_parameter_state(struct d3dx_parameter *param, BOOL element, BOOL child, enum STATE_TYPE st) { unsigned int i; - TRACE("Free parameter %p, name %s, type %s, child %s, state_type %x\n", param, param->name, - debug_d3dxparameter_type(param->type), child ? "yes" : "no", st); + TRACE("Free parameter %p, name %s, type %s, child %s\n", param, param->name, + debug_d3dxparameter_type(param->type), child ? "yes" : "no"); if (!param) return; @@ -594,8 +555,7 @@ static void free_parameter_state(struct d3dx_parameter *param, BOOL element, BOO switch (param->type) { case D3DXPT_STRING: - HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data); - if (!child) HeapFree(GetProcessHeap(), 0, param->data); + HeapFree(GetProcessHeap(), 0, *(char **)param->data); break; case D3DXPT_TEXTURE: @@ -605,15 +565,7 @@ static void free_parameter_state(struct d3dx_parameter *param, BOOL element, BOO case D3DXPT_TEXTURECUBE: case D3DXPT_PIXELSHADER: case D3DXPT_VERTEXSHADER: - if (st == ST_CONSTANT) - { - if (*(IUnknown **)param->data) IUnknown_Release(*(IUnknown **)param->data); - } - else - { - HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data); - } - if (!child) HeapFree(GetProcessHeap(), 0, param->data); + if (*(IUnknown **)param->data) IUnknown_Release(*(IUnknown **)param->data); break; case D3DXPT_SAMPLER: @@ -621,16 +573,7 @@ static void free_parameter_state(struct d3dx_parameter *param, BOOL element, BOO case D3DXPT_SAMPLER2D: case D3DXPT_SAMPLER3D: case D3DXPT_SAMPLERCUBE: - if (st == ST_CONSTANT) - { - free_sampler((struct d3dx_sampler *)param->data); - } - else - { - HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data); - } - /* samplers have always own data, so free that */ - HeapFree(GetProcessHeap(), 0, param->data); + free_sampler((struct d3dx_sampler *)param->data); break; default: @@ -638,16 +581,10 @@ static void free_parameter_state(struct d3dx_parameter *param, BOOL element, BOO break; } } - else + + if (!child) { - if (!child) - { - if (st != ST_CONSTANT) - { - HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data); - } - HeapFree(GetProcessHeap(), 0, param->data); - } + HeapFree(GetProcessHeap(), 0, param->data); } /* only the parent has to release name and semantic */ @@ -722,6 +659,8 @@ static void d3dx9_base_effect_cleanup(struct d3dx9_base_effect *base) TRACE("base %p.\n", base); + HeapFree(GetProcessHeap(), 0, base->param_table.table); + if (base->parameters) { for (i = 0; i < base->parameter_count; ++i) @@ -737,6 +676,16 @@ static void d3dx9_base_effect_cleanup(struct d3dx9_base_effect *base) HeapFree(GetProcessHeap(), 0, base->techniques); base->techniques = NULL; } + + if (base->objects) + { + for (i = 0; i < base->object_count; ++i) + { + free_object(&base->objects[i]); + } + HeapFree(GetProcessHeap(), 0, base->objects); + base->objects = NULL; + } } static void free_effect(struct ID3DXEffectImpl *effect) @@ -778,7 +727,7 @@ static void get_vector(struct d3dx_parameter *param, D3DXVECTOR4 *vector) } } -static void set_vector(struct d3dx_parameter *param, CONST D3DXVECTOR4 *vector) +static void set_vector(struct d3dx_parameter *param, const D3DXVECTOR4 *vector) { UINT i; @@ -806,7 +755,31 @@ static void get_matrix(struct d3dx_parameter *param, D3DXMATRIX *matrix, BOOL tr } } -static void set_matrix(struct d3dx_parameter *param, const D3DXMATRIX *matrix, BOOL transpose) +static void set_matrix(struct d3dx_parameter *param, const D3DXMATRIX *matrix) +{ + UINT i, k; + + if (param->type == D3DXPT_FLOAT) + { + if (param->columns == 4) + memcpy(param->data, matrix->u.m, param->rows * 4 * sizeof(float)); + else + for (i = 0; i < param->rows; ++i) + memcpy((float *)param->data + i * param->columns, matrix->u.m + i, param->columns * sizeof(float)); + return; + } + + for (i = 0; i < param->rows; ++i) + { + for (k = 0; k < param->columns; ++k) + { + set_number((FLOAT *)param->data + i * param->columns + k, param->type, + &matrix->u.m[i][k], D3DXPT_FLOAT); + } + } +} + +static void set_matrix_transpose(struct d3dx_parameter *param, const D3DXMATRIX *matrix) { UINT i, k; @@ -815,7 +788,7 @@ static void set_matrix(struct d3dx_parameter *param, const D3DXMATRIX *matrix, B for (k = 0; k < param->columns; ++k) { set_number((FLOAT *)param->data + i * param->columns + k, param->type, - transpose ? &matrix->u.m[k][i] : &matrix->u.m[i][k], D3DXPT_FLOAT); + &matrix->u.m[k][i], D3DXPT_FLOAT); } } } @@ -1082,7 +1055,7 @@ static D3DXHANDLE d3dx9_base_effect_get_parameter(struct d3dx9_base_effect *base } } - WARN("Invalid argument specified.\n"); + WARN("Parameter not found.\n"); return NULL; } @@ -1160,7 +1133,7 @@ static D3DXHANDLE d3dx9_base_effect_get_parameter_by_semantic(struct d3dx9_base_ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return NULL; } @@ -1187,7 +1160,7 @@ static D3DXHANDLE d3dx9_base_effect_get_parameter_element(struct d3dx9_base_effe } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return NULL; } @@ -1216,7 +1189,7 @@ static D3DXHANDLE d3dx9_base_effect_get_technique_by_name(struct d3dx9_base_effe return t; } - WARN("Invalid argument specified.\n"); + WARN("Technique not found.\n"); return NULL; } @@ -1232,7 +1205,7 @@ static D3DXHANDLE d3dx9_base_effect_get_pass(struct d3dx9_base_effect *base, return get_pass_handle(&tech->passes[index]); } - WARN("Invalid argument specified.\n"); + WARN("Pass not found.\n"); return NULL; } @@ -1258,7 +1231,7 @@ static D3DXHANDLE d3dx9_base_effect_get_pass_by_name(struct d3dx9_base_effect *b } } - WARN("Invalid argument specified.\n"); + WARN("Pass not found.\n"); return NULL; } @@ -1320,7 +1293,7 @@ static D3DXHANDLE d3dx9_base_effect_get_annotation(struct d3dx9_base_effect *bas return get_parameter_handle(&annotations[index]); } - WARN("Invalid argument specified\n"); + WARN("Annotation not found.\n"); return NULL; } @@ -1347,7 +1320,7 @@ static D3DXHANDLE d3dx9_base_effect_get_annotation_by_name(struct d3dx9_base_eff return get_parameter_handle(annotation); } - WARN("Invalid argument specified\n"); + WARN("Annotation not found.\n"); return NULL; } @@ -1458,7 +1431,7 @@ static HRESULT d3dx9_base_effect_get_value(struct d3dx9_base_effect *base, return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1473,7 +1446,7 @@ static HRESULT d3dx9_base_effect_set_bool(struct d3dx9_base_effect *base, D3DXHA return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1489,7 +1462,7 @@ static HRESULT d3dx9_base_effect_get_bool(struct d3dx9_base_effect *base, D3DXHA return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1527,7 +1500,7 @@ static HRESULT d3dx9_base_effect_set_bool_array(struct d3dx9_base_effect *base, } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1551,7 +1524,7 @@ static HRESULT d3dx9_base_effect_get_bool_array(struct d3dx9_base_effect *base, return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1588,7 +1561,7 @@ static HRESULT d3dx9_base_effect_set_int(struct d3dx9_base_effect *base, D3DXHAN } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1626,7 +1599,7 @@ static HRESULT d3dx9_base_effect_get_int(struct d3dx9_base_effect *base, D3DXHAN } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1663,7 +1636,7 @@ static HRESULT d3dx9_base_effect_set_int_array(struct d3dx9_base_effect *base, } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1687,7 +1660,7 @@ static HRESULT d3dx9_base_effect_get_int_array(struct d3dx9_base_effect *base, return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1702,7 +1675,7 @@ static HRESULT d3dx9_base_effect_set_float(struct d3dx9_base_effect *base, D3DXH return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1718,7 +1691,7 @@ static HRESULT d3dx9_base_effect_get_float(struct d3dx9_base_effect *base, D3DXH return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1755,7 +1728,7 @@ static HRESULT d3dx9_base_effect_set_float_array(struct d3dx9_base_effect *base, } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1779,7 +1752,7 @@ static HRESULT d3dx9_base_effect_get_float_array(struct d3dx9_base_effect *base, return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1810,6 +1783,12 @@ static HRESULT d3dx9_base_effect_set_vector(struct d3dx9_base_effect *base, *(INT *)param->data = tmp; return D3D_OK; } + if (param->type == D3DXPT_FLOAT) + { + memcpy(param->data, vector, param->columns * sizeof(float)); + return D3D_OK; + } + set_vector(param, vector); return D3D_OK; @@ -1824,7 +1803,7 @@ static HRESULT d3dx9_base_effect_set_vector(struct d3dx9_base_effect *base, } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1865,7 +1844,7 @@ static HRESULT d3dx9_base_effect_get_vector(struct d3dx9_base_effect *base, } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1884,6 +1863,17 @@ static HRESULT d3dx9_base_effect_set_vector_array(struct d3dx9_base_effect *base switch (param->class) { case D3DXPC_VECTOR: + if (param->type == D3DXPT_FLOAT) + { + if (param->columns == 4) + memcpy(param->data, vector, count * 4 * sizeof(float)); + else + for (i = 0; i < count; ++i) + memcpy((float *)param->data + param->columns * i, vector + i, + param->columns * sizeof(float)); + return D3D_OK; + } + for (i = 0; i < count; ++i) { set_vector(¶m->members[i], &vector[i]); @@ -1902,7 +1892,7 @@ static HRESULT d3dx9_base_effect_set_vector_array(struct d3dx9_base_effect *base } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1941,7 +1931,7 @@ static HRESULT d3dx9_base_effect_get_vector_array(struct d3dx9_base_effect *base } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1958,7 +1948,7 @@ static HRESULT d3dx9_base_effect_set_matrix(struct d3dx9_base_effect *base, switch (param->class) { case D3DXPC_MATRIX_ROWS: - set_matrix(param, matrix, FALSE); + set_matrix(param, matrix); return D3D_OK; case D3DXPC_SCALAR: @@ -1973,7 +1963,7 @@ static HRESULT d3dx9_base_effect_set_matrix(struct d3dx9_base_effect *base, } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2005,7 +1995,7 @@ static HRESULT d3dx9_base_effect_get_matrix(struct d3dx9_base_effect *base, } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2026,7 +2016,7 @@ static HRESULT d3dx9_base_effect_set_matrix_array(struct d3dx9_base_effect *base case D3DXPC_MATRIX_ROWS: for (i = 0; i < count; ++i) { - set_matrix(¶m->members[i], &matrix[i], FALSE); + set_matrix(¶m->members[i], &matrix[i]); } return D3D_OK; @@ -2042,7 +2032,7 @@ static HRESULT d3dx9_base_effect_set_matrix_array(struct d3dx9_base_effect *base } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2081,7 +2071,7 @@ static HRESULT d3dx9_base_effect_get_matrix_array(struct d3dx9_base_effect *base } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2100,7 +2090,7 @@ static HRESULT d3dx9_base_effect_set_matrix_pointer_array(struct d3dx9_base_effe case D3DXPC_MATRIX_ROWS: for (i = 0; i < count; ++i) { - set_matrix(¶m->members[i], matrix[i], FALSE); + set_matrix(¶m->members[i], matrix[i]); } return D3D_OK; @@ -2115,7 +2105,7 @@ static HRESULT d3dx9_base_effect_set_matrix_pointer_array(struct d3dx9_base_effe } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2153,7 +2143,7 @@ static HRESULT d3dx9_base_effect_get_matrix_pointer_array(struct d3dx9_base_effe } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2170,7 +2160,7 @@ static HRESULT d3dx9_base_effect_set_matrix_transpose(struct d3dx9_base_effect * switch (param->class) { case D3DXPC_MATRIX_ROWS: - set_matrix(param, matrix, TRUE); + set_matrix_transpose(param, matrix); return D3D_OK; case D3DXPC_SCALAR: @@ -2185,7 +2175,7 @@ static HRESULT d3dx9_base_effect_set_matrix_transpose(struct d3dx9_base_effect * } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2220,7 +2210,7 @@ static HRESULT d3dx9_base_effect_get_matrix_transpose(struct d3dx9_base_effect * } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2241,7 +2231,7 @@ static HRESULT d3dx9_base_effect_set_matrix_transpose_array(struct d3dx9_base_ef case D3DXPC_MATRIX_ROWS: for (i = 0; i < count; ++i) { - set_matrix(¶m->members[i], &matrix[i], TRUE); + set_matrix_transpose(¶m->members[i], &matrix[i]); } return D3D_OK; @@ -2257,7 +2247,7 @@ static HRESULT d3dx9_base_effect_set_matrix_transpose_array(struct d3dx9_base_ef } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2296,7 +2286,7 @@ static HRESULT d3dx9_base_effect_get_matrix_transpose_array(struct d3dx9_base_ef } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2315,7 +2305,7 @@ static HRESULT d3dx9_base_effect_set_matrix_transpose_pointer_array(struct d3dx9 case D3DXPC_MATRIX_ROWS: for (i = 0; i < count; ++i) { - set_matrix(¶m->members[i], matrix[i], TRUE); + set_matrix_transpose(¶m->members[i], matrix[i]); } return D3D_OK; @@ -2330,7 +2320,7 @@ static HRESULT d3dx9_base_effect_set_matrix_transpose_pointer_array(struct d3dx9 } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2368,7 +2358,7 @@ static HRESULT d3dx9_base_effect_get_matrix_transpose_pointer_array(struct d3dx9 } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2388,12 +2378,12 @@ static HRESULT d3dx9_base_effect_get_string(struct d3dx9_base_effect *base, if (string && param && !param->element_count && param->type == D3DXPT_STRING) { - *string = *(LPCSTR *)param->data; - TRACE("Returning %s\n", debugstr_a(*string)); + *string = *(const char **)param->data; + TRACE("Returning %s.\n", debugstr_a(*string)); return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2410,6 +2400,9 @@ static HRESULT d3dx9_base_effect_set_texture(struct d3dx9_base_effect *base, { struct IDirect3DBaseTexture9 *oltexture = *(struct IDirect3DBaseTexture9 **)param->data; + if (texture == oltexture) + return D3D_OK; + if (texture) IDirect3DBaseTexture9_AddRef(texture); if (oltexture) IDirect3DBaseTexture9_Release(oltexture); @@ -2418,7 +2411,7 @@ static HRESULT d3dx9_base_effect_set_texture(struct d3dx9_base_effect *base, return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2439,7 +2432,7 @@ static HRESULT d3dx9_base_effect_get_texture(struct d3dx9_base_effect *base, return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2457,7 +2450,7 @@ static HRESULT d3dx9_base_effect_get_pixel_shader(struct d3dx9_base_effect *base return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2475,7 +2468,7 @@ static HRESULT d3dx9_base_effect_get_vertex_shader(struct d3dx9_base_effect *bas return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -3097,7 +3090,7 @@ static HRESULT WINAPI ID3DXEffectImpl_SetTechnique(ID3DXEffect *iface, D3DXHANDL return D3D_OK; } - WARN("Invalid argument supplied.\n"); + WARN("Technique not found.\n"); return D3DERR_INVALIDCALL; } @@ -3143,7 +3136,7 @@ static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect *iface, UINT *passes, DW struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface); struct d3dx_technique *technique = This->active_technique; - FIXME("iface %p, passes %p, flags %#x partial stub\n", iface, passes, flags); + TRACE("iface %p, passes %p, flags %#x.\n", iface, passes, flags); if (passes && technique) { @@ -3198,6 +3191,12 @@ static HRESULT WINAPI ID3DXEffectImpl_CommitChanges(ID3DXEffect* iface) FIXME("(%p)->(): stub\n", This); + if (!This->active_pass) + { + WARN("Called without an active pass.\n"); + return D3D_OK; + } + return E_NOTIMPL; } @@ -3222,7 +3221,7 @@ static HRESULT WINAPI ID3DXEffectImpl_End(ID3DXEffect *iface) { struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface); - FIXME("iface %p partial stub\n", iface); + TRACE("iface %p.\n", iface); if (!This->started) return D3D_OK; @@ -3358,11 +3357,11 @@ static HRESULT WINAPI ID3DXEffectImpl_CloneEffect(ID3DXEffect *iface, return E_NOTIMPL; } -static HRESULT WINAPI ID3DXEffectImpl_SetRawValue(ID3DXEffect* iface, D3DXHANDLE parameter, LPCVOID data, UINT byte_offset, UINT bytes) +static HRESULT WINAPI ID3DXEffectImpl_SetRawValue(ID3DXEffect *iface, + D3DXHANDLE parameter, const void *data, UINT byte_offset, UINT bytes) { - struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface); - - FIXME("(%p)->(%p, %p, %u, %u): stub\n", This, parameter, data, byte_offset, bytes); + FIXME("iface %p, parameter %p, data %p, byte_offset %u, bytes %u stub!\n", + iface, parameter, data, byte_offset, bytes); return E_NOTIMPL; } @@ -4139,17 +4138,17 @@ static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl = ID3DXEffectCompilerImpl_CompileShader, }; -static HRESULT d3dx9_parse_sampler(struct d3dx_sampler *sampler, const char *data, const char **ptr, D3DXHANDLE *objects) +static HRESULT d3dx9_parse_sampler(struct d3dx9_base_effect *base, struct d3dx_sampler *sampler, + const char *data, const char **ptr, struct d3dx_object *objects) { HRESULT hr; UINT i; - struct d3dx_state *states; read_dword(ptr, &sampler->state_count); TRACE("Count: %u\n", sampler->state_count); - states = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*states) * sampler->state_count); - if (!states) + sampler->states = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*sampler->states) * sampler->state_count); + if (!sampler->states) { ERR("Out of memory\n"); return E_OUTOFMEMORY; @@ -4157,7 +4156,7 @@ static HRESULT d3dx9_parse_sampler(struct d3dx_sampler *sampler, const char *dat for (i = 0; i < sampler->state_count; ++i) { - hr = d3dx9_parse_state(&states[i], data, ptr, objects); + hr = d3dx9_parse_state(base, &sampler->states[i], data, ptr, objects); if (hr != D3D_OK) { WARN("Failed to parse state %u\n", i); @@ -4165,28 +4164,26 @@ static HRESULT d3dx9_parse_sampler(struct d3dx_sampler *sampler, const char *dat } } - sampler->states = states; - return D3D_OK; err_out: for (i = 0; i < sampler->state_count; ++i) { - free_state(&states[i]); + free_state(&sampler->states[i]); } - - HeapFree(GetProcessHeap(), 0, states); + HeapFree(GetProcessHeap(), 0, sampler->states); + sampler->states = NULL; return hr; } -static HRESULT d3dx9_parse_value(struct d3dx_parameter *param, void *value, const char *data, const char **ptr, D3DXHANDLE *objects) +static HRESULT d3dx9_parse_value(struct d3dx9_base_effect *base, struct d3dx_parameter *param, + void *value, const char *data, const char **ptr, struct d3dx_object *objects) { unsigned int i; HRESULT hr; UINT old_size = 0; - DWORD id; if (param->element_count) { @@ -4196,7 +4193,7 @@ static HRESULT d3dx9_parse_value(struct d3dx_parameter *param, void *value, cons { struct d3dx_parameter *member = ¶m->members[i]; - hr = d3dx9_parse_value(member, value ? (char *)value + old_size : NULL, data, ptr, objects); + hr = d3dx9_parse_value(base, member, value ? (char *)value + old_size : NULL, data, ptr, objects); if (hr != D3D_OK) { WARN("Failed to parse value %u\n", i); @@ -4225,7 +4222,7 @@ static HRESULT d3dx9_parse_value(struct d3dx_parameter *param, void *value, cons { struct d3dx_parameter *member = ¶m->members[i]; - hr = d3dx9_parse_value(member, (char *)value + old_size, data, ptr, objects); + hr = d3dx9_parse_value(base, member, (char *)value + old_size, data, ptr, objects); if (hr != D3D_OK) { WARN("Failed to parse value %u\n", i); @@ -4247,9 +4244,9 @@ static HRESULT d3dx9_parse_value(struct d3dx_parameter *param, void *value, cons case D3DXPT_TEXTURECUBE: case D3DXPT_PIXELSHADER: case D3DXPT_VERTEXSHADER: - read_dword(ptr, &id); - TRACE("Id: %u\n", id); - objects[id] = get_parameter_handle(param); + read_dword(ptr, ¶m->object_id); + TRACE("Id: %u\n", param->object_id); + objects[param->object_id].param = param; param->data = value; break; @@ -4265,7 +4262,7 @@ static HRESULT d3dx9_parse_value(struct d3dx_parameter *param, void *value, cons if (!sampler) return E_OUTOFMEMORY; - hr = d3dx9_parse_sampler(sampler, data, ptr, objects); + hr = d3dx9_parse_sampler(base, sampler, data, ptr, objects); if (hr != D3D_OK) { HeapFree(GetProcessHeap(), 0, sampler); @@ -4291,7 +4288,8 @@ static HRESULT d3dx9_parse_value(struct d3dx_parameter *param, void *value, cons return D3D_OK; } -static HRESULT d3dx9_parse_init_value(struct d3dx_parameter *param, const char *data, const char *ptr, D3DXHANDLE *objects) +static HRESULT d3dx9_parse_init_value(struct d3dx9_base_effect *base, struct d3dx_parameter *param, + const char *data, const char *ptr, struct d3dx_object *objects) { UINT size = param->bytes; HRESULT hr; @@ -4328,7 +4326,7 @@ static HRESULT d3dx9_parse_init_value(struct d3dx_parameter *param, const char * } } - hr = d3dx9_parse_value(param, value, data, &ptr, objects); + hr = d3dx9_parse_value(base, param, value, data, &ptr, objects); if (hr != D3D_OK) { WARN("Failed to parse value\n"); @@ -4364,86 +4362,89 @@ static HRESULT d3dx9_parse_name(char **name, const char *ptr) return D3D_OK; } -static HRESULT d3dx9_copy_data(char **str, const char **ptr) +static HRESULT d3dx9_copy_data(struct d3dx_object *object, const char **ptr) { - DWORD size; + if (object->size || object->data) + FIXME("Object already initialized!\n"); - read_dword(ptr, &size); - TRACE("Data size: %#x\n", size); + read_dword(ptr, &object->size); + TRACE("Data size: %#x\n", object->size); - *str = HeapAlloc(GetProcessHeap(), 0, size); - if (!*str) + if (!object->size) + return D3D_OK; + + object->data = HeapAlloc(GetProcessHeap(), 0, object->size); + if (!object->data) { - ERR("Failed to allocate name memory.\n"); + ERR("Failed to allocate object memory.\n"); return E_OUTOFMEMORY; } - TRACE("Data: %s.\n", debugstr_an(*ptr, size)); - memcpy(*str, *ptr, size); + TRACE("Data: %s.\n", debugstr_an(*ptr, object->size)); + memcpy(object->data, *ptr, object->size); - *ptr += ((size + 3) & ~3); + *ptr += ((object->size + 3) & ~3); return D3D_OK; } -static HRESULT d3dx9_parse_data(struct d3dx_parameter *param, const char **ptr, struct IDirect3DDevice9 *device) +static void add_param_to_table(struct d3dx9_base_effect *base, struct d3dx_parameter *param) { - DWORD size; - HRESULT hr; + struct param_table *table = &base->param_table; - TRACE("Parse data for parameter %s, type %s\n", debugstr_a(param->name), debug_d3dxparameter_type(param->type)); - - read_dword(ptr, &size); - TRACE("Data size: %#x\n", size); - - if (!size) + if (table->count >= table->size) { - TRACE("Size is 0\n"); - *(void **)param->data = NULL; - return D3D_OK; + unsigned int new_size; + struct d3dx_parameter **new_alloc; + + if (!table->size) + { + new_size = INITIAL_PARAM_TABLE_SIZE; + new_alloc = HeapAlloc(GetProcessHeap(), 0, sizeof(*table->table) * new_size); + if (!new_alloc) + { + ERR("Out of memory.\n"); + return; + } + } + else + { + new_size = table->size * 2; + new_alloc = HeapReAlloc(GetProcessHeap(), 0, table->table, sizeof(*table->table) * new_size); + if (!new_alloc) + { + ERR("Out of memory.\n"); + return; + } + } + table->table = new_alloc; + table->size = new_size; } - switch (param->type) - { - case D3DXPT_STRING: - /* re-read with size (sizeof(DWORD) = 4) */ - hr = d3dx9_parse_name((LPSTR *)param->data, *ptr - 4); - if (hr != D3D_OK) - { - WARN("Failed to parse string data\n"); - return hr; - } - break; - - case D3DXPT_VERTEXSHADER: - if (FAILED(hr = IDirect3DDevice9_CreateVertexShader(device, (DWORD *)*ptr, param->data))) - { - WARN("Failed to create vertex shader\n"); - return hr; - } - break; - - case D3DXPT_PIXELSHADER: - if (FAILED(hr = IDirect3DDevice9_CreatePixelShader(device, (DWORD *)*ptr, param->data))) - { - WARN("Failed to create pixel shader\n"); - return hr; - } - break; - - default: - FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type)); - break; - } - - - *ptr += ((size + 3) & ~3); - - return D3D_OK; + table->table[table->count++] = param; } -static HRESULT d3dx9_parse_effect_typedef(struct d3dx_parameter *param, const char *data, const char **ptr, - struct d3dx_parameter *parent, UINT flags) +static void sync_param_handles(struct d3dx9_base_effect *base) +{ + struct param_table *table = &base->param_table; + struct d3dx_parameter **new_alloc; + unsigned int i; + + if (table->count) + { + new_alloc = HeapReAlloc(GetProcessHeap(), 0, table->table, sizeof(*table->table) * table->count); + if (new_alloc) + table->table = new_alloc; + else + ERR("Out of memory.\n"); + } + + for (i = 0; i < table->count; ++i) + table->table[i]->handle = (D3DXHANDLE)&table->table[i]; +} + +static HRESULT d3dx9_parse_effect_typedef(struct d3dx9_base_effect *base, struct d3dx_parameter *param, + const char *data, const char **ptr, struct d3dx_parameter *parent, UINT flags) { DWORD offset; HRESULT hr; @@ -4453,10 +4454,10 @@ static HRESULT d3dx9_parse_effect_typedef(struct d3dx_parameter *param, const ch if (!parent) { - read_dword(ptr, ¶m->type); + read_dword(ptr, (DWORD *)¶m->type); TRACE("Type: %s\n", debug_d3dxparameter_type(param->type)); - read_dword(ptr, ¶m->class); + read_dword(ptr, (DWORD *)¶m->class); TRACE("Class: %s\n", debug_d3dxparameter_class(param->class)); read_dword(ptr, &offset); @@ -4576,7 +4577,8 @@ static HRESULT d3dx9_parse_effect_typedef(struct d3dx_parameter *param, const ch { *ptr = save_ptr; - hr = d3dx9_parse_effect_typedef(¶m->members[i], data, ptr, param, flags); + add_param_to_table(base, ¶m->members[i]); + hr = d3dx9_parse_effect_typedef(base, ¶m->members[i], data, ptr, param, flags); if (hr != D3D_OK) { WARN("Failed to parse member %u\n", i); @@ -4600,7 +4602,8 @@ static HRESULT d3dx9_parse_effect_typedef(struct d3dx_parameter *param, const ch for (i = 0; i < param->member_count; ++i) { - hr = d3dx9_parse_effect_typedef(¶m->members[i], data, ptr, NULL, flags); + add_param_to_table(base, ¶m->members[i]); + hr = d3dx9_parse_effect_typedef(base, ¶m->members[i], data, ptr, NULL, flags); if (hr != D3D_OK) { WARN("Failed to parse member %u\n", i); @@ -4635,7 +4638,8 @@ err_out: return hr; } -static HRESULT d3dx9_parse_effect_annotation(struct d3dx_parameter *anno, const char *data, const char **ptr, D3DXHANDLE *objects) +static HRESULT d3dx9_parse_effect_annotation(struct d3dx9_base_effect *base, struct d3dx_parameter *anno, + const char *data, const char **ptr, struct d3dx_object *objects) { DWORD offset; const char *ptr2; @@ -4646,7 +4650,7 @@ static HRESULT d3dx9_parse_effect_annotation(struct d3dx_parameter *anno, const read_dword(ptr, &offset); TRACE("Typedef offset: %#x\n", offset); ptr2 = data + offset; - hr = d3dx9_parse_effect_typedef(anno, data, &ptr2, NULL, D3DX_PARAMETER_ANNOTATION); + hr = d3dx9_parse_effect_typedef(base, anno, data, &ptr2, NULL, D3DX_PARAMETER_ANNOTATION); if (hr != D3D_OK) { WARN("Failed to parse type definition\n"); @@ -4655,7 +4659,7 @@ static HRESULT d3dx9_parse_effect_annotation(struct d3dx_parameter *anno, const read_dword(ptr, &offset); TRACE("Value offset: %#x\n", offset); - hr = d3dx9_parse_init_value(anno, data, data + offset, objects); + hr = d3dx9_parse_init_value(base, anno, data, data + offset, objects); if (hr != D3D_OK) { WARN("Failed to parse value\n"); @@ -4665,16 +4669,12 @@ static HRESULT d3dx9_parse_effect_annotation(struct d3dx_parameter *anno, const return D3D_OK; } -static HRESULT d3dx9_parse_state(struct d3dx_state *state, const char *data, const char **ptr, D3DXHANDLE *objects) +static HRESULT d3dx9_parse_state(struct d3dx9_base_effect *base, struct d3dx_state *state, + const char *data, const char **ptr, struct d3dx_object *objects) { DWORD offset; const char *ptr2; HRESULT hr; - struct d3dx_parameter *parameter; - - parameter = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter)); - if (!parameter) - return E_OUTOFMEMORY; state->type = ST_CONSTANT; @@ -4687,7 +4687,7 @@ static HRESULT d3dx9_parse_state(struct d3dx_state *state, const char *data, con read_dword(ptr, &offset); TRACE("Typedef offset: %#x\n", offset); ptr2 = data + offset; - hr = d3dx9_parse_effect_typedef(parameter, data, &ptr2, NULL, 0); + hr = d3dx9_parse_effect_typedef(base, &state->parameter, data, &ptr2, NULL, 0); if (hr != D3D_OK) { WARN("Failed to parse type definition\n"); @@ -4696,25 +4696,24 @@ static HRESULT d3dx9_parse_state(struct d3dx_state *state, const char *data, con read_dword(ptr, &offset); TRACE("Value offset: %#x\n", offset); - hr = d3dx9_parse_init_value(parameter, data, data + offset, objects); + hr = d3dx9_parse_init_value(base, &state->parameter, data, data + offset, objects); if (hr != D3D_OK) { WARN("Failed to parse value\n"); goto err_out; } - state->parameter = parameter; - return D3D_OK; err_out: - free_parameter(parameter, FALSE, FALSE); + free_parameter(&state->parameter, FALSE, FALSE); return hr; } -static HRESULT d3dx9_parse_effect_parameter(struct d3dx_parameter *param, const char *data, const char **ptr, D3DXHANDLE *objects) +static HRESULT d3dx9_parse_effect_parameter(struct d3dx9_base_effect *base, struct d3dx_parameter *param, + const char *data, const char **ptr, struct d3dx_object *objects) { DWORD offset; HRESULT hr; @@ -4734,14 +4733,14 @@ static HRESULT d3dx9_parse_effect_parameter(struct d3dx_parameter *param, const read_dword(ptr, ¶m->annotation_count); TRACE("Annotation count: %u\n", param->annotation_count); - hr = d3dx9_parse_effect_typedef(param, data, &ptr2, NULL, param->flags); + hr = d3dx9_parse_effect_typedef(base, param, data, &ptr2, NULL, param->flags); if (hr != D3D_OK) { WARN("Failed to parse type definition\n"); return hr; } - hr = d3dx9_parse_init_value(param, data, data + offset, objects); + hr = d3dx9_parse_init_value(base, param, data, data + offset, objects); if (hr != D3D_OK) { WARN("Failed to parse value\n"); @@ -4761,7 +4760,8 @@ static HRESULT d3dx9_parse_effect_parameter(struct d3dx_parameter *param, const for (i = 0; i < param->annotation_count; ++i) { - hr = d3dx9_parse_effect_annotation(¶m->annotations[i], data, ptr, objects); + add_param_to_table(base, ¶m->annotations[i]); + hr = d3dx9_parse_effect_annotation(base, ¶m->annotations[i], data, ptr, objects); if (hr != D3D_OK) { WARN("Failed to parse annotation\n"); @@ -4785,7 +4785,8 @@ err_out: return hr; } -static HRESULT d3dx9_parse_effect_pass(struct d3dx_pass *pass, const char *data, const char **ptr, D3DXHANDLE *objects) +static HRESULT d3dx9_parse_effect_pass(struct d3dx9_base_effect *base, struct d3dx_pass *pass, + const char *data, const char **ptr, struct d3dx_object *objects) { DWORD offset; HRESULT hr; @@ -4821,7 +4822,8 @@ static HRESULT d3dx9_parse_effect_pass(struct d3dx_pass *pass, const char *data, for (i = 0; i < pass->annotation_count; ++i) { - hr = d3dx9_parse_effect_annotation(&pass->annotations[i], data, ptr, objects); + add_param_to_table(base, &pass->annotations[i]); + hr = d3dx9_parse_effect_annotation(base, &pass->annotations[i], data, ptr, objects); if (hr != D3D_OK) { WARN("Failed to parse annotation %u\n", i); @@ -4842,7 +4844,7 @@ static HRESULT d3dx9_parse_effect_pass(struct d3dx_pass *pass, const char *data, for (i = 0; i < pass->state_count; ++i) { - hr = d3dx9_parse_state(&states[i], data, ptr, objects); + hr = d3dx9_parse_state(base, &states[i], data, ptr, objects); if (hr != D3D_OK) { WARN("Failed to parse annotation %u\n", i); @@ -4880,7 +4882,8 @@ err_out: return hr; } -static HRESULT d3dx9_parse_effect_technique(struct d3dx_technique *technique, const char *data, const char **ptr, D3DXHANDLE *objects) +static HRESULT d3dx9_parse_effect_technique(struct d3dx9_base_effect *base, struct d3dx_technique *technique, + const char *data, const char **ptr, struct d3dx_object *objects) { DWORD offset; HRESULT hr; @@ -4915,7 +4918,8 @@ static HRESULT d3dx9_parse_effect_technique(struct d3dx_technique *technique, co for (i = 0; i < technique->annotation_count; ++i) { - hr = d3dx9_parse_effect_annotation(&technique->annotations[i], data, ptr, objects); + add_param_to_table(base, &technique->annotations[i]); + hr = d3dx9_parse_effect_annotation(base, &technique->annotations[i], data, ptr, objects); if (hr != D3D_OK) { WARN("Failed to parse annotation %u\n", i); @@ -4937,7 +4941,7 @@ static HRESULT d3dx9_parse_effect_technique(struct d3dx_technique *technique, co for (i = 0; i < technique->pass_count; ++i) { - hr = d3dx9_parse_effect_pass(&technique->passes[i], data, ptr, objects); + hr = d3dx9_parse_effect_pass(base, &technique->passes[i], data, ptr, objects); if (hr != D3D_OK) { WARN("Failed to parse pass %u\n", i); @@ -4973,12 +4977,81 @@ err_out: return hr; } +static HRESULT d3dx9_create_object(struct d3dx9_base_effect *base, struct d3dx_object *object) +{ + struct d3dx_parameter *param = object->param; + struct IDirect3DDevice9 *device = base->effect->device; + HRESULT hr; + + if (*(char **)param->data) + ERR("Parameter data already allocated.\n"); + + switch (param->type) + { + case D3DXPT_STRING: + *(char **)param->data = HeapAlloc(GetProcessHeap(), 0, object->size); + if (!*(char **)param->data) + { + ERR("Out of memory.\n"); + return E_OUTOFMEMORY; + } + memcpy(*(char **)param->data, object->data, object->size); + break; + case D3DXPT_VERTEXSHADER: + if (FAILED(hr = IDirect3DDevice9_CreateVertexShader(device, object->data, + (IDirect3DVertexShader9 **)param->data))) + { + WARN("Failed to create vertex shader.\n"); + return hr; + } + break; + case D3DXPT_PIXELSHADER: + if (FAILED(hr = IDirect3DDevice9_CreatePixelShader(device, object->data, + (IDirect3DPixelShader9 **)param->data))) + { + WARN("Failed to create pixel shader.\n"); + return hr; + } + break; + default: + break; + } + return D3D_OK; +} + +static HRESULT d3dx9_parse_array_selector(struct d3dx9_base_effect *base, struct d3dx_parameter *param) +{ + DWORD string_size; + struct d3dx_object *object = &base->objects[param->object_id]; + char *ptr = object->data; + + TRACE("Parsing array entry selection state for parameter %p.\n", param); + + string_size = *(DWORD *)ptr; + param->referenced_param = get_parameter_by_name(base, NULL, ptr + 4); + if (param->referenced_param) + { + TRACE("Mapping to parameter %s.\n", debugstr_a(param->referenced_param->name)); + } + else + { + FIXME("Referenced parameter %s not found.\n", ptr + 4); + return D3DXERR_INVALIDDATA; + } + TRACE("Unknown DWORD: 0x%.8x.\n", *(DWORD *)(ptr + string_size)); + + FIXME("Parse preshader.\n"); + + return D3D_OK; +} + static HRESULT d3dx9_parse_resource(struct d3dx9_base_effect *base, const char *data, const char **ptr) { DWORD technique_index; DWORD index, state_index, usage, element_index; struct d3dx_state *state; struct d3dx_parameter *param; + struct d3dx_object *object; HRESULT hr = E_FAIL; read_dword(ptr, &technique_index); @@ -5056,18 +5129,26 @@ static HRESULT d3dx9_parse_resource(struct d3dx9_base_effect *base, const char * state = &pass->states[state_index]; } - param = state->parameter; + TRACE("State operation %#x (%s).\n", state->operation, state_table[state->operation].name); + param = &state->parameter; + TRACE("Using object id %u.\n", param->object_id); + object = &base->objects[param->object_id]; + TRACE("Usage %u: class %s, type %s.\n", usage, debug_d3dxparameter_class(param->class), + debug_d3dxparameter_type(param->type)); switch (usage) { case 0: - TRACE("usage 0: type %s\n", debug_d3dxparameter_type(param->type)); switch (param->type) { case D3DXPT_VERTEXSHADER: case D3DXPT_PIXELSHADER: state->type = ST_CONSTANT; - hr = d3dx9_parse_data(param, ptr, base->effect->device); + if (FAILED(hr = d3dx9_copy_data(&base->objects[param->object_id], ptr))) + return hr; + + if (object->data) + hr = d3dx9_create_object(base, object); break; case D3DXPT_BOOL: @@ -5075,7 +5156,7 @@ static HRESULT d3dx9_parse_resource(struct d3dx9_base_effect *base, const char * case D3DXPT_FLOAT: case D3DXPT_STRING: state->type = ST_FXLC; - hr = d3dx9_copy_data(param->data, ptr); + hr = d3dx9_copy_data(&base->objects[param->object_id], ptr); break; default: @@ -5086,11 +5167,27 @@ static HRESULT d3dx9_parse_resource(struct d3dx9_base_effect *base, const char * case 1: state->type = ST_PARAMETER; - hr = d3dx9_copy_data(param->data, ptr); - if (hr == D3D_OK) + if (FAILED(hr = d3dx9_copy_data(&base->objects[param->object_id], ptr))) + return hr; + + TRACE("Looking for parameter %s.\n", debugstr_a(object->data)); + param->referenced_param = get_parameter_by_name(base, NULL, object->data); + if (param->referenced_param) { - TRACE("Mapping to parameter %s\n", *(char **)param->data); + TRACE("Mapping to parameter %p.\n", param->referenced_param); } + else + { + FIXME("Referenced parameter %s not found.\n", (char *)object->data); + return D3DXERR_INVALIDDATA; + } + break; + + case 2: + state->type = ST_ARRAY_SELECTOR; + if (FAILED(hr = d3dx9_copy_data(object, ptr))) + return hr; + hr = d3dx9_parse_array_selector(base, param); break; default: @@ -5104,8 +5201,7 @@ static HRESULT d3dx9_parse_resource(struct d3dx9_base_effect *base, const char * static HRESULT d3dx9_parse_effect(struct d3dx9_base_effect *base, const char *data, UINT data_size, DWORD start) { const char *ptr = data + start; - D3DXHANDLE *objects = NULL; - UINT stringcount, objectcount, resourcecount; + UINT stringcount, resourcecount; HRESULT hr; UINT i; @@ -5117,11 +5213,11 @@ static HRESULT d3dx9_parse_effect(struct d3dx9_base_effect *base, const char *da skip_dword_unknown(&ptr, 1); - read_dword(&ptr, &objectcount); - TRACE("Object count: %u\n", objectcount); + read_dword(&ptr, &base->object_count); + TRACE("Object count: %u\n", base->object_count); - objects = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*objects) * objectcount); - if (!objects) + base->objects = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*base->objects) * base->object_count); + if (!base->objects) { ERR("Out of memory\n"); hr = E_OUTOFMEMORY; @@ -5141,7 +5237,8 @@ static HRESULT d3dx9_parse_effect(struct d3dx9_base_effect *base, const char *da for (i = 0; i < base->parameter_count; ++i) { - hr = d3dx9_parse_effect_parameter(&base->parameters[i], data, &ptr, objects); + add_param_to_table(base, &base->parameters[i]); + hr = d3dx9_parse_effect_parameter(base, &base->parameters[i], data, &ptr, base->objects); if (hr != D3D_OK) { WARN("Failed to parse parameter %u\n", i); @@ -5163,7 +5260,8 @@ static HRESULT d3dx9_parse_effect(struct d3dx9_base_effect *base, const char *da for (i = 0; i < base->technique_count; ++i) { - hr = d3dx9_parse_effect_technique(&base->techniques[i], data, &ptr, objects); + TRACE("Parsing technique %u.\n", i); + hr = d3dx9_parse_effect_technique(base, &base->techniques[i], data, &ptr, base->objects); if (hr != D3D_OK) { WARN("Failed to parse technique %u\n", i); @@ -5172,6 +5270,8 @@ static HRESULT d3dx9_parse_effect(struct d3dx9_base_effect *base, const char *da } } + sync_param_handles(base); + read_dword(&ptr, &stringcount); TRACE("String count: %u\n", stringcount); @@ -5181,18 +5281,17 @@ static HRESULT d3dx9_parse_effect(struct d3dx9_base_effect *base, const char *da for (i = 0; i < stringcount; ++i) { DWORD id; - struct d3dx_parameter *param; read_dword(&ptr, &id); TRACE("Id: %u\n", id); - param = get_parameter_struct(objects[id]); - - hr = d3dx9_parse_data(param, &ptr, base->effect->device); - if (hr != D3D_OK) - { - WARN("Failed to parse data %u\n", i); + if (FAILED(hr = d3dx9_copy_data(&base->objects[id], &ptr))) goto err_out; + + if (base->objects[id].data) + { + if (FAILED(hr = d3dx9_create_object(base, &base->objects[id]))) + goto err_out; } } @@ -5208,8 +5307,6 @@ static HRESULT d3dx9_parse_effect(struct d3dx9_base_effect *base, const char *da } } - HeapFree(GetProcessHeap(), 0, objects); - return D3D_OK; err_out: @@ -5232,17 +5329,27 @@ err_out: base->parameters = NULL; } - HeapFree(GetProcessHeap(), 0, objects); + if (base->objects) + { + for (i = 0; i < base->object_count; ++i) + { + free_object(&base->objects[i]); + } + HeapFree(GetProcessHeap(), 0, base->objects); + base->objects = NULL; + } return hr; } static HRESULT d3dx9_base_effect_init(struct d3dx9_base_effect *base, - const char *data, SIZE_T data_size, struct ID3DXEffectImpl *effect) + const char *data, SIZE_T data_size, const D3D_SHADER_MACRO *defines, ID3DInclude *include, + UINT eflags, ID3DBlob **errors, struct ID3DXEffectImpl *effect) { DWORD tag, offset; const char *ptr = data; HRESULT hr; + ID3DBlob *bytecode = NULL, *temp_errors = NULL; TRACE("base %p, data %p, data_size %lu, effect %p\n", base, data, data_size, effect); @@ -5253,30 +5360,55 @@ static HRESULT d3dx9_base_effect_init(struct d3dx9_base_effect *base, if (tag != d3dx9_effect_version(9, 1)) { - /* todo: compile hlsl ascii code */ - FIXME("HLSL ascii effects not supported, yet\n"); - - /* Show the start of the shader for debugging info. */ - TRACE("effect:\n%s\n", debugstr_an(data, data_size > 40 ? 40 : data_size)); - } - else - { - read_dword(&ptr, &offset); - TRACE("Offset: %x\n", offset); - - hr = d3dx9_parse_effect(base, ptr, data_size, offset); - if (hr != D3D_OK) + TRACE("HLSL ASCII effect, trying to compile it.\n"); + hr = D3DCompile(data, data_size, NULL, defines, include, + "main", "fx_2_0", 0, eflags, &bytecode, &temp_errors); + if (FAILED(hr)) { - FIXME("Failed to parse effect.\n"); + WARN("Failed to compile ASCII effect.\n"); + if (bytecode) + ID3D10Blob_Release(bytecode); + if (temp_errors) + TRACE("%s\n", (char *)ID3D10Blob_GetBufferPointer(temp_errors)); + if (errors) + *errors = temp_errors; + else if (temp_errors) + ID3D10Blob_Release(temp_errors); return hr; } + if (!bytecode) + { + FIXME("No output from effect compilation.\n"); + return D3DERR_INVALIDCALL; + } + if (errors) + *errors = temp_errors; + else if (temp_errors) + ID3D10Blob_Release(temp_errors); + + ptr = ID3D10Blob_GetBufferPointer(bytecode); + read_dword(&ptr, &tag); + TRACE("Tag: %x\n", tag); + } + + read_dword(&ptr, &offset); + TRACE("Offset: %x\n", offset); + + hr = d3dx9_parse_effect(base, ptr, data_size, offset); + if (bytecode) + ID3D10Blob_Release(bytecode); + if (hr != D3D_OK) + { + FIXME("Failed to parse effect.\n"); + return hr; } return D3D_OK; } static HRESULT d3dx9_effect_init(struct ID3DXEffectImpl *effect, struct IDirect3DDevice9 *device, - const char *data, SIZE_T data_size, struct ID3DXEffectPool *pool) + const char *data, SIZE_T data_size, const D3D_SHADER_MACRO *defines, ID3DInclude *include, + UINT eflags, ID3DBlob **error_messages, struct ID3DXEffectPool *pool) { HRESULT hr; @@ -5291,7 +5423,8 @@ static HRESULT d3dx9_effect_init(struct ID3DXEffectImpl *effect, struct IDirect3 IDirect3DDevice9_AddRef(device); effect->device = device; - if (FAILED(hr = d3dx9_base_effect_init(&effect->base_effect, data, data_size, effect))) + if (FAILED(hr = d3dx9_base_effect_init(&effect->base_effect, data, data_size, defines, include, + eflags, error_messages, effect))) { FIXME("Failed to parse effect, hr %#x.\n", hr); free_effect(effect); @@ -5315,8 +5448,10 @@ HRESULT WINAPI D3DXCreateEffectEx(struct IDirect3DDevice9 *device, const void *s struct ID3DXEffectImpl *object; HRESULT hr; - FIXME("(%p, %p, %u, %p, %p, %p, %#x, %p, %p, %p): semi-stub\n", device, srcdata, srcdatalen, defines, include, - skip_constants, flags, pool, effect, compilation_errors); + TRACE("device %p, srcdata %p, srcdatalen %u, defines %p, include %p," + " skip_constants %p, flags %#x, pool %p, effect %p, compilation_errors %p.\n", + device, srcdata, srcdatalen, defines, include, + skip_constants, flags, pool, effect, compilation_errors); if (compilation_errors) *compilation_errors = NULL; @@ -5331,14 +5466,18 @@ HRESULT WINAPI D3DXCreateEffectEx(struct IDirect3DDevice9 *device, const void *s if (!effect) return D3D_OK; + if (skip_constants) + FIXME("skip_constants is not NULL, not supported yet.\n"); + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) return E_OUTOFMEMORY; - hr = d3dx9_effect_init(object, device, srcdata, srcdatalen, pool); + hr = d3dx9_effect_init(object, device, srcdata, srcdatalen, (const D3D_SHADER_MACRO *)defines, + (ID3DInclude *)include, flags, (ID3DBlob **)compilation_errors, pool); if (FAILED(hr)) { - WARN("Failed to initialize shader reflection\n"); + WARN("Failed to create effect object.\n"); HeapFree(GetProcessHeap(), 0, object); return hr; } @@ -5360,7 +5499,9 @@ HRESULT WINAPI D3DXCreateEffect(struct IDirect3DDevice9 *device, const void *src return D3DXCreateEffectEx(device, srcdata, srcdatalen, defines, include, NULL, flags, pool, effect, compilation_errors); } -static HRESULT d3dx9_effect_compiler_init(struct ID3DXEffectCompilerImpl *compiler, const char *data, SIZE_T data_size) +static HRESULT d3dx9_effect_compiler_init(struct ID3DXEffectCompilerImpl *compiler, + const char *data, SIZE_T data_size, const D3D_SHADER_MACRO *defines, ID3DInclude *include, + UINT eflags, ID3DBlob **error_messages) { HRESULT hr; @@ -5369,7 +5510,8 @@ static HRESULT d3dx9_effect_compiler_init(struct ID3DXEffectCompilerImpl *compil compiler->ID3DXEffectCompiler_iface.lpVtbl = &ID3DXEffectCompiler_Vtbl; compiler->ref = 1; - if (FAILED(hr = d3dx9_base_effect_init(&compiler->base_effect, data, data_size, NULL))) + if (FAILED(hr = d3dx9_base_effect_init(&compiler->base_effect, data, data_size, defines, + include, eflags, error_messages, NULL))) { FIXME("Failed to parse effect, hr %#x.\n", hr); free_effect_compiler(compiler); @@ -5398,7 +5540,8 @@ HRESULT WINAPI D3DXCreateEffectCompiler(const char *srcdata, UINT srcdatalen, co if (!object) return E_OUTOFMEMORY; - hr = d3dx9_effect_compiler_init(object, srcdata, srcdatalen); + hr = d3dx9_effect_compiler_init(object, srcdata, srcdatalen, (const D3D_SHADER_MACRO *)defines, + (ID3DInclude *)include, flags, (ID3DBlob **)parse_errors); if (FAILED(hr)) { WARN("Failed to initialize effect compiler\n"); @@ -5497,11 +5640,14 @@ HRESULT WINAPI D3DXCreateEffectFromFileExW(struct IDirect3DDevice9 *device, cons const D3DXMACRO *defines, struct ID3DXInclude *include, const char *skipconstants, DWORD flags, struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilationerrors) { - LPVOID buffer; + void *buffer; HRESULT ret; DWORD size; - TRACE("(%s): relay\n", debugstr_w(srcfile)); + TRACE("device %p, srcfile %s, defines %p, include %p, skipconstants %s, " + "flags %#x, pool %p, effect %p, compilationerrors %p.\n", + device, debugstr_w(srcfile), defines, include, debugstr_a(skipconstants), + flags, pool, effect, compilationerrors); if (!device || !srcfile) return D3DERR_INVALIDCALL; @@ -5521,11 +5667,14 @@ HRESULT WINAPI D3DXCreateEffectFromFileExA(struct IDirect3DDevice9 *device, cons const D3DXMACRO *defines, struct ID3DXInclude *include, const char *skipconstants, DWORD flags, struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilationerrors) { - LPWSTR srcfileW; + WCHAR *srcfileW; HRESULT ret; DWORD len; - TRACE("(void): relay\n"); + TRACE("device %p, srcfile %s, defines %p, include %p, skipconstants %s, " + "flags %#x, pool %p, effect %p, compilationerrors %p.\n", + device, debugstr_a(srcfile), defines, include, debugstr_a(skipconstants), + flags, pool, effect, compilationerrors); if (!srcfile) return D3DERR_INVALIDCALL; @@ -5627,11 +5776,12 @@ HRESULT WINAPI D3DXCreateEffectFromResourceA(struct IDirect3DDevice9 *device, HM HRESULT WINAPI D3DXCreateEffectCompilerFromFileW(const WCHAR *srcfile, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXEffectCompiler **effectcompiler, ID3DXBuffer **parseerrors) { - LPVOID buffer; + void *buffer; HRESULT ret; DWORD size; - TRACE("(%s): relay\n", debugstr_w(srcfile)); + TRACE("srcfile %s, defines %p, include %p, flags %#x, effectcompiler %p, parseerrors %p.\n", + debugstr_w(srcfile), defines, include, flags, effectcompiler, parseerrors); if (!srcfile) return D3DERR_INVALIDCALL; @@ -5650,11 +5800,12 @@ HRESULT WINAPI D3DXCreateEffectCompilerFromFileW(const WCHAR *srcfile, const D3D HRESULT WINAPI D3DXCreateEffectCompilerFromFileA(const char *srcfile, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXEffectCompiler **effectcompiler, ID3DXBuffer **parseerrors) { - LPWSTR srcfileW; + WCHAR *srcfileW; HRESULT ret; DWORD len; - TRACE("(void): relay\n"); + TRACE("srcfile %s, defines %p, include %p, flags %#x, effectcompiler %p, parseerrors %p.\n", + debugstr_a(srcfile), defines, include, flags, effectcompiler, parseerrors); if (!srcfile) return D3DERR_INVALIDCALL; diff --git a/dll/directx/wine/d3dx9_36/line.c b/dll/directx/wine/d3dx9_36/line.c index cac954e71f2..e1b691a07bb 100644 --- a/dll/directx/wine/d3dx9_36/line.c +++ b/dll/directx/wine/d3dx9_36/line.c @@ -19,327 +19,289 @@ #include "d3dx9_36_private.h" -typedef struct ID3DXLineImpl { +struct d3dx9_line +{ ID3DXLine ID3DXLine_iface; LONG ref; IDirect3DDevice9 *device; IDirect3DStateBlock9 *state; -} ID3DXLineImpl; +}; -static inline ID3DXLineImpl *impl_from_ID3DXLine(ID3DXLine *iface) +static inline struct d3dx9_line *impl_from_ID3DXLine(ID3DXLine *iface) { - return CONTAINING_RECORD(iface, ID3DXLineImpl, ID3DXLine_iface); + return CONTAINING_RECORD(iface, struct d3dx9_line, ID3DXLine_iface); } -/*** IUnknown methods ***/ -static HRESULT WINAPI ID3DXLineImpl_QueryInterface(ID3DXLine* iface, REFIID riid, LPVOID* object) +static HRESULT WINAPI d3dx9_line_QueryInterface(ID3DXLine *iface, REFIID riid, void **out) { - TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), object); + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_ID3DXLine)) + if (IsEqualGUID(riid, &IID_ID3DXLine) + || IsEqualGUID(riid, &IID_IUnknown)) { ID3DXLine_AddRef(iface); - *object = iface; + *out = iface; return S_OK; } - ERR("Interface %s not found\n", debugstr_guid(riid)); + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); + *out = NULL; return E_NOINTERFACE; } -static ULONG WINAPI ID3DXLineImpl_AddRef(ID3DXLine* iface) +static ULONG WINAPI d3dx9_line_AddRef(ID3DXLine *iface) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); + struct d3dx9_line *line = impl_from_ID3DXLine(iface); + ULONG refcount = InterlockedIncrement(&line->ref); - TRACE("(%p)->(): AddRef from %u\n", This, This->ref); + TRACE("%p increasing refcount to %u.\n", line, refcount); - return InterlockedIncrement(&This->ref); + return refcount; } -static ULONG WINAPI ID3DXLineImpl_Release(ID3DXLine* iface) +static ULONG WINAPI d3dx9_line_Release(ID3DXLine *iface) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); - ULONG ref = InterlockedDecrement(&This->ref); + struct d3dx9_line *line = impl_from_ID3DXLine(iface); + ULONG refcount = InterlockedDecrement(&line->ref); - TRACE("(%p)->(): Release from %u\n", This, ref + 1); + TRACE("%p decreasing refcount to %u.\n", line, refcount); - if (!ref) + if (!refcount) { - IDirect3DDevice9_Release(This->device); - HeapFree(GetProcessHeap(), 0, This); + IDirect3DDevice9_Release(line->device); + HeapFree(GetProcessHeap(), 0, line); } - return ref; + return refcount; } -/*** ID3DXLine methods ***/ -static HRESULT WINAPI ID3DXLineImpl_GetDevice(struct ID3DXLine *iface, struct IDirect3DDevice9 **device) +static HRESULT WINAPI d3dx9_line_GetDevice(struct ID3DXLine *iface, struct IDirect3DDevice9 **device) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); + struct d3dx9_line *line = impl_from_ID3DXLine(iface); - TRACE ("(%p)->(%p)\n", This, device); + TRACE("iface %p, device %p.\n", iface, line); - if (device == NULL) return D3DERR_INVALIDCALL; + if (!device) + return D3DERR_INVALIDCALL; - *device = This->device; - IDirect3DDevice9_AddRef(This->device); + *device = line->device; + IDirect3DDevice9_AddRef(line->device); return D3D_OK; } -static HRESULT WINAPI ID3DXLineImpl_Begin(ID3DXLine* iface) +static HRESULT WINAPI d3dx9_line_Begin(ID3DXLine *iface) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); - - HRESULT hr; + struct d3dx9_line *line = impl_from_ID3DXLine(iface); D3DXMATRIX identity, projection; D3DVIEWPORT9 vp; - TRACE ("(%p)->()\n", This); + TRACE("iface %p.\n", iface); - if (This->state != NULL) /* We already began. Return error. */ + if (line->state) return D3DERR_INVALIDCALL; - hr = IDirect3DDevice9_CreateStateBlock(This->device, D3DSBT_ALL, &This->state); - if (FAILED(hr)) return D3DXERR_INVALIDDATA; + if (FAILED(IDirect3DDevice9_CreateStateBlock(line->device, D3DSBT_ALL, &line->state))) + return D3DXERR_INVALIDDATA; - hr = IDirect3DDevice9_GetViewport(This->device, &vp); - if (FAILED(hr)) goto failed; + if (FAILED(IDirect3DDevice9_GetViewport(line->device, &vp))) + goto failed; D3DXMatrixIdentity(&identity); - D3DXMatrixOrthoOffCenterLH(&projection, - 0.0, vp.Width, /* Min and max x */ - vp.Height, 0.0, /* Min and max y. Screen y is on top so this is inverted */ - 0.0, 1.0); /* Min and max z */ + D3DXMatrixOrthoOffCenterLH(&projection, 0.0, (FLOAT)vp.Width, (FLOAT)vp.Height, 0.0, 0.0, 1.0); - hr = IDirect3DDevice9_SetTransform(This->device, D3DTS_WORLD, &identity); - if (FAILED(hr)) goto failed; + if (FAILED(IDirect3DDevice9_SetTransform(line->device, D3DTS_WORLD, &identity))) + goto failed; + if (FAILED(IDirect3DDevice9_SetTransform(line->device, D3DTS_VIEW, &identity))) + goto failed; + if (FAILED(IDirect3DDevice9_SetTransform(line->device, D3DTS_PROJECTION, &projection))) + goto failed; - hr = IDirect3DDevice9_SetTransform(This->device, D3DTS_VIEW, &identity); - if (FAILED(hr)) goto failed; - - hr = IDirect3DDevice9_SetTransform(This->device, D3DTS_PROJECTION, &projection); - if (FAILED(hr)) goto failed; - - /* Windows sets similar states so we do the same */ - - hr = IDirect3DDevice9_SetRenderState(This->device, D3DRS_LIGHTING, FALSE); - if (FAILED(hr)) goto failed; - - hr = IDirect3DDevice9_SetRenderState(This->device, D3DRS_FOGENABLE, FALSE); - if (FAILED(hr)) goto failed; - - hr = IDirect3DDevice9_SetRenderState(This->device, D3DRS_SHADEMODE, D3DSHADE_FLAT); - if (FAILED(hr)) goto failed; - - hr = IDirect3DDevice9_SetRenderState(This->device, D3DRS_ALPHABLENDENABLE, TRUE); - if (FAILED(hr)) goto failed; - - hr = IDirect3DDevice9_SetRenderState(This->device, D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); - if (FAILED(hr)) goto failed; - - hr = IDirect3DDevice9_SetRenderState(This->device, D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); - if (FAILED(hr)) goto failed; + if (FAILED(IDirect3DDevice9_SetRenderState(line->device, D3DRS_LIGHTING, FALSE))) + goto failed; + if (FAILED(IDirect3DDevice9_SetRenderState(line->device, D3DRS_FOGENABLE, FALSE))) + goto failed; + if (FAILED(IDirect3DDevice9_SetRenderState(line->device, D3DRS_SHADEMODE, D3DSHADE_FLAT))) + goto failed; + if (FAILED(IDirect3DDevice9_SetRenderState(line->device, D3DRS_ALPHABLENDENABLE, TRUE))) + goto failed; + if (FAILED(IDirect3DDevice9_SetRenderState(line->device, D3DRS_SRCBLEND, D3DBLEND_SRCALPHA))) + goto failed; + if (FAILED(IDirect3DDevice9_SetRenderState(line->device, D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA))) + goto failed; return D3D_OK; + failed: - IDirect3DStateBlock9_Apply(This->state); - IDirect3DStateBlock9_Release(This->state); - This->state = NULL; + IDirect3DStateBlock9_Apply(line->state); + IDirect3DStateBlock9_Release(line->state); + line->state = NULL; return D3DXERR_INVALIDDATA; } -static HRESULT WINAPI ID3DXLineImpl_Draw(ID3DXLine* iface, CONST D3DXVECTOR2* vertexlist, DWORD vertexlistcount, D3DCOLOR color) +static HRESULT WINAPI d3dx9_line_Draw(ID3DXLine *iface, const D3DXVECTOR2 *vertex_list, + DWORD vertex_list_count, D3DCOLOR color) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); - - FIXME("(%p)->(%p, %u, %#x): stub\n", This, vertexlist, vertexlistcount, color); + FIXME("iface %p, vertex_list %p, vertex_list_count %u, color 0x%08x stub!\n", + iface, vertex_list, vertex_list_count, color); return E_NOTIMPL; } -static HRESULT WINAPI ID3DXLineImpl_DrawTransform(ID3DXLine* iface, CONST D3DXVECTOR3* vertexlist, DWORD vertexlistcount, - CONST D3DXMATRIX* transform, D3DCOLOR color) +static HRESULT WINAPI d3dx9_line_DrawTransform(ID3DXLine *iface, const D3DXVECTOR3 *vertex_list, + DWORD vertex_list_count, const D3DXMATRIX *transform, D3DCOLOR color) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); - - FIXME("(%p)->(%p, %u, %p, %#x): stub\n", This, vertexlist, vertexlistcount, transform, color); + FIXME("iface %p, vertex_list %p, vertex_list_count %u, transform %p, color 0x%08x stub!\n", + iface, vertex_list, vertex_list_count, transform, color); return E_NOTIMPL; } -static HRESULT WINAPI ID3DXLineImpl_SetPattern(ID3DXLine* iface, DWORD pattern) +static HRESULT WINAPI d3dx9_line_SetPattern(ID3DXLine *iface, DWORD pattern) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); - - FIXME("(%p)->(%#x): stub\n", This, pattern); + FIXME("iface %p, pattern 0x%08x stub!\n", iface, pattern); return E_NOTIMPL; } -static DWORD WINAPI ID3DXLineImpl_GetPattern(ID3DXLine* iface) +static DWORD WINAPI d3dx9_line_GetPattern(ID3DXLine *iface) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); + FIXME("iface %p stub!\n", iface); - FIXME("(%p)->(): stub\n", This); - - return 0xFFFFFFFF; + return 0xffffffff; } -static HRESULT WINAPI ID3DXLineImpl_SetPatternScale(ID3DXLine* iface, FLOAT scale) +static HRESULT WINAPI d3dx9_line_SetPatternScale(ID3DXLine *iface, float scale) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); - - FIXME("(%p)->(%f): stub\n", This, scale); + FIXME("iface %p, scale %.8e stub!\n", iface, scale); return E_NOTIMPL; } -static FLOAT WINAPI ID3DXLineImpl_GetPatternScale(ID3DXLine* iface) +static float WINAPI d3dx9_line_GetPatternScale(ID3DXLine *iface) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); - - FIXME("(%p)->(): stub\n", This); + FIXME("iface %p stub!\n", iface); return 1.0f; } -static HRESULT WINAPI ID3DXLineImpl_SetWidth(ID3DXLine* iface, FLOAT width) +static HRESULT WINAPI d3dx9_line_SetWidth(ID3DXLine *iface, float width) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); - - FIXME("(%p)->(%f): stub\n", This, width); + FIXME("iface %p, width %.8e stub!\n", iface, width); return E_NOTIMPL; } -static FLOAT WINAPI ID3DXLineImpl_GetWidth(ID3DXLine* iface) +static float WINAPI d3dx9_line_GetWidth(ID3DXLine *iface) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); - - FIXME("(%p)->(): stub\n", This); + FIXME("iface %p stub!\n", iface); return 1.0f; } -static HRESULT WINAPI ID3DXLineImpl_SetAntialias(ID3DXLine* iface, BOOL antialias) +static HRESULT WINAPI d3dx9_line_SetAntialias(ID3DXLine *iface, BOOL antialias) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); - - FIXME("(%p)->(%u): stub\n", This, antialias); + FIXME("iface %p, antialias %#x stub!\n", iface, antialias); return E_NOTIMPL; } -static BOOL WINAPI ID3DXLineImpl_GetAntialias(ID3DXLine* iface) +static BOOL WINAPI d3dx9_line_GetAntialias(ID3DXLine *iface) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); - - FIXME("(%p)->(): stub\n", This); + FIXME("iface %p stub!\n", iface); return FALSE; } -static HRESULT WINAPI ID3DXLineImpl_SetGLLines(ID3DXLine* iface, BOOL gl_lines) +static HRESULT WINAPI d3dx9_line_SetGLLines(ID3DXLine *iface, BOOL gl_lines) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); - - FIXME("(%p)->(%u): stub\n", This, gl_lines); + FIXME("iface %p, gl_lines %#x stub!\n", iface, gl_lines); return E_NOTIMPL; } -static BOOL WINAPI ID3DXLineImpl_GetGLLines(ID3DXLine* iface) +static BOOL WINAPI d3dx9_line_GetGLLines(ID3DXLine *iface) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); - - FIXME("(%p)->(): stub\n", This); + FIXME("iface %p stub!\n", iface); return FALSE; } -static HRESULT WINAPI ID3DXLineImpl_End(ID3DXLine* iface) +static HRESULT WINAPI d3dx9_line_End(ID3DXLine *iface) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); + struct d3dx9_line *line = impl_from_ID3DXLine(iface); HRESULT hr; - TRACE ("(%p)->()\n", This); + TRACE("iface %p.\n", iface); - if (This->state == NULL) /* We haven't begun yet. */ + if (!line->state) return D3DERR_INVALIDCALL; - hr = IDirect3DStateBlock9_Apply(This->state); - IDirect3DStateBlock9_Release(This->state); - This->state = NULL; + hr = IDirect3DStateBlock9_Apply(line->state); + IDirect3DStateBlock9_Release(line->state); + line->state = NULL; - if (FAILED(hr)) return D3DXERR_INVALIDDATA; - else return D3D_OK; + if (FAILED(hr)) + return D3DXERR_INVALIDDATA; + + return D3D_OK; } -static HRESULT WINAPI ID3DXLineImpl_OnLostDevice(ID3DXLine* iface) +static HRESULT WINAPI d3dx9_line_OnLostDevice(ID3DXLine *iface) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); - - FIXME("(%p)->(): stub\n", This); + FIXME("iface %p stub!\n", iface); return E_NOTIMPL; } -static HRESULT WINAPI ID3DXLineImpl_OnResetDevice(ID3DXLine* iface) +static HRESULT WINAPI d3dx9_line_OnResetDevice(ID3DXLine *iface) { - ID3DXLineImpl *This = impl_from_ID3DXLine(iface); - - FIXME("(%p)->(): stub\n", This); + FIXME("iface %p stub!\n", iface); return E_NOTIMPL; } -static const struct ID3DXLineVtbl ID3DXLine_Vtbl = +static const struct ID3DXLineVtbl d3dx9_line_vtbl = { - /*** IUnknown methods ***/ - ID3DXLineImpl_QueryInterface, - ID3DXLineImpl_AddRef, - ID3DXLineImpl_Release, - /*** ID3DXLine methods ***/ - ID3DXLineImpl_GetDevice, - ID3DXLineImpl_Begin, - ID3DXLineImpl_Draw, - ID3DXLineImpl_DrawTransform, - ID3DXLineImpl_SetPattern, - ID3DXLineImpl_GetPattern, - ID3DXLineImpl_SetPatternScale, - ID3DXLineImpl_GetPatternScale, - ID3DXLineImpl_SetWidth, - ID3DXLineImpl_GetWidth, - ID3DXLineImpl_SetAntialias, - ID3DXLineImpl_GetAntialias, - ID3DXLineImpl_SetGLLines, - ID3DXLineImpl_GetGLLines, - ID3DXLineImpl_End, - ID3DXLineImpl_OnLostDevice, - ID3DXLineImpl_OnResetDevice + d3dx9_line_QueryInterface, + d3dx9_line_AddRef, + d3dx9_line_Release, + d3dx9_line_GetDevice, + d3dx9_line_Begin, + d3dx9_line_Draw, + d3dx9_line_DrawTransform, + d3dx9_line_SetPattern, + d3dx9_line_GetPattern, + d3dx9_line_SetPatternScale, + d3dx9_line_GetPatternScale, + d3dx9_line_SetWidth, + d3dx9_line_GetWidth, + d3dx9_line_SetAntialias, + d3dx9_line_GetAntialias, + d3dx9_line_SetGLLines, + d3dx9_line_GetGLLines, + d3dx9_line_End, + d3dx9_line_OnLostDevice, + d3dx9_line_OnResetDevice, }; HRESULT WINAPI D3DXCreateLine(struct IDirect3DDevice9 *device, struct ID3DXLine **line) { - ID3DXLineImpl* object; + struct d3dx9_line *object; - TRACE("(%p, %p)\n", device, line); + TRACE("device %p, line %p.\n", device, line); if (!device || !line) return D3DERR_INVALIDCALL; - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ID3DXLineImpl)); - if (!object) + if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) return E_OUTOFMEMORY; - object->ID3DXLine_iface.lpVtbl = &ID3DXLine_Vtbl; + object->ID3DXLine_iface.lpVtbl = &d3dx9_line_vtbl; object->ref = 1; object->device = device; - object->state = NULL; /* We only initialize it on Begin */ IDirect3DDevice9_AddRef(device); *line = &object->ID3DXLine_iface; diff --git a/dll/directx/wine/d3dx9_36/math.c b/dll/directx/wine/d3dx9_36/math.c index e168062eb86..2e1182116bd 100644 --- a/dll/directx/wine/d3dx9_36/math.c +++ b/dll/directx/wine/d3dx9_36/math.c @@ -155,7 +155,7 @@ D3DXMATRIX * WINAPI D3DXMatrixAffineTransformation2D(D3DXMATRIX *out, FLOAT scal s = sinf(rotation / 2.0f); tmp1 = 1.0f - 2.0f * s * s; - tmp2 = 2.0 * s * cosf(rotation / 2.0f); + tmp2 = 2.0f * s * cosf(rotation / 2.0f); D3DXMatrixIdentity(out); out->u.m[0][0] = scaling * tmp1; @@ -480,8 +480,8 @@ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH(D3DXMATRIX *pout, FLOAT fovy, FLOA TRACE("pout %p, fovy %f, aspect %f, zn %f, zf %f\n", pout, fovy, aspect, zn, zf); D3DXMatrixIdentity(pout); - pout->u.m[0][0] = 1.0f / (aspect * tan(fovy/2.0f)); - pout->u.m[1][1] = 1.0f / tan(fovy/2.0f); + pout->u.m[0][0] = 1.0f / (aspect * tanf(fovy/2.0f)); + pout->u.m[1][1] = 1.0f / tanf(fovy/2.0f); pout->u.m[2][2] = zf / (zf - zn); pout->u.m[2][3] = 1.0f; pout->u.m[3][2] = (zf * zn) / (zn - zf); @@ -494,8 +494,8 @@ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH(D3DXMATRIX *pout, FLOAT fovy, FLOA TRACE("pout %p, fovy %f, aspect %f, zn %f, zf %f\n", pout, fovy, aspect, zn, zf); D3DXMatrixIdentity(pout); - pout->u.m[0][0] = 1.0f / (aspect * tan(fovy/2.0f)); - pout->u.m[1][1] = 1.0f / tan(fovy/2.0f); + pout->u.m[0][0] = 1.0f / (aspect * tanf(fovy/2.0f)); + pout->u.m[1][1] = 1.0f / tanf(fovy/2.0f); pout->u.m[2][2] = zf / (zn - zf); pout->u.m[2][3] = -1.0f; pout->u.m[3][2] = (zf * zn) / (zn - zf); @@ -640,10 +640,10 @@ D3DXMATRIX* WINAPI D3DXMatrixRotationX(D3DXMATRIX *pout, FLOAT angle) TRACE("pout %p, angle %f\n", pout, angle); D3DXMatrixIdentity(pout); - pout->u.m[1][1] = cos(angle); - pout->u.m[2][2] = cos(angle); - pout->u.m[1][2] = sin(angle); - pout->u.m[2][1] = -sin(angle); + pout->u.m[1][1] = cosf(angle); + pout->u.m[2][2] = cosf(angle); + pout->u.m[1][2] = sinf(angle); + pout->u.m[2][1] = -sinf(angle); return pout; } @@ -652,10 +652,10 @@ D3DXMATRIX* WINAPI D3DXMatrixRotationY(D3DXMATRIX *pout, FLOAT angle) TRACE("pout %p, angle %f\n", pout, angle); D3DXMatrixIdentity(pout); - pout->u.m[0][0] = cos(angle); - pout->u.m[2][2] = cos(angle); - pout->u.m[0][2] = -sin(angle); - pout->u.m[2][0] = sin(angle); + pout->u.m[0][0] = cosf(angle); + pout->u.m[2][2] = cosf(angle); + pout->u.m[0][2] = -sinf(angle); + pout->u.m[2][0] = sinf(angle); return pout; } @@ -697,10 +697,10 @@ D3DXMATRIX* WINAPI D3DXMatrixRotationZ(D3DXMATRIX *pout, FLOAT angle) TRACE("pout %p, angle %f\n", pout, angle); D3DXMatrixIdentity(pout); - pout->u.m[0][0] = cos(angle); - pout->u.m[1][1] = cos(angle); - pout->u.m[0][1] = sin(angle); - pout->u.m[1][0] = -sin(angle); + pout->u.m[0][0] = cosf(angle); + pout->u.m[1][1] = cosf(angle); + pout->u.m[0][1] = sinf(angle); + pout->u.m[1][0] = -sinf(angle); return pout; } @@ -881,15 +881,15 @@ D3DXMATRIX* WINAPI D3DXMatrixTransformation2D(D3DXMATRIX *pout, const D3DXVECTOR trans.z=0.0f; } - rot.w=cos(rotation/2.0f); + rot.w=cosf(rotation/2.0f); rot.x=0.0f; rot.y=0.0f; - rot.z=sin(rotation/2.0f); + rot.z=sinf(rotation/2.0f); - sca_rot.w=cos(scalingrotation/2.0f); + sca_rot.w=cosf(scalingrotation/2.0f); sca_rot.x=0.0f; sca_rot.y=0.0f; - sca_rot.z=sin(scalingrotation/2.0f); + sca_rot.z=sinf(scalingrotation/2.0f); D3DXMatrixTransformation(pout, &sca_center, &sca_rot, &sca, &rot_center, &rot, &trans); @@ -1648,7 +1648,7 @@ void WINAPI D3DXQuaternionToAxisAngle(const D3DXQUATERNION *pq, D3DXVECTOR3 *pax paxis->x = pq->x; paxis->y = pq->y; paxis->z = pq->z; - *pangle = 2.0f * acos(pq->w); + *pangle = 2.0f * acosf(pq->w); } /*_________________D3DXVec2_____________________*/ @@ -2121,7 +2121,7 @@ D3DXVECTOR4* WINAPI D3DXVec4TransformArray(D3DXVECTOR4* out, UINT outstride, con unsigned short float_32_to_16(const float in) { int exp = 0, origexp; - float tmp = fabs(in); + float tmp = fabsf(in); int sign = (copysignf(1, in) < 0); unsigned int mantissa; unsigned short ret; @@ -2219,7 +2219,7 @@ D3DXFLOAT16 *WINAPI D3DXFloat32To16Array(D3DXFLOAT16 *pout, const FLOAT *pin, UI /* Native d3dx9's D3DXFloat16to32Array lacks support for NaN and Inf. Specifically, e = 16 is treated as a * regular number - e.g., 0x7fff is converted to 131008.0 and 0xffff to -131008.0. */ -static inline float float_16_to_32(const unsigned short in) +float float_16_to_32(const unsigned short in) { const unsigned short s = (in & 0x8000); const unsigned short e = (in & 0x7C00) >> 10; @@ -2279,7 +2279,7 @@ FLOAT WINAPI D3DXSHDot(UINT order, const FLOAT *a, const FLOAT *b) return s; } -static void weightedcapintegrale(FLOAT *out, FLOAT order, FLOAT angle) +static void weightedcapintegrale(FLOAT *out, UINT order, FLOAT angle) { FLOAT coeff[3]; @@ -2387,9 +2387,9 @@ FLOAT* WINAPI D3DXSHEvalDirection(FLOAT *out, UINT order, const D3DXVECTOR3 *dir out[9] = -sqrtf(70.0f / D3DX_PI) / 8.0f * dir->y * (3.0f * dirxx - diryy); out[10] = sqrtf(105.0f / D3DX_PI) / 2.0f * dirxy * dir->z; - out[11] = -sqrtf(42.0 / D3DX_PI) / 8.0f * dir->y * (-1.0f + 5.0f * dirzz); + out[11] = -sqrtf(42.0f / D3DX_PI) / 8.0f * dir->y * (-1.0f + 5.0f * dirzz); out[12] = sqrtf(7.0f / D3DX_PI) / 4.0f * dir->z * (5.0f * dirzz - 3.0f); - out[13] = sqrtf(42.0 / D3DX_PI) / 8.0f * dir->x * (1.0f - 5.0f * dirzz); + out[13] = sqrtf(42.0f / D3DX_PI) / 8.0f * dir->x * (1.0f - 5.0f * dirzz); out[14] = sqrtf(105.0f / D3DX_PI) / 4.0f * dir->z * (dirxx - diryy); out[15] = -sqrtf(70.0f / D3DX_PI) / 8.0f * dir->x * (dirxx - 3.0f * diryy); if (order == 4) @@ -2402,7 +2402,7 @@ FLOAT* WINAPI D3DXSHEvalDirection(FLOAT *out, UINT order, const D3DXVECTOR3 *dir out[20] = 3.0f / (16.0f * sqrtf(D3DX_PI)) * (35.0f * dirzzzz - 30.f * dirzz + 3.0f); out[21] = 0.375f * sqrtf(10.0f / D3DX_PI) * dirxz * (3.0f - 7.0f * dirzz); out[22] = 0.375f * sqrtf(5.0f / D3DX_PI) * (dirxx - diryy) * (7.0f * dirzz - 1.0f); - out[23] = 3.0 * dir->z * out[15]; + out[23] = 3.0f * dir->z * out[15]; out[24] = 3.0f / 16.0f * sqrtf(35.0f / D3DX_PI) * (dirxxxx - 6.0f * dirxyxy + diryyyy); if (order == 5) return out; @@ -2416,7 +2416,7 @@ FLOAT* WINAPI D3DXSHEvalDirection(FLOAT *out, UINT order, const D3DXVECTOR3 *dir out[31] = sqrtf(165.0f / D3DX_PI) / 16.0f * dir->x * (14.0f * dirzz - 21.0f * dirzzzz - 1.0f); out[32] = sqrtf(1155.0f / D3DX_PI) / 8.0f * dir->z * (dirxx - diryy) * (3.0f * dirzz - 1.0f); out[33] = sqrtf(770.0f / D3DX_PI) / 32.0f * dir->x * (dirxx - 3.0f * diryy) * (1.0f - 9.0f * dirzz); - out[34] = 3.0f / 16.0f * sqrtf(385.0f / D3DX_PI) * dir->z * (dirxxxx - 6.0 * dirxyxy + diryyyy); + out[34] = 3.0f / 16.0f * sqrtf(385.0f / D3DX_PI) * dir->z * (dirxxxx - 6.0f * dirxyxy + diryyyy); out[35] = -3.0f/ 32.0f * sqrtf(154.0f / D3DX_PI) * dir->x * (dirxxxx - 10.0f * dirxyxy + 5.0f * diryyyy); return out; @@ -2622,8 +2622,8 @@ FLOAT * WINAPI D3DXSHMultiply3(FLOAT *out, const FLOAT *a, const FLOAT *b) t = a[4] * b[5] + a[5] * b[4]; out[7] += 0.15607834f * t; - ta = 0.28209479f * a[0] + 0.09011186 * a[6] - 0.15607835f * a[8]; - tb = 0.28209479f * b[0] + 0.09011186 * b[6] - 0.15607835f * b[8]; + ta = 0.28209479f * a[0] + 0.09011186f * a[6] - 0.15607835f * a[8]; + tb = 0.28209479f * b[0] + 0.09011186f * b[6] - 0.15607835f * b[8]; out[5] += ta * b[5] + tb * a[5]; t = a[5] * b[5]; out[0] += 0.28209479f * t; @@ -2637,8 +2637,8 @@ FLOAT * WINAPI D3DXSHMultiply3(FLOAT *out, const FLOAT *a, const FLOAT *b) out[0] += 0.28209480f * t; out[6] += 0.18022376f * t; - ta = 0.28209479f * a[0] + 0.09011186 * a[6] + 0.15607835f * a[8]; - tb = 0.28209479f * b[0] + 0.09011186 * b[6] + 0.15607835f * b[8]; + ta = 0.28209479f * a[0] + 0.09011186f * a[6] + 0.15607835f * a[8]; + tb = 0.28209479f * b[0] + 0.09011186f * b[6] + 0.15607835f * b[8]; out[7] += ta * b[7] + tb * a[7]; t = a[7] * b[7]; out[0] += 0.28209479f * t; @@ -2981,7 +2981,7 @@ static void rotate_X(FLOAT *out, UINT order, FLOAT a, FLOAT *in) out[25] = a * 0.7015607357f * in[30] - a * 0.6846531630f * in[32] + a * 0.1976423711f * in[34]; out[26] = -0.5f * in[26] + 0.8660253882f * in[28]; - out[27] = a * 0.5229125023f * in[30] + a * 0.3061861992f * in[32] - a * 0.7954951525 * in[34]; + out[27] = a * 0.5229125023f * in[30] + a * 0.3061861992f * in[32] - a * 0.7954951525f * in[34]; out[28] = 0.8660253882f * in[26] + 0.5f * in[28]; out[29] = a * 0.4841229022f * in[30] + a * 0.6614378691f * in[32] + a * 0.5728219748f * in[34]; out[30] = -a * 0.7015607357f * in[25] - a * 0.5229125023f * in[27] - a * 0.4841229022f * in[29]; diff --git a/dll/directx/wine/d3dx9_36/mesh.c b/dll/directx/wine/d3dx9_36/mesh.c index ba9755284a0..aa74c7afb23 100644 --- a/dll/directx/wine/d3dx9_36/mesh.c +++ b/dll/directx/wine/d3dx9_36/mesh.c @@ -37,9 +37,7 @@ #include "rmxftmpl.h" #include "wine/list.h" -#define fmax(a, b) ((a) > (b) ? (a) : (b)) - -typedef struct ID3DXMeshImpl +struct d3dx9_mesh { ID3DXMesh ID3DXMesh_iface; LONG ref; @@ -59,7 +57,7 @@ typedef struct ID3DXMeshImpl int attrib_buffer_lock_count; DWORD attrib_table_size; D3DXATTRIBUTERANGE *attrib_table; -} ID3DXMeshImpl; +}; const UINT d3dx_decltype_size[] = { @@ -82,21 +80,21 @@ const UINT d3dx_decltype_size[] = /* D3DDECLTYPE_FLOAT16_4 */ 4 * sizeof(D3DXFLOAT16), }; -static inline ID3DXMeshImpl *impl_from_ID3DXMesh(ID3DXMesh *iface) +static inline struct d3dx9_mesh *impl_from_ID3DXMesh(ID3DXMesh *iface) { - return CONTAINING_RECORD(iface, ID3DXMeshImpl, ID3DXMesh_iface); + return CONTAINING_RECORD(iface, struct d3dx9_mesh, ID3DXMesh_iface); } -static HRESULT WINAPI ID3DXMeshImpl_QueryInterface(ID3DXMesh *iface, REFIID riid, LPVOID *object) +static HRESULT WINAPI d3dx9_mesh_QueryInterface(ID3DXMesh *iface, REFIID riid, void **out) { - TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), object); + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ID3DXBaseMesh) || IsEqualGUID(riid, &IID_ID3DXMesh)) { iface->lpVtbl->AddRef(iface); - *object = iface; + *out = iface; return S_OK; } @@ -105,47 +103,47 @@ static HRESULT WINAPI ID3DXMeshImpl_QueryInterface(ID3DXMesh *iface, REFIID riid return E_NOINTERFACE; } -static ULONG WINAPI ID3DXMeshImpl_AddRef(ID3DXMesh *iface) +static ULONG WINAPI d3dx9_mesh_AddRef(ID3DXMesh *iface) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); + ULONG refcount = InterlockedIncrement(&mesh->ref); - TRACE("(%p)->(): AddRef from %d\n", This, This->ref); + TRACE("%p increasing refcount to %u.\n", mesh, refcount); - return InterlockedIncrement(&This->ref); + return refcount; } -static ULONG WINAPI ID3DXMeshImpl_Release(ID3DXMesh *iface) +static ULONG WINAPI d3dx9_mesh_Release(ID3DXMesh *iface) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); - ULONG ref = InterlockedDecrement(&This->ref); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); + ULONG refcount = InterlockedDecrement(&mesh->ref); - TRACE("(%p)->(): Release from %d\n", This, ref + 1); + TRACE("%p decreasing refcount to %u.\n", mesh, refcount); - if (!ref) + if (!refcount) { - IDirect3DIndexBuffer9_Release(This->index_buffer); - IDirect3DVertexBuffer9_Release(This->vertex_buffer); - if (This->vertex_declaration) - IDirect3DVertexDeclaration9_Release(This->vertex_declaration); - IDirect3DDevice9_Release(This->device); - HeapFree(GetProcessHeap(), 0, This->attrib_buffer); - HeapFree(GetProcessHeap(), 0, This->attrib_table); - HeapFree(GetProcessHeap(), 0, This); + IDirect3DIndexBuffer9_Release(mesh->index_buffer); + IDirect3DVertexBuffer9_Release(mesh->vertex_buffer); + if (mesh->vertex_declaration) + IDirect3DVertexDeclaration9_Release(mesh->vertex_declaration); + IDirect3DDevice9_Release(mesh->device); + HeapFree(GetProcessHeap(), 0, mesh->attrib_buffer); + HeapFree(GetProcessHeap(), 0, mesh->attrib_table); + HeapFree(GetProcessHeap(), 0, mesh); } - return ref; + return refcount; } -/*** ID3DXBaseMesh ***/ -static HRESULT WINAPI ID3DXMeshImpl_DrawSubset(ID3DXMesh *iface, DWORD attrib_id) +static HRESULT WINAPI d3dx9_mesh_DrawSubset(ID3DXMesh *iface, DWORD attrib_id) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *This = impl_from_ID3DXMesh(iface); HRESULT hr; DWORD face_start; DWORD face_end = 0; DWORD vertex_size; - TRACE("(%p)->(%u)\n", This, attrib_id); + TRACE("iface %p, attrib_id %u.\n", iface, attrib_id); if (!This->vertex_declaration) { @@ -185,31 +183,31 @@ static HRESULT WINAPI ID3DXMeshImpl_DrawSubset(ID3DXMesh *iface, DWORD attrib_id return D3D_OK; } -static DWORD WINAPI ID3DXMeshImpl_GetNumFaces(ID3DXMesh *iface) +static DWORD WINAPI d3dx9_mesh_GetNumFaces(ID3DXMesh *iface) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); - TRACE("(%p)\n", This); + TRACE("iface %p.\n", iface); - return This->numfaces; + return mesh->numfaces; } -static DWORD WINAPI ID3DXMeshImpl_GetNumVertices(ID3DXMesh *iface) +static DWORD WINAPI d3dx9_mesh_GetNumVertices(ID3DXMesh *iface) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); - TRACE("(%p)\n", This); + TRACE("iface %p.\n", iface); - return This->numvertices; + return mesh->numvertices; } -static DWORD WINAPI ID3DXMeshImpl_GetFVF(ID3DXMesh *iface) +static DWORD WINAPI d3dx9_mesh_GetFVF(ID3DXMesh *iface) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); - TRACE("(%p)\n", This); + TRACE("iface %p.\n", iface); - return This->fvf; + return mesh->fvf; } static void copy_declaration(D3DVERTEXELEMENT9 *dst, const D3DVERTEXELEMENT9 *src, UINT num_elem) @@ -217,61 +215,63 @@ static void copy_declaration(D3DVERTEXELEMENT9 *dst, const D3DVERTEXELEMENT9 *sr memcpy(dst, src, num_elem * sizeof(*src)); } -static HRESULT WINAPI ID3DXMeshImpl_GetDeclaration(ID3DXMesh *iface, D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE]) +static HRESULT WINAPI d3dx9_mesh_GetDeclaration(ID3DXMesh *iface, D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE]) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); - TRACE("(%p)\n", This); + TRACE("iface %p, declaration %p.\n", iface, declaration); - if (declaration == NULL) return D3DERR_INVALIDCALL; + if (!declaration) + return D3DERR_INVALIDCALL; - copy_declaration(declaration, This->cached_declaration, This->num_elem); + copy_declaration(declaration, mesh->cached_declaration, mesh->num_elem); return D3D_OK; } -static DWORD WINAPI ID3DXMeshImpl_GetNumBytesPerVertex(ID3DXMesh *iface) +static DWORD WINAPI d3dx9_mesh_GetNumBytesPerVertex(ID3DXMesh *iface) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); - TRACE("iface (%p)\n", This); + TRACE("iface %p.\n", iface); - return This->vertex_declaration_size; + return mesh->vertex_declaration_size; } -static DWORD WINAPI ID3DXMeshImpl_GetOptions(ID3DXMesh *iface) +static DWORD WINAPI d3dx9_mesh_GetOptions(ID3DXMesh *iface) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); - TRACE("(%p)\n", This); + TRACE("iface %p.\n", iface); - return This->options; + return mesh->options; } -static HRESULT WINAPI ID3DXMeshImpl_GetDevice(struct ID3DXMesh *iface, struct IDirect3DDevice9 **device) +static HRESULT WINAPI d3dx9_mesh_GetDevice(struct ID3DXMesh *iface, struct IDirect3DDevice9 **device) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); - TRACE("(%p)->(%p)\n", This, device); + TRACE("iface %p, device %p.\n", iface, device); - if (device == NULL) return D3DERR_INVALIDCALL; - *device = This->device; - IDirect3DDevice9_AddRef(This->device); + if (!device) + return D3DERR_INVALIDCALL; + *device = mesh->device; + IDirect3DDevice9_AddRef(mesh->device); return D3D_OK; } -static HRESULT WINAPI ID3DXMeshImpl_CloneMeshFVF(struct ID3DXMesh *iface, DWORD options, DWORD fvf, +static HRESULT WINAPI d3dx9_mesh_CloneMeshFVF(struct ID3DXMesh *iface, DWORD options, DWORD fvf, struct IDirect3DDevice9 *device, struct ID3DXMesh **clone_mesh) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); HRESULT hr; D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE]; - TRACE("(%p)->(%x,%x,%p,%p)\n", This, options, fvf, device, clone_mesh); + TRACE("iface %p, options %#x, fvf %#x, device %p, clone_mesh %p.\n", + iface, options, fvf, device, clone_mesh); - hr = D3DXDeclaratorFromFVF(fvf, declaration); - if (FAILED(hr)) return hr; + if (FAILED(hr = D3DXDeclaratorFromFVF(fvf, declaration))) + return hr; return iface->lpVtbl->CloneMesh(iface, options, declaration, device, clone_mesh); } @@ -336,7 +336,7 @@ static INT simple_round(FLOAT value) return res; } -static void convert_float4(BYTE *dst, CONST D3DXVECTOR4 *src, D3DDECLTYPE type_dst) +static void convert_float4(BYTE *dst, const D3DXVECTOR4 *src, D3DDECLTYPE type_dst) { BOOL fixme_once = FALSE; @@ -650,7 +650,7 @@ cleanup: return hr; } -static BOOL declaration_equals(CONST D3DVERTEXELEMENT9 *declaration1, CONST D3DVERTEXELEMENT9 *declaration2) +static BOOL declaration_equals(const D3DVERTEXELEMENT9 *declaration1, const D3DVERTEXELEMENT9 *declaration2) { UINT size1 = 0, size2 = 0; @@ -669,11 +669,11 @@ static BOOL declaration_equals(CONST D3DVERTEXELEMENT9 *declaration1, CONST D3DV return FALSE; } -static HRESULT WINAPI ID3DXMeshImpl_CloneMesh(struct ID3DXMesh *iface, DWORD options, +static HRESULT WINAPI d3dx9_mesh_CloneMesh(struct ID3DXMesh *iface, DWORD options, const D3DVERTEXELEMENT9 *declaration, struct IDirect3DDevice9 *device, struct ID3DXMesh **clone_mesh_out) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); - ID3DXMeshImpl *cloned_this; + struct d3dx9_mesh *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *cloned_this; ID3DXMesh *clone_mesh; D3DVERTEXELEMENT9 orig_declaration[MAX_FVF_DECL_SIZE] = { D3DDECL_END() }; void *data_in, *data_out; @@ -681,7 +681,8 @@ static HRESULT WINAPI ID3DXMeshImpl_CloneMesh(struct ID3DXMesh *iface, DWORD opt HRESULT hr; BOOL same_declaration; - TRACE("(%p)->(%x,%p,%p,%p)\n", This, options, declaration, device, clone_mesh_out); + TRACE("iface %p, options %#x, declaration %p, device %p, clone_mesh_out %p.\n", + iface, options, declaration, device, clone_mesh_out); if (!clone_mesh_out) return D3DERR_INVALIDCALL; @@ -765,81 +766,87 @@ error: return hr; } -static HRESULT WINAPI ID3DXMeshImpl_GetVertexBuffer(struct ID3DXMesh *iface, +static HRESULT WINAPI d3dx9_mesh_GetVertexBuffer(struct ID3DXMesh *iface, struct IDirect3DVertexBuffer9 **vertex_buffer) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); - TRACE("(%p)->(%p)\n", This, vertex_buffer); + TRACE("iface %p, vertex_buffer %p.\n", iface, vertex_buffer); - if (vertex_buffer == NULL) return D3DERR_INVALIDCALL; - *vertex_buffer = This->vertex_buffer; - IDirect3DVertexBuffer9_AddRef(This->vertex_buffer); + if (!vertex_buffer) + return D3DERR_INVALIDCALL; + *vertex_buffer = mesh->vertex_buffer; + IDirect3DVertexBuffer9_AddRef(mesh->vertex_buffer); return D3D_OK; } -static HRESULT WINAPI ID3DXMeshImpl_GetIndexBuffer(struct ID3DXMesh *iface, +static HRESULT WINAPI d3dx9_mesh_GetIndexBuffer(struct ID3DXMesh *iface, struct IDirect3DIndexBuffer9 **index_buffer) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); - TRACE("(%p)->(%p)\n", This, index_buffer); + TRACE("iface %p, index_buffer %p.\n", iface, index_buffer); - if (index_buffer == NULL) return D3DERR_INVALIDCALL; - *index_buffer = This->index_buffer; - IDirect3DIndexBuffer9_AddRef(This->index_buffer); + if (!index_buffer) + return D3DERR_INVALIDCALL; + *index_buffer = mesh->index_buffer; + IDirect3DIndexBuffer9_AddRef(mesh->index_buffer); return D3D_OK; } -static HRESULT WINAPI ID3DXMeshImpl_LockVertexBuffer(ID3DXMesh *iface, DWORD flags, LPVOID *data) +static HRESULT WINAPI d3dx9_mesh_LockVertexBuffer(ID3DXMesh *iface, DWORD flags, void **data) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); - TRACE("(%p)->(%u,%p)\n", This, flags, data); + TRACE("iface %p, flags %#x, data %p.\n", iface, flags, data); - return IDirect3DVertexBuffer9_Lock(This->vertex_buffer, 0, 0, data, flags); + return IDirect3DVertexBuffer9_Lock(mesh->vertex_buffer, 0, 0, data, flags); } -static HRESULT WINAPI ID3DXMeshImpl_UnlockVertexBuffer(ID3DXMesh *iface) +static HRESULT WINAPI d3dx9_mesh_UnlockVertexBuffer(ID3DXMesh *iface) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); - TRACE("(%p)\n", This); + TRACE("iface %p.\n", iface); - return IDirect3DVertexBuffer9_Unlock(This->vertex_buffer); + return IDirect3DVertexBuffer9_Unlock(mesh->vertex_buffer); } -static HRESULT WINAPI ID3DXMeshImpl_LockIndexBuffer(ID3DXMesh *iface, DWORD flags, LPVOID *data) +static HRESULT WINAPI d3dx9_mesh_LockIndexBuffer(ID3DXMesh *iface, DWORD flags, void **data) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); - TRACE("(%p)->(%u,%p)\n", This, flags, data); + TRACE("iface %p, flags %#x, data %p.\n", iface, flags, data); - return IDirect3DIndexBuffer9_Lock(This->index_buffer, 0, 0, data, flags); + return IDirect3DIndexBuffer9_Lock(mesh->index_buffer, 0, 0, data, flags); } -static HRESULT WINAPI ID3DXMeshImpl_UnlockIndexBuffer(ID3DXMesh *iface) +static HRESULT WINAPI d3dx9_mesh_UnlockIndexBuffer(ID3DXMesh *iface) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); - TRACE("(%p)\n", This); + TRACE("iface %p.\n", iface); - return IDirect3DIndexBuffer9_Unlock(This->index_buffer); + return IDirect3DIndexBuffer9_Unlock(mesh->index_buffer); } -static HRESULT WINAPI ID3DXMeshImpl_GetAttributeTable(ID3DXMesh *iface, D3DXATTRIBUTERANGE *attrib_table, DWORD *attrib_table_size) +/* FIXME: This looks just wrong, we never check *attrib_table_size before + * copying the data. */ +static HRESULT WINAPI d3dx9_mesh_GetAttributeTable(ID3DXMesh *iface, + D3DXATTRIBUTERANGE *attrib_table, DWORD *attrib_table_size) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); - TRACE("(%p)->(%p,%p)\n", This, attrib_table, attrib_table_size); + TRACE("iface %p, attrib_table %p, attrib_table_size %p.\n", + iface, attrib_table, attrib_table_size); if (attrib_table_size) - *attrib_table_size = This->attrib_table_size; + *attrib_table_size = mesh->attrib_table_size; if (attrib_table) - CopyMemory(attrib_table, This->attrib_table, This->attrib_table_size * sizeof(*attrib_table)); + memcpy(attrib_table, mesh->attrib_table, mesh->attrib_table_size * sizeof(*attrib_table)); return D3D_OK; } @@ -867,7 +874,8 @@ struct edge_face_map * is at most one edge to face mapping, i.e. an edge can only belong to one * face. */ -static HRESULT init_edge_face_map(struct edge_face_map *edge_face_map, CONST DWORD *index_buffer, CONST DWORD *point_reps, CONST DWORD num_faces) +static HRESULT init_edge_face_map(struct edge_face_map *edge_face_map, const DWORD *index_buffer, + const DWORD *point_reps, DWORD num_faces) { DWORD face, edge; DWORD i; @@ -907,7 +915,7 @@ static HRESULT init_edge_face_map(struct edge_face_map *edge_face_map, CONST DWO return D3D_OK; } -static DWORD find_adjacent_face(struct edge_face_map *edge_face_map, DWORD vertex1, DWORD vertex2, CONST DWORD num_faces) +static DWORD find_adjacent_face(struct edge_face_map *edge_face_map, DWORD vertex1, DWORD vertex2, DWORD num_faces) { struct edge_face *edge_face_ptr; @@ -937,9 +945,9 @@ static DWORD *generate_identity_point_reps(DWORD num_vertices) return id_point_reps; } -static HRESULT WINAPI ID3DXMeshImpl_ConvertPointRepsToAdjacency(ID3DXMesh *iface, CONST DWORD *point_reps, DWORD *adjacency) +static HRESULT WINAPI d3dx9_mesh_ConvertPointRepsToAdjacency(ID3DXMesh *iface, + const DWORD *point_reps, DWORD *adjacency) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); HRESULT hr; DWORD num_faces = iface->lpVtbl->GetNumFaces(iface); DWORD num_vertices = iface->lpVtbl->GetNumVertices(iface); @@ -950,10 +958,10 @@ static HRESULT WINAPI ID3DXMeshImpl_ConvertPointRepsToAdjacency(ID3DXMesh *iface DWORD face; DWORD edge; struct edge_face_map edge_face_map = {0}; - CONST DWORD *point_reps_ptr = NULL; + const DWORD *point_reps_ptr = NULL; DWORD *id_point_reps = NULL; - TRACE("(%p)->(%p,%p)\n", This, point_reps, adjacency); + TRACE("iface %p, point_reps %p, adjacency %p.\n", iface, point_reps, adjacency); if (!adjacency) return D3DERR_INVALIDCALL; @@ -1038,9 +1046,8 @@ cleanup: * vertex 5 is replaced by vertex 3 then index 5 would contain 3. If no vertex * replaces it, then it contains the same number as the index itself, e.g. * index 5 would contain 5. */ -static HRESULT propagate_face_vertices(CONST DWORD *adjacency, DWORD *point_reps, - CONST DWORD *indices, DWORD *new_indices, - CONST DWORD face, CONST DWORD numfaces) +static HRESULT propagate_face_vertices(const DWORD *adjacency, DWORD *point_reps, + const DWORD *indices, DWORD *new_indices, DWORD face, DWORD numfaces) { const unsigned int VERTS_PER_FACE = 3; DWORD edge, opp_edge; @@ -1088,8 +1095,10 @@ static HRESULT propagate_face_vertices(CONST DWORD *adjacency, DWORD *point_reps return D3D_OK; } -static HRESULT WINAPI ID3DXMeshImpl_ConvertAdjacencyToPointReps(ID3DXMesh *iface, CONST DWORD *adjacency, DWORD *point_reps) +static HRESULT WINAPI d3dx9_mesh_ConvertAdjacencyToPointReps(ID3DXMesh *iface, + const DWORD *adjacency, DWORD *point_reps) { + struct d3dx9_mesh *This = impl_from_ID3DXMesh(iface); HRESULT hr; DWORD face; DWORD i; @@ -1098,9 +1107,7 @@ static HRESULT WINAPI ID3DXMeshImpl_ConvertAdjacencyToPointReps(ID3DXMesh *iface DWORD *new_indices = NULL; const unsigned int VERTS_PER_FACE = 3; - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); - - TRACE("(%p)->(%p,%p)\n", This, adjacency, point_reps); + TRACE("iface %p, adjacency %p, point_reps %p.\n", iface, adjacency, point_reps); if (!adjacency) { @@ -1209,9 +1216,9 @@ static int compare_vertex_keys(const void *a, const void *b) return left->key < right->key ? -1 : 1; } -static HRESULT WINAPI ID3DXMeshImpl_GenerateAdjacency(ID3DXMesh *iface, FLOAT epsilon, DWORD *adjacency) +static HRESULT WINAPI d3dx9_mesh_GenerateAdjacency(ID3DXMesh *iface, float epsilon, DWORD *adjacency) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *This = impl_from_ID3DXMesh(iface); HRESULT hr; BYTE *vertices = NULL; const DWORD *indices = NULL; @@ -1225,7 +1232,7 @@ static HRESULT WINAPI ID3DXMeshImpl_GenerateAdjacency(ID3DXMesh *iface, FLOAT ep const FLOAT epsilon_sq = epsilon * epsilon; DWORD i; - TRACE("(%p)->(%f,%p)\n", This, epsilon, adjacency); + TRACE("iface %p, epsilon %.8e, adjacency %p.\n", iface, epsilon, adjacency); if (!adjacency) return D3DERR_INVALIDCALL; @@ -1355,14 +1362,14 @@ cleanup: return hr; } -static HRESULT WINAPI ID3DXMeshImpl_UpdateSemantics(ID3DXMesh *iface, D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE]) +static HRESULT WINAPI d3dx9_mesh_UpdateSemantics(ID3DXMesh *iface, D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE]) { + struct d3dx9_mesh *This = impl_from_ID3DXMesh(iface); HRESULT hr; - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); UINT vertex_declaration_size; int i; - TRACE("(%p)->(%p)\n", This, declaration); + TRACE("iface %p, declaration %p.\n", iface, declaration); if (!declaration) { @@ -1414,53 +1421,54 @@ static HRESULT WINAPI ID3DXMeshImpl_UpdateSemantics(ID3DXMesh *iface, D3DVERTEXE return D3D_OK; } -/*** ID3DXMesh ***/ -static HRESULT WINAPI ID3DXMeshImpl_LockAttributeBuffer(ID3DXMesh *iface, DWORD flags, DWORD **data) +static HRESULT WINAPI d3dx9_mesh_LockAttributeBuffer(ID3DXMesh *iface, DWORD flags, DWORD **data) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); - TRACE("(%p)->(%u,%p)\n", This, flags, data); + TRACE("iface %p, flags %#x, data %p.\n", iface, flags, data); - InterlockedIncrement(&This->attrib_buffer_lock_count); + InterlockedIncrement(&mesh->attrib_buffer_lock_count); - if (!(flags & D3DLOCK_READONLY)) { - D3DXATTRIBUTERANGE *attrib_table = This->attrib_table; - This->attrib_table_size = 0; - This->attrib_table = NULL; + if (!(flags & D3DLOCK_READONLY)) + { + D3DXATTRIBUTERANGE *attrib_table = mesh->attrib_table; + mesh->attrib_table_size = 0; + mesh->attrib_table = NULL; HeapFree(GetProcessHeap(), 0, attrib_table); } - *data = This->attrib_buffer; + *data = mesh->attrib_buffer; return D3D_OK; } -static HRESULT WINAPI ID3DXMeshImpl_UnlockAttributeBuffer(ID3DXMesh *iface) +static HRESULT WINAPI d3dx9_mesh_UnlockAttributeBuffer(ID3DXMesh *iface) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); int lock_count; - TRACE("(%p)\n", This); + TRACE("iface %p.\n", iface); - lock_count = InterlockedDecrement(&This->attrib_buffer_lock_count); - - if (lock_count < 0) { - InterlockedIncrement(&This->attrib_buffer_lock_count); + lock_count = InterlockedDecrement(&mesh->attrib_buffer_lock_count); + if (lock_count < 0) + { + InterlockedIncrement(&mesh->attrib_buffer_lock_count); return D3DERR_INVALIDCALL; } return D3D_OK; } -static HRESULT WINAPI ID3DXMeshImpl_Optimize(ID3DXMesh *iface, DWORD flags, const DWORD *adjacency_in, +static HRESULT WINAPI d3dx9_mesh_Optimize(ID3DXMesh *iface, DWORD flags, const DWORD *adjacency_in, DWORD *adjacency_out, DWORD *face_remap, ID3DXBuffer **vertex_remap, ID3DXMesh **opt_mesh) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); HRESULT hr; D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE] = { D3DDECL_END() }; ID3DXMesh *optimized_mesh; - TRACE("(%p)->(%x,%p,%p,%p,%p,%p)\n", This, flags, adjacency_in, adjacency_out, face_remap, vertex_remap, opt_mesh); + TRACE("iface %p, flags %#x, adjacency_in %p, adjacency_out %p, face_remap %p, vertex_remap %p, opt_mesh %p.\n", + iface, flags, adjacency_in, adjacency_out, face_remap, vertex_remap, opt_mesh); if (!opt_mesh) return D3DERR_INVALIDCALL; @@ -1468,8 +1476,8 @@ static HRESULT WINAPI ID3DXMeshImpl_Optimize(ID3DXMesh *iface, DWORD flags, cons hr = iface->lpVtbl->GetDeclaration(iface, declaration); if (FAILED(hr)) return hr; - hr = iface->lpVtbl->CloneMesh(iface, This->options, declaration, This->device, &optimized_mesh); - if (FAILED(hr)) return hr; + if (FAILED(hr = iface->lpVtbl->CloneMesh(iface, mesh->options, declaration, mesh->device, &optimized_mesh))) + return hr; hr = optimized_mesh->lpVtbl->OptimizeInplace(optimized_mesh, flags, adjacency_in, adjacency_out, face_remap, vertex_remap); if (SUCCEEDED(hr)) @@ -1481,7 +1489,8 @@ static HRESULT WINAPI ID3DXMeshImpl_Optimize(ID3DXMesh *iface, DWORD flags, cons /* Creates a vertex_remap that removes unused vertices. * Indices are updated according to the vertex_remap. */ -static HRESULT compact_mesh(ID3DXMeshImpl *This, DWORD *indices, DWORD *new_num_vertices, ID3DXBuffer **vertex_remap) +static HRESULT compact_mesh(struct d3dx9_mesh *This, DWORD *indices, + DWORD *new_num_vertices, ID3DXBuffer **vertex_remap) { HRESULT hr; DWORD *vertex_remap_ptr; @@ -1590,18 +1599,23 @@ static int attrib_entry_compare(const DWORD **a, const DWORD **b) } /* Create face_remap, a new attribute buffer for attribute sort optimization. */ -static HRESULT remap_faces_for_attrsort(ID3DXMeshImpl *This, const DWORD *indices, - const DWORD *attrib_buffer, DWORD **sorted_attrib_buffer, DWORD **face_remap) +static HRESULT remap_faces_for_attrsort(struct d3dx9_mesh *This, const DWORD *indices, + DWORD *attrib_buffer, DWORD **sorted_attrib_buffer, DWORD **face_remap) { - const DWORD **sorted_attrib_ptr_buffer = NULL; + DWORD **sorted_attrib_ptr_buffer = NULL; DWORD i; - *face_remap = HeapAlloc(GetProcessHeap(), 0, This->numfaces * sizeof(**face_remap)); sorted_attrib_ptr_buffer = HeapAlloc(GetProcessHeap(), 0, This->numfaces * sizeof(*sorted_attrib_ptr_buffer)); - if (!*face_remap || !sorted_attrib_ptr_buffer) { + if (!sorted_attrib_ptr_buffer) + return E_OUTOFMEMORY; + + *face_remap = HeapAlloc(GetProcessHeap(), 0, This->numfaces * sizeof(**face_remap)); + if (!*face_remap) + { HeapFree(GetProcessHeap(), 0, sorted_attrib_ptr_buffer); return E_OUTOFMEMORY; } + for (i = 0; i < This->numfaces; i++) sorted_attrib_ptr_buffer[i] = &attrib_buffer[i]; qsort(sorted_attrib_ptr_buffer, This->numfaces, sizeof(*sorted_attrib_ptr_buffer), @@ -1621,10 +1635,10 @@ static HRESULT remap_faces_for_attrsort(ID3DXMeshImpl *This, const DWORD *indice return D3D_OK; } -static HRESULT WINAPI ID3DXMeshImpl_OptimizeInplace(ID3DXMesh *iface, DWORD flags, const DWORD *adjacency_in, +static HRESULT WINAPI d3dx9_mesh_OptimizeInplace(ID3DXMesh *iface, DWORD flags, const DWORD *adjacency_in, DWORD *adjacency_out, DWORD *face_remap_out, ID3DXBuffer **vertex_remap_out) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *This = impl_from_ID3DXMesh(iface); void *indices = NULL; DWORD *attrib_buffer = NULL; HRESULT hr; @@ -1637,7 +1651,8 @@ static HRESULT WINAPI ID3DXMeshImpl_OptimizeInplace(ID3DXMesh *iface, DWORD flag DWORD *sorted_attrib_buffer = NULL; DWORD i; - TRACE("(%p)->(%x,%p,%p,%p,%p)\n", This, flags, adjacency_in, adjacency_out, face_remap_out, vertex_remap_out); + TRACE("iface %p, flags %#x, adjacency_in %p, adjacency_out %p, face_remap_out %p, vertex_remap_out %p.\n", + iface, flags, adjacency_in, adjacency_out, face_remap_out, vertex_remap_out); if (!flags) return D3DERR_INVALIDCALL; @@ -1818,12 +1833,13 @@ cleanup: return hr; } -static HRESULT WINAPI ID3DXMeshImpl_SetAttributeTable(ID3DXMesh *iface, CONST D3DXATTRIBUTERANGE *attrib_table, DWORD attrib_table_size) +static HRESULT WINAPI d3dx9_mesh_SetAttributeTable(ID3DXMesh *iface, + const D3DXATTRIBUTERANGE *attrib_table, DWORD attrib_table_size) { - ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface); + struct d3dx9_mesh *mesh = impl_from_ID3DXMesh(iface); D3DXATTRIBUTERANGE *new_table = NULL; - TRACE("(%p)->(%p,%u)\n", This, attrib_table, attrib_table_size); + TRACE("iface %p, attrib_table %p, attrib_table_size %u.\n", iface, attrib_table, attrib_table_size); if (attrib_table_size) { size_t size = attrib_table_size * sizeof(*attrib_table); @@ -1836,53 +1852,46 @@ static HRESULT WINAPI ID3DXMeshImpl_SetAttributeTable(ID3DXMesh *iface, CONST D3 } else if (attrib_table) { return D3DERR_INVALIDCALL; } - HeapFree(GetProcessHeap(), 0, This->attrib_table); - This->attrib_table = new_table; - This->attrib_table_size = attrib_table_size; + HeapFree(GetProcessHeap(), 0, mesh->attrib_table); + mesh->attrib_table = new_table; + mesh->attrib_table_size = attrib_table_size; return D3D_OK; } static const struct ID3DXMeshVtbl D3DXMesh_Vtbl = { - /*** IUnknown methods ***/ - ID3DXMeshImpl_QueryInterface, - ID3DXMeshImpl_AddRef, - ID3DXMeshImpl_Release, - /*** ID3DXBaseMesh ***/ - ID3DXMeshImpl_DrawSubset, - ID3DXMeshImpl_GetNumFaces, - ID3DXMeshImpl_GetNumVertices, - ID3DXMeshImpl_GetFVF, - ID3DXMeshImpl_GetDeclaration, - ID3DXMeshImpl_GetNumBytesPerVertex, - ID3DXMeshImpl_GetOptions, - ID3DXMeshImpl_GetDevice, - ID3DXMeshImpl_CloneMeshFVF, - ID3DXMeshImpl_CloneMesh, - ID3DXMeshImpl_GetVertexBuffer, - ID3DXMeshImpl_GetIndexBuffer, - ID3DXMeshImpl_LockVertexBuffer, - ID3DXMeshImpl_UnlockVertexBuffer, - ID3DXMeshImpl_LockIndexBuffer, - ID3DXMeshImpl_UnlockIndexBuffer, - ID3DXMeshImpl_GetAttributeTable, - ID3DXMeshImpl_ConvertPointRepsToAdjacency, - ID3DXMeshImpl_ConvertAdjacencyToPointReps, - ID3DXMeshImpl_GenerateAdjacency, - ID3DXMeshImpl_UpdateSemantics, - /*** ID3DXMesh ***/ - ID3DXMeshImpl_LockAttributeBuffer, - ID3DXMeshImpl_UnlockAttributeBuffer, - ID3DXMeshImpl_Optimize, - ID3DXMeshImpl_OptimizeInplace, - ID3DXMeshImpl_SetAttributeTable + d3dx9_mesh_QueryInterface, + d3dx9_mesh_AddRef, + d3dx9_mesh_Release, + d3dx9_mesh_DrawSubset, + d3dx9_mesh_GetNumFaces, + d3dx9_mesh_GetNumVertices, + d3dx9_mesh_GetFVF, + d3dx9_mesh_GetDeclaration, + d3dx9_mesh_GetNumBytesPerVertex, + d3dx9_mesh_GetOptions, + d3dx9_mesh_GetDevice, + d3dx9_mesh_CloneMeshFVF, + d3dx9_mesh_CloneMesh, + d3dx9_mesh_GetVertexBuffer, + d3dx9_mesh_GetIndexBuffer, + d3dx9_mesh_LockVertexBuffer, + d3dx9_mesh_UnlockVertexBuffer, + d3dx9_mesh_LockIndexBuffer, + d3dx9_mesh_UnlockIndexBuffer, + d3dx9_mesh_GetAttributeTable, + d3dx9_mesh_ConvertPointRepsToAdjacency, + d3dx9_mesh_ConvertAdjacencyToPointReps, + d3dx9_mesh_GenerateAdjacency, + d3dx9_mesh_UpdateSemantics, + d3dx9_mesh_LockAttributeBuffer, + d3dx9_mesh_UnlockAttributeBuffer, + d3dx9_mesh_Optimize, + d3dx9_mesh_OptimizeInplace, + d3dx9_mesh_SetAttributeTable, }; -/************************************************************************* - * D3DXBoxBoundProbe - */ -BOOL WINAPI D3DXBoxBoundProbe(CONST D3DXVECTOR3 *pmin, CONST D3DXVECTOR3 *pmax, CONST D3DXVECTOR3 *prayposition, CONST D3DXVECTOR3 *praydirection) /* Algorithm taken from the article: An Efficient and Robust Ray-Box Intersection Algorithm Amy Williams University of Utah @@ -1898,9 +1907,9 @@ This algorithm is free of patents or of copyrights, as confirmed by Peter Shirle Algorithm: Consider the box as the intersection of three slabs. Clip the ray against each slab, if there's anything left of the ray after we're -done we've got an intersection of the ray with the box. -*/ - +done we've got an intersection of the ray with the box. */ +BOOL WINAPI D3DXBoxBoundProbe(const D3DXVECTOR3 *pmin, const D3DXVECTOR3 *pmax, + const D3DXVECTOR3 *prayposition, const D3DXVECTOR3 *praydirection) { FLOAT div, tmin, tmax, tymin, tymax, tzmin, tzmax; @@ -1952,10 +1961,8 @@ done we've got an intersection of the ray with the box. return TRUE; } -/************************************************************************* - * D3DXComputeBoundingBox - */ -HRESULT WINAPI D3DXComputeBoundingBox(CONST D3DXVECTOR3 *pfirstposition, DWORD numvertices, DWORD dwstride, D3DXVECTOR3 *pmin, D3DXVECTOR3 *pmax) +HRESULT WINAPI D3DXComputeBoundingBox(const D3DXVECTOR3 *pfirstposition, + DWORD numvertices, DWORD dwstride, D3DXVECTOR3 *pmin, D3DXVECTOR3 *pmax) { D3DXVECTOR3 vec; unsigned int i; @@ -1982,10 +1989,8 @@ HRESULT WINAPI D3DXComputeBoundingBox(CONST D3DXVECTOR3 *pfirstposition, DWORD n return D3D_OK; } -/************************************************************************* - * D3DXComputeBoundingSphere - */ -HRESULT WINAPI D3DXComputeBoundingSphere(CONST D3DXVECTOR3* pfirstposition, DWORD numvertices, DWORD dwstride, D3DXVECTOR3 *pcenter, FLOAT *pradius) +HRESULT WINAPI D3DXComputeBoundingSphere(const D3DXVECTOR3 *pfirstposition, + DWORD numvertices, DWORD dwstride, D3DXVECTOR3 *pcenter, float *pradius) { D3DXVECTOR3 temp; FLOAT d; @@ -2359,10 +2364,8 @@ UINT WINAPI D3DXGetDeclLength(const D3DVERTEXELEMENT9 *decl) return element - decl; } -/************************************************************************* - * D3DXIntersectTri - */ -BOOL WINAPI D3DXIntersectTri(CONST D3DXVECTOR3 *p0, CONST D3DXVECTOR3 *p1, CONST D3DXVECTOR3 *p2, CONST D3DXVECTOR3 *praypos, CONST D3DXVECTOR3 *praydir, FLOAT *pu, FLOAT *pv, FLOAT *pdist) +BOOL WINAPI D3DXIntersectTri(const D3DXVECTOR3 *p0, const D3DXVECTOR3 *p1, const D3DXVECTOR3 *p2, + const D3DXVECTOR3 *praypos, const D3DXVECTOR3 *praydir, float *pu, float *pv, float *pdist) { D3DXMATRIX m; D3DXVECTOR4 vec; @@ -2396,7 +2399,7 @@ BOOL WINAPI D3DXIntersectTri(CONST D3DXVECTOR3 *p0, CONST D3DXVECTOR3 *p1, CONST { *pu = vec.x; *pv = vec.y; - *pdist = fabs( vec.z ); + *pdist = fabsf( vec.z ); return TRUE; } } @@ -2404,10 +2407,8 @@ BOOL WINAPI D3DXIntersectTri(CONST D3DXVECTOR3 *p0, CONST D3DXVECTOR3 *p1, CONST return FALSE; } -/************************************************************************* - * D3DXSphereBoundProbe - */ -BOOL WINAPI D3DXSphereBoundProbe(CONST D3DXVECTOR3 *pcenter, FLOAT radius, CONST D3DXVECTOR3 *prayposition, CONST D3DXVECTOR3 *praydirection) +BOOL WINAPI D3DXSphereBoundProbe(const D3DXVECTOR3 *pcenter, float radius, + const D3DXVECTOR3 *prayposition, const D3DXVECTOR3 *praydirection) { D3DXVECTOR3 difference; FLOAT a, b, c, d; @@ -2436,7 +2437,7 @@ HRESULT WINAPI D3DXCreateMesh(DWORD numfaces, DWORD numvertices, DWORD options, IDirect3DVertexBuffer9 *vertex_buffer; IDirect3DIndexBuffer9 *index_buffer; DWORD *attrib_buffer; - ID3DXMeshImpl *object; + struct d3dx9_mesh *object; DWORD index_usage = 0; D3DPOOL index_pool = D3DPOOL_DEFAULT; D3DFORMAT index_format = D3DFMT_INDEX16; @@ -2444,7 +2445,8 @@ HRESULT WINAPI D3DXCreateMesh(DWORD numfaces, DWORD numvertices, DWORD options, D3DPOOL vertex_pool = D3DPOOL_DEFAULT; int i; - TRACE("(%d, %d, %x, %p, %p, %p)\n", numfaces, numvertices, options, declaration, device, mesh); + TRACE("numfaces %u, numvertices %u, options %#x, declaration %p, device %p, mesh %p.\n", + numfaces, numvertices, options, declaration, device, mesh); if (numfaces == 0 || numvertices == 0 || declaration == NULL || device == NULL || mesh == NULL || /* D3DXMESH_VB_SHARE is for cloning, and D3DXMESH_USEHWONLY is for ConvertToBlendedMesh */ @@ -2550,7 +2552,7 @@ HRESULT WINAPI D3DXCreateMesh(DWORD numfaces, DWORD numvertices, DWORD options, } attrib_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, numfaces * sizeof(*attrib_buffer)); - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ID3DXMeshImpl)); + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (object == NULL || attrib_buffer == NULL) { HeapFree(GetProcessHeap(), 0, object); @@ -2630,7 +2632,7 @@ struct mesh_data { DWORD nb_bones; }; -static HRESULT parse_texture_filename(ID3DXFileData *filedata, LPSTR *filename_out) +static HRESULT parse_texture_filename(ID3DXFileData *filedata, char **filename_out) { HRESULT hr; SIZE_T data_size; @@ -2650,12 +2652,13 @@ static HRESULT parse_texture_filename(ID3DXFileData *filedata, LPSTR *filename_o if (FAILED(hr)) return hr; /* FIXME: String must be retrieved directly instead of through a pointer once ID3DXFILE is fixed */ - if (data_size < sizeof(LPSTR)) { + if (data_size < sizeof(filename_in)) + { WARN("truncated data (%lu bytes)\n", data_size); filedata->lpVtbl->Unlock(filedata); return E_FAIL; } - filename_in = *(LPSTR*)data; + filename_in = *(char **)data; filename = HeapAlloc(GetProcessHeap(), 0, strlen(filename_in) + 1); if (!filename) { @@ -2678,8 +2681,7 @@ static HRESULT parse_material(ID3DXFileData *filedata, D3DXMATERIAL *material) const BYTE *data; GUID type; ID3DXFileData *child; - SIZE_T nb_children; - int i; + SIZE_T i, nb_children; material->pTextureFilename = NULL; @@ -3390,7 +3392,7 @@ static HRESULT generate_effects(ID3DXBuffer *materials, DWORD num_materials, for (j = 0; j < ARRAY_SIZE(material_effects); j++) { - defaults->pParamName = (LPSTR)out_ptr; + defaults->pParamName = (char *)out_ptr; strcpy(defaults->pParamName, material_effects[j].param_name); defaults->pValue = defaults->pParamName + material_effects[j].name_size; defaults->Type = D3DXEDT_FLOATS; @@ -3400,8 +3402,9 @@ static HRESULT generate_effects(ID3DXBuffer *materials, DWORD num_materials, defaults++; } - if (material_ptr->pTextureFilename) { - defaults->pParamName = (LPSTR)out_ptr; + if (material_ptr->pTextureFilename) + { + defaults->pParamName = (char *)out_ptr; strcpy(defaults->pParamName, texture_paramname); defaults->pValue = defaults->pParamName + sizeof(texture_paramname); defaults->Type = D3DXEDT_STRING; @@ -3665,12 +3668,14 @@ HRESULT WINAPI D3DXLoadMeshHierarchyFromXA(const char *filename, DWORD options, struct ID3DXAllocateHierarchy *alloc_hier, struct ID3DXLoadUserData *load_user_data, D3DXFRAME **frame_hierarchy, struct ID3DXAnimationController **anim_controller) { + WCHAR *filenameW; HRESULT hr; int len; - LPWSTR filenameW; - TRACE("(%s, %x, %p, %p, %p, %p, %p)\n", debugstr_a(filename), options, - device, alloc_hier, load_user_data, frame_hierarchy, anim_controller); + TRACE("filename %s, options %#x, device %p, alloc_hier %p, " + "load_user_data %p, frame_hierarchy %p, anim_controller %p.\n", + debugstr_a(filename), options, device, alloc_hier, + load_user_data, frame_hierarchy, anim_controller); if (!filename) return D3DERR_INVALIDCALL; @@ -3691,12 +3696,14 @@ HRESULT WINAPI D3DXLoadMeshHierarchyFromXW(const WCHAR *filename, DWORD options, struct ID3DXAllocateHierarchy *alloc_hier, struct ID3DXLoadUserData *load_user_data, D3DXFRAME **frame_hierarchy, struct ID3DXAnimationController **anim_controller) { + void *buffer; HRESULT hr; DWORD size; - LPVOID buffer; - TRACE("(%s, %x, %p, %p, %p, %p, %p)\n", debugstr_w(filename), options, - device, alloc_hier, load_user_data, frame_hierarchy, anim_controller); + TRACE("filename %s, options %#x, device %p, alloc_hier %p, " + "load_user_data %p, frame_hierarchy %p, anim_controller %p.\n", + debugstr_w(filename), options, device, alloc_hier, + load_user_data, frame_hierarchy, anim_controller); if (!filename) return D3DERR_INVALIDCALL; @@ -3814,8 +3821,7 @@ static HRESULT load_frame(struct ID3DXFileData *filedata, DWORD options, struct D3DXFRAME *frame = NULL; D3DXMESHCONTAINER **next_container; D3DXFRAME **next_child; - SIZE_T nb_children; - int i; + SIZE_T i, nb_children; hr = filedata_get_name(filedata, &name); if (FAILED(hr)) return hr; @@ -3872,9 +3878,8 @@ HRESULT WINAPI D3DXLoadMeshHierarchyFromXInMemory(const void *memory, DWORD memo D3DXF_FILELOADMEMORY source; D3DXFRAME *first_frame = NULL; D3DXFRAME **next_frame = &first_frame; - SIZE_T nb_children; + SIZE_T i, nb_children; GUID guid; - int i; TRACE("(%p, %u, %x, %p, %p, %p, %p, %p)\n", memory, memory_size, options, device, alloc_hier, load_user_data, frame_hierarchy, anim_controller); @@ -4017,12 +4022,14 @@ HRESULT WINAPI D3DXLoadMeshFromXA(const char *filename, DWORD options, struct ID struct ID3DXBuffer **adjacency, struct ID3DXBuffer **materials, struct ID3DXBuffer **effect_instances, DWORD *num_materials, struct ID3DXMesh **mesh) { + WCHAR *filenameW; HRESULT hr; int len; - LPWSTR filenameW; - TRACE("(%s, %x, %p, %p, %p, %p, %p, %p)\n", debugstr_a(filename), options, - device, adjacency, materials, effect_instances, num_materials, mesh); + TRACE("filename %s, options %#x, device %p, adjacency %p, materials %p, " + "effect_instances %p, num_materials %p, mesh %p.\n", + debugstr_a(filename), options, device, adjacency, materials, + effect_instances, num_materials, mesh); if (!filename) return D3DERR_INVALIDCALL; @@ -4043,12 +4050,14 @@ HRESULT WINAPI D3DXLoadMeshFromXW(const WCHAR *filename, DWORD options, struct I struct ID3DXBuffer **adjacency, struct ID3DXBuffer **materials, struct ID3DXBuffer **effect_instances, DWORD *num_materials, struct ID3DXMesh **mesh) { + void *buffer; HRESULT hr; DWORD size; - LPVOID buffer; - TRACE("(%s, %x, %p, %p, %p, %p, %p, %p)\n", debugstr_w(filename), options, - device, adjacency, materials, effect_instances, num_materials, mesh); + TRACE("filename %s, options %#x, device %p, adjacency %p, materials %p, " + "effect_instances %p, num_materials %p, mesh %p.\n", + debugstr_w(filename), options, device, adjacency, materials, + effect_instances, num_materials, mesh); if (!filename) return D3DERR_INVALIDCALL; @@ -4071,12 +4080,13 @@ HRESULT WINAPI D3DXLoadMeshFromXResource(HMODULE module, const char *name, const { HRESULT hr; HRSRC resinfo; + void *buffer; DWORD size; - LPVOID buffer; - TRACE("(%p, %s, %s, %x, %p, %p, %p, %p, %p, %p)\n", - module, debugstr_a(name), debugstr_a(type), options, device, - adjacency, materials, effect_instances, num_materials, mesh); + TRACE("module %p, name %s, type %s, options %#x, device %p, adjacency %p, " + "materials %p, effect_instances %p, num_materials %p, mesh %p.\n", + module, debugstr_a(name), debugstr_a(type), options, device, adjacency, + materials, effect_instances, num_materials, mesh); resinfo = FindResourceA(module, name, type); if (!resinfo) return D3DXERR_INVALIDDATA; @@ -4106,8 +4116,7 @@ static HRESULT parse_frame(struct ID3DXFileData *filedata, DWORD options, struct D3DXMATRIX transform = *parent_transform; ID3DXFileData *child; GUID type; - SIZE_T nb_children; - int i; + SIZE_T i, nb_children; hr = filedata->lpVtbl->GetChildren(filedata, &nb_children); if (FAILED(hr)) @@ -4172,9 +4181,8 @@ HRESULT WINAPI D3DXLoadMeshFromXInMemory(const void *memory, DWORD memory_size, void *concat_indices = NULL; DWORD index_offset; DWORD concat_vertex_size; - SIZE_T nb_children; + SIZE_T i, nb_children; GUID guid; - int i; TRACE("(%p, %u, %x, %p, %p, %p, %p, %p, %p)\n", memory, memory_size, options, device, adjacency_out, materials_out, effects_out, num_materials_out, mesh_out); @@ -4507,20 +4515,106 @@ cleanup: return hr; } -HRESULT WINAPI D3DXCreateBox(struct IDirect3DDevice9 *device, float width, float height, - float depth, struct ID3DXMesh **mesh, struct ID3DXBuffer **adjacency) -{ - FIXME("(%p, %f, %f, %f, %p, %p): stub\n", device, width, height, depth, mesh, adjacency); - - return E_NOTIMPL; -} - struct vertex { D3DXVECTOR3 position; D3DXVECTOR3 normal; }; +HRESULT WINAPI D3DXCreateBox(struct IDirect3DDevice9 *device, float width, float height, + float depth, struct ID3DXMesh **mesh, struct ID3DXBuffer **adjacency) +{ + HRESULT hr; + ID3DXMesh *box; + struct vertex *vertices; + WORD (*faces)[3]; + DWORD *adjacency_buf; + unsigned int i, face; + static const D3DXVECTOR3 unit_box[] = + { + {-0.5f, -0.5f, -0.5f}, {-0.5f, -0.5f, 0.5f}, {-0.5f, 0.5f, 0.5f}, {-0.5f, 0.5f, -0.5f}, + {-0.5f, 0.5f, -0.5f}, {-0.5f, 0.5f, 0.5f}, { 0.5f, 0.5f, 0.5f}, { 0.5f, 0.5f, -0.5f}, + { 0.5f, 0.5f, -0.5f}, { 0.5f, 0.5f, 0.5f}, { 0.5f, -0.5f, 0.5f}, { 0.5f, -0.5f, -0.5f}, + {-0.5f, -0.5f, 0.5f}, {-0.5f, -0.5f, -0.5f}, { 0.5f, -0.5f, -0.5f}, { 0.5f, -0.5f, 0.5f}, + {-0.5f, -0.5f, 0.5f}, { 0.5f, -0.5f, 0.5f}, { 0.5f, 0.5f, 0.5f}, {-0.5f, 0.5f, 0.5f}, + {-0.5f, -0.5f, -0.5f}, {-0.5f, 0.5f, -0.5f}, { 0.5f, 0.5f, -0.5f}, { 0.5f, -0.5f, -0.5f} + }; + static const D3DXVECTOR3 normals[] = + { + {-1.0f, 0.0f, 0.0f}, { 0.0f, 1.0f, 0.0f}, { 1.0f, 0.0f, 0.0f}, + { 0.0f, -1.0f, 0.0f}, { 0.0f, 0.0f, 1.0f}, { 0.0f, 0.0f, -1.0f} + }; + static const DWORD adjacency_table[] = + { + 6, 9, 1, 2, 10, 0, 1, 9, 3, 4, 10, 2, + 3, 8, 5, 7, 11, 4, 0, 11, 7, 5, 8, 6, + 7, 4, 9, 2, 0, 8, 1, 3, 11, 5, 6, 10 + }; + + TRACE("device %p, width %f, height %f, depth %f, mesh %p, adjacency %p\n", + device, width, height, depth, mesh, adjacency); + + if (!device || width < 0.0f || height < 0.0f || depth < 0.0f || !mesh) + { + return D3DERR_INVALIDCALL; + } + + if (FAILED(hr = D3DXCreateMeshFVF(12, 24, D3DXMESH_MANAGED, D3DFVF_XYZ | D3DFVF_NORMAL, device, &box))) + { + return hr; + } + + if (FAILED(hr = box->lpVtbl->LockVertexBuffer(box, 0, (void **)&vertices))) + { + box->lpVtbl->Release(box); + return hr; + } + + if (FAILED(hr = box->lpVtbl->LockIndexBuffer(box, 0, (void **)&faces))) + { + box->lpVtbl->UnlockVertexBuffer(box); + box->lpVtbl->Release(box); + return hr; + } + + for (i = 0; i < 24; i++) + { + vertices[i].position.x = width * unit_box[i].x; + vertices[i].position.y = height * unit_box[i].y; + vertices[i].position.z = depth * unit_box[i].z; + vertices[i].normal.x = normals[i / 4].x; + vertices[i].normal.y = normals[i / 4].y; + vertices[i].normal.z = normals[i / 4].z; + } + + face = 0; + for (i = 0; i < 12; i++) + { + faces[i][0] = face++; + faces[i][1] = face++; + faces[i][2] = (i % 2) ? face - 4 : face; + } + + box->lpVtbl->UnlockIndexBuffer(box); + box->lpVtbl->UnlockVertexBuffer(box); + + if (adjacency) + { + if (FAILED(hr = D3DXCreateBuffer(sizeof(adjacency_table), adjacency))) + { + box->lpVtbl->Release(box); + return hr; + } + + adjacency_buf = ID3DXBuffer_GetBufferPointer(*adjacency); + memcpy(adjacency_buf, adjacency_table, sizeof(adjacency_table)); + } + + *mesh = box; + + return D3D_OK; +} + typedef WORD face[3]; struct sincos_table @@ -4556,8 +4650,8 @@ static BOOL compute_sincos_table(struct sincos_table *sincos_table, float angle_ angle = angle_start; for (i = 0; i < n; i++) { - sincos_table->sin[i] = sin(angle); - sincos_table->cos[i] = cos(angle); + sincos_table->sin[i] = sinf(angle); + sincos_table->cos[i] = cosf(angle); angle += angle_step; } @@ -4605,15 +4699,13 @@ HRESULT WINAPI D3DXCreateSphere(struct IDirect3DDevice9 *device, float radius, U return hr; } - hr = sphere->lpVtbl->LockVertexBuffer(sphere, 0, (LPVOID *)&vertices); - if (FAILED(hr)) + if (FAILED(hr = sphere->lpVtbl->LockVertexBuffer(sphere, 0, (void **)&vertices))) { sphere->lpVtbl->Release(sphere); return hr; } - hr = sphere->lpVtbl->LockIndexBuffer(sphere, 0, (LPVOID *)&faces); - if (FAILED(hr)) + if (FAILED(hr = sphere->lpVtbl->LockIndexBuffer(sphere, 0, (void **)&faces))) { sphere->lpVtbl->UnlockVertexBuffer(sphere); sphere->lpVtbl->Release(sphere); @@ -4621,8 +4713,8 @@ HRESULT WINAPI D3DXCreateSphere(struct IDirect3DDevice9 *device, float radius, U } /* phi = angle on xz plane wrt z axis */ - phi_step = -2 * M_PI / slices; - phi_start = M_PI / 2; + phi_step = -2.0f * D3DX_PI / slices; + phi_start = D3DX_PI / 2.0f; if (!compute_sincos_table(&phi, phi_start, phi_step, slices)) { @@ -4633,7 +4725,7 @@ HRESULT WINAPI D3DXCreateSphere(struct IDirect3DDevice9 *device, float radius, U } /* theta = angle on xy plane wrt x axis */ - theta_step = M_PI / stacks; + theta_step = D3DX_PI / stacks; theta = theta_step; vertex = 0; @@ -4649,8 +4741,8 @@ HRESULT WINAPI D3DXCreateSphere(struct IDirect3DDevice9 *device, float radius, U for (stack = 0; stack < stacks - 1; stack++) { - sin_theta = sin(theta); - cos_theta = cos(theta); + sin_theta = sinf(theta); + cos_theta = cosf(theta); for (slice = 0; slice < slices; slice++) { @@ -4776,15 +4868,13 @@ HRESULT WINAPI D3DXCreateCylinder(struct IDirect3DDevice9 *device, float radius1 return hr; } - hr = cylinder->lpVtbl->LockVertexBuffer(cylinder, 0, (LPVOID *)&vertices); - if (FAILED(hr)) + if (FAILED(hr = cylinder->lpVtbl->LockVertexBuffer(cylinder, 0, (void **)&vertices))) { cylinder->lpVtbl->Release(cylinder); return hr; } - hr = cylinder->lpVtbl->LockIndexBuffer(cylinder, 0, (LPVOID *)&faces); - if (FAILED(hr)) + if (FAILED(hr = cylinder->lpVtbl->LockIndexBuffer(cylinder, 0, (void **)&faces))) { cylinder->lpVtbl->UnlockVertexBuffer(cylinder); cylinder->lpVtbl->Release(cylinder); @@ -4792,8 +4882,8 @@ HRESULT WINAPI D3DXCreateCylinder(struct IDirect3DDevice9 *device, float radius1 } /* theta = angle on xy plane wrt x axis */ - theta_step = -2 * M_PI / slices; - theta_start = M_PI / 2; + theta_step = -2.0f * D3DX_PI / slices; + theta_start = D3DX_PI / 2.0f; if (!compute_sincos_table(&theta, theta_start, theta_step, slices)) { @@ -4935,12 +5025,12 @@ HRESULT WINAPI D3DXCreateTeapot(struct IDirect3DDevice9 *device, HRESULT WINAPI D3DXCreateTextA(struct IDirect3DDevice9 *device, HDC hdc, const char *text, float deviation, float extrusion, struct ID3DXMesh **mesh, struct ID3DXBuffer **adjacency, GLYPHMETRICSFLOAT *glyphmetrics) { + WCHAR *textW; HRESULT hr; int len; - LPWSTR textW; - TRACE("(%p, %p, %s, %f, %f, %p, %p, %p)\n", device, hdc, - debugstr_a(text), deviation, extrusion, mesh, adjacency, glyphmetrics); + TRACE("device %p, hdc %p, text %s, deviation %.8e, extrusion %.8e, mesh %p, adjacency %p, glyphmetrics %p.\n", + device, hdc, debugstr_a(text), deviation, extrusion, mesh, adjacency, glyphmetrics); if (!text) return D3DERR_INVALIDCALL; @@ -5114,7 +5204,7 @@ static HRESULT add_vertex_index(struct word_array *array, WORD vertex_index) C_ASSERT(sizeof(FIXED) == sizeof(float)); C_ASSERT(sizeof(POINTFX) == sizeof(D3DXVECTOR2)); -static inline D3DXVECTOR2 *convert_fixed_to_float(POINTFX *pt, int count, float emsquare) +static inline D3DXVECTOR2 *convert_fixed_to_float(POINTFX *pt, int count, unsigned int emsquare) { D3DXVECTOR2 *ret = (D3DXVECTOR2*)pt; while (count--) { @@ -5219,7 +5309,8 @@ static BOOL attempt_line_merge(struct outline *outline, } static HRESULT create_outline(struct glyphinfo *glyph, void *raw_outline, int datasize, - float max_deviation_sq, float emsquare, const struct cos_table *cos_table) + float max_deviation_sq, unsigned int emsquare, + const struct cos_table *cos_table) { TTPOLYGONHEADER *header = (TTPOLYGONHEADER *)raw_outline; @@ -5763,9 +5854,9 @@ HRESULT WINAPI D3DXCreateTextW(struct IDirect3DDevice9 *device, HDC hdc, const W face *face_ptr; float max_deviation_sq; const struct cos_table cos_table = { - cos(D3DXToRadian(0.5f)), - cos(D3DXToRadian(45.0f)), - cos(D3DXToRadian(90.0f)), + cosf(D3DXToRadian(0.5f)), + cosf(D3DXToRadian(45.0f)), + cosf(D3DXToRadian(90.0f)), }; int f1, f2; @@ -5883,12 +5974,10 @@ HRESULT WINAPI D3DXCreateTextW(struct IDirect3DDevice9 *device, HDC hdc, const W if (FAILED(hr)) goto error; - hr = mesh->lpVtbl->LockVertexBuffer(mesh, 0, (LPVOID *)&vertices); - if (FAILED(hr)) + if (FAILED(hr = mesh->lpVtbl->LockVertexBuffer(mesh, 0, (void **)&vertices))) goto error; - hr = mesh->lpVtbl->LockIndexBuffer(mesh, 0, (LPVOID *)&faces); - if (FAILED(hr)) + if (FAILED(hr = mesh->lpVtbl->LockIndexBuffer(mesh, 0, (void **)&faces))) goto error; /* convert 2D vertices and faces into 3D mesh */ @@ -6147,7 +6236,7 @@ static BOOL weld_float4(void *to, void *from, FLOAT epsilon) FLOAT diff_y = fabsf(v1->y - v2->y); FLOAT diff_z = fabsf(v1->z - v2->z); FLOAT diff_w = fabsf(v1->w - v2->w); - FLOAT max_abs_diff = fmax(diff_x, diff_y); + FLOAT max_abs_diff = max(diff_x, diff_y); max_abs_diff = max(diff_z, max_abs_diff); max_abs_diff = max(diff_w, max_abs_diff); @@ -6386,9 +6475,9 @@ static BOOL weld_float16_2(void *to, void *from, FLOAT epsilon) FLOAT diff_x; FLOAT diff_y; FLOAT max_abs_diff; - const UINT NUM_ELEM = 2; - FLOAT v1[2]; - FLOAT v2[2]; +#define NUM_ELEM 2 + FLOAT v1[NUM_ELEM]; + FLOAT v2[NUM_ELEM]; D3DXFloat16To32Array(v1, v1_float16, NUM_ELEM); D3DXFloat16To32Array(v2, v2_float16, NUM_ELEM); @@ -6405,6 +6494,7 @@ static BOOL weld_float16_2(void *to, void *from, FLOAT epsilon) } return FALSE; +#undef NUM_ELEM } static BOOL weld_float16_4(void *to, void *from, FLOAT epsilon) @@ -6416,9 +6506,9 @@ static BOOL weld_float16_4(void *to, void *from, FLOAT epsilon) FLOAT diff_z; FLOAT diff_w; FLOAT max_abs_diff; - const UINT NUM_ELEM = 4; - FLOAT v1[4]; - FLOAT v2[4]; +#define NUM_ELEM 4 + FLOAT v1[NUM_ELEM]; + FLOAT v2[NUM_ELEM]; D3DXFloat16To32Array(v1, v1_float16, NUM_ELEM); D3DXFloat16To32Array(v2, v2_float16, NUM_ELEM); @@ -6439,6 +6529,7 @@ static BOOL weld_float16_4(void *to, void *from, FLOAT epsilon) } return FALSE; +#undef NUM_ELEM } /* Sets the vertex components to the same value if they are within epsilon. */ @@ -6663,13 +6754,13 @@ HRESULT WINAPI D3DXWeldVertices(ID3DXMesh *mesh, DWORD flags, const D3DXWELDEPSI BOOL indices_are_32bit = mesh->lpVtbl->GetOptions(mesh) & D3DXMESH_32BIT; DWORD optimize_flags; DWORD *point_reps = NULL; - ID3DXMeshImpl *This = impl_from_ID3DXMesh(mesh); + struct d3dx9_mesh *This = impl_from_ID3DXMesh(mesh); DWORD *vertex_face_map = NULL; ID3DXBuffer *vertex_remap = NULL; BYTE *vertices = NULL; - TRACE("(%p, %x, %p, %p, %p, %p, %p)\n", mesh, flags, epsilons, - adjacency, adjacency_out, face_remap_out, vertex_remap_out); + TRACE("mesh %p, flags %#x, epsilons %p, adjacency %p, adjacency_out %p, face_remap_out %p, vertex_remap_out %p.\n", + mesh, flags, epsilons, adjacency, adjacency_out, face_remap_out, vertex_remap_out); if (flags == 0) { @@ -6858,20 +6949,17 @@ cleanup: * The face re-ordering does not use the vertex cache optimally. * */ -HRESULT WINAPI D3DXOptimizeFaces(LPCVOID indices, - UINT num_faces, - UINT num_vertices, - BOOL indices_are_32bit, - DWORD *face_remap) +HRESULT WINAPI D3DXOptimizeFaces(const void *indices, UINT num_faces, + UINT num_vertices, BOOL indices_are_32bit, DWORD *face_remap) { UINT i; UINT j = num_faces - 1; UINT limit_16_bit = 2 << 15; /* According to MSDN */ HRESULT hr = D3D_OK; - FIXME("(%p, %u, %u, %s, %p): semi-stub. Face order will not be optimal.\n", - indices, num_faces, num_vertices, - indices_are_32bit ? "TRUE" : "FALSE", face_remap); + FIXME("indices %p, num_faces %u, num_vertices %u, indices_are_32bit %#x, face_remap %p semi-stub. " + "Face order will not be optimal.\n", + indices, num_faces, num_vertices, indices_are_32bit, face_remap); if (!indices_are_32bit && num_faces >= limit_16_bit) { diff --git a/dll/directx/wine/d3dx9_36/render.c b/dll/directx/wine/d3dx9_36/render.c index 00cece9f948..02e6caa8eb7 100644 --- a/dll/directx/wine/d3dx9_36/render.c +++ b/dll/directx/wine/d3dx9_36/render.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Jأ³zef Kucia + * Copyright (C) 2012 Józef Kucia * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/dll/directx/wine/d3dx9_36/shader.c b/dll/directx/wine/d3dx9_36/shader.c index 1ef31590927..36b100713ba 100644 --- a/dll/directx/wine/d3dx9_36/shader.c +++ b/dll/directx/wine/d3dx9_36/shader.c @@ -21,11 +21,11 @@ #include "d3dx9_36_private.h" #include "d3dcompiler.h" -/* This function is not declared in the SDK headers yet */ -HRESULT WINAPI D3DAssemble(LPCVOID data, SIZE_T datasize, LPCSTR filename, - const D3D_SHADER_MACRO *defines, ID3DInclude *include, - UINT flags, - ID3DBlob **shader, ID3DBlob **error_messages); + +/* This function is not declared in the SDK headers yet. */ +HRESULT WINAPI D3DAssemble(const void *data, SIZE_T datasize, const char *filename, + const D3D_SHADER_MACRO *defines, ID3DInclude *include, UINT flags, + ID3DBlob **shader, ID3DBlob **error_messages); static inline BOOL is_valid_bytecode(DWORD token) { @@ -142,6 +142,7 @@ const char * WINAPI D3DXGetVertexShaderProfile(struct IDirect3DDevice9 *device) HRESULT WINAPI D3DXFindShaderComment(const DWORD *byte_code, DWORD fourcc, const void **data, UINT *size) { const DWORD *ptr = byte_code; + DWORD version; TRACE("byte_code %p, fourcc %x, data %p, size %p\n", byte_code, fourcc, data, size); @@ -149,7 +150,18 @@ HRESULT WINAPI D3DXFindShaderComment(const DWORD *byte_code, DWORD fourcc, const if (size) *size = 0; if (!byte_code) return D3DERR_INVALIDCALL; - if (!is_valid_bytecode(*byte_code)) return D3DXERR_INVALIDDATA; + + version = *ptr >> 16; + if (version != 0x4658 /* FX */ + && version != 0x5458 /* TX */ + && version != 0x7ffe + && version != 0x7fff + && version != 0xfffe /* VS */ + && version != 0xffff) /* PS */ + { + WARN("Invalid data supplied\n"); + return D3DXERR_INVALIDDATA; + } while (*++ptr != D3DSIO_END) { @@ -162,7 +174,7 @@ HRESULT WINAPI D3DXFindShaderComment(const DWORD *byte_code, DWORD fourcc, const if (*(ptr + 1) == fourcc) { UINT ctab_size = (comment_size - 1) * sizeof(DWORD); - LPCVOID ctab_data = ptr + 2; + const void *ctab_data = ptr + 2; if (size) *size = ctab_size; if (data) @@ -196,14 +208,13 @@ HRESULT WINAPI D3DXAssembleShader(const char *data, UINT data_len, const D3DXMAC } /* D3DXInclude private implementation, used to implement - D3DXAssembleShaderFromFile from D3DXAssembleShader */ -/* To be able to correctly resolve include search paths we have to store - the pathname of each include file. We store the pathname pointer right - before the file data. */ -static HRESULT WINAPI d3dincludefromfile_open(ID3DXInclude *iface, - D3DXINCLUDE_TYPE include_type, - LPCSTR filename, LPCVOID parent_data, - LPCVOID *data, UINT *bytes) { + * D3DXAssembleShaderFromFile() from D3DXAssembleShader(). */ +/* To be able to correctly resolve include search paths we have to store the + * pathname of each include file. We store the pathname pointer right before + * the file data. */ +static HRESULT WINAPI d3dincludefromfile_open(ID3DXInclude *iface, D3DXINCLUDE_TYPE include_type, + const char *filename, const void *parent_data, const void **data, UINT *bytes) +{ const char *p, *parent_name = ""; char *pathname = NULL; char **buffer = NULL; @@ -253,7 +264,8 @@ error: return HRESULT_FROM_WIN32(GetLastError()); } -static HRESULT WINAPI d3dincludefromfile_close(ID3DXInclude *iface, LPCVOID data) { +static HRESULT WINAPI d3dincludefromfile_close(ID3DXInclude *iface, const void *data) +{ HeapFree(GetProcessHeap(), 0, *((char **)data - 1)); HeapFree(GetProcessHeap(), 0, (char **)data - 1); return S_OK; @@ -271,10 +283,13 @@ struct D3DXIncludeImpl { HRESULT WINAPI D3DXAssembleShaderFromFileA(const char *filename, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages) { - LPWSTR filename_w = NULL; + WCHAR *filename_w; DWORD len; HRESULT ret; + TRACE("filename %s, defines %p, include %p, flags %#x, shader %p, error_messages %p.\n", + debugstr_a(filename), defines, include, flags, shader, error_messages); + if (!filename) return D3DXERR_INVALIDDATA; len = MultiByteToWideChar(CP_ACP, 0, filename, -1, NULL, 0); @@ -291,13 +306,14 @@ HRESULT WINAPI D3DXAssembleShaderFromFileA(const char *filename, const D3DXMACRO HRESULT WINAPI D3DXAssembleShaderFromFileW(const WCHAR *filename, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages) { - void *buffer; + const void *buffer; DWORD len; HRESULT hr; struct D3DXIncludeImpl includefromfile; + char *filename_a; - if(FAILED(map_view_of_file(filename, &buffer, &len))) - return D3DXERR_INVALIDDATA; + TRACE("filename %s, defines %p, include %p, flags %#x, shader %p, error_messages %p.\n", + debugstr_w(filename), defines, include, flags, shader, error_messages); if(!include) { @@ -305,10 +321,23 @@ HRESULT WINAPI D3DXAssembleShaderFromFileW(const WCHAR *filename, const D3DXMACR include = &includefromfile.ID3DXInclude_iface; } - hr = D3DXAssembleShader(buffer, len, defines, include, flags, - shader, error_messages); + len = WideCharToMultiByte(CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL); + filename_a = HeapAlloc(GetProcessHeap(), 0, len * sizeof(char)); + if (!filename_a) + return E_OUTOFMEMORY; + WideCharToMultiByte(CP_ACP, 0, filename, -1, filename_a, len, NULL, NULL); - UnmapViewOfFile(buffer); + hr = ID3DXInclude_Open(include, D3D_INCLUDE_LOCAL, filename_a, NULL, &buffer, &len); + if (FAILED(hr)) + { + HeapFree(GetProcessHeap(), 0, filename_a); + return D3DXERR_INVALIDDATA; + } + + hr = D3DXAssembleShader(buffer, len, defines, include, flags, shader, error_messages); + + ID3DXInclude_Close(include, buffer); + HeapFree(GetProcessHeap(), 0, filename_a); return hr; } @@ -319,7 +348,10 @@ HRESULT WINAPI D3DXAssembleShaderFromResourceA(HMODULE module, const char *resou HRSRC res; DWORD len; - if (!(res = FindResourceA(module, resource, (LPCSTR)RT_RCDATA))) + TRACE("module %p, resource %s, defines %p, include %p, flags %#x, shader %p, error_messages %p.\n", + module, debugstr_a(resource), defines, include, flags, shader, error_messages); + + if (!(res = FindResourceA(module, resource, (const char *)RT_RCDATA))) return D3DXERR_INVALIDDATA; if (FAILED(load_resource_into_memory(module, res, &buffer, &len))) return D3DXERR_INVALIDDATA; @@ -351,8 +383,10 @@ HRESULT WINAPI D3DXCompileShader(const char *data, UINT length, const D3DXMACRO { HRESULT hr; - TRACE("data %p, length %u, defines %p, include %p, function %s, profile %s, flags %#x, shader %p, error_msgs %p, constant_table %p\n", - data, length, defines, include, function, profile, flags, shader, error_msgs, constant_table); + TRACE("data %s, length %u, defines %p, include %p, function %s, profile %s, " + "flags %#x, shader %p, error_msgs %p, constant_table %p.\n", + debugstr_a(data), length, defines, include, debugstr_a(function), debugstr_a(profile), + flags, shader, error_msgs, constant_table); hr = D3DCompile(data, length, NULL, (D3D_SHADER_MACRO *)defines, (ID3DInclude *)include, function, profile, flags, 0, (ID3DBlob **)shader, (ID3DBlob **)error_msgs); @@ -374,10 +408,15 @@ HRESULT WINAPI D3DXCompileShaderFromFileA(const char *filename, const D3DXMACRO ID3DXInclude *include, const char *entrypoint, const char *profile, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages, ID3DXConstantTable **constant_table) { - LPWSTR filename_w = NULL; + WCHAR *filename_w; DWORD len; HRESULT ret; + TRACE("filename %s, defines %p, include %p, entrypoint %s, profile %s, " + "flags %#x, shader %p, error_messages %p, constant_table %p.\n", + debugstr_a(filename), defines, include, debugstr_a(entrypoint), + debugstr_a(profile), flags, shader, error_messages, constant_table); + if (!filename) return D3DXERR_INVALIDDATA; len = MultiByteToWideChar(CP_ACP, 0, filename, -1, NULL, 0); @@ -397,14 +436,16 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(const WCHAR *filename, const D3DXMACRO ID3DXInclude *include, const char *entrypoint, const char *profile, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages, ID3DXConstantTable **constant_table) { - void *buffer; + const void *buffer; DWORD len, filename_len; HRESULT hr; struct D3DXIncludeImpl includefromfile; char *filename_a; - if (FAILED(map_view_of_file(filename, &buffer, &len))) - return D3DXERR_INVALIDDATA; + TRACE("filename %s, defines %p, include %p, entrypoint %s, profile %s, " + "flags %#x, shader %p, error_messages %p, constant_table %p.\n", + debugstr_w(filename), defines, include, debugstr_a(entrypoint), debugstr_a(profile), + flags, shader, error_messages, constant_table); if (!include) { @@ -415,12 +456,16 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(const WCHAR *filename, const D3DXMACRO filename_len = WideCharToMultiByte(CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL); filename_a = HeapAlloc(GetProcessHeap(), 0, filename_len * sizeof(char)); if (!filename_a) - { - UnmapViewOfFile(buffer); return E_OUTOFMEMORY; - } WideCharToMultiByte(CP_ACP, 0, filename, -1, filename_a, filename_len, NULL, NULL); + hr = ID3DXInclude_Open(include, D3D_INCLUDE_LOCAL, filename_a, NULL, &buffer, &len); + if (FAILED(hr)) + { + HeapFree(GetProcessHeap(), 0, filename_a); + return D3DXERR_INVALIDDATA; + } + hr = D3DCompile(buffer, len, filename_a, (const D3D_SHADER_MACRO *)defines, (ID3DInclude *)include, entrypoint, profile, flags, 0, (ID3DBlob **)shader, (ID3DBlob **)error_messages); @@ -429,8 +474,8 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(const WCHAR *filename, const D3DXMACRO hr = D3DXGetShaderConstantTable(ID3DXBuffer_GetBufferPointer(*shader), constant_table); + ID3DXInclude_Close(include, buffer); HeapFree(GetProcessHeap(), 0, filename_a); - UnmapViewOfFile(buffer); return hr; } @@ -442,7 +487,12 @@ HRESULT WINAPI D3DXCompileShaderFromResourceA(HMODULE module, const char *resour HRSRC res; DWORD len; - if (!(res = FindResourceA(module, resource, (LPCSTR)RT_RCDATA))) + TRACE("module %p, resource %s, defines %p, include %p, entrypoint %s, profile %s, " + "flags %#x, shader %p, error_messages %p, constant_table %p.\n", + module, debugstr_a(resource), defines, include, debugstr_a(entrypoint), debugstr_a(profile), + flags, shader, error_messages, constant_table); + + if (!(res = FindResourceA(module, resource, (const char *)RT_RCDATA))) return D3DXERR_INVALIDDATA; if (FAILED(load_resource_into_memory(module, res, &buffer, &len))) return D3DXERR_INVALIDDATA; @@ -474,7 +524,9 @@ HRESULT WINAPI D3DXCompileShaderFromResourceW(HMODULE module, const WCHAR *resou HRESULT WINAPI D3DXPreprocessShader(const char *data, UINT data_len, const D3DXMACRO *defines, ID3DXInclude *include, ID3DXBuffer **shader, ID3DXBuffer **error_messages) { - TRACE("Forward to D3DPreprocess\n"); + TRACE("data %s, data_len %u, defines %p, include %p, shader %p, error_messages %p.\n", + debugstr_a(data), data_len, defines, include, shader, error_messages); + return D3DPreprocess(data, data_len, NULL, (const D3D_SHADER_MACRO *)defines, (ID3DInclude *)include, (ID3DBlob **)shader, (ID3DBlob **)error_messages); @@ -487,6 +539,9 @@ HRESULT WINAPI D3DXPreprocessShaderFromFileA(const char *filename, const D3DXMAC DWORD len; HRESULT ret; + TRACE("filename %s, defines %p, include %p, shader %p, error_messages %p.\n", + debugstr_a(filename), defines, include, shader, error_messages); + if (!filename) return D3DXERR_INVALIDDATA; len = MultiByteToWideChar(CP_ACP, 0, filename, -1, NULL, 0); @@ -503,13 +558,14 @@ HRESULT WINAPI D3DXPreprocessShaderFromFileA(const char *filename, const D3DXMAC HRESULT WINAPI D3DXPreprocessShaderFromFileW(const WCHAR *filename, const D3DXMACRO *defines, ID3DXInclude *include, ID3DXBuffer **shader, ID3DXBuffer **error_messages) { - void *buffer; + const void *buffer; DWORD len; HRESULT hr; struct D3DXIncludeImpl includefromfile; + char *filename_a; - if (FAILED(map_view_of_file(filename, &buffer, &len))) - return D3DXERR_INVALIDDATA; + TRACE("filename %s, defines %p, include %p, shader %p, error_messages %p.\n", + debugstr_w(filename), defines, include, shader, error_messages); if (!include) { @@ -517,12 +573,26 @@ HRESULT WINAPI D3DXPreprocessShaderFromFileW(const WCHAR *filename, const D3DXMA include = &includefromfile.ID3DXInclude_iface; } + len = WideCharToMultiByte(CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL); + filename_a = HeapAlloc(GetProcessHeap(), 0, len * sizeof(char)); + if (!filename_a) + return E_OUTOFMEMORY; + WideCharToMultiByte(CP_ACP, 0, filename, -1, filename_a, len, NULL, NULL); + + hr = ID3DXInclude_Open(include, D3D_INCLUDE_LOCAL, filename_a, NULL, &buffer, &len); + if (FAILED(hr)) + { + HeapFree(GetProcessHeap(), 0, filename_a); + return D3DXERR_INVALIDDATA; + } + hr = D3DPreprocess(buffer, len, NULL, (const D3D_SHADER_MACRO *)defines, (ID3DInclude *) include, (ID3DBlob **)shader, (ID3DBlob **)error_messages); - UnmapViewOfFile(buffer); + ID3DXInclude_Close(include, buffer); + HeapFree(GetProcessHeap(), 0, filename_a); return hr; } @@ -533,7 +603,10 @@ HRESULT WINAPI D3DXPreprocessShaderFromResourceA(HMODULE module, const char *res HRSRC res; DWORD len; - if (!(res = FindResourceA(module, resource, (LPCSTR)RT_RCDATA))) + TRACE("module %p, resource %s, defines %p, include %p, shader %p, error_messages %p.\n", + module, debugstr_a(resource), defines, include, shader, error_messages); + + if (!(res = FindResourceA(module, resource, (const char *)RT_RCDATA))) return D3DXERR_INVALIDDATA; if (FAILED(load_resource_into_memory(module, res, &buffer, &len))) return D3DXERR_INVALIDDATA; @@ -548,6 +621,9 @@ HRESULT WINAPI D3DXPreprocessShaderFromResourceW(HMODULE module, const WCHAR *re HRSRC res; DWORD len; + TRACE("module %p, resource %s, defines %p, include %p, shader %p, error_messages %p.\n", + module, debugstr_w(resource), defines, include, shader, error_messages); + if (!(res = FindResourceW(module, resource, (const WCHAR *)RT_RCDATA))) return D3DXERR_INVALIDDATA; if (FAILED(load_resource_into_memory(module, res, &buffer, &len))) @@ -615,12 +691,13 @@ static inline D3DXHANDLE handle_from_constant(struct ctab_constant *constant) return (D3DXHANDLE)constant; } -static struct ctab_constant *get_constant_by_name(struct ID3DXConstantTableImpl *, struct ctab_constant *, LPCSTR); +static struct ctab_constant *get_constant_by_name(struct ID3DXConstantTableImpl *table, + struct ctab_constant *constant, const char *name); -static struct ctab_constant *get_constant_element_by_name(struct ctab_constant *constant, LPCSTR name) +static struct ctab_constant *get_constant_element_by_name(struct ctab_constant *constant, const char *name) { + const char *part; UINT element; - LPCSTR part; TRACE("constant %p, name %s\n", constant, debugstr_a(name)); @@ -656,11 +733,11 @@ static struct ctab_constant *get_constant_element_by_name(struct ctab_constant * } static struct ctab_constant *get_constant_by_name(struct ID3DXConstantTableImpl *table, - struct ctab_constant *constant, LPCSTR name) + struct ctab_constant *constant, const char *name) { UINT i, count, length; struct ctab_constant *handles; - LPCSTR part; + const char *part; TRACE("table %p, constant %p, name %s\n", table, constant, debugstr_a(name)); @@ -788,13 +865,13 @@ static ULONG WINAPI ID3DXConstantTableImpl_Release(ID3DXConstantTable *iface) } /*** ID3DXBuffer methods ***/ -static LPVOID WINAPI ID3DXConstantTableImpl_GetBufferPointer(ID3DXConstantTable *iface) +static void * WINAPI ID3DXConstantTableImpl_GetBufferPointer(ID3DXConstantTable *iface) { - struct ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface); + struct ID3DXConstantTableImpl *table = impl_from_ID3DXConstantTable(iface); - TRACE("(%p)->()\n", This); + TRACE("iface %p.\n", iface); - return This->ctab; + return table->ctab; } static DWORD WINAPI ID3DXConstantTableImpl_GetBufferSize(ID3DXConstantTable *iface) @@ -889,12 +966,13 @@ static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstant(ID3DXConstantTable * return NULL; } -static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstantByName(ID3DXConstantTable *iface, D3DXHANDLE constant, LPCSTR name) +static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstantByName(ID3DXConstantTable *iface, + D3DXHANDLE constant, const char *name) { struct ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface); struct ctab_constant *c = get_valid_constant(This, constant); - TRACE("(%p)->(%p, %s)\n", This, constant, name); + TRACE("iface %p, constant %p, name %s.\n", iface, constant, debugstr_a(name)); c = get_constant_by_name(This, c, name); TRACE("Returning constant %p\n", c); @@ -939,7 +1017,7 @@ static UINT set(struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, UINT l, i, regcount = 1, regsize = 1, cin = 1, rin = 1, ret, last = 0; DWORD tmp; - /* size to small to set anything */ + /* size too small to set anything */ if (*size < desc->Rows * desc->Columns) { *size = 0; @@ -1059,7 +1137,7 @@ static UINT set(struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, break; case D3DXPC_MATRIX_COLUMNS: - regcount = desc->Columns; + regcount = min(desc->RegisterCount, desc->Columns); if (inclass == D3DXPC_MATRIX_ROWS) rin = incol; else cin = incol; regsize = desc->Rows; @@ -1685,7 +1763,7 @@ static const struct ID3DXConstantTableVtbl ID3DXConstantTable_Vtbl = }; static HRESULT parse_ctab_constant_type(const char *ctab, DWORD typeoffset, struct ctab_constant *constant, - BOOL is_element, WORD index, WORD max, DWORD *offset, DWORD nameoffset, UINT regset) + BOOL is_element, WORD index, WORD max_index, DWORD *offset, DWORD nameoffset, UINT regset) { const D3DXSHADER_TYPEINFO *type = (LPD3DXSHADER_TYPEINFO)(ctab + typeoffset); const D3DXSHADER_STRUCTMEMBERINFO *memberinfo = NULL; @@ -1734,7 +1812,7 @@ static HRESULT parse_ctab_constant_type(const char *ctab, DWORD typeoffset, stru for (i = 0; i < count; ++i) { hr = parse_ctab_constant_type(ctab, memberinfo ? memberinfo[i].TypeInfo : typeoffset, - &constant->constants[i], memberinfo == NULL, index + size, max, offset, + &constant->constants[i], memberinfo == NULL, index + size, max_index, offset, memberinfo ? memberinfo[i].Name : nameoffset, regset); if (hr != D3D_OK) goto error; @@ -1769,7 +1847,7 @@ static HRESULT parse_ctab_constant_type(const char *ctab, DWORD typeoffset, stru case D3DXPC_MATRIX_ROWS: offsetdiff = type->Rows * 4; - size = is_element ? type->Rows : max(type->Rows, type->Columns); + size = type->Rows; break; case D3DXPC_MATRIX_COLUMNS: @@ -1803,7 +1881,7 @@ static HRESULT parse_ctab_constant_type(const char *ctab, DWORD typeoffset, stru if (offset) *offset += offsetdiff * 4; } - constant->desc.RegisterCount = max(0, min(max - index, size)); + constant->desc.RegisterCount = max(0, min(max_index - index, size)); constant->desc.Bytes = 4 * constant->desc.Elements * type->Rows * type->Columns; return D3D_OK; @@ -1825,8 +1903,8 @@ error: HRESULT WINAPI D3DXGetShaderConstantTableEx(const DWORD *byte_code, DWORD flags, ID3DXConstantTable **constant_table) { struct ID3DXConstantTableImpl *object = NULL; + const void *data; HRESULT hr; - LPCVOID data; UINT size; const D3DXSHADER_CONSTANTTABLE *ctab_header; const D3DXSHADER_CONSTANTINFO *constant_info; diff --git a/dll/directx/wine/d3dx9_36/skin.c b/dll/directx/wine/d3dx9_36/skin.c index 3ac5799bd0f..125823654d4 100644 --- a/dll/directx/wine/d3dx9_36/skin.c +++ b/dll/directx/wine/d3dx9_36/skin.c @@ -29,7 +29,7 @@ struct bone FLOAT *weights; }; -typedef struct ID3DXSkinInfoImpl +struct d3dx9_skin_info { ID3DXSkinInfo ID3DXSkinInfo_iface; LONG ref; @@ -39,21 +39,21 @@ typedef struct ID3DXSkinInfoImpl DWORD num_vertices; DWORD num_bones; struct bone *bones; -} ID3DXSkinInfoImpl; +}; -static inline struct ID3DXSkinInfoImpl *impl_from_ID3DXSkinInfo(ID3DXSkinInfo *iface) +static inline struct d3dx9_skin_info *impl_from_ID3DXSkinInfo(ID3DXSkinInfo *iface) { - return CONTAINING_RECORD(iface, struct ID3DXSkinInfoImpl, ID3DXSkinInfo_iface); + return CONTAINING_RECORD(iface, struct d3dx9_skin_info, ID3DXSkinInfo_iface); } -static HRESULT WINAPI ID3DXSkinInfoImpl_QueryInterface(ID3DXSkinInfo *iface, REFIID riid, void **ppobj) +static HRESULT WINAPI d3dx9_skin_info_QueryInterface(ID3DXSkinInfo *iface, REFIID riid, void **out) { - TRACE("(%p, %s, %p)\n", iface, debugstr_guid(riid), ppobj); + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ID3DXSkinInfo)) { IUnknown_AddRef(iface); - *ppobj = iface; + *out = iface; return D3D_OK; } @@ -62,47 +62,52 @@ static HRESULT WINAPI ID3DXSkinInfoImpl_QueryInterface(ID3DXSkinInfo *iface, REF return E_NOINTERFACE; } -static ULONG WINAPI ID3DXSkinInfoImpl_AddRef(ID3DXSkinInfo *iface) +static ULONG WINAPI d3dx9_skin_info_AddRef(ID3DXSkinInfo *iface) { - struct ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); - ULONG ref = InterlockedIncrement(&This->ref); + struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface); + ULONG refcount = InterlockedIncrement(&skin->ref); - TRACE("%p increasing refcount to %u\n", This, ref); + TRACE("%p increasing refcount to %u.\n", skin, refcount); - return ref; + return refcount; } -static ULONG WINAPI ID3DXSkinInfoImpl_Release(ID3DXSkinInfo *iface) +static ULONG WINAPI d3dx9_skin_info_Release(ID3DXSkinInfo *iface) { - struct ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); - ULONG ref = InterlockedDecrement(&This->ref); + struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface); + ULONG refcount = InterlockedDecrement(&skin->ref); - TRACE("%p decreasing refcount to %u\n", This, ref); + TRACE("%p decreasing refcount to %u.\n", skin, refcount); - if (ref == 0) { + if (!refcount) + { DWORD i; - for (i = 0; i < This->num_bones; i++) { - HeapFree(GetProcessHeap(), 0, This->bones[i].name); - HeapFree(GetProcessHeap(), 0, This->bones[i].vertices); - HeapFree(GetProcessHeap(), 0, This->bones[i].weights); + + for (i = 0; i < skin->num_bones; ++i) + { + HeapFree(GetProcessHeap(), 0, skin->bones[i].name); + HeapFree(GetProcessHeap(), 0, skin->bones[i].vertices); + HeapFree(GetProcessHeap(), 0, skin->bones[i].weights); } - HeapFree(GetProcessHeap(), 0, This->bones); - HeapFree(GetProcessHeap(), 0, This); + HeapFree(GetProcessHeap(), 0, skin->bones); + HeapFree(GetProcessHeap(), 0, skin); } - return ref; + return refcount; } -static HRESULT WINAPI ID3DXSkinInfoImpl_SetBoneInfluence(ID3DXSkinInfo *iface, DWORD bone_num, DWORD num_influences, CONST DWORD *vertices, CONST FLOAT *weights) +static HRESULT WINAPI d3dx9_skin_info_SetBoneInfluence(ID3DXSkinInfo *iface, + DWORD bone_num, DWORD num_influences, const DWORD *vertices, const float *weights) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); + struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface); struct bone *bone; DWORD *new_vertices = NULL; FLOAT *new_weights = NULL; - TRACE("(%p, %u, %u, %p, %p)\n", This, bone_num, num_influences, vertices, weights); + TRACE("iface %p, bone_num %u, num_influences %u, vertices %p, weights %p.\n", + iface, bone_num, num_influences, vertices, weights); - if (bone_num >= This->num_bones || !vertices || !weights) + if (bone_num >= skin->num_bones || !vertices || !weights) return D3DERR_INVALIDCALL; if (num_influences) { @@ -117,7 +122,7 @@ static HRESULT WINAPI ID3DXSkinInfoImpl_SetBoneInfluence(ID3DXSkinInfo *iface, D memcpy(new_vertices, vertices, num_influences * sizeof(*vertices)); memcpy(new_weights, weights, num_influences * sizeof(*weights)); } - bone = &This->bones[bone_num]; + bone = &skin->bones[bone_num]; bone->num_influences = num_influences; HeapFree(GetProcessHeap(), 0, bone->vertices); HeapFree(GetProcessHeap(), 0, bone->weights); @@ -127,38 +132,40 @@ static HRESULT WINAPI ID3DXSkinInfoImpl_SetBoneInfluence(ID3DXSkinInfo *iface, D return D3D_OK; } -static HRESULT WINAPI ID3DXSkinInfoImpl_SetBoneVertexInfluence(ID3DXSkinInfo *iface, DWORD bone_num, DWORD influence_num, float weight) +static HRESULT WINAPI d3dx9_skin_info_SetBoneVertexInfluence(ID3DXSkinInfo *iface, + DWORD bone_num, DWORD influence_num, float weight) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); - - FIXME("(%p, %u, %u, %g): stub\n", This, bone_num, influence_num, weight); + FIXME("iface %p, bone_num %u, influence_num %u, weight %.8e stub!\n", + iface, bone_num, influence_num, weight); return E_NOTIMPL; } -static DWORD WINAPI ID3DXSkinInfoImpl_GetNumBoneInfluences(ID3DXSkinInfo *iface, DWORD bone_num) +static DWORD WINAPI d3dx9_skin_info_GetNumBoneInfluences(ID3DXSkinInfo *iface, DWORD bone_num) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); + struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface); - TRACE("(%p, %u)\n", This, bone_num); + TRACE("iface %p, bone_num %u.\n", iface, bone_num); - if (bone_num >= This->num_bones) + if (bone_num >= skin->num_bones) return 0; - return This->bones[bone_num].num_influences; + return skin->bones[bone_num].num_influences; } -static HRESULT WINAPI ID3DXSkinInfoImpl_GetBoneInfluence(ID3DXSkinInfo *iface, DWORD bone_num, DWORD *vertices, FLOAT *weights) +static HRESULT WINAPI d3dx9_skin_info_GetBoneInfluence(ID3DXSkinInfo *iface, + DWORD bone_num, DWORD *vertices, float *weights) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); + struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface); struct bone *bone; - TRACE("(%p, %u, %p, %p)\n", This, bone_num, vertices, weights); + TRACE("iface %p, bone_num %u, vertices %p, weights %p.\n", + iface, bone_num, vertices, weights); - if (bone_num >= This->num_bones || !vertices) + if (bone_num >= skin->num_bones || !vertices) return D3DERR_INVALIDCALL; - bone = &This->bones[bone_num]; + bone = &skin->bones[bone_num]; if (!bone->num_influences) return D3D_OK; @@ -169,81 +176,72 @@ static HRESULT WINAPI ID3DXSkinInfoImpl_GetBoneInfluence(ID3DXSkinInfo *iface, D return D3D_OK; } -static HRESULT WINAPI ID3DXSkinInfoImpl_GetBoneVertexInfluence(ID3DXSkinInfo *iface, DWORD bone_num, - DWORD influence_num, float *weight, DWORD *vertex_num) +static HRESULT WINAPI d3dx9_skin_info_GetBoneVertexInfluence(ID3DXSkinInfo *iface, + DWORD bone_num, DWORD influence_num, float *weight, DWORD *vertex_num) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); - - FIXME("(%p, %u, %u, %p, %p): stub\n", This, bone_num, influence_num, weight, vertex_num); + FIXME("iface %p, bone_num %u, influence_num %u, weight %p, vertex_num %p stub!\n", + iface, bone_num, influence_num, weight, vertex_num); return E_NOTIMPL; } -static HRESULT WINAPI ID3DXSkinInfoImpl_GetMaxVertexInfluences(ID3DXSkinInfo *iface, DWORD *max_vertex_influences) +static HRESULT WINAPI d3dx9_skin_info_GetMaxVertexInfluences(ID3DXSkinInfo *iface, DWORD *max_vertex_influences) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); - - FIXME("(%p, %p): stub\n", This, max_vertex_influences); + FIXME("iface %p, max_vertex_influences %p stub!\n", iface, max_vertex_influences); return E_NOTIMPL; } -static DWORD WINAPI ID3DXSkinInfoImpl_GetNumBones(ID3DXSkinInfo *iface) +static DWORD WINAPI d3dx9_skin_info_GetNumBones(ID3DXSkinInfo *iface) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); + struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface); - TRACE("(%p)\n", This); + TRACE("iface %p.\n", iface); - return This->num_bones; + return skin->num_bones; } -static HRESULT WINAPI ID3DXSkinInfoImpl_FindBoneVertexInfluenceIndex(ID3DXSkinInfo *iface, DWORD bone_num, - DWORD vertex_num, DWORD *influence_index) +static HRESULT WINAPI d3dx9_skin_info_FindBoneVertexInfluenceIndex(ID3DXSkinInfo *iface, + DWORD bone_num, DWORD vertex_num, DWORD *influence_index) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); - - FIXME("(%p, %u, %u, %p): stub\n", This, bone_num, vertex_num, influence_index); + FIXME("iface %p, bone_num %u, vertex_num %u, influence_index %p stub!\n", + iface, bone_num, vertex_num, influence_index); return E_NOTIMPL; } -static HRESULT WINAPI ID3DXSkinInfoImpl_GetMaxFaceInfluences(struct ID3DXSkinInfo *iface, +static HRESULT WINAPI d3dx9_skin_info_GetMaxFaceInfluences(struct ID3DXSkinInfo *iface, struct IDirect3DIndexBuffer9 *index_buffer, DWORD num_faces, DWORD *max_face_influences) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); - - FIXME("(%p, %p, %u, %p): stub\n", This, index_buffer, num_faces, max_face_influences); + FIXME("iface %p, index_buffer %p, num_faces %u, max_face_influences %p stub!\n", + iface, index_buffer, num_faces, max_face_influences); return E_NOTIMPL; } -static HRESULT WINAPI ID3DXSkinInfoImpl_SetMinBoneInfluence(ID3DXSkinInfo *iface, FLOAT min_influence) +static HRESULT WINAPI d3dx9_skin_info_SetMinBoneInfluence(ID3DXSkinInfo *iface, float min_influence) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); - - FIXME("(%p, %g): stub\n", This, min_influence); + FIXME("iface %p, min_influence %.8e stub!\n", iface, min_influence); return E_NOTIMPL; } -static FLOAT WINAPI ID3DXSkinInfoImpl_GetMinBoneInfluence(ID3DXSkinInfo *iface) +static float WINAPI d3dx9_skin_info_GetMinBoneInfluence(ID3DXSkinInfo *iface) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); - - FIXME("(%p): stub\n", This); + FIXME("iface %p stub!\n", iface); return 0.0f; } -static HRESULT WINAPI ID3DXSkinInfoImpl_SetBoneName(ID3DXSkinInfo *iface, DWORD bone_num, LPCSTR name) +static HRESULT WINAPI d3dx9_skin_info_SetBoneName(ID3DXSkinInfo *iface, DWORD bone_idx, const char *name) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); + struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface); char *new_name; size_t size; - TRACE("(%p, %u, %s)\n", This, bone_num, debugstr_a(name)); + TRACE("iface %p, bone_idx %u, name %s.\n", iface, bone_idx, debugstr_a(name)); - if (bone_num >= This->num_bones || !name) + if (bone_idx >= skin->num_bones || !name) return D3DERR_INVALIDCALL; size = strlen(name) + 1; @@ -251,74 +249,70 @@ static HRESULT WINAPI ID3DXSkinInfoImpl_SetBoneName(ID3DXSkinInfo *iface, DWORD if (!new_name) return E_OUTOFMEMORY; memcpy(new_name, name, size); - HeapFree(GetProcessHeap(), 0, This->bones[bone_num].name); - This->bones[bone_num].name = new_name; + HeapFree(GetProcessHeap(), 0, skin->bones[bone_idx].name); + skin->bones[bone_idx].name = new_name; return D3D_OK; } -static LPCSTR WINAPI ID3DXSkinInfoImpl_GetBoneName(ID3DXSkinInfo *iface, DWORD bone_num) +static const char * WINAPI d3dx9_skin_info_GetBoneName(ID3DXSkinInfo *iface, DWORD bone_idx) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); + struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface); - TRACE("(%p, %u)\n", This, bone_num); + TRACE("iface %p, bone_idx %u.\n", iface, bone_idx); - if (bone_num >= This->num_bones) + if (bone_idx >= skin->num_bones) return NULL; - return This->bones[bone_num].name; + return skin->bones[bone_idx].name; } -static HRESULT WINAPI ID3DXSkinInfoImpl_SetBoneOffsetMatrix(ID3DXSkinInfo *iface, DWORD bone_num, CONST D3DXMATRIX *bone_transform) +static HRESULT WINAPI d3dx9_skin_info_SetBoneOffsetMatrix(ID3DXSkinInfo *iface, + DWORD bone_num, const D3DXMATRIX *bone_transform) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); + struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface); - TRACE("(%p, %u, %p)\n", This, bone_num, bone_transform); + TRACE("iface %p, bone_num %u, bone_transform %p.\n", iface, bone_num, bone_transform); - if (bone_num >= This->num_bones || !bone_transform) + if (bone_num >= skin->num_bones || !bone_transform) return D3DERR_INVALIDCALL; - This->bones[bone_num].transform = *bone_transform; + skin->bones[bone_num].transform = *bone_transform; return D3D_OK; } -static D3DXMATRIX * WINAPI ID3DXSkinInfoImpl_GetBoneOffsetMatrix(ID3DXSkinInfo *iface, DWORD bone_num) +static D3DXMATRIX * WINAPI d3dx9_skin_info_GetBoneOffsetMatrix(ID3DXSkinInfo *iface, DWORD bone_num) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); + struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface); - TRACE("(%p, %u)\n", This, bone_num); + TRACE("iface %p, bone_num %u.\n", iface, bone_num); - if (bone_num >= This->num_bones) + if (bone_num >= skin->num_bones) return NULL; - return &This->bones[bone_num].transform; + return &skin->bones[bone_num].transform; } -static HRESULT WINAPI ID3DXSkinInfoImpl_Clone(ID3DXSkinInfo *iface, ID3DXSkinInfo **skin_info) +static HRESULT WINAPI d3dx9_skin_info_Clone(ID3DXSkinInfo *iface, ID3DXSkinInfo **skin_info) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); - - FIXME("(%p, %p): stub\n", This, skin_info); + FIXME("iface %p, skin_info %p stub!\n", iface, skin_info); return E_NOTIMPL; } -static HRESULT WINAPI ID3DXSkinInfoImpl_Remap(ID3DXSkinInfo *iface, DWORD num_vertices, DWORD *vertex_remap) +static HRESULT WINAPI d3dx9_skin_info_Remap(ID3DXSkinInfo *iface, DWORD num_vertices, DWORD *vertex_remap) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); - - FIXME("(%p, %u, %p): stub\n", This, num_vertices, vertex_remap); + FIXME("iface %p, num_vertices %u, vertex_remap %p stub!\n", iface, num_vertices, vertex_remap); return E_NOTIMPL; } -static HRESULT WINAPI ID3DXSkinInfoImpl_SetFVF(ID3DXSkinInfo *iface, DWORD fvf) +static HRESULT WINAPI d3dx9_skin_info_SetFVF(ID3DXSkinInfo *iface, DWORD fvf) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); HRESULT hr; D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE]; - TRACE("(%p, %x)\n", This, fvf); + TRACE("iface %p, fvf %#x.\n", iface, fvf); hr = D3DXDeclaratorFromFVF(fvf, declaration); if (FAILED(hr)) return hr; @@ -326,13 +320,13 @@ static HRESULT WINAPI ID3DXSkinInfoImpl_SetFVF(ID3DXSkinInfo *iface, DWORD fvf) return iface->lpVtbl->SetDeclaration(iface, declaration); } -static HRESULT WINAPI ID3DXSkinInfoImpl_SetDeclaration(ID3DXSkinInfo *iface, CONST D3DVERTEXELEMENT9 *declaration) +static HRESULT WINAPI d3dx9_skin_info_SetDeclaration(ID3DXSkinInfo *iface, const D3DVERTEXELEMENT9 *declaration) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); + struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface); HRESULT hr; int count; - TRACE("(%p, %p)\n", This, declaration); + TRACE("iface %p, declaration %p.\n", iface, declaration); if (!declaration) return D3DERR_INVALIDCALL; @@ -345,115 +339,111 @@ static HRESULT WINAPI ID3DXSkinInfoImpl_SetDeclaration(ID3DXSkinInfo *iface, CON } count++; - memcpy(This->vertex_declaration, declaration, count * sizeof(*declaration)); + memcpy(skin->vertex_declaration, declaration, count * sizeof(*declaration)); - hr = D3DXFVFFromDeclarator(This->vertex_declaration, &This->fvf); - if (FAILED(hr)) - This->fvf = 0; + if (FAILED(hr = D3DXFVFFromDeclarator(skin->vertex_declaration, &skin->fvf))) + skin->fvf = 0; return D3D_OK; } -static DWORD WINAPI ID3DXSkinInfoImpl_GetFVF(ID3DXSkinInfo *iface) +static DWORD WINAPI d3dx9_skin_info_GetFVF(ID3DXSkinInfo *iface) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); + struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface); - TRACE("(%p)\n", This); + TRACE("iface %p.\n", iface); - return This->fvf; + return skin->fvf; } -static HRESULT WINAPI ID3DXSkinInfoImpl_GetDeclaration(ID3DXSkinInfo *iface, D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE]) +static HRESULT WINAPI d3dx9_skin_info_GetDeclaration(ID3DXSkinInfo *iface, + D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE]) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); + struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface); UINT count = 0; - TRACE("(%p)\n", This); + TRACE("iface %p, declaration %p.\n", iface, declaration); - while (This->vertex_declaration[count++].Stream != 0xff); - memcpy(declaration, This->vertex_declaration, count * sizeof(declaration[0])); + while (skin->vertex_declaration[count++].Stream != 0xff); + memcpy(declaration, skin->vertex_declaration, count * sizeof(declaration[0])); return D3D_OK; } -static HRESULT WINAPI ID3DXSkinInfoImpl_UpdateSkinnedMesh(ID3DXSkinInfo *iface, CONST D3DXMATRIX *bone_transforms, - CONST D3DXMATRIX *bone_inv_transpose_transforms, LPCVOID vertices_src, PVOID vertices_dest) +static HRESULT WINAPI d3dx9_skin_info_UpdateSkinnedMesh(ID3DXSkinInfo *iface, const D3DXMATRIX *bone_transforms, + const D3DXMATRIX *bone_inv_transpose_transforms, const void *src_vertices, void *dst_vertices) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); - - FIXME("(%p, %p, %p, %p, %p): stub\n", This, bone_transforms, bone_inv_transpose_transforms, vertices_src, vertices_dest); + FIXME("iface %p, bone_transforms %p, bone_inv_transpose_transforms %p, src_vertices %p, dst_vertices %p stub!\n", + iface, bone_transforms, bone_inv_transpose_transforms, src_vertices, dst_vertices); return E_NOTIMPL; } -static HRESULT WINAPI ID3DXSkinInfoImpl_ConvertToBlendedMesh(ID3DXSkinInfo *iface, ID3DXMesh *mesh_in, +static HRESULT WINAPI d3dx9_skin_info_ConvertToBlendedMesh(ID3DXSkinInfo *iface, ID3DXMesh *mesh_in, DWORD options, const DWORD *adjacency_in, DWORD *adjacency_out, DWORD *face_remap, ID3DXBuffer **vertex_remap, DWORD *max_face_infl, DWORD *num_bone_combinations, ID3DXBuffer **bone_combination_table, ID3DXMesh **mesh_out) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); - - FIXME("(%p, %p, %x, %p, %p, %p, %p, %p, %p, %p, %p): stub\n", - This, mesh_in, options, adjacency_in, adjacency_out, face_remap, vertex_remap, - max_face_infl, num_bone_combinations, bone_combination_table, mesh_out); + FIXME("iface %p, mesh_in %p, options %#x, adjacency_in %p, adjacency_out %p, face_remap %p, vertex_remap %p, " + "max_face_infl %p, num_bone_combinations %p, bone_combination_table %p, mesh_out %p stub!\n", + iface, mesh_in, options, adjacency_in, adjacency_out, face_remap, vertex_remap, + max_face_infl, num_bone_combinations, bone_combination_table, mesh_out); return E_NOTIMPL; } -static HRESULT WINAPI ID3DXSkinInfoImpl_ConvertToIndexedBlendedMesh(ID3DXSkinInfo *iface, ID3DXMesh *mesh_in, +static HRESULT WINAPI d3dx9_skin_info_ConvertToIndexedBlendedMesh(ID3DXSkinInfo *iface, ID3DXMesh *mesh_in, DWORD options, const DWORD *adjacency_in, DWORD *adjacency_out, DWORD *face_remap, ID3DXBuffer **vertex_remap, DWORD *max_face_infl, DWORD *num_bone_combinations, ID3DXBuffer **bone_combination_table, ID3DXMesh **mesh_out) { - ID3DXSkinInfoImpl *This = impl_from_ID3DXSkinInfo(iface); - - FIXME("(%p, %p, %x, %p, %p, %p, %p, %p, %p, %p, %p): stub\n", - This, mesh_in, options, adjacency_in, adjacency_out, face_remap, vertex_remap, - max_face_infl, num_bone_combinations, bone_combination_table, mesh_out); + FIXME("iface %p, mesh_in %p, options %#x, adjacency_in %p, adjacency_out %p, face_remap %p, vertex_remap %p, " + "max_face_infl %p, num_bone_combinations %p, bone_combination_table %p, mesh_out %p stub!\n", + iface, mesh_in, options, adjacency_in, adjacency_out, face_remap, vertex_remap, + max_face_infl, num_bone_combinations, bone_combination_table, mesh_out); return E_NOTIMPL; } -static const struct ID3DXSkinInfoVtbl ID3DXSkinInfoImpl_Vtbl = +static const struct ID3DXSkinInfoVtbl d3dx9_skin_info_vtbl = { - /* IUnknown methods */ - ID3DXSkinInfoImpl_QueryInterface, - ID3DXSkinInfoImpl_AddRef, - ID3DXSkinInfoImpl_Release, - /* ID3DXSkinInfo */ - ID3DXSkinInfoImpl_SetBoneInfluence, - ID3DXSkinInfoImpl_SetBoneVertexInfluence, - ID3DXSkinInfoImpl_GetNumBoneInfluences, - ID3DXSkinInfoImpl_GetBoneInfluence, - ID3DXSkinInfoImpl_GetBoneVertexInfluence, - ID3DXSkinInfoImpl_GetMaxVertexInfluences, - ID3DXSkinInfoImpl_GetNumBones, - ID3DXSkinInfoImpl_FindBoneVertexInfluenceIndex, - ID3DXSkinInfoImpl_GetMaxFaceInfluences, - ID3DXSkinInfoImpl_SetMinBoneInfluence, - ID3DXSkinInfoImpl_GetMinBoneInfluence, - ID3DXSkinInfoImpl_SetBoneName, - ID3DXSkinInfoImpl_GetBoneName, - ID3DXSkinInfoImpl_SetBoneOffsetMatrix, - ID3DXSkinInfoImpl_GetBoneOffsetMatrix, - ID3DXSkinInfoImpl_Clone, - ID3DXSkinInfoImpl_Remap, - ID3DXSkinInfoImpl_SetFVF, - ID3DXSkinInfoImpl_SetDeclaration, - ID3DXSkinInfoImpl_GetFVF, - ID3DXSkinInfoImpl_GetDeclaration, - ID3DXSkinInfoImpl_UpdateSkinnedMesh, - ID3DXSkinInfoImpl_ConvertToBlendedMesh, - ID3DXSkinInfoImpl_ConvertToIndexedBlendedMesh + d3dx9_skin_info_QueryInterface, + d3dx9_skin_info_AddRef, + d3dx9_skin_info_Release, + d3dx9_skin_info_SetBoneInfluence, + d3dx9_skin_info_SetBoneVertexInfluence, + d3dx9_skin_info_GetNumBoneInfluences, + d3dx9_skin_info_GetBoneInfluence, + d3dx9_skin_info_GetBoneVertexInfluence, + d3dx9_skin_info_GetMaxVertexInfluences, + d3dx9_skin_info_GetNumBones, + d3dx9_skin_info_FindBoneVertexInfluenceIndex, + d3dx9_skin_info_GetMaxFaceInfluences, + d3dx9_skin_info_SetMinBoneInfluence, + d3dx9_skin_info_GetMinBoneInfluence, + d3dx9_skin_info_SetBoneName, + d3dx9_skin_info_GetBoneName, + d3dx9_skin_info_SetBoneOffsetMatrix, + d3dx9_skin_info_GetBoneOffsetMatrix, + d3dx9_skin_info_Clone, + d3dx9_skin_info_Remap, + d3dx9_skin_info_SetFVF, + d3dx9_skin_info_SetDeclaration, + d3dx9_skin_info_GetFVF, + d3dx9_skin_info_GetDeclaration, + d3dx9_skin_info_UpdateSkinnedMesh, + d3dx9_skin_info_ConvertToBlendedMesh, + d3dx9_skin_info_ConvertToIndexedBlendedMesh, }; HRESULT WINAPI D3DXCreateSkinInfo(DWORD num_vertices, const D3DVERTEXELEMENT9 *declaration, DWORD num_bones, ID3DXSkinInfo **skin_info) { HRESULT hr; - ID3DXSkinInfoImpl *object = NULL; static const D3DVERTEXELEMENT9 empty_declaration = D3DDECL_END(); + struct d3dx9_skin_info *object = NULL; - TRACE("(%u, %p, %u, %p)\n", num_vertices, declaration, num_bones, skin_info); + TRACE("num_vertices %u, declaration %p, num_bones %u, skin_info %p.\n", + num_vertices, declaration, num_bones, skin_info); if (!skin_info || !declaration) return D3DERR_INVALIDCALL; @@ -462,7 +452,7 @@ HRESULT WINAPI D3DXCreateSkinInfo(DWORD num_vertices, const D3DVERTEXELEMENT9 *d if (!object) return E_OUTOFMEMORY; - object->ID3DXSkinInfo_iface.lpVtbl = &ID3DXSkinInfoImpl_Vtbl; + object->ID3DXSkinInfo_iface.lpVtbl = &d3dx9_skin_info_vtbl; object->ref = 1; object->num_vertices = num_vertices; object->num_bones = num_bones; @@ -475,8 +465,8 @@ HRESULT WINAPI D3DXCreateSkinInfo(DWORD num_vertices, const D3DVERTEXELEMENT9 *d goto error; } - hr = ID3DXSkinInfoImpl_SetDeclaration(&object->ID3DXSkinInfo_iface, declaration); - if (FAILED(hr)) goto error; + if (FAILED(hr = d3dx9_skin_info_SetDeclaration(&object->ID3DXSkinInfo_iface, declaration))) + goto error; *skin_info = &object->ID3DXSkinInfo_iface; diff --git a/dll/directx/wine/d3dx9_36/sprite.c b/dll/directx/wine/d3dx9_36/sprite.c index f320eaffb5f..4fdec6a5863 100644 --- a/dll/directx/wine/d3dx9_36/sprite.c +++ b/dll/directx/wine/d3dx9_36/sprite.c @@ -22,13 +22,15 @@ /* the combination of all possible D3DXSPRITE flags */ #define D3DXSPRITE_FLAGLIMIT 511 -typedef struct _SPRITEVERTEX { +struct sprite_vertex +{ D3DXVECTOR3 pos; DWORD col; D3DXVECTOR2 tex; -} SPRITEVERTEX; +}; -typedef struct _SPRITE { +struct sprite +{ IDirect3DTexture9 *texture; UINT texw, texh; RECT rect; @@ -36,9 +38,9 @@ typedef struct _SPRITE { D3DXVECTOR3 pos; D3DCOLOR color; D3DXMATRIX transform; -} SPRITE; +}; -typedef struct ID3DXSpriteImpl +struct d3dx9_sprite { ID3DXSprite ID3DXSprite_iface; LONG ref; @@ -56,17 +58,17 @@ typedef struct ID3DXSpriteImpl DWORD maxanisotropy; DWORD alphacmp_caps; - SPRITE *sprites; + struct sprite *sprites; int sprite_count; /* number of sprites to be drawn */ int allocated_sprites; /* number of (pre-)allocated sprites */ -} ID3DXSpriteImpl; +}; -static inline ID3DXSpriteImpl *impl_from_ID3DXSprite(ID3DXSprite *iface) +static inline struct d3dx9_sprite *impl_from_ID3DXSprite(ID3DXSprite *iface) { - return CONTAINING_RECORD(iface, ID3DXSpriteImpl, ID3DXSprite_iface); + return CONTAINING_RECORD(iface, struct d3dx9_sprite, ID3DXSprite_iface); } -static HRESULT WINAPI ID3DXSpriteImpl_QueryInterface(ID3DXSprite *iface, REFIID riid, void **out) +static HRESULT WINAPI d3dx9_sprite_QueryInterface(ID3DXSprite *iface, REFIID riid, void **out) { TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); @@ -84,93 +86,108 @@ static HRESULT WINAPI ID3DXSpriteImpl_QueryInterface(ID3DXSprite *iface, REFIID return E_NOINTERFACE; } -static ULONG WINAPI ID3DXSpriteImpl_AddRef(ID3DXSprite *iface) +static ULONG WINAPI d3dx9_sprite_AddRef(ID3DXSprite *iface) { - ID3DXSpriteImpl *This = impl_from_ID3DXSprite(iface); - ULONG ref=InterlockedIncrement(&This->ref); - TRACE("(%p)->(): AddRef from %d\n", This, ref-1); - return ref; + struct d3dx9_sprite *sprite = impl_from_ID3DXSprite(iface); + ULONG refcount = InterlockedIncrement(&sprite->ref); + + TRACE("%p increasing refcount to %u.\n", sprite, refcount); + + return refcount; } -static ULONG WINAPI ID3DXSpriteImpl_Release(ID3DXSprite *iface) +static ULONG WINAPI d3dx9_sprite_Release(ID3DXSprite *iface) { - ID3DXSpriteImpl *This = impl_from_ID3DXSprite(iface); - ULONG ref=InterlockedDecrement(&This->ref); + struct d3dx9_sprite *sprite = impl_from_ID3DXSprite(iface); + ULONG refcount = InterlockedDecrement(&sprite->ref); - TRACE("(%p)->(): ReleaseRef to %d\n", This, ref); + TRACE("%p decreasing refcount to %u.\n", sprite, refcount); - if(ref==0) { - if(This->sprites) { + if (!refcount) + { + if (sprite->sprites) + { int i; - for(i=0;isprite_count;i++) - if(This->sprites[i].texture) - IDirect3DTexture9_Release(This->sprites[i].texture); - HeapFree(GetProcessHeap(), 0, This->sprites); + for (i = 0; i < sprite->sprite_count; ++i) + { + if (sprite->sprites[i].texture) + IDirect3DTexture9_Release(sprite->sprites[i].texture); + } + + HeapFree(GetProcessHeap(), 0, sprite->sprites); } - if(This->stateblock) IDirect3DStateBlock9_Release(This->stateblock); - if(This->vdecl) IDirect3DVertexDeclaration9_Release(This->vdecl); - if(This->device) IDirect3DDevice9_Release(This->device); - HeapFree(GetProcessHeap(), 0, This); + + if (sprite->stateblock) + IDirect3DStateBlock9_Release(sprite->stateblock); + if (sprite->vdecl) + IDirect3DVertexDeclaration9_Release(sprite->vdecl); + if (sprite->device) + IDirect3DDevice9_Release(sprite->device); + HeapFree(GetProcessHeap(), 0, sprite); } - return ref; + + return refcount; } -static HRESULT WINAPI ID3DXSpriteImpl_GetDevice(struct ID3DXSprite *iface, struct IDirect3DDevice9 **device) +static HRESULT WINAPI d3dx9_sprite_GetDevice(struct ID3DXSprite *iface, struct IDirect3DDevice9 **device) { - ID3DXSpriteImpl *This = impl_from_ID3DXSprite(iface); + struct d3dx9_sprite *sprite = impl_from_ID3DXSprite(iface); - TRACE("(%p)->(%p)\n", This, device); + TRACE("iface %p, device %p.\n", iface, device); - if(device==NULL) return D3DERR_INVALIDCALL; - *device=This->device; - IDirect3DDevice9_AddRef(This->device); + if (!device) + return D3DERR_INVALIDCALL; + *device = sprite->device; + IDirect3DDevice9_AddRef(sprite->device); return D3D_OK; } -static HRESULT WINAPI ID3DXSpriteImpl_GetTransform(ID3DXSprite *iface, D3DXMATRIX *transform) +static HRESULT WINAPI d3dx9_sprite_GetTransform(ID3DXSprite *iface, D3DXMATRIX *transform) { - ID3DXSpriteImpl *This = impl_from_ID3DXSprite(iface); + struct d3dx9_sprite *sprite = impl_from_ID3DXSprite(iface); - TRACE("(%p)->(%p)\n", This, transform); + TRACE("iface %p, transform %p.\n", iface, transform); - if(transform==NULL) return D3DERR_INVALIDCALL; - *transform=This->transform; + if (!transform) + return D3DERR_INVALIDCALL; + *transform = sprite->transform; return D3D_OK; } -static HRESULT WINAPI ID3DXSpriteImpl_SetTransform(ID3DXSprite *iface, CONST D3DXMATRIX *transform) +static HRESULT WINAPI d3dx9_sprite_SetTransform(ID3DXSprite *iface, const D3DXMATRIX *transform) { - ID3DXSpriteImpl *This = impl_from_ID3DXSprite(iface); + struct d3dx9_sprite *sprite = impl_from_ID3DXSprite(iface); - TRACE("(%p)->(%p)\n", This, transform); + TRACE("iface %p, transform %p.\n", iface, transform); - if(transform==NULL) return D3DERR_INVALIDCALL; - This->transform=*transform; + if (!transform) + return D3DERR_INVALIDCALL; + sprite->transform = *transform; return D3D_OK; } -static HRESULT WINAPI ID3DXSpriteImpl_SetWorldViewRH(ID3DXSprite *iface, CONST D3DXMATRIX *world, - CONST D3DXMATRIX *view) +static HRESULT WINAPI d3dx9_sprite_SetWorldViewRH(ID3DXSprite *iface, + const D3DXMATRIX *world, const D3DXMATRIX *view) { - ID3DXSpriteImpl *This = impl_from_ID3DXSprite(iface); - FIXME("(%p)->(%p, %p): stub\n", This, world, view); + FIXME("iface %p, world %p, view %p stub!\n", iface, world, view); + return E_NOTIMPL; } -static HRESULT WINAPI ID3DXSpriteImpl_SetWorldViewLH(ID3DXSprite *iface, CONST D3DXMATRIX *world, - CONST D3DXMATRIX *view) +static HRESULT WINAPI d3dx9_sprite_SetWorldViewLH(ID3DXSprite *iface, + const D3DXMATRIX *world, const D3DXMATRIX *view) { - ID3DXSpriteImpl *This = impl_from_ID3DXSprite(iface); - FIXME("(%p)->(%p, %p): stub\n", This, world, view); + FIXME("iface %p, world %p, view %p stub!\n", iface, world, view); + return E_NOTIMPL; } /* Helper function */ -static void set_states(ID3DXSpriteImpl *object) +static void set_states(struct d3dx9_sprite *object) { D3DXMATRIX mat; D3DVIEWPORT9 vp; @@ -251,12 +268,12 @@ static void set_states(ID3DXSpriteImpl *object) IDirect3DDevice9_SetTransform(object->device, D3DTS_PROJECTION, &mat); } -static HRESULT WINAPI ID3DXSpriteImpl_Begin(ID3DXSprite *iface, DWORD flags) +static HRESULT WINAPI d3dx9_sprite_Begin(ID3DXSprite *iface, DWORD flags) { - ID3DXSpriteImpl *This = impl_from_ID3DXSprite(iface); + struct d3dx9_sprite *This = impl_from_ID3DXSprite(iface); HRESULT hr; - TRACE("(%p)->(%#x)\n", This, flags); + TRACE("iface %p, flags %#x.\n", iface, flags); if(flags>D3DXSPRITE_FLAGLIMIT || This->ready) return D3DERR_INVALIDCALL; @@ -273,7 +290,7 @@ D3DXSPRITE_SORT_TEXTURE: sort by texture (so that it doesn't change too often) D3DXSPRITE_DONOTMODIFY_RENDERSTATE | D3DXSPRITE_OBJECTSPACE | D3DXSPRITE_SORT_DEPTH_BACKTOFRONT)) FIXME("Flags unsupported: %#x\n", flags); - /* These flags should only matter to performances */ + /* These flags should only matter to performance */ else if(flags & (D3DXSPRITE_SORT_DEPTH_FRONTTOBACK | D3DXSPRITE_SORT_TEXTURE)) TRACE("Flags unsupported: %#x\n", flags); @@ -297,7 +314,7 @@ D3DXSPRITE_SORT_TEXTURE: sort by texture (so that it doesn't change too often) set_states(This); IDirect3DDevice9_SetVertexDeclaration(This->device, This->vdecl); - IDirect3DDevice9_SetStreamSource(This->device, 0, NULL, 0, sizeof(SPRITEVERTEX)); + IDirect3DDevice9_SetStreamSource(This->device, 0, NULL, 0, sizeof(struct sprite_vertex)); IDirect3DDevice9_SetIndices(This->device, NULL); IDirect3DDevice9_SetTexture(This->device, 0, NULL); @@ -315,10 +332,10 @@ D3DXSPRITE_SORT_TEXTURE: sort by texture (so that it doesn't change too often) return D3D_OK; } -static HRESULT WINAPI ID3DXSpriteImpl_Draw(ID3DXSprite *iface, IDirect3DTexture9 *texture, +static HRESULT WINAPI d3dx9_sprite_Draw(ID3DXSprite *iface, IDirect3DTexture9 *texture, const RECT *rect, const D3DXVECTOR3 *center, const D3DXVECTOR3 *position, D3DCOLOR color) { - ID3DXSpriteImpl *This = impl_from_ID3DXSprite(iface); + struct d3dx9_sprite *This = impl_from_ID3DXSprite(iface); D3DSURFACE_DESC texdesc; TRACE("iface %p, texture %p, rect %s, center %p, position %p, color 0x%08x.\n", @@ -327,12 +344,16 @@ static HRESULT WINAPI ID3DXSpriteImpl_Draw(ID3DXSprite *iface, IDirect3DTexture9 if(texture==NULL) return D3DERR_INVALIDCALL; if(!This->ready) return D3DERR_INVALIDCALL; - if(This->allocated_sprites==0) { - This->sprites=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 32*sizeof(SPRITE)); - This->allocated_sprites=32; - } else if(This->allocated_sprites<=This->sprite_count) { - This->allocated_sprites=This->allocated_sprites*3/2; - This->sprites=HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->sprites, This->allocated_sprites*sizeof(SPRITE)); + if (!This->allocated_sprites) + { + This->sprites = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 32 * sizeof(*This->sprites)); + This->allocated_sprites = 32; + } + else if (This->allocated_sprites <= This->sprite_count) + { + This->allocated_sprites += This->allocated_sprites / 2; + This->sprites = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + This->sprites, This->allocated_sprites * sizeof(*This->sprites)); } This->sprites[This->sprite_count].texture=texture; if(!(This->flags & D3DXSPRITE_DO_NOT_ADDREF_TEXTURE)) @@ -377,19 +398,19 @@ static HRESULT WINAPI ID3DXSpriteImpl_Draw(ID3DXSprite *iface, IDirect3DTexture9 return D3D_OK; } -static HRESULT WINAPI ID3DXSpriteImpl_Flush(ID3DXSprite *iface) +static HRESULT WINAPI d3dx9_sprite_Flush(ID3DXSprite *iface) { - ID3DXSpriteImpl *This = impl_from_ID3DXSprite(iface); - SPRITEVERTEX *vertices; + struct d3dx9_sprite *This = impl_from_ID3DXSprite(iface); + struct sprite_vertex *vertices; int i, count=0, start; - TRACE("(%p)->()\n", This); + TRACE("iface %p.\n", iface); if(!This->ready) return D3DERR_INVALIDCALL; if(!This->sprite_count) return D3D_OK; /* TODO: use of a vertex buffer here */ - vertices=HeapAlloc(GetProcessHeap(), 0, sizeof(SPRITEVERTEX)*6*This->sprite_count); + vertices = HeapAlloc(GetProcessHeap(), 0, sizeof(*vertices) * 6 * This->sprite_count); for(start=0;startsprite_count;start+=count,count=0) { i=start; @@ -426,9 +447,8 @@ static HRESULT WINAPI ID3DXSpriteImpl_Flush(ID3DXSprite *iface) vertices[6*i+4]=vertices[6*i]; vertices[6*i+5]=vertices[6*i+2]; - D3DXVec3TransformCoordArray(&vertices[6*i].pos, sizeof(SPRITEVERTEX), - &vertices[6*i].pos, sizeof(SPRITEVERTEX), - &This->sprites[i].transform, 6); + D3DXVec3TransformCoordArray(&vertices[6 * i].pos, sizeof(*vertices), + &vertices[6 * i].pos, sizeof(*vertices), &This->sprites[i].transform, 6); count++; i++; } @@ -436,7 +456,8 @@ static HRESULT WINAPI ID3DXSpriteImpl_Flush(ID3DXSprite *iface) IDirect3DDevice9_SetTexture(This->device, 0, (struct IDirect3DBaseTexture9 *)This->sprites[start].texture); IDirect3DDevice9_SetVertexDeclaration(This->device, This->vdecl); - IDirect3DDevice9_DrawPrimitiveUP(This->device, D3DPT_TRIANGLELIST, 2*count, vertices+6*start, sizeof(SPRITEVERTEX)); + IDirect3DDevice9_DrawPrimitiveUP(This->device, D3DPT_TRIANGLELIST, + 2 * count, vertices + 6 * start, sizeof(*vertices)); } HeapFree(GetProcessHeap(), 0, vertices); @@ -451,34 +472,37 @@ static HRESULT WINAPI ID3DXSpriteImpl_Flush(ID3DXSprite *iface) return D3D_OK; } -static HRESULT WINAPI ID3DXSpriteImpl_End(ID3DXSprite *iface) +static HRESULT WINAPI d3dx9_sprite_End(ID3DXSprite *iface) { - ID3DXSpriteImpl *This = impl_from_ID3DXSprite(iface); + struct d3dx9_sprite *sprite = impl_from_ID3DXSprite(iface); - TRACE("(%p)->()\n", This); + TRACE("iface %p.\n", iface); - if(!This->ready) return D3DERR_INVALIDCALL; + if (!sprite->ready) + return D3DERR_INVALIDCALL; ID3DXSprite_Flush(iface); - if(!(This->flags & D3DXSPRITE_DONOTSAVESTATE)) - if(This->stateblock) IDirect3DStateBlock9_Apply(This->stateblock); /* Restore old state */ + if (sprite->stateblock && !(sprite->flags & D3DXSPRITE_DONOTSAVESTATE)) + IDirect3DStateBlock9_Apply(sprite->stateblock); /* Restore old state */ - This->ready=FALSE; + sprite->ready = FALSE; return D3D_OK; } -static HRESULT WINAPI ID3DXSpriteImpl_OnLostDevice(ID3DXSprite *iface) +static HRESULT WINAPI d3dx9_sprite_OnLostDevice(ID3DXSprite *iface) { - ID3DXSpriteImpl *This = impl_from_ID3DXSprite(iface); + struct d3dx9_sprite *sprite = impl_from_ID3DXSprite(iface); - TRACE("(%p)->()\n", This); + TRACE("iface %p.\n", iface); - if(This->stateblock) IDirect3DStateBlock9_Release(This->stateblock); - if(This->vdecl) IDirect3DVertexDeclaration9_Release(This->vdecl); - This->vdecl=NULL; - This->stateblock=NULL; + if (sprite->stateblock) + IDirect3DStateBlock9_Release(sprite->stateblock); + if (sprite->vdecl) + IDirect3DVertexDeclaration9_Release(sprite->vdecl); + sprite->vdecl = NULL; + sprite->stateblock = NULL; /* Reset some variables */ ID3DXSprite_OnResetDevice(iface); @@ -486,21 +510,22 @@ static HRESULT WINAPI ID3DXSpriteImpl_OnLostDevice(ID3DXSprite *iface) return D3D_OK; } -static HRESULT WINAPI ID3DXSpriteImpl_OnResetDevice(ID3DXSprite *iface) +static HRESULT WINAPI d3dx9_sprite_OnResetDevice(ID3DXSprite *iface) { - ID3DXSpriteImpl *This = impl_from_ID3DXSprite(iface); + struct d3dx9_sprite *sprite = impl_from_ID3DXSprite(iface); int i; - TRACE("(%p)->()\n", This); + TRACE("iface %p.\n", iface); - for(i=0;isprite_count;i++) - if(This->sprites[i].texture) - IDirect3DTexture9_Release(This->sprites[i].texture); + for (i = 0; i < sprite->sprite_count; ++i) + { + if (sprite->sprites[i].texture) + IDirect3DTexture9_Release(sprite->sprites[i].texture); + } - This->sprite_count=0; - - This->flags=0; - This->ready=FALSE; + sprite->sprite_count = 0; + sprite->flags = 0; + sprite->ready = FALSE; /* keep matrices */ /* device objects get restored on Begin */ @@ -508,41 +533,39 @@ static HRESULT WINAPI ID3DXSpriteImpl_OnResetDevice(ID3DXSprite *iface) return D3D_OK; } -static const ID3DXSpriteVtbl D3DXSprite_Vtbl = +static const ID3DXSpriteVtbl d3dx9_sprite_vtbl = { - /*** IUnknown methods ***/ - ID3DXSpriteImpl_QueryInterface, - ID3DXSpriteImpl_AddRef, - ID3DXSpriteImpl_Release, - /*** ID3DXSprite methods ***/ - ID3DXSpriteImpl_GetDevice, - ID3DXSpriteImpl_GetTransform, - ID3DXSpriteImpl_SetTransform, - ID3DXSpriteImpl_SetWorldViewRH, - ID3DXSpriteImpl_SetWorldViewLH, - ID3DXSpriteImpl_Begin, - ID3DXSpriteImpl_Draw, - ID3DXSpriteImpl_Flush, - ID3DXSpriteImpl_End, - ID3DXSpriteImpl_OnLostDevice, - ID3DXSpriteImpl_OnResetDevice + d3dx9_sprite_QueryInterface, + d3dx9_sprite_AddRef, + d3dx9_sprite_Release, + d3dx9_sprite_GetDevice, + d3dx9_sprite_GetTransform, + d3dx9_sprite_SetTransform, + d3dx9_sprite_SetWorldViewRH, + d3dx9_sprite_SetWorldViewLH, + d3dx9_sprite_Begin, + d3dx9_sprite_Draw, + d3dx9_sprite_Flush, + d3dx9_sprite_End, + d3dx9_sprite_OnLostDevice, + d3dx9_sprite_OnResetDevice, }; HRESULT WINAPI D3DXCreateSprite(struct IDirect3DDevice9 *device, struct ID3DXSprite **sprite) { - ID3DXSpriteImpl *object; + struct d3dx9_sprite *object; D3DCAPS9 caps; - TRACE("(%p, %p)\n", device, sprite); + TRACE("device %p, sprite %p.\n", device, sprite); if(device==NULL || sprite==NULL) return D3DERR_INVALIDCALL; - object=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ID3DXSpriteImpl)); - if(object==NULL) { - *sprite=NULL; + if (!(object=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) + { + *sprite = NULL; return E_OUTOFMEMORY; } - object->ID3DXSprite_iface.lpVtbl = &D3DXSprite_Vtbl; + object->ID3DXSprite_iface.lpVtbl = &d3dx9_sprite_vtbl; object->ref=1; object->device=device; IUnknown_AddRef(device); diff --git a/dll/directx/wine/d3dx9_36/surface.c b/dll/directx/wine/d3dx9_36/surface.c index bd141c18563..29914c5b4d8 100644 --- a/dll/directx/wine/d3dx9_36/surface.c +++ b/dll/directx/wine/d3dx9_36/surface.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2009-2010 Tony Wasserka - * Copyright (C) 2012 Jأ³zef Kucia + * Copyright (C) 2012 Józef Kucia * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -149,7 +149,13 @@ static D3DFORMAT dds_fourcc_to_d3dformat(DWORD fourcc) MAKEFOURCC('D','X','T','2'), MAKEFOURCC('D','X','T','3'), MAKEFOURCC('D','X','T','4'), - MAKEFOURCC('D','X','T','5') + MAKEFOURCC('D','X','T','5'), + D3DFMT_R16F, + D3DFMT_G16R16F, + D3DFMT_A16B16G16R16F, + D3DFMT_R32F, + D3DFMT_G32R32F, + D3DFMT_A32B32G32R32F, }; for (i = 0; i < sizeof(known_fourcc) / sizeof(known_fourcc[0]); i++) @@ -255,6 +261,11 @@ static D3DFORMAT dds_bump_to_d3dformat(const struct dds_pixel_format *pixel_form static D3DFORMAT dds_pixel_format_to_d3dformat(const struct dds_pixel_format *pixel_format) { + TRACE("pixel_format: size %u, flags %#x, fourcc %#x, bpp %u.\n", pixel_format->size, + pixel_format->flags, pixel_format->fourcc, pixel_format->bpp); + TRACE("rmask %#x, gmask %#x, bmask %#x, amask %#x.\n", pixel_format->rmask, pixel_format->gmask, + pixel_format->bmask, pixel_format->amask); + if (pixel_format->flags & DDS_PF_FOURCC) return dds_fourcc_to_d3dformat(pixel_format->fourcc); if (pixel_format->flags & DDS_PF_RGB) @@ -524,8 +535,8 @@ HRESULT load_volume_from_dds(IDirect3DVolume9 *dst_volume, const PALETTEENTRY *d } HRESULT load_texture_from_dds(IDirect3DTexture9 *texture, const void *src_data, const PALETTEENTRY *palette, - DWORD filter, D3DCOLOR color_key, const D3DXIMAGE_INFO *src_info) - + DWORD filter, D3DCOLOR color_key, const D3DXIMAGE_INFO *src_info, unsigned int skip_levels, + unsigned int *loaded_miplevels) { HRESULT hr; RECT src_rect; @@ -538,31 +549,45 @@ HRESULT load_texture_from_dds(IDirect3DTexture9 *texture, const void *src_data, const struct dds_header *header = src_data; const BYTE *pixels = (BYTE *)(header + 1); - /* Loading a cube texture as a simple texture is also supported (only first face texture is taken) */ - if ((src_info->ResourceType != D3DRTYPE_TEXTURE) && (src_info->ResourceType != D3DRTYPE_CUBETEXTURE)) + /* Loading a cube texture as a simple texture is also supported + * (only first face texture is taken). Same with volume textures. */ + if ((src_info->ResourceType != D3DRTYPE_TEXTURE) + && (src_info->ResourceType != D3DRTYPE_CUBETEXTURE) + && (src_info->ResourceType != D3DRTYPE_VOLUMETEXTURE)) + { + WARN("Trying to load a %u resource as a 2D texture, returning failure.\n", src_info->ResourceType); return D3DXERR_INVALIDDATA; + } width = src_info->Width; height = src_info->Height; mip_levels = min(src_info->MipLevels, IDirect3DTexture9_GetLevelCount(texture)); - for (mip_level = 0; mip_level < mip_levels; mip_level++) + if (src_info->ResourceType == D3DRTYPE_VOLUMETEXTURE) + mip_levels = 1; + for (mip_level = 0; mip_level < mip_levels + skip_levels; ++mip_level) { hr = calculate_dds_surface_size(src_info->Format, width, height, &src_pitch, &mip_level_size); if (FAILED(hr)) return hr; - SetRect(&src_rect, 0, 0, width, height); + if (mip_level >= skip_levels) + { + SetRect(&src_rect, 0, 0, width, height); - IDirect3DTexture9_GetSurfaceLevel(texture, mip_level, &surface); - hr = D3DXLoadSurfaceFromMemory(surface, palette, NULL, pixels, src_info->Format, src_pitch, - NULL, &src_rect, filter, color_key); - IDirect3DSurface9_Release(surface); - if (FAILED(hr)) return hr; + IDirect3DTexture9_GetSurfaceLevel(texture, mip_level - skip_levels, &surface); + hr = D3DXLoadSurfaceFromMemory(surface, palette, NULL, pixels, src_info->Format, src_pitch, + NULL, &src_rect, filter, color_key); + IDirect3DSurface9_Release(surface); + if (FAILED(hr)) + return hr; + } pixels += mip_level_size; width = max(1, width / 2); height = max(1, height / 2); } + *loaded_miplevels = mip_levels - skip_levels; + return D3D_OK; } @@ -895,13 +920,13 @@ HRESULT WINAPI D3DXGetImageInfoFromFileInMemory(const void *data, UINT datasize, * D3DERR_INVALIDCALL, if file is NULL * */ -HRESULT WINAPI D3DXGetImageInfoFromFileA(LPCSTR file, D3DXIMAGE_INFO *info) +HRESULT WINAPI D3DXGetImageInfoFromFileA(const char *file, D3DXIMAGE_INFO *info) { - LPWSTR widename; + WCHAR *widename; HRESULT hr; int strlength; - TRACE("(%s, %p): relay\n", debugstr_a(file), info); + TRACE("file %s, info %p.\n", debugstr_a(file), info); if( !file ) return D3DERR_INVALIDCALL; @@ -1010,7 +1035,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromFileInMemory(IDirect3DSurface9 *pDestSurface, const RECT *pSrcRect, DWORD dwFilter, D3DCOLOR Colorkey, D3DXIMAGE_INFO *pSrcInfo) { D3DXIMAGE_INFO imginfo; - HRESULT hr; + HRESULT hr, com_init; IWICImagingFactory *factory = NULL; IWICBitmapDecoder *decoder; @@ -1063,7 +1088,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromFileInMemory(IDirect3DSurface9 *pDestSurface, if (imginfo.ImageFileFormat == D3DXIFF_DIB) convert_dib_to_bmp((void**)&pSrcData, &SrcDataSize); - CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + com_init = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if (FAILED(CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, &IID_IWICImagingFactory, (void**)&factory))) goto cleanup_err; @@ -1166,7 +1191,8 @@ cleanup_err: if (factory) IWICImagingFactory_Release(factory); - CoUninitialize(); + if (SUCCEEDED(com_init)) + CoUninitialize(); if (imginfo.ImageFileFormat == D3DXIFF_DIB) HeapFree(GetProcessHeap(), 0, (void*)pSrcData); @@ -1184,7 +1210,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromFileA(IDirect3DSurface9 *dst_surface, const PALETTEENTRY *dst_palette, const RECT *dst_rect, const char *src_file, const RECT *src_rect, DWORD filter, D3DCOLOR color_key, D3DXIMAGE_INFO *src_info) { - LPWSTR pWidename; + WCHAR *src_file_w; HRESULT hr; int strlength; @@ -1197,12 +1223,12 @@ HRESULT WINAPI D3DXLoadSurfaceFromFileA(IDirect3DSurface9 *dst_surface, return D3DERR_INVALIDCALL; strlength = MultiByteToWideChar(CP_ACP, 0, src_file, -1, NULL, 0); - pWidename = HeapAlloc(GetProcessHeap(), 0, strlength * sizeof(*pWidename)); - MultiByteToWideChar(CP_ACP, 0, src_file, -1, pWidename, strlength); + src_file_w = HeapAlloc(GetProcessHeap(), 0, strlength * sizeof(*src_file_w)); + MultiByteToWideChar(CP_ACP, 0, src_file, -1, src_file_w, strlength); hr = D3DXLoadSurfaceFromFileW(dst_surface, dst_palette, dst_rect, - pWidename, src_rect, filter, color_key, src_info); - HeapFree(GetProcessHeap(), 0, pWidename); + src_file_w, src_rect, filter, color_key, src_info); + HeapFree(GetProcessHeap(), 0, src_file_w); return hr; } @@ -1330,40 +1356,13 @@ static void init_argb_conversion_info(const struct pixel_format_desc *srcformat, } } -static DWORD dword_from_bytes(CONST BYTE *src, UINT bytes_per_pixel) -{ - DWORD ret = 0; - static BOOL fixme_once; - - if(bytes_per_pixel > sizeof(DWORD)) { - if(!fixme_once++) FIXME("Unsupported image: %u bytes per pixel\n", bytes_per_pixel); - bytes_per_pixel = sizeof(DWORD); - } - - memcpy(&ret, src, bytes_per_pixel); - return ret; -} - -static void dword_to_bytes(BYTE *dst, DWORD dword, UINT bytes_per_pixel) -{ - static BOOL fixme_once; - - if(bytes_per_pixel > sizeof(DWORD)) { - if(!fixme_once++) FIXME("Unsupported image: %u bytes per pixel\n", bytes_per_pixel); - ZeroMemory(dst, bytes_per_pixel); - bytes_per_pixel = sizeof(DWORD); - } - - memcpy(dst, &dword, bytes_per_pixel); -} - /************************************************************ * get_relevant_argb_components * * Extracts the relevant components from the source color and * drops the less significant bits if they aren't used by the destination format. */ -static void get_relevant_argb_components(CONST struct argb_conversion_info *info, CONST DWORD col, DWORD *out) +static void get_relevant_argb_components(const struct argb_conversion_info *info, DWORD col, DWORD *out) { UINT i = 0; for(;i < 4;i++) @@ -1377,7 +1376,7 @@ static void get_relevant_argb_components(CONST struct argb_conversion_info *info * Recombines the output of get_relevant_argb_components and converts * it to the destination format. */ -static DWORD make_argb_color(CONST struct argb_conversion_info *info, CONST DWORD *in) +static DWORD make_argb_color(const struct argb_conversion_info *info, const DWORD *in) { UINT i; DWORD val = 0; @@ -1394,55 +1393,78 @@ static DWORD make_argb_color(CONST struct argb_conversion_info *info, CONST DWOR return val; } -static void format_to_vec4(const struct pixel_format_desc *format, const DWORD *src, struct vec4 *dst) +/* It doesn't work for components bigger than 32 bits (or somewhat smaller but unaligned). */ +static void format_to_vec4(const struct pixel_format_desc *format, const BYTE *src, struct vec4 *dst) { - DWORD mask; + DWORD mask, tmp; + unsigned int c; - if (format->bits[1]) + for (c = 0; c < 4; ++c) { - mask = (1 << format->bits[1]) - 1; - dst->x = (float)((*src >> format->shift[1]) & mask) / mask; - } - else - dst->x = 1.0f; + static const unsigned int component_offsets[4] = {3, 0, 1, 2}; + float *dst_component = (float *)dst + component_offsets[c]; - if (format->bits[2]) - { - mask = (1 << format->bits[2]) - 1; - dst->y = (float)((*src >> format->shift[2]) & mask) / mask; - } - else - dst->y = 1.0f; + if (format->bits[c]) + { + mask = ~0u >> (32 - format->bits[c]); - if (format->bits[3]) - { - mask = (1 << format->bits[3]) - 1; - dst->z = (float)((*src >> format->shift[3]) & mask) / mask; - } - else - dst->z = 1.0f; + memcpy(&tmp, src + format->shift[c] / 8, + min(sizeof(DWORD), (format->shift[c] % 8 + format->bits[c] + 7) / 8)); - if (format->bits[0]) - { - mask = (1 << format->bits[0]) - 1; - dst->w = (float)((*src >> format->shift[0]) & mask) / mask; + if (format->type == FORMAT_ARGBF16) + *dst_component = float_16_to_32(tmp); + else if (format->type == FORMAT_ARGBF) + *dst_component = *(float *)&tmp; + else + *dst_component = (float)((tmp >> format->shift[c] % 8) & mask) / mask; + } + else + *dst_component = 1.0f; } - else - dst->w = 1.0f; } -static void format_from_vec4(const struct pixel_format_desc *format, const struct vec4 *src, DWORD *dst) +/* It doesn't work for components bigger than 32 bits. */ +static void format_from_vec4(const struct pixel_format_desc *format, const struct vec4 *src, BYTE *dst) { - *dst = 0; + DWORD v, mask32; + unsigned int c, i; - if (format->bits[1]) - *dst |= (DWORD)(src->x * ((1 << format->bits[1]) - 1) + 0.5f) << format->shift[1]; - if (format->bits[2]) - *dst |= (DWORD)(src->y * ((1 << format->bits[2]) - 1) + 0.5f) << format->shift[2]; - if (format->bits[3]) - *dst |= (DWORD)(src->z * ((1 << format->bits[3]) - 1) + 0.5f) << format->shift[3]; - if (format->bits[0]) - *dst |= (DWORD)(src->w * ((1 << format->bits[0]) - 1) + 0.5f) << format->shift[0]; + memset(dst, 0, format->bytes_per_pixel); + + for (c = 0; c < 4; ++c) + { + static const unsigned int component_offsets[4] = {3, 0, 1, 2}; + const float src_component = *((const float *)src + component_offsets[c]); + + if (!format->bits[c]) + continue; + + mask32 = ~0u >> (32 - format->bits[c]); + + if (format->type == FORMAT_ARGBF16) + v = float_32_to_16(src_component); + else if (format->type == FORMAT_ARGBF) + v = *(DWORD *)&src_component; + else + v = (DWORD)(src_component * ((1 << format->bits[c]) - 1) + 0.5f); + + for (i = format->shift[c] / 8 * 8; i < format->shift[c] + format->bits[c]; i += 8) + { + BYTE mask, byte; + + if (format->shift[c] > i) + { + mask = mask32 << (format->shift[c] - i); + byte = (v << (format->shift[c] - i)) & mask; + } + else + { + mask = mask32 >> (i - format->shift[c]); + byte = (v >> (i - format->shift[c])) & mask; + } + dst[i / 8] |= byte; + } + } } /************************************************************ @@ -1491,7 +1513,7 @@ void convert_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slice_pit { struct argb_conversion_info conv_info, ck_conv_info; const struct pixel_format_desc *ck_format = NULL; - DWORD channels[4], pixel; + DWORD channels[4]; UINT min_width, min_height, min_depth; UINT x, y, z; @@ -1516,30 +1538,32 @@ void convert_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slice_pit for (y = 0; y < min_height; y++) { const BYTE *src_ptr = src_slice_ptr + y * src_row_pitch; BYTE *dst_ptr = dst_slice_ptr + y * dst_row_pitch; - DWORD val; for (x = 0; x < min_width; x++) { - /* extract source color components */ - pixel = dword_from_bytes(src_ptr, src_format->bytes_per_pixel); - - if (!src_format->to_rgba && !dst_format->from_rgba) + if (!src_format->to_rgba && !dst_format->from_rgba + && src_format->bytes_per_pixel <= 4 && dst_format->bytes_per_pixel <= 4) { - get_relevant_argb_components(&conv_info, pixel, channels); + DWORD val; + + get_relevant_argb_components(&conv_info, *(DWORD *)src_ptr, channels); val = make_argb_color(&conv_info, channels); if (color_key) { - get_relevant_argb_components(&ck_conv_info, pixel, channels); - pixel = make_argb_color(&ck_conv_info, channels); - if (pixel == color_key) + DWORD ck_pixel; + + get_relevant_argb_components(&ck_conv_info, *(DWORD *)src_ptr, channels); + ck_pixel = make_argb_color(&ck_conv_info, channels); + if (ck_pixel == color_key) val &= ~conv_info.destmask[0]; } + memcpy(dst_ptr, &val, dst_format->bytes_per_pixel); } else { struct vec4 color, tmp; - format_to_vec4(src_format, &pixel, &color); + format_to_vec4(src_format, src_ptr, &color); if (src_format->to_rgba) src_format->to_rgba(&color, &tmp, palette); else @@ -1547,8 +1571,10 @@ void convert_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slice_pit if (ck_format) { - format_from_vec4(ck_format, &tmp, &pixel); - if (pixel == color_key) + DWORD ck_pixel; + + format_from_vec4(ck_format, &tmp, (BYTE *)&ck_pixel); + if (ck_pixel == color_key) tmp.w = 0.0f; } @@ -1557,11 +1583,10 @@ void convert_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slice_pit else color = tmp; - format_from_vec4(dst_format, &color, &val); + format_from_vec4(dst_format, &color, dst_ptr); } - dword_to_bytes(dst_ptr, val, dst_format->bytes_per_pixel); - src_ptr += src_format->bytes_per_pixel; + src_ptr += src_format->bytes_per_pixel; dst_ptr += dst_format->bytes_per_pixel; } @@ -1591,7 +1616,7 @@ void point_filter_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slic { struct argb_conversion_info conv_info, ck_conv_info; const struct pixel_format_desc *ck_format = NULL; - DWORD channels[4], pixel; + DWORD channels[4]; UINT x, y, z; ZeroMemory(channels, sizeof(channels)); @@ -1617,29 +1642,31 @@ void point_filter_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slic for (x = 0; x < dst_size->width; x++) { const BYTE *src_ptr = src_row_ptr + (x * src_size->width / dst_size->width) * src_format->bytes_per_pixel; - DWORD val; - /* extract source color components */ - pixel = dword_from_bytes(src_ptr, src_format->bytes_per_pixel); - - if (!src_format->to_rgba && !dst_format->from_rgba) + if (!src_format->to_rgba && !dst_format->from_rgba + && src_format->bytes_per_pixel <= 4 && dst_format->bytes_per_pixel <= 4) { - get_relevant_argb_components(&conv_info, pixel, channels); + DWORD val; + + get_relevant_argb_components(&conv_info, *(DWORD *)src_ptr, channels); val = make_argb_color(&conv_info, channels); if (color_key) { - get_relevant_argb_components(&ck_conv_info, pixel, channels); - pixel = make_argb_color(&ck_conv_info, channels); - if (pixel == color_key) + DWORD ck_pixel; + + get_relevant_argb_components(&ck_conv_info, *(DWORD *)src_ptr, channels); + ck_pixel = make_argb_color(&ck_conv_info, channels); + if (ck_pixel == color_key) val &= ~conv_info.destmask[0]; } + memcpy(dst_ptr, &val, dst_format->bytes_per_pixel); } else { struct vec4 color, tmp; - format_to_vec4(src_format, &pixel, &color); + format_to_vec4(src_format, src_ptr, &color); if (src_format->to_rgba) src_format->to_rgba(&color, &tmp, palette); else @@ -1647,8 +1674,10 @@ void point_filter_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slic if (ck_format) { - format_from_vec4(ck_format, &tmp, &pixel); - if (pixel == color_key) + DWORD ck_pixel; + + format_from_vec4(ck_format, &tmp, (BYTE *)&ck_pixel); + if (ck_pixel == color_key) tmp.w = 0.0f; } @@ -1657,10 +1686,9 @@ void point_filter_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slic else color = tmp; - format_from_vec4(dst_format, &color, &val); + format_from_vec4(dst_format, &color, dst_ptr); } - dword_to_bytes(dst_ptr, val, dst_format->bytes_per_pixel); dst_ptr += dst_format->bytes_per_pixel; } } diff --git a/dll/directx/wine/d3dx9_36/texture.c b/dll/directx/wine/d3dx9_36/texture.c index bc3daf6bc1d..5ed137e60bb 100644 --- a/dll/directx/wine/d3dx9_36/texture.c +++ b/dll/directx/wine/d3dx9_36/texture.c @@ -191,6 +191,7 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN D3DDISPLAYMODE mode; HRESULT hr; D3DFORMAT usedformat = D3DFMT_UNKNOWN; + const struct pixel_format_desc *fmt; TRACE("(%p, %p, %p, %p, %u, %p, %u)\n", device, width, height, miplevels, usage, format, pool); @@ -207,73 +208,6 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN if ((pool != D3DPOOL_DEFAULT) && (pool != D3DPOOL_MANAGED) && (pool != D3DPOOL_SYSTEMMEM) && (pool != D3DPOOL_SCRATCH)) return D3DERR_INVALIDCALL; - /* width and height */ - if (FAILED(IDirect3DDevice9_GetDeviceCaps(device, &caps))) - return D3DERR_INVALIDCALL; - - /* 256 x 256 default width/height */ - if ((w == D3DX_DEFAULT) && (h == D3DX_DEFAULT)) - w = h = 256; - else if (w == D3DX_DEFAULT) - w = (height ? h : 256); - else if (h == D3DX_DEFAULT) - h = (width ? w : 256); - - /* ensure width/height is power of 2 */ - if ((caps.TextureCaps & D3DPTEXTURECAPS_POW2) && (!is_pow2(w))) - w = make_pow2(w); - - if (w > caps.MaxTextureWidth) - w = caps.MaxTextureWidth; - - if ((caps.TextureCaps & D3DPTEXTURECAPS_POW2) && (!is_pow2(h))) - h = make_pow2(h); - - if (h > caps.MaxTextureHeight) - h = caps.MaxTextureHeight; - - /* texture must be square? */ - if (caps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY) - { - if (w > h) - h = w; - else - w = h; - } - - if (width) - *width = w; - - if (height) - *height = h; - - /* miplevels */ - if (miplevels && (usage & D3DUSAGE_AUTOGENMIPMAP)) - { - if (*miplevels > 1) - *miplevels = 0; - } - else if (miplevels) - { - UINT max_mipmaps = 1; - - if (!width && !height) - max_mipmaps = 9; /* number of mipmaps in a 256x256 texture */ - else - { - UINT max_dimen = max(w, h); - - while (max_dimen > 1) - { - max_dimen >>= 1; - max_mipmaps++; - } - } - - if (*miplevels == 0 || *miplevels > max_mipmaps) - *miplevels = max_mipmaps; - } - /* format */ if (format) { @@ -299,17 +233,18 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN if ((usedformat == D3DFMT_UNKNOWN) || (usedformat == D3DX_DEFAULT)) usedformat = D3DFMT_A8R8G8B8; + fmt = get_format_info(usedformat); + hr = IDirect3D9_CheckDeviceFormat(d3d, params.AdapterOrdinal, params.DeviceType, mode.Format, usage, D3DRTYPE_TEXTURE, usedformat); - if (FAILED(hr)) { - /* Heuristic to choose the fallback format */ - const struct pixel_format_desc *fmt = get_format_info(usedformat); BOOL allow_24bits; int bestscore = INT_MIN, i = 0, j; unsigned int channels; - const struct pixel_format_desc *curfmt; + const struct pixel_format_desc *curfmt, *bestfmt = NULL; + + TRACE("Requested format not supported, looking for a fallback.\n"); if (!fmt) { @@ -354,11 +289,83 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN { bestscore = score; usedformat = curfmt->format; + bestfmt = curfmt; } } + fmt = bestfmt; hr = D3D_OK; } + if (FAILED(IDirect3DDevice9_GetDeviceCaps(device, &caps))) + return D3DERR_INVALIDCALL; + + if ((w == D3DX_DEFAULT) && (h == D3DX_DEFAULT)) + w = h = 256; + else if (w == D3DX_DEFAULT) + w = (height ? h : 256); + else if (h == D3DX_DEFAULT) + h = (width ? w : 256); + + if (fmt->block_width != 1 || fmt->block_height != 1) + { + if (w < fmt->block_width) + w = fmt->block_width; + if (h < fmt->block_height) + h = fmt->block_height; + } + + if ((caps.TextureCaps & D3DPTEXTURECAPS_POW2) && (!is_pow2(w))) + w = make_pow2(w); + + if (w > caps.MaxTextureWidth) + w = caps.MaxTextureWidth; + + if ((caps.TextureCaps & D3DPTEXTURECAPS_POW2) && (!is_pow2(h))) + h = make_pow2(h); + + if (h > caps.MaxTextureHeight) + h = caps.MaxTextureHeight; + + if (caps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY) + { + if (w > h) + h = w; + else + w = h; + } + + if (width) + *width = w; + + if (height) + *height = h; + + if (miplevels && (usage & D3DUSAGE_AUTOGENMIPMAP)) + { + if (*miplevels > 1) + *miplevels = 0; + } + else if (miplevels) + { + UINT max_mipmaps = 1; + + if (!width && !height) + max_mipmaps = 9; /* number of mipmaps in a 256x256 texture */ + else + { + UINT max_dimen = max(w, h); + + while (max_dimen > 1) + { + max_dimen >>= 1; + max_mipmaps++; + } + } + + if (*miplevels == 0 || *miplevels > max_mipmaps) + *miplevels = max_mipmaps; + } + cleanup: if (d3d) @@ -518,21 +525,24 @@ HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *devi BOOL file_format = FALSE, file_miplevels = FALSE; BOOL dynamic_texture; D3DXIMAGE_INFO imginfo; - UINT loaded_miplevels; + UINT loaded_miplevels, skip_levels; D3DCAPS9 caps; HRESULT hr; - TRACE("(%p, %p, %u, %u, %u, %u, %x, %x, %x, %u, %u, %x, %p, %p, %p)\n", device, srcdata, srcdatasize, width, - height, miplevels, usage, format, pool, filter, mipfilter, colorkey, srcinfo, palette, texture); + TRACE("device %p, srcdata %p, srcdatasize %u, width %u, height %u, miplevels %u," + " usage %#x, format %#x, pool %#x, filter %#x, mipfilter %#x, colorkey %#x," + " srcinfo %p, palette %p, texture %p.\n", + device, srcdata, srcdatasize, width, height, miplevels, usage, format, pool, + filter, mipfilter, colorkey, srcinfo, palette, texture); /* check for invalid parameters */ if (!device || !texture || !srcdata || !srcdatasize) return D3DERR_INVALIDCALL; hr = D3DXGetImageInfoFromFileInMemory(srcdata, srcdatasize, &imginfo); - if (FAILED(hr)) { + FIXME("Unrecognized file format, returning failure.\n"); *texture = NULL; return hr; } @@ -577,11 +587,26 @@ HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *devi miplevels = imginfo.MipLevels; } + skip_levels = mipfilter != D3DX_DEFAULT ? mipfilter >> D3DX_SKIP_DDS_MIP_LEVELS_SHIFT : 0; + if (skip_levels && imginfo.MipLevels > skip_levels) + { + TRACE("Skipping the first %u (of %u) levels of a DDS mipmapped texture.\n", + skip_levels, imginfo.MipLevels); + TRACE("Texture level 0 dimensions are %ux%u.\n", imginfo.Width, imginfo.Height); + width >>= skip_levels; + height >>= skip_levels; + miplevels -= skip_levels; + } + else + { + skip_levels = 0; + } + /* fix texture creation parameters */ hr = D3DXCheckTextureRequirements(device, &width, &height, &miplevels, usage, &format, pool); - if (FAILED(hr)) { + FIXME("Couldn't find suitable texture parameters.\n"); *texture = NULL; return hr; } @@ -591,6 +616,12 @@ HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *devi FIXME("Generation of mipmaps for compressed pixel formats is not implemented yet\n"); miplevels = imginfo.MipLevels; } + if (imginfo.ResourceType == D3DRTYPE_VOLUMETEXTURE + && D3DFMT_DXT1 <= imginfo.Format && imginfo.Format <= D3DFMT_DXT5 && miplevels > 1) + { + FIXME("Generation of mipmaps for compressed pixel formats is not implemented yet.\n"); + miplevels = 1; + } if (((file_width) && (width != imginfo.Width)) || ((file_height) && (height != imginfo.Height)) || @@ -618,34 +649,37 @@ HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *devi if (FAILED(hr)) { + FIXME("Texture creation failed.\n"); *texture = NULL; return hr; } - /* Load the file */ + TRACE("Texture created correctly. Now loading the texture data into it.\n"); if (imginfo.ImageFileFormat != D3DXIFF_DDS) { IDirect3DTexture9_GetSurfaceLevel(*texptr, 0, &surface); hr = D3DXLoadSurfaceFromFileInMemory(surface, palette, NULL, srcdata, srcdatasize, NULL, filter, colorkey, NULL); IDirect3DSurface9_Release(surface); + loaded_miplevels = min(IDirect3DTexture9_GetLevelCount(*texptr), imginfo.MipLevels); } else { - hr = load_texture_from_dds(*texptr, srcdata, palette, filter, colorkey, &imginfo); + hr = load_texture_from_dds(*texptr, srcdata, palette, filter, colorkey, &imginfo, skip_levels, + &loaded_miplevels); } if (FAILED(hr)) { + FIXME("Texture loading failed.\n"); IDirect3DTexture9_Release(*texptr); *texture = NULL; return hr; } - loaded_miplevels = min(IDirect3DTexture9_GetLevelCount(*texptr), imginfo.MipLevels); hr = D3DXFilterTexture((IDirect3DBaseTexture9*) *texptr, palette, loaded_miplevels - 1, mipfilter); - if (FAILED(hr)) { + FIXME("Texture filtering failed.\n"); IDirect3DTexture9_Release(*texptr); *texture = NULL; return hr; @@ -687,13 +721,14 @@ HRESULT WINAPI D3DXCreateTextureFromFileExW(struct IDirect3DDevice9 *device, con D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DTexture9 **texture) { + void *buffer; HRESULT hr; DWORD size; - LPVOID buffer; - TRACE("(%p, %s, %u, %u, %u, %x, %x, %x, %u, %u, %x, %p, %p, %p): relay\n", - device, debugstr_w(srcfile), width, height, miplevels, usage, format, pool, filter, - mipfilter, colorkey, srcinfo, palette, texture); + TRACE("device %p, srcfile %s, width %u, height %u, miplevels %u, usage %#x, format %#x, " + "pool %#x, filter %#x, mipfilter %#x, colorkey 0x%08x, srcinfo %p, palette %p, texture %p.\n", + device, debugstr_w(srcfile), width, height, miplevels, usage, format, + pool, filter, mipfilter, colorkey, srcinfo, palette, texture); if (!srcfile) return D3DERR_INVALIDCALL; @@ -715,13 +750,14 @@ HRESULT WINAPI D3DXCreateTextureFromFileExA(struct IDirect3DDevice9 *device, con D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DTexture9 **texture) { - LPWSTR widename; + WCHAR *widename; HRESULT hr; DWORD len; - TRACE("(%p, %s, %u, %u, %u, %x, %x, %x, %u, %u, %x, %p, %p, %p): relay\n", - device, debugstr_a(srcfile), width, height, miplevels, usage, format, pool, filter, - mipfilter, colorkey, srcinfo, palette, texture); + TRACE("device %p, srcfile %s, width %u, height %u, miplevels %u, usage %#x, format %#x, " + "pool %#x, filter %#x, mipfilter %#x, colorkey 0x%08x, srcinfo %p, palette %p, texture %p.\n", + device, debugstr_a(srcfile), width, height, miplevels, usage, format, + pool, filter, mipfilter, colorkey, srcinfo, palette, texture); if (!device || !srcfile || !texture) return D3DERR_INVALIDCALL; diff --git a/dll/directx/wine/d3dx9_36/util.c b/dll/directx/wine/d3dx9_36/util.c index 783122a09a5..a137418c212 100644 --- a/dll/directx/wine/d3dx9_36/util.c +++ b/dll/directx/wine/d3dx9_36/util.c @@ -78,7 +78,11 @@ static const struct pixel_format_desc formats[] = {D3DFMT_DXT3, { 0, 0, 0, 0}, { 0, 0, 0, 0}, 1, 4, 4, 16, FORMAT_DXT, NULL, NULL }, {D3DFMT_DXT4, { 0, 0, 0, 0}, { 0, 0, 0, 0}, 1, 4, 4, 16, FORMAT_DXT, NULL, NULL }, {D3DFMT_DXT5, { 0, 0, 0, 0}, { 0, 0, 0, 0}, 1, 4, 4, 16, FORMAT_DXT, NULL, NULL }, + {D3DFMT_R16F, { 0, 16, 0, 0}, { 0, 0, 0, 0}, 2, 1, 1, 2, FORMAT_ARGBF16, NULL, NULL }, + {D3DFMT_G16R16F, { 0, 16, 16, 0}, { 0, 0, 16, 0}, 4, 1, 1, 4, FORMAT_ARGBF16, NULL, NULL }, {D3DFMT_A16B16G16R16F, {16, 16, 16, 16}, {48, 0, 16, 32}, 8, 1, 1, 8, FORMAT_ARGBF16, NULL, NULL }, + {D3DFMT_R32F, { 0, 32, 0, 0}, { 0, 0, 0, 0}, 4, 1, 1, 4, FORMAT_ARGBF, NULL, NULL }, + {D3DFMT_G32R32F, { 0, 32, 32, 0}, { 0, 0, 32, 0}, 8, 1, 1, 8, FORMAT_ARGBF, NULL, NULL }, {D3DFMT_A32B32G32R32F, {32, 32, 32, 32}, {96, 0, 32, 64}, 16, 1, 1, 16, FORMAT_ARGBF, NULL, NULL }, {D3DFMT_P8, { 8, 8, 8, 8}, { 0, 0, 0, 0}, 1, 1, 1, 1, FORMAT_INDEX, NULL, index_to_rgba}, /* marks last element */ @@ -153,7 +157,7 @@ error: * The memory doesn't need to be freed by the caller manually * */ -HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, LPVOID *buffer, DWORD *length) +HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, void **buffer, DWORD *length) { HGLOBAL resource; @@ -282,7 +286,7 @@ const char *debug_d3dxparameter_registerset(D3DXREGISTER_SET r) #undef WINE_D3DX_TO_STR /* parameter type conversion helpers */ -static BOOL get_bool(D3DXPARAMETER_TYPE type, LPCVOID data) +static BOOL get_bool(D3DXPARAMETER_TYPE type, const void *data) { switch (type) { @@ -300,12 +304,12 @@ static BOOL get_bool(D3DXPARAMETER_TYPE type, LPCVOID data) } } -static INT get_int(D3DXPARAMETER_TYPE type, LPCVOID data) +static INT get_int(D3DXPARAMETER_TYPE type, const void *data) { switch (type) { case D3DXPT_FLOAT: - return *(FLOAT *)data; + return (INT)(*(FLOAT *)data); case D3DXPT_INT: case D3DXPT_VOID: @@ -320,7 +324,7 @@ static INT get_int(D3DXPARAMETER_TYPE type, LPCVOID data) } } -static FLOAT get_float(D3DXPARAMETER_TYPE type, LPCVOID data) +static FLOAT get_float(D3DXPARAMETER_TYPE type, const void *data) { switch (type) { @@ -329,10 +333,10 @@ static FLOAT get_float(D3DXPARAMETER_TYPE type, LPCVOID data) return *(FLOAT *)data; case D3DXPT_INT: - return *(INT *)data; + return (FLOAT)(*(INT *)data); case D3DXPT_BOOL: - return get_bool(type, data); + return (FLOAT)get_bool(type, data); default: FIXME("Unhandled type %s.\n", debug_d3dxparameter_type(type)); @@ -340,10 +344,8 @@ static FLOAT get_float(D3DXPARAMETER_TYPE type, LPCVOID data) } } -void set_number(LPVOID outdata, D3DXPARAMETER_TYPE outtype, LPCVOID indata, D3DXPARAMETER_TYPE intype) +void set_number(void *outdata, D3DXPARAMETER_TYPE outtype, const void *indata, D3DXPARAMETER_TYPE intype) { - TRACE("Changing from type %s to type %s\n", debug_d3dxparameter_type(intype), debug_d3dxparameter_type(outtype)); - if (outtype == intype) { *(DWORD *)outdata = *(DWORD *)indata; diff --git a/dll/directx/wine/d3dx9_36/version.rc b/dll/directx/wine/d3dx9_36/version.rc index 8ca195d5c66..38c29425f53 100644 --- a/dll/directx/wine/d3dx9_36/version.rc +++ b/dll/directx/wine/d3dx9_36/version.rc @@ -17,7 +17,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_36.dll" #define WINE_FILEVERSION 9,19,949,2111 #define WINE_FILEVERSION_STR "9.19.949.2111" #define WINE_PRODUCTVERSION 9,19,949,2111 diff --git a/dll/directx/wine/d3dx9_36/volume.c b/dll/directx/wine/d3dx9_36/volume.c index d409e29775c..756f270e776 100644 --- a/dll/directx/wine/d3dx9_36/volume.c +++ b/dll/directx/wine/d3dx9_36/volume.c @@ -235,6 +235,10 @@ HRESULT WINAPI D3DXLoadVolumeFromFileInMemory(IDirect3DVolume9 *dst_volume, D3DBOX box; D3DXIMAGE_INFO image_info; + TRACE("dst_volume %p, dst_palette %p, dst_box %p, src_data %p, src_data_size %u, src_box %p,\n", + dst_volume, dst_palette, dst_box, src_data, src_data_size, src_box); + TRACE("filter %#x, color_key %#x, src_info %p.\n", filter, color_key, src_info); + if (!dst_volume || !src_data) return D3DERR_INVALIDCALL; hr = D3DXGetImageInfoFromFileInMemory(src_data, src_data_size, &image_info); diff --git a/dll/directx/wine/d3dx9_36/xfile.c b/dll/directx/wine/d3dx9_36/xfile.c index 956f51078ba..7cc0ba817eb 100644 --- a/dll/directx/wine/d3dx9_36/xfile.c +++ b/dll/directx/wine/d3dx9_36/xfile.c @@ -43,119 +43,119 @@ static HRESULT error_dxfile_to_d3dxfile(HRESULT error) } } -typedef struct { +struct d3dx9_file +{ ID3DXFile ID3DXFile_iface; LONG ref; IDirectXFile *dxfile; -} ID3DXFileImpl; +}; -typedef struct { +struct d3dx9_file_enum_object +{ ID3DXFileEnumObject ID3DXFileEnumObject_iface; LONG ref; ULONG nb_children; ID3DXFileData **children; -} ID3DXFileEnumObjectImpl; +}; -typedef struct { +struct d3dx9_file_data +{ ID3DXFileData ID3DXFileData_iface; LONG ref; BOOL reference; IDirectXFileData *dxfile_data; ULONG nb_children; ID3DXFileData **children; -} ID3DXFileDataImpl; +}; - -static inline ID3DXFileImpl* impl_from_ID3DXFile(ID3DXFile *iface) +static inline struct d3dx9_file *impl_from_ID3DXFile(ID3DXFile *iface) { - return CONTAINING_RECORD(iface, ID3DXFileImpl, ID3DXFile_iface); + return CONTAINING_RECORD(iface, struct d3dx9_file, ID3DXFile_iface); } -static inline ID3DXFileEnumObjectImpl* impl_from_ID3DXFileEnumObject(ID3DXFileEnumObject *iface) +static inline struct d3dx9_file_enum_object *impl_from_ID3DXFileEnumObject(ID3DXFileEnumObject *iface) { - return CONTAINING_RECORD(iface, ID3DXFileEnumObjectImpl, ID3DXFileEnumObject_iface); + return CONTAINING_RECORD(iface, struct d3dx9_file_enum_object, ID3DXFileEnumObject_iface); } -static inline ID3DXFileDataImpl* impl_from_ID3DXFileData(ID3DXFileData *iface) +static inline struct d3dx9_file_data *impl_from_ID3DXFileData(ID3DXFileData *iface) { - return CONTAINING_RECORD(iface, ID3DXFileDataImpl, ID3DXFileData_iface); + return CONTAINING_RECORD(iface, struct d3dx9_file_data, ID3DXFileData_iface); } -/*** IUnknown methods ***/ - -static HRESULT WINAPI ID3DXFileDataImpl_QueryInterface(ID3DXFileData *iface, REFIID riid, void **ret_iface) +static HRESULT WINAPI d3dx9_file_data_QueryInterface(ID3DXFileData *iface, REFIID riid, void **out) { - TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ret_iface); + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_ID3DXFileData)) + if (IsEqualGUID(riid, &IID_ID3DXFileData) + || IsEqualGUID(riid, &IID_IUnknown)) { iface->lpVtbl->AddRef(iface); - *ret_iface = iface; + *out = iface; return S_OK; } - WARN("(%p)->(%s, %p), not found\n", iface, debugstr_guid(riid), ret_iface); - *ret_iface = NULL; + WARN("Interface %s not found.\n", debugstr_guid(riid)); + + *out = NULL; return E_NOINTERFACE; } -static ULONG WINAPI ID3DXFileDataImpl_AddRef(ID3DXFileData *iface) +static ULONG WINAPI d3dx9_file_data_AddRef(ID3DXFileData *iface) { - ID3DXFileDataImpl *This = impl_from_ID3DXFileData(iface); - ULONG ref = InterlockedIncrement(&This->ref); + struct d3dx9_file_data *file_data = impl_from_ID3DXFileData(iface); + ULONG refcount = InterlockedIncrement(&file_data->ref); - TRACE("(%p)->(): new ref = %u\n", iface, ref); + TRACE("%p increasing refcount to %u.\n", file_data, refcount); - return ref; + return refcount; } -static ULONG WINAPI ID3DXFileDataImpl_Release(ID3DXFileData *iface) +static ULONG WINAPI d3dx9_file_data_Release(ID3DXFileData *iface) { - ID3DXFileDataImpl *This = impl_from_ID3DXFileData(iface); - ULONG ref = InterlockedDecrement(&This->ref); + struct d3dx9_file_data *file_data = impl_from_ID3DXFileData(iface); + ULONG refcount = InterlockedDecrement(&file_data->ref); - TRACE("(%p)->(): new ref = %u\n", iface, ref); + TRACE("%p decreasing refcount to %u.\n", file_data, refcount); - if (!ref) + if (!refcount) { ULONG i; - for (i = 0; i < This->nb_children; i++) - (This->children[i])->lpVtbl->Release(This->children[i]); - HeapFree(GetProcessHeap(), 0, This->children); - IDirectXFileData_Release(This->dxfile_data); - HeapFree(GetProcessHeap(), 0, This); + for (i = 0; i < file_data->nb_children; ++i) + { + ID3DXFileData *child = file_data->children[i]; + child->lpVtbl->Release(child); + } + HeapFree(GetProcessHeap(), 0, file_data->children); + IDirectXFileData_Release(file_data->dxfile_data); + HeapFree(GetProcessHeap(), 0, file_data); } - return ref; + return refcount; } - -/*** ID3DXFileData methods ***/ - -static HRESULT WINAPI ID3DXFileDataImpl_GetEnum(ID3DXFileData *iface, ID3DXFileEnumObject **enum_object) +static HRESULT WINAPI d3dx9_file_data_GetEnum(ID3DXFileData *iface, ID3DXFileEnumObject **enum_object) { - FIXME("(%p)->(%p): stub\n", iface, enum_object); + FIXME("iface %p, enum_object %p stub!\n", iface, enum_object); return E_NOTIMPL; } - -static HRESULT WINAPI ID3DXFileDataImpl_GetName(ID3DXFileData *iface, char *name, SIZE_T *size) +static HRESULT WINAPI d3dx9_file_data_GetName(ID3DXFileData *iface, char *name, SIZE_T *size) { - ID3DXFileDataImpl *This = impl_from_ID3DXFileData(iface); + struct d3dx9_file_data *file_data = impl_from_ID3DXFileData(iface); DWORD dxfile_size; HRESULT ret; - TRACE("(%p)->(%p, %p)\n", iface, name, size); + TRACE("iface %p, name %p, size %p.\n", iface, name, size); if (!size) return D3DXFERR_BADVALUE; dxfile_size = *size; - ret = IDirectXFileData_GetName(This->dxfile_data, name, &dxfile_size); + ret = IDirectXFileData_GetName(file_data->dxfile_data, name, &dxfile_size); if (ret != DXFILE_OK) return error_dxfile_to_d3dxfile(ret); @@ -173,37 +173,35 @@ static HRESULT WINAPI ID3DXFileDataImpl_GetName(ID3DXFileData *iface, char *name return S_OK; } - -static HRESULT WINAPI ID3DXFileDataImpl_GetId(ID3DXFileData *iface, GUID *guid) +static HRESULT WINAPI d3dx9_file_data_GetId(ID3DXFileData *iface, GUID *guid) { - ID3DXFileDataImpl *This = impl_from_ID3DXFileData(iface); + struct d3dx9_file_data *file_data = impl_from_ID3DXFileData(iface); HRESULT ret; - TRACE("(%p)->(%p)\n", iface, guid); + TRACE("iface %p, guid %p.\n", iface, guid); if (!guid) return E_POINTER; - ret = IDirectXFileData_GetId(This->dxfile_data, guid); + ret = IDirectXFileData_GetId(file_data->dxfile_data, guid); if (ret != DXFILE_OK) return error_dxfile_to_d3dxfile(ret); return S_OK; } - -static HRESULT WINAPI ID3DXFileDataImpl_Lock(ID3DXFileData *iface, SIZE_T *size, const void **data) +static HRESULT WINAPI d3dx9_file_data_Lock(ID3DXFileData *iface, SIZE_T *size, const void **data) { - ID3DXFileDataImpl *This = impl_from_ID3DXFileData(iface); + struct d3dx9_file_data *file_data = impl_from_ID3DXFileData(iface); DWORD dxfile_size; HRESULT ret; - TRACE("(%p)->(%p, %p)\n", iface, size, data); + TRACE("iface %p, size %p, data %p.\n", iface, size, data); if (!size || !data) return E_POINTER; - ret = IDirectXFileData_GetData(This->dxfile_data, NULL, &dxfile_size, (void**)data); + ret = IDirectXFileData_GetData(file_data->dxfile_data, NULL, &dxfile_size, (void **)data); if (ret != DXFILE_OK) return error_dxfile_to_d3dxfile(ret); @@ -212,26 +210,24 @@ static HRESULT WINAPI ID3DXFileDataImpl_Lock(ID3DXFileData *iface, SIZE_T *size, return S_OK; } - -static HRESULT WINAPI ID3DXFileDataImpl_Unlock(ID3DXFileData *iface) +static HRESULT WINAPI d3dx9_file_data_Unlock(ID3DXFileData *iface) { - TRACE("(%p)->()\n", iface); + TRACE("iface %p.\n", iface); /* Nothing to do */ return S_OK; } - -static HRESULT WINAPI ID3DXFileDataImpl_GetType(ID3DXFileData *iface, GUID *guid) +static HRESULT WINAPI d3dx9_file_data_GetType(ID3DXFileData *iface, GUID *guid) { - ID3DXFileDataImpl *This = impl_from_ID3DXFileData(iface); + struct d3dx9_file_data *file_data = impl_from_ID3DXFileData(iface); const GUID *dxfile_guid; HRESULT ret; - TRACE("(%p)->(%p)\n", iface, guid); + TRACE("iface %p, guid %p.\n", iface, guid); - ret = IDirectXFileData_GetType(This->dxfile_data, &dxfile_guid); + ret = IDirectXFileData_GetType(file_data->dxfile_data, &dxfile_guid); if (ret != DXFILE_OK) return error_dxfile_to_d3dxfile(ret); @@ -240,72 +236,67 @@ static HRESULT WINAPI ID3DXFileDataImpl_GetType(ID3DXFileData *iface, GUID *guid return S_OK; } - -static BOOL WINAPI ID3DXFileDataImpl_IsReference(ID3DXFileData *iface) +static BOOL WINAPI d3dx9_file_data_IsReference(ID3DXFileData *iface) { - ID3DXFileDataImpl *This = impl_from_ID3DXFileData(iface); + struct d3dx9_file_data *file_data = impl_from_ID3DXFileData(iface); - TRACE("(%p)->()\n", iface); + TRACE("iface %p.\n", iface); - return This->reference; + return file_data->reference; } - -static HRESULT WINAPI ID3DXFileDataImpl_GetChildren(ID3DXFileData *iface, SIZE_T *children) +static HRESULT WINAPI d3dx9_file_data_GetChildren(ID3DXFileData *iface, SIZE_T *children) { - ID3DXFileDataImpl *This = impl_from_ID3DXFileData(iface); + struct d3dx9_file_data *file_data = impl_from_ID3DXFileData(iface); - TRACE("(%p)->(%p)\n", iface, children); + TRACE("iface %p, children %p.\n", iface, children); if (!children) return E_POINTER; - *children = This->nb_children; + *children = file_data->nb_children; return S_OK; } - -static HRESULT WINAPI ID3DXFileDataImpl_GetChild(ID3DXFileData *iface, SIZE_T id, ID3DXFileData **object) +static HRESULT WINAPI d3dx9_file_data_GetChild(ID3DXFileData *iface, SIZE_T id, ID3DXFileData **object) { - ID3DXFileDataImpl *This = impl_from_ID3DXFileData(iface); + struct d3dx9_file_data *file_data = impl_from_ID3DXFileData(iface); - TRACE("(%p)->(%lu, %p)\n", iface, id, object); + TRACE("iface %p, id %#lx, object %p.\n", iface, id, object); if (!object) return E_POINTER; - *object = This->children[id]; + *object = file_data->children[id]; (*object)->lpVtbl->AddRef(*object); return S_OK; } - -static const ID3DXFileDataVtbl ID3DXFileData_Vtbl = +static const ID3DXFileDataVtbl d3dx9_file_data_vtbl = { - ID3DXFileDataImpl_QueryInterface, - ID3DXFileDataImpl_AddRef, - ID3DXFileDataImpl_Release, - ID3DXFileDataImpl_GetEnum, - ID3DXFileDataImpl_GetName, - ID3DXFileDataImpl_GetId, - ID3DXFileDataImpl_Lock, - ID3DXFileDataImpl_Unlock, - ID3DXFileDataImpl_GetType, - ID3DXFileDataImpl_IsReference, - ID3DXFileDataImpl_GetChildren, - ID3DXFileDataImpl_GetChild + d3dx9_file_data_QueryInterface, + d3dx9_file_data_AddRef, + d3dx9_file_data_Release, + d3dx9_file_data_GetEnum, + d3dx9_file_data_GetName, + d3dx9_file_data_GetId, + d3dx9_file_data_Lock, + d3dx9_file_data_Unlock, + d3dx9_file_data_GetType, + d3dx9_file_data_IsReference, + d3dx9_file_data_GetChildren, + d3dx9_file_data_GetChild, }; - -static HRESULT ID3DXFileDataImpl_Create(IDirectXFileObject *dxfile_object, ID3DXFileData **ret_iface) +static HRESULT d3dx9_file_data_create(IDirectXFileObject *dxfile_object, ID3DXFileData **ret_iface) { - ID3DXFileDataImpl *object; + struct d3dx9_file_data *object; IDirectXFileObject *data_object; HRESULT ret; - TRACE("(%p, %p)\n", dxfile_object, ret_iface); + TRACE("dxfile_object %p, ret_iface %p.\n", dxfile_object, ret_iface); *ret_iface = NULL; @@ -313,7 +304,7 @@ static HRESULT ID3DXFileDataImpl_Create(IDirectXFileObject *dxfile_object, ID3DX if (!object) return E_OUTOFMEMORY; - object->ID3DXFileData_iface.lpVtbl = &ID3DXFileData_Vtbl; + object->ID3DXFileData_iface.lpVtbl = &d3dx9_file_data_vtbl; object->ref = 1; ret = IDirectXFileObject_QueryInterface(dxfile_object, &IID_IDirectXFileData, (void **)&object->dxfile_data); @@ -351,8 +342,7 @@ static HRESULT ID3DXFileDataImpl_Create(IDirectXFileObject *dxfile_object, ID3DX ret = E_OUTOFMEMORY; break; } - ret = ID3DXFileDataImpl_Create(data_object, &object->children[object->nb_children]); - if (ret != S_OK) + if (FAILED(ret = d3dx9_file_data_create(data_object, &object->children[object->nb_children]))) break; object->nb_children++; } @@ -370,181 +360,170 @@ static HRESULT ID3DXFileDataImpl_Create(IDirectXFileObject *dxfile_object, ID3DX return S_OK; } - -/*** IUnknown methods ***/ - -static HRESULT WINAPI ID3DXFileEnumObjectImpl_QueryInterface(ID3DXFileEnumObject *iface, REFIID riid, void **ret_iface) +static HRESULT WINAPI d3dx9_file_enum_object_QueryInterface(ID3DXFileEnumObject *iface, REFIID riid, void **out) { - TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ret_iface); + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_ID3DXFileEnumObject)) + if (IsEqualGUID(riid, &IID_ID3DXFileEnumObject) + || IsEqualGUID(riid, &IID_IUnknown)) { iface->lpVtbl->AddRef(iface); - *ret_iface = iface; + *out = iface; return S_OK; } - WARN("(%p)->(%s, %p), not found\n", iface, debugstr_guid(riid), ret_iface); - *ret_iface = NULL; + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); + + *out = NULL; return E_NOINTERFACE; } -static ULONG WINAPI ID3DXFileEnumObjectImpl_AddRef(ID3DXFileEnumObject *iface) +static ULONG WINAPI d3dx9_file_enum_object_AddRef(ID3DXFileEnumObject *iface) { - ID3DXFileEnumObjectImpl *This = impl_from_ID3DXFileEnumObject(iface); - ULONG ref = InterlockedIncrement(&This->ref); + struct d3dx9_file_enum_object *file_enum = impl_from_ID3DXFileEnumObject(iface); + ULONG refcount = InterlockedIncrement(&file_enum->ref); - TRACE("(%p)->(): new ref = %u\n", iface, ref); + TRACE("%p increasing refcount to %u.\n", file_enum, refcount); - return ref; + return refcount; } -static ULONG WINAPI ID3DXFileEnumObjectImpl_Release(ID3DXFileEnumObject *iface) +static ULONG WINAPI d3dx9_file_enum_object_Release(ID3DXFileEnumObject *iface) { - ID3DXFileEnumObjectImpl *This = impl_from_ID3DXFileEnumObject(iface); - ULONG ref = InterlockedDecrement(&This->ref); + struct d3dx9_file_enum_object *file_enum = impl_from_ID3DXFileEnumObject(iface); + ULONG refcount = InterlockedDecrement(&file_enum->ref); - TRACE("(%p)->(): new ref = %u\n", iface, ref); + TRACE("%p decreasing refcount to %u.\n", file_enum, refcount); - if (!ref) + if (!refcount) { ULONG i; - for (i = 0; i < This->nb_children; i++) - (This->children[i])->lpVtbl->Release(This->children[i]); - HeapFree(GetProcessHeap(), 0, This->children); - HeapFree(GetProcessHeap(), 0, This); + for (i = 0; i < file_enum->nb_children; ++i) + { + ID3DXFileData *child = file_enum->children[i]; + child->lpVtbl->Release(child); + } + HeapFree(GetProcessHeap(), 0, file_enum->children); + HeapFree(GetProcessHeap(), 0, file_enum); } - return ref; + return refcount; } - -/*** ID3DXFileEnumObject methods ***/ - -static HRESULT WINAPI ID3DXFileEnumObjectImpl_GetFile(ID3DXFileEnumObject *iface, ID3DXFile **file) +static HRESULT WINAPI d3dx9_file_enum_object_GetFile(ID3DXFileEnumObject *iface, ID3DXFile **file) { - FIXME("(%p)->(%p): stub\n", iface, file); + FIXME("iface %p, file %p stub!\n", iface, file); return E_NOTIMPL; } - -static HRESULT WINAPI ID3DXFileEnumObjectImpl_GetChildren(ID3DXFileEnumObject *iface, SIZE_T *children) +static HRESULT WINAPI d3dx9_file_enum_object_GetChildren(ID3DXFileEnumObject *iface, SIZE_T *children) { - ID3DXFileEnumObjectImpl *This = impl_from_ID3DXFileEnumObject(iface); + struct d3dx9_file_enum_object *file_enum = impl_from_ID3DXFileEnumObject(iface); - TRACE("(%p)->(%p)\n", iface, children); + TRACE("iface %p, children %p.\n", iface, children); if (!children) return E_POINTER; - *children = This->nb_children; + *children = file_enum->nb_children; return S_OK; } - -static HRESULT WINAPI ID3DXFileEnumObjectImpl_GetChild(ID3DXFileEnumObject *iface, SIZE_T id, ID3DXFileData **object) +static HRESULT WINAPI d3dx9_file_enum_object_GetChild(ID3DXFileEnumObject *iface, SIZE_T id, ID3DXFileData **object) { - ID3DXFileEnumObjectImpl *This = impl_from_ID3DXFileEnumObject(iface); + struct d3dx9_file_enum_object *file_enum = impl_from_ID3DXFileEnumObject(iface); - TRACE("(%p)->(%lu, %p)\n", iface, id, object); + TRACE("iface %p, id %#lx, object %p.\n", iface, id, object); if (!object) return E_POINTER; - *object = This->children[id]; + *object = file_enum->children[id]; (*object)->lpVtbl->AddRef(*object); return S_OK; } - -static HRESULT WINAPI ID3DXFileEnumObjectImpl_GetDataObjectById(ID3DXFileEnumObject *iface, REFGUID guid, ID3DXFileData **object) +static HRESULT WINAPI d3dx9_file_enum_object_GetDataObjectById(ID3DXFileEnumObject *iface, + REFGUID guid, ID3DXFileData **object) { - FIXME("(%p)->(%s, %p): stub\n", iface, debugstr_guid(guid), object); + FIXME("iface %p, guid %s, object %p stub!\n", iface, debugstr_guid(guid), object); return E_NOTIMPL; } - -static HRESULT WINAPI ID3DXFileEnumObjectImpl_GetDataObjectByName(ID3DXFileEnumObject *iface, const char *name, ID3DXFileData **object) +static HRESULT WINAPI d3dx9_file_enum_object_GetDataObjectByName(ID3DXFileEnumObject *iface, + const char *name, ID3DXFileData **object) { - FIXME("(%p)->(%s, %p): stub\n", iface, debugstr_a(name), object); + FIXME("iface %p, name %s, object %p stub!\n", iface, debugstr_a(name), object); return E_NOTIMPL; } - -static const ID3DXFileEnumObjectVtbl ID3DXFileEnumObject_Vtbl = +static const ID3DXFileEnumObjectVtbl d3dx9_file_enum_object_vtbl = { - ID3DXFileEnumObjectImpl_QueryInterface, - ID3DXFileEnumObjectImpl_AddRef, - ID3DXFileEnumObjectImpl_Release, - ID3DXFileEnumObjectImpl_GetFile, - ID3DXFileEnumObjectImpl_GetChildren, - ID3DXFileEnumObjectImpl_GetChild, - ID3DXFileEnumObjectImpl_GetDataObjectById, - ID3DXFileEnumObjectImpl_GetDataObjectByName + d3dx9_file_enum_object_QueryInterface, + d3dx9_file_enum_object_AddRef, + d3dx9_file_enum_object_Release, + d3dx9_file_enum_object_GetFile, + d3dx9_file_enum_object_GetChildren, + d3dx9_file_enum_object_GetChild, + d3dx9_file_enum_object_GetDataObjectById, + d3dx9_file_enum_object_GetDataObjectByName, }; - -/*** IUnknown methods ***/ - -static HRESULT WINAPI ID3DXFileImpl_QueryInterface(ID3DXFile *iface, REFIID riid, void **ret_iface) +static HRESULT WINAPI d3dx9_file_QueryInterface(ID3DXFile *iface, REFIID riid, void **out) { - TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ret_iface); + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_ID3DXFile)) + if (IsEqualGUID(riid, &IID_ID3DXFile) + || IsEqualGUID(riid, &IID_IUnknown)) { iface->lpVtbl->AddRef(iface); - *ret_iface = iface; + *out = iface; return S_OK; } - WARN("(%p)->(%s, %p), not found\n", iface, debugstr_guid(riid), ret_iface); - *ret_iface = NULL; + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); + + *out = NULL; return E_NOINTERFACE; } - -static ULONG WINAPI ID3DXFileImpl_AddRef(ID3DXFile *iface) +static ULONG WINAPI d3dx9_file_AddRef(ID3DXFile *iface) { - ID3DXFileImpl *This = impl_from_ID3DXFile(iface); - ULONG ref = InterlockedIncrement(&This->ref); + struct d3dx9_file *file = impl_from_ID3DXFile(iface); + ULONG refcount = InterlockedIncrement(&file->ref); - TRACE("(%p)->(): new ref = %u\n", iface, ref); + TRACE("%p increasing refcount to %u.\n", file, refcount); - return ref; + return refcount; } - -static ULONG WINAPI ID3DXFileImpl_Release(ID3DXFile *iface) +static ULONG WINAPI d3dx9_file_Release(ID3DXFile *iface) { - ID3DXFileImpl *This = impl_from_ID3DXFile(iface); - ULONG ref = InterlockedDecrement(&This->ref); + struct d3dx9_file *file = impl_from_ID3DXFile(iface); + ULONG refcount = InterlockedDecrement(&file->ref); - TRACE("(%p)->(): new ref = %u\n", iface, ref); + TRACE("%p decreasing refcount to %u.\n", file, refcount); - if (!ref) + if (!refcount) { - IDirectXFile_Release(This->dxfile); - HeapFree(GetProcessHeap(), 0, This); + IDirectXFile_Release(file->dxfile); + HeapFree(GetProcessHeap(), 0, file); } - return ref; + return refcount; } - -/*** ID3DXFile methods ***/ - -static HRESULT WINAPI ID3DXFileImpl_CreateEnumObject(ID3DXFile *iface, const void *source, D3DXF_FILELOADOPTIONS options, ID3DXFileEnumObject **enum_object) +static HRESULT WINAPI d3dx9_file_CreateEnumObject(ID3DXFile *iface, const void *source, + D3DXF_FILELOADOPTIONS options, ID3DXFileEnumObject **enum_object) { - ID3DXFileImpl *This = impl_from_ID3DXFile(iface); - ID3DXFileEnumObjectImpl *object; + struct d3dx9_file *file = impl_from_ID3DXFile(iface); + struct d3dx9_file_enum_object *object; IDirectXFileEnumObject *dxfile_enum_object; void *dxfile_source; DXFILELOADOPTIONS dxfile_options; @@ -553,7 +532,7 @@ static HRESULT WINAPI ID3DXFileImpl_CreateEnumObject(ID3DXFile *iface, const voi IDirectXFileData *data_object; HRESULT ret; - TRACE("(%p)->(%p, %x, %p)\n", iface, source, options, enum_object); + TRACE("iface %p, source %p, options %#x, enum_object %p.\n", iface, source, options, enum_object); if (!enum_object) return E_POINTER; @@ -594,10 +573,10 @@ static HRESULT WINAPI ID3DXFileImpl_CreateEnumObject(ID3DXFile *iface, const voi if (!object) return E_OUTOFMEMORY; - object->ID3DXFileEnumObject_iface.lpVtbl = &ID3DXFileEnumObject_Vtbl; + object->ID3DXFileEnumObject_iface.lpVtbl = &d3dx9_file_enum_object_vtbl; object->ref = 1; - ret = IDirectXFile_CreateEnumObject(This->dxfile, dxfile_source, dxfile_options, &dxfile_enum_object); + ret = IDirectXFile_CreateEnumObject(file->dxfile, dxfile_source, dxfile_options, &dxfile_enum_object); if (ret != S_OK) { @@ -617,8 +596,8 @@ static HRESULT WINAPI ID3DXFileImpl_CreateEnumObject(ID3DXFile *iface, const voi ret = E_OUTOFMEMORY; break; } - ret = ID3DXFileDataImpl_Create((IDirectXFileObject*)data_object, &object->children[object->nb_children]); - if (ret != S_OK) + if (FAILED(ret = d3dx9_file_data_create((IDirectXFileObject*)data_object, + &object->children[object->nb_children]))) break; object->nb_children++; } @@ -635,23 +614,23 @@ static HRESULT WINAPI ID3DXFileImpl_CreateEnumObject(ID3DXFile *iface, const voi return S_OK; } - -static HRESULT WINAPI ID3DXFileImpl_CreateSaveObject(ID3DXFile *iface, const void *data, D3DXF_FILESAVEOPTIONS options, D3DXF_FILEFORMAT format, ID3DXFileSaveObject **save_object) +static HRESULT WINAPI d3dx9_file_CreateSaveObject(ID3DXFile *iface, const void *data, + D3DXF_FILESAVEOPTIONS options, D3DXF_FILEFORMAT format, ID3DXFileSaveObject **save_object) { - FIXME("(%p)->(%p, %x, %u, %p): stub\n", iface, data, options, format, save_object); + FIXME("iface %p, data %p, options %#x, format %#x, save_object %p stub!\n", + iface, data, options, format, save_object); return E_NOTIMPL; } - -static HRESULT WINAPI ID3DXFileImpl_RegisterTemplates(ID3DXFile *iface, const void *data, SIZE_T size) +static HRESULT WINAPI d3dx9_file_RegisterTemplates(ID3DXFile *iface, const void *data, SIZE_T size) { - ID3DXFileImpl *This = impl_from_ID3DXFile(iface); + struct d3dx9_file *file = impl_from_ID3DXFile(iface); HRESULT ret; - TRACE("(%p)->(%p, %lu)\n", iface, data, size); + TRACE("iface %p, data %p, size %lu.\n", iface, data, size); - ret = IDirectXFile_RegisterTemplates(This->dxfile, (void*)data, size); + ret = IDirectXFile_RegisterTemplates(file->dxfile, (void *)data, size); if (ret != DXFILE_OK) { WARN("Error %#x\n", ret); @@ -661,32 +640,30 @@ static HRESULT WINAPI ID3DXFileImpl_RegisterTemplates(ID3DXFile *iface, const vo return S_OK; } - -static HRESULT WINAPI ID3DXFileImpl_RegisterEnumTemplates(ID3DXFile *iface, ID3DXFileEnumObject *enum_object) +static HRESULT WINAPI d3dx9_file_RegisterEnumTemplates(ID3DXFile *iface, ID3DXFileEnumObject *enum_object) { - FIXME("(%p)->(%p): stub\n", iface, enum_object); + FIXME("iface %p, enum_object %p stub!\n", iface, enum_object); return E_NOTIMPL; } - -static const ID3DXFileVtbl ID3DXFile_Vtbl = +static const ID3DXFileVtbl d3dx9_file_vtbl = { - ID3DXFileImpl_QueryInterface, - ID3DXFileImpl_AddRef, - ID3DXFileImpl_Release, - ID3DXFileImpl_CreateEnumObject, - ID3DXFileImpl_CreateSaveObject, - ID3DXFileImpl_RegisterTemplates, - ID3DXFileImpl_RegisterEnumTemplates + d3dx9_file_QueryInterface, + d3dx9_file_AddRef, + d3dx9_file_Release, + d3dx9_file_CreateEnumObject, + d3dx9_file_CreateSaveObject, + d3dx9_file_RegisterTemplates, + d3dx9_file_RegisterEnumTemplates, }; HRESULT WINAPI D3DXFileCreate(ID3DXFile **d3dxfile) { - ID3DXFileImpl *object; + struct d3dx9_file *object; HRESULT ret; - TRACE("(%p)\n", d3dxfile); + TRACE("d3dxfile %p.\n", d3dxfile); if (!d3dxfile) return E_POINTER; @@ -706,7 +683,7 @@ HRESULT WINAPI D3DXFileCreate(ID3DXFile **d3dxfile) return E_FAIL; } - object->ID3DXFile_iface.lpVtbl = &ID3DXFile_Vtbl; + object->ID3DXFile_iface.lpVtbl = &d3dx9_file_vtbl; object->ref = 1; *d3dxfile = &object->ID3DXFile_iface; diff --git a/dll/directx/wine/d3dx9_37/version.rc b/dll/directx/wine/d3dx9_37/version.rc index aeb99d2cf9c..996388eec21 100644 --- a/dll/directx/wine/d3dx9_37/version.rc +++ b/dll/directx/wine/d3dx9_37/version.rc @@ -17,7 +17,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_37.dll" #define WINE_FILEVERSION 9,22,949,2248 #define WINE_FILEVERSION_STR "9.22.949.2248" #define WINE_PRODUCTVERSION 9,22,949,2248 diff --git a/dll/directx/wine/d3dx9_38/version.rc b/dll/directx/wine/d3dx9_38/version.rc index a8fdca8e3bc..5c33e25f16d 100644 --- a/dll/directx/wine/d3dx9_38/version.rc +++ b/dll/directx/wine/d3dx9_38/version.rc @@ -17,7 +17,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_38.dll" #define WINE_FILEVERSION 9,23,949,2378 #define WINE_FILEVERSION_STR "9.23.949.2378" #define WINE_PRODUCTVERSION 9,23,949,2378 diff --git a/dll/directx/wine/d3dx9_39/version.rc b/dll/directx/wine/d3dx9_39/version.rc index 234dcb9149c..d33fc41a425 100644 --- a/dll/directx/wine/d3dx9_39/version.rc +++ b/dll/directx/wine/d3dx9_39/version.rc @@ -17,7 +17,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_39.dll" #define WINE_FILEVERSION 9,24,949,2307 #define WINE_FILEVERSION_STR "9.24.949.2307" #define WINE_PRODUCTVERSION 9,24,949,2307 diff --git a/dll/directx/wine/d3dx9_40/version.rc b/dll/directx/wine/d3dx9_40/version.rc index f951079abd0..79894fd491d 100644 --- a/dll/directx/wine/d3dx9_40/version.rc +++ b/dll/directx/wine/d3dx9_40/version.rc @@ -18,7 +18,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_40.dll" #define WINE_FILEVERSION 9,24,950,2656 #define WINE_FILEVERSION_STR "9.24.950.2656" #define WINE_PRODUCTVERSION 9,24,950,2656 diff --git a/dll/directx/wine/d3dx9_41/version.rc b/dll/directx/wine/d3dx9_41/version.rc index 6db7842c738..2419a7da57e 100644 --- a/dll/directx/wine/d3dx9_41/version.rc +++ b/dll/directx/wine/d3dx9_41/version.rc @@ -18,7 +18,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_41.dll" #define WINE_FILEVERSION 9,26,952,2844 #define WINE_FILEVERSION_STR "9.26.952.2844" #define WINE_PRODUCTVERSION 9,26,952,2844 diff --git a/dll/directx/wine/d3dx9_42/version.rc b/dll/directx/wine/d3dx9_42/version.rc index 5733eb975e0..16afffc4174 100644 --- a/dll/directx/wine/d3dx9_42/version.rc +++ b/dll/directx/wine/d3dx9_42/version.rc @@ -19,7 +19,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_42.dll" #define WINE_FILEVERSION 9,27,952,3001 #define WINE_FILEVERSION_STR "9.27.952.3001" #define WINE_PRODUCTVERSION 9,27,952,3001 diff --git a/dll/directx/wine/d3dx9_43/d3dx9_43_main.c b/dll/directx/wine/d3dx9_43/d3dx9_43_main.c index b3d74cbf56d..67cc17a9f1e 100644 --- a/dll/directx/wine/d3dx9_43/d3dx9_43_main.c +++ b/dll/directx/wine/d3dx9_43/d3dx9_43_main.c @@ -2,7 +2,7 @@ * Direct3D X 9 main file * * Copyright (C) 2007 David Adam - * Copyright (C) 2009 Rico Schأ¼ller + * Copyright (C) 2009 Rico Schüller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,17 +20,21 @@ * */ -#include "config.h" -#include "wine/port.h" +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#include +//#include "wine/port.h" #include -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" +#include +#include +#include +//#include "winuser.h" -#include "d3dx9.h" +#include /*********************************************************************** * DllMain. diff --git a/dll/directx/wine/d3dx9_43/version.rc b/dll/directx/wine/d3dx9_43/version.rc index 90a4c2b62d0..7220bd2a908 100644 --- a/dll/directx/wine/d3dx9_43/version.rc +++ b/dll/directx/wine/d3dx9_43/version.rc @@ -1,6 +1,6 @@ /* * Copyright 2008 Louis Lenders - * Copyright 2009 Rico Schأ¼ller + * Copyright 2009 Rico Schüller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,7 +18,7 @@ */ #define WINE_FILEDESCRIPTION_STR "Wine D3DX9" -#define WINE_FILENAME_STR "d3dx9.dll" +#define WINE_FILENAME_STR "d3dx9_43.dll" #define WINE_FILEVERSION 9,29,952,3111 #define WINE_FILEVERSION_STR "9.29.952.3111" #define WINE_PRODUCTVERSION 9,29,952,3111 diff --git a/dll/directx/wine/d3dxof/d3dxof.c b/dll/directx/wine/d3dxof/d3dxof.c index 0cab8277874..8b8f3de4f1b 100644 --- a/dll/directx/wine/d3dxof/d3dxof.c +++ b/dll/directx/wine/d3dxof/d3dxof.c @@ -176,7 +176,7 @@ static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject(IDirectXFile* iface, LPV HGLOBAL resource_data; LPDXFILELOADRESOURCE lpdxflr = pvSource; - TRACE("Source in resource (module = %p, name = %s, type = %s\n", lpdxflr->hModule, debugstr_a(lpdxflr->lpName), debugstr_a(lpdxflr->lpType)); + TRACE("Source in resource (module = %p, name = %s, type = %s)\n", lpdxflr->hModule, debugstr_a(lpdxflr->lpName), debugstr_a(lpdxflr->lpType)); resource_info = FindResourceA(lpdxflr->hModule, lpdxflr->lpName, lpdxflr->lpType); if (!resource_info) diff --git a/dll/directx/wine/d3dxof/d3dxof.idl b/dll/directx/wine/d3dxof/d3dxof.idl index ea72a6e36e0..79d35cc3b2e 100644 --- a/dll/directx/wine/d3dxof/d3dxof.idl +++ b/dll/directx/wine/d3dxof/d3dxof.idl @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ helpstring("DirectX File"), threading(both), diff --git a/dll/directx/wine/d3dxof/d3dxof.rgs b/dll/directx/wine/d3dxof/d3dxof.rgs new file mode 100644 index 00000000000..f6fa4382d63 --- /dev/null +++ b/dll/directx/wine/d3dxof/d3dxof.rgs @@ -0,0 +1,13 @@ +HKCR +{ + NoRemove Interface + { + } + NoRemove CLSID + { + '{4516EC43-8F20-11D0-9B6D-0000C0781BC3}' = s 'DirectX File' + { + InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' } + } + } +} diff --git a/dll/directx/wine/d3dxof/main.c b/dll/directx/wine/d3dxof/main.c index 103c771c91c..c2f82529f6e 100644 --- a/dll/directx/wine/d3dxof/main.c +++ b/dll/directx/wine/d3dxof/main.c @@ -119,7 +119,7 @@ static HRESULT WINAPI XFCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter static HRESULT WINAPI XFCF_LockServer(LPCLASSFACTORY iface, BOOL dolock) { IClassFactoryImpl *This = impl_from_IClassFactory(iface); - FIXME("(%p)->(%d),stub!\n",This,dolock); + FIXME("(%p)->(%d), stub!\n",This,dolock); return S_OK; } diff --git a/dll/directx/wine/d3dxof/parsing.c b/dll/directx/wine/d3dxof/parsing.c index 224c83db294..564fe22d6d1 100644 --- a/dll/directx/wine/d3dxof/parsing.c +++ b/dll/directx/wine/d3dxof/parsing.c @@ -79,7 +79,7 @@ static const char *debugstr_fourcc(DWORD fourcc) (char)(fourcc >> 16), (char)(fourcc >> 24)); } -static const char* get_primitive_string(WORD token) +static const char* get_primitive_string(DWORD token) { switch(token) { @@ -499,11 +499,11 @@ static BOOL is_name(parse_buffer* buf) char tmp[512]; DWORD pos = 0; char c; - BOOL error = 0; + BOOL error = FALSE; while (pos < buf->rem_bytes && !is_separator(c = *(buf->buffer+pos))) { if (!(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || ((c >= '0') && (c <= '9')) || (c == '_') || (c == '-'))) - error = 1; + error = TRUE; if (pos < sizeof(tmp)) tmp[pos] = c; pos++; @@ -531,7 +531,7 @@ static BOOL is_float(parse_buffer* buf) DWORD pos = 0; char c; float decimal; - BOOL dot = 0; + BOOL dot = FALSE; while (pos < buf->rem_bytes && !is_separator(c = *(buf->buffer+pos))) { @@ -591,7 +591,7 @@ static BOOL is_string(parse_buffer* buf) char tmp[512]; DWORD pos = 0; char c; - BOOL ok = 0; + BOOL ok = FALSE; if (*buf->buffer != '"') return FALSE; @@ -601,7 +601,7 @@ static BOOL is_string(parse_buffer* buf) c = *(buf->buffer+pos+1); if (c == '"') { - ok = 1; + ok = TRUE; break; } if (pos < sizeof(tmp)) @@ -888,10 +888,10 @@ static inline BOOL is_primitive_type(WORD token) case TOKEN_LPSTR: case TOKEN_UNICODE: case TOKEN_CSTRING: - ret = 1; + ret = TRUE; break; default: - ret = 0; + ret = FALSE; break; } return ret; @@ -937,14 +937,14 @@ static BOOL parse_template_members_list(parse_buffer * buf) while (1) { - BOOL array = 0; + BOOL array = FALSE; int nb_dims = 0; cur_member = &buf->pdxf->xtemplates[buf->pdxf->nb_xtemplates].members[idx_member]; if (check_TOKEN(buf) == TOKEN_ARRAY) { get_TOKEN(buf); - array = 1; + array = TRUE; } if (check_TOKEN(buf) == TOKEN_NAME) diff --git a/dll/directx/wine/d3dxof/version.rc b/dll/directx/wine/d3dxof/version.rc index 93c1371c7c0..f7e4e7c30d3 100644 --- a/dll/directx/wine/d3dxof/version.rc +++ b/dll/directx/wine/d3dxof/version.rc @@ -23,4 +23,6 @@ #define WINE_PRODUCTVERSION 5,0,2135,1 #define WINE_PRODUCTVERSION_STR "5.0.2135.1" -#include "wine/wine_common_ver.rc" +1 WINE_REGISTRY d3dxof.rgs + +#include diff --git a/dll/directx/wine/ddraw/ddraw.c b/dll/directx/wine/ddraw/ddraw.c index 272e10969a9..e16a23d7e7e 100644 --- a/dll/directx/wine/ddraw/ddraw.c +++ b/dll/directx/wine/ddraw/ddraw.c @@ -30,7 +30,7 @@ static BOOL restore_mode; /* Device identifier. Don't relay it to WineD3D */ static const DDDEVICEIDENTIFIER2 deviceidentifier = { - "display", + "vga.dll", /* default 2D driver */ "DirectDraw HAL", { { 0x00010001, 0x00010001 } }, 0, 0, 0, 0, @@ -2556,19 +2556,46 @@ static HRESULT WINAPI ddraw7_EvaluateMode(IDirectDraw7 *iface, DWORD Flags, DWOR static HRESULT WINAPI ddraw7_GetDeviceIdentifier(IDirectDraw7 *iface, DDDEVICEIDENTIFIER2 *DDDI, DWORD Flags) { + struct ddraw *ddraw = impl_from_IDirectDraw7(iface); + struct wined3d_adapter_identifier adapter_id; + HRESULT hr = S_OK; + TRACE("iface %p, device_identifier %p, flags %#x.\n", iface, DDDI, Flags); - if(!DDDI) + if (!DDDI) return DDERR_INVALIDPARAMS; - /* The DDGDI_GETHOSTIDENTIFIER returns the information about the 2D - * host adapter, if there's a secondary 3D adapter. This doesn't apply - * to any modern hardware, nor is it interesting for Wine, so ignore it. - * Size of DDDEVICEIDENTIFIER2 may be aligned to 8 bytes and thus 4 - * bytes too long. So only copy the relevant part of the structure - */ + if (Flags & DDGDI_GETHOSTIDENTIFIER) + { + /* The DDGDI_GETHOSTIDENTIFIER returns the information about the 2D + * host adapter, if there's a secondary 3D adapter. This doesn't apply + * to any modern hardware, nor is it interesting for Wine, so ignore it. + * Size of DDDEVICEIDENTIFIER2 may be aligned to 8 bytes and thus 4 + * bytes too long. So only copy the relevant part of the structure + */ - memcpy(DDDI, &deviceidentifier, FIELD_OFFSET(DDDEVICEIDENTIFIER2, dwWHQLLevel) + sizeof(DWORD)); + memcpy(DDDI, &deviceidentifier, FIELD_OFFSET(DDDEVICEIDENTIFIER2, dwWHQLLevel) + sizeof(DWORD)); + return DD_OK; + } + + /* Drakan: Order of the Flame expects accurate D3D device information from ddraw */ + adapter_id.driver = DDDI->szDriver; + adapter_id.driver_size = sizeof(DDDI->szDriver); + adapter_id.description = DDDI->szDescription; + adapter_id.description_size = sizeof(DDDI->szDescription); + adapter_id.device_name_size = 0; + wined3d_mutex_lock(); + hr = wined3d_get_adapter_identifier(ddraw->wined3d, WINED3DADAPTER_DEFAULT, 0x0, &adapter_id); + wined3d_mutex_unlock(); + if (FAILED(hr)) return hr; + + DDDI->liDriverVersion = adapter_id.driver_version; + DDDI->dwVendorId = adapter_id.vendor_id; + DDDI->dwDeviceId = adapter_id.device_id; + DDDI->dwSubSysId = adapter_id.subsystem_id; + DDDI->dwRevision = adapter_id.revision; + DDDI->guidDeviceIdentifier = adapter_id.device_identifier; + DDDI->dwWHQLLevel = adapter_id.whql_level; return DD_OK; } @@ -4839,9 +4866,9 @@ HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type) ddraw->ref7 = 1; flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING; - if (!(ddraw->wined3d = wined3d_create(7, flags))) + if (!(ddraw->wined3d = wined3d_create(flags))) { - if (!(ddraw->wined3d = wined3d_create(7, flags | WINED3D_NO3D))) + if (!(ddraw->wined3d = wined3d_create(flags | WINED3D_NO3D))) { WARN("Failed to create a wined3d object.\n"); return E_FAIL; diff --git a/dll/directx/wine/ddraw/ddraw.rc b/dll/directx/wine/ddraw/ddraw.rc index 3926bb44eae..6ab8c4e7ea1 100644 --- a/dll/directx/wine/ddraw/ddraw.rc +++ b/dll/directx/wine/ddraw/ddraw.rc @@ -1,3 +1,3 @@ #include "version.rc" -1 WINE_REGISTRY ddraw.rgs +1 WINE_REGISTRY ddraw_classes.rgs diff --git a/dll/directx/wine/ddraw/ddraw.rgs b/dll/directx/wine/ddraw/ddraw_classes.rgs similarity index 100% rename from dll/directx/wine/ddraw/ddraw.rgs rename to dll/directx/wine/ddraw/ddraw_classes.rgs diff --git a/dll/directx/wine/ddraw/ddraw_private.h b/dll/directx/wine/ddraw/ddraw_private.h index a312ed7dad2..ae2adbd218a 100644 --- a/dll/directx/wine/ddraw/ddraw_private.h +++ b/dll/directx/wine/ddraw/ddraw_private.h @@ -157,6 +157,7 @@ struct ddraw_surface struct ddraw *ddraw; struct wined3d_surface *wined3d_surface; struct wined3d_texture *wined3d_texture; + struct wined3d_private_store private_store; struct d3d_device *device1; /* This implementation handles attaching surfaces to other surfaces */ @@ -550,8 +551,6 @@ struct d3d_vertex_buffer DWORD fvf; DWORD size; BOOL dynamic; - - BOOL read_since_last_map; }; HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **buffer, struct ddraw *ddraw, diff --git a/dll/directx/wine/ddraw/device.c b/dll/directx/wine/ddraw/device.c index cfad802e46d..c53f69b1633 100644 --- a/dll/directx/wine/ddraw/device.c +++ b/dll/directx/wine/ddraw/device.c @@ -4264,9 +4264,6 @@ static HRESULT d3d_device7_DrawPrimitiveVB(IDirect3DDevice7 *iface, D3DPRIMITIVE wined3d_device_set_primitive_type(device->wined3d_device, PrimitiveType); hr = wined3d_device_draw_primitive(device->wined3d_device, StartVertex, NumVertices); - if (SUCCEEDED(hr)) - vb->read_since_last_map = TRUE; - wined3d_mutex_unlock(); return hr; @@ -4392,9 +4389,6 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType); hr = wined3d_device_draw_indexed_primitive(This->wined3d_device, ib_pos / sizeof(WORD), IndexCount); - if (SUCCEEDED(hr)) - vb->read_since_last_map = TRUE; - wined3d_mutex_unlock(); return hr; diff --git a/dll/directx/wine/ddraw/main.c b/dll/directx/wine/ddraw/main.c index 9387cc09bc7..bac39e8d2d8 100644 --- a/dll/directx/wine/ddraw/main.c +++ b/dll/directx/wine/ddraw/main.c @@ -402,9 +402,9 @@ HRESULT WINAPI DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA callback, void *contex FIXME("flags 0x%08x not handled\n", flags & ~DDENUM_ATTACHEDSECONDARYDEVICES); TRACE("Enumerating ddraw interfaces\n"); - if (!(wined3d = wined3d_create(7, WINED3D_LEGACY_DEPTH_BIAS))) + if (!(wined3d = wined3d_create(WINED3D_LEGACY_DEPTH_BIAS))) { - if (!(wined3d = wined3d_create(7, WINED3D_LEGACY_DEPTH_BIAS | WINED3D_NO3D))) + if (!(wined3d = wined3d_create(WINED3D_LEGACY_DEPTH_BIAS | WINED3D_NO3D))) { WARN("Failed to create a wined3d object.\n"); return E_FAIL; diff --git a/dll/directx/wine/ddraw/surface.c b/dll/directx/wine/ddraw/surface.c index 9a35b1ad452..4e465d3727c 100644 --- a/dll/directx/wine/ddraw/surface.c +++ b/dll/directx/wine/ddraw/surface.c @@ -1665,106 +1665,94 @@ static HRESULT WINAPI ddraw_surface7_AddAttachedSurface(IDirectDrawSurface7 *ifa static HRESULT WINAPI ddraw_surface4_AddAttachedSurface(IDirectDrawSurface4 *iface, IDirectDrawSurface4 *attachment) { - struct ddraw_surface *This = impl_from_IDirectDrawSurface4(iface); + struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface); struct ddraw_surface *attachment_impl = unsafe_impl_from_IDirectDrawSurface4(attachment); HRESULT hr; TRACE("iface %p, attachment %p.\n", iface, attachment); - hr = ddraw_surface7_AddAttachedSurface(&This->IDirectDrawSurface7_iface, - attachment_impl ? &attachment_impl->IDirectDrawSurface7_iface : NULL); - if (FAILED(hr)) - { - return hr; - } - attachment_impl->attached_iface = (IUnknown *)attachment; - IUnknown_AddRef(attachment_impl->attached_iface); - ddraw_surface7_Release(&attachment_impl->IDirectDrawSurface7_iface); - return hr; -} -static HRESULT WINAPI ddraw_surface3_AddAttachedSurface(IDirectDrawSurface3 *iface, IDirectDrawSurface3 *attachment) -{ - struct ddraw_surface *This = impl_from_IDirectDrawSurface3(iface); - struct ddraw_surface *attachment_impl = unsafe_impl_from_IDirectDrawSurface3(attachment); - HRESULT hr; - - TRACE("iface %p, attachment %p.\n", iface, attachment); - /* Tests suggest that * -> offscreen plain surfaces can be attached to other offscreen plain surfaces * -> offscreen plain surfaces can be attached to primaries * -> primaries can be attached to offscreen plain surfaces * -> z buffers can be attached to primaries */ - if (This->surface_desc.ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_OFFSCREENPLAIN) + if (surface->surface_desc.ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_OFFSCREENPLAIN) && attachment_impl->surface_desc.ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_OFFSCREENPLAIN)) { /* Sizes have to match */ - if (attachment_impl->surface_desc.dwWidth != This->surface_desc.dwWidth - || attachment_impl->surface_desc.dwHeight != This->surface_desc.dwHeight) + if (attachment_impl->surface_desc.dwWidth != surface->surface_desc.dwWidth + || attachment_impl->surface_desc.dwHeight != surface->surface_desc.dwHeight) { WARN("Surface sizes do not match.\n"); return DDERR_CANNOTATTACHSURFACE; } - /* OK */ } - else if (This->surface_desc.ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE) - && attachment_impl->surface_desc.ddsCaps.dwCaps & (DDSCAPS_ZBUFFER)) - { - /* OK */ - } - else + else if (!(surface->surface_desc.ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE)) + || !(attachment_impl->surface_desc.ddsCaps.dwCaps & (DDSCAPS_ZBUFFER))) { WARN("Invalid attachment combination.\n"); return DDERR_CANNOTATTACHSURFACE; } - hr = ddraw_surface_attach_surface(This, attachment_impl); - if (FAILED(hr)) - { + if (FAILED(hr = ddraw_surface_attach_surface(surface, attachment_impl))) return hr; - } + attachment_impl->attached_iface = (IUnknown *)attachment; IUnknown_AddRef(attachment_impl->attached_iface); return hr; } +static HRESULT WINAPI ddraw_surface3_AddAttachedSurface(IDirectDrawSurface3 *iface, IDirectDrawSurface3 *attachment) +{ + struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface); + struct ddraw_surface *attachment_impl = unsafe_impl_from_IDirectDrawSurface3(attachment); + HRESULT hr; + + TRACE("iface %p, attachment %p.\n", iface, attachment); + + if (FAILED(hr = ddraw_surface4_AddAttachedSurface(&surface->IDirectDrawSurface4_iface, + attachment_impl ? &attachment_impl->IDirectDrawSurface4_iface : NULL))) + return hr; + + attachment_impl->attached_iface = (IUnknown *)attachment; + IUnknown_AddRef(attachment_impl->attached_iface); + ddraw_surface4_Release(&attachment_impl->IDirectDrawSurface4_iface); + return hr; +} + static HRESULT WINAPI ddraw_surface2_AddAttachedSurface(IDirectDrawSurface2 *iface, IDirectDrawSurface2 *attachment) { - struct ddraw_surface *This = impl_from_IDirectDrawSurface2(iface); + struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface); struct ddraw_surface *attachment_impl = unsafe_impl_from_IDirectDrawSurface2(attachment); HRESULT hr; TRACE("iface %p, attachment %p.\n", iface, attachment); - hr = ddraw_surface3_AddAttachedSurface(&This->IDirectDrawSurface3_iface, - attachment_impl ? &attachment_impl->IDirectDrawSurface3_iface : NULL); - if (FAILED(hr)) - { + if (FAILED(hr = ddraw_surface4_AddAttachedSurface(&surface->IDirectDrawSurface4_iface, + attachment_impl ? &attachment_impl->IDirectDrawSurface4_iface : NULL))) return hr; - } + attachment_impl->attached_iface = (IUnknown *)attachment; IUnknown_AddRef(attachment_impl->attached_iface); - ddraw_surface3_Release(&attachment_impl->IDirectDrawSurface3_iface); + ddraw_surface4_Release(&attachment_impl->IDirectDrawSurface4_iface); return hr; } static HRESULT WINAPI ddraw_surface1_AddAttachedSurface(IDirectDrawSurface *iface, IDirectDrawSurface *attachment) { - struct ddraw_surface *This = impl_from_IDirectDrawSurface(iface); + struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface); struct ddraw_surface *attachment_impl = unsafe_impl_from_IDirectDrawSurface(attachment); HRESULT hr; TRACE("iface %p, attachment %p.\n", iface, attachment); - hr = ddraw_surface3_AddAttachedSurface(&This->IDirectDrawSurface3_iface, - attachment_impl ? &attachment_impl->IDirectDrawSurface3_iface : NULL); - if (FAILED(hr)) - { + if (FAILED(hr = ddraw_surface4_AddAttachedSurface(&surface->IDirectDrawSurface4_iface, + attachment_impl ? &attachment_impl->IDirectDrawSurface4_iface : NULL))) return hr; - } + attachment_impl->attached_iface = (IUnknown *)attachment; IUnknown_AddRef(attachment_impl->attached_iface); - ddraw_surface3_Release(&attachment_impl->IDirectDrawSurface3_iface); + ddraw_surface4_Release(&attachment_impl->IDirectDrawSurface4_iface); return hr; } @@ -2253,25 +2241,24 @@ static HRESULT WINAPI ddraw_surface7_GetPriority(IDirectDrawSurface7 *iface, DWO * *****************************************************************************/ static HRESULT WINAPI ddraw_surface7_SetPrivateData(IDirectDrawSurface7 *iface, - REFGUID tag, void *Data, DWORD Size, DWORD Flags) + REFGUID tag, void *data, DWORD size, DWORD flags) { struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface); - struct wined3d_resource *resource; HRESULT hr; TRACE("iface %p, tag %s, data %p, data_size %u, flags %#x.\n", - iface, debugstr_guid(tag), Data, Size, Flags); + iface, debugstr_guid(tag), data, size, flags); + + if (!data) + { + WARN("data is NULL, returning DDERR_INVALIDPARAMS.\n"); + return DDERR_INVALIDPARAMS; + } wined3d_mutex_lock(); - resource = wined3d_surface_get_resource(surface->wined3d_surface); - hr = wined3d_resource_set_private_data(resource, tag, Data, Size, Flags); + hr = wined3d_private_store_set_private_data(&surface->private_store, tag, data, size, flags); wined3d_mutex_unlock(); - - switch(hr) - { - case WINED3DERR_INVALIDCALL: return DDERR_INVALIDPARAMS; - default: return hr; - } + return hr_ddraw_from_wined3d(hr); } static HRESULT WINAPI ddraw_surface4_SetPrivateData(IDirectDrawSurface4 *iface, @@ -2301,23 +2288,45 @@ static HRESULT WINAPI ddraw_surface4_SetPrivateData(IDirectDrawSurface4 *iface, * For more details, see IWineD3DSurface::GetPrivateData * *****************************************************************************/ -static HRESULT WINAPI ddraw_surface7_GetPrivateData(IDirectDrawSurface7 *iface, REFGUID tag, void *Data, DWORD *Size) +static HRESULT WINAPI ddraw_surface7_GetPrivateData(IDirectDrawSurface7 *iface, REFGUID tag, void *data, DWORD *size) { struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface); - struct wined3d_resource *resource; + const struct wined3d_private_data *stored_data; HRESULT hr; TRACE("iface %p, tag %s, data %p, data_size %p.\n", - iface, debugstr_guid(tag), Data, Size); - - if(!Data) - return DDERR_INVALIDPARAMS; + iface, debugstr_guid(tag), data, size); wined3d_mutex_lock(); - resource = wined3d_surface_get_resource(surface->wined3d_surface); - hr = wined3d_resource_get_private_data(resource, tag, Data, Size); - wined3d_mutex_unlock(); + stored_data = wined3d_private_store_get_private_data(&surface->private_store, tag); + if (!stored_data) + { + hr = DDERR_NOTFOUND; + goto done; + } + if (!size) + { + hr = DDERR_INVALIDPARAMS; + goto done; + } + if (*size < stored_data->size) + { + *size = stored_data->size; + hr = DDERR_MOREDATA; + goto done; + } + if (!data) + { + hr = DDERR_INVALIDPARAMS; + goto done; + } + *size = stored_data->size; + memcpy(data, stored_data->content.data, stored_data->size); + hr = DD_OK; + +done: + wined3d_mutex_unlock(); return hr; } @@ -2347,17 +2356,22 @@ static HRESULT WINAPI ddraw_surface4_GetPrivateData(IDirectDrawSurface4 *iface, static HRESULT WINAPI ddraw_surface7_FreePrivateData(IDirectDrawSurface7 *iface, REFGUID tag) { struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface); - struct wined3d_resource *resource; - HRESULT hr; + struct wined3d_private_data *entry; TRACE("iface %p, tag %s.\n", iface, debugstr_guid(tag)); wined3d_mutex_lock(); - resource = wined3d_surface_get_resource(surface->wined3d_surface); - hr = wined3d_resource_free_private_data(resource, tag); + entry = wined3d_private_store_get_private_data(&surface->private_store, tag); + if (!entry) + { + wined3d_mutex_unlock(); + return DDERR_NOTFOUND; + } + + wined3d_private_store_free_private_data(&surface->private_store, entry); wined3d_mutex_unlock(); - return hr; + return DD_OK; } static HRESULT WINAPI ddraw_surface4_FreePrivateData(IDirectDrawSurface4 *iface, REFGUID tag) @@ -5476,6 +5490,8 @@ static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *paren if (surface == surface->ddraw->primary) surface->ddraw->primary = NULL; + wined3d_private_store_cleanup(&surface->private_store); + HeapFree(GetProcessHeap(), 0, surface); } @@ -5538,11 +5554,6 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ /* Ensure DDSD_CAPS is always set. */ desc->dwFlags |= DDSD_CAPS; - /* If the surface is of the 'ALLOCONLOAD' type, ignore the LPSURFACE - * field. Frank Herbert's Dune specifies a NULL pointer for lpSurface. */ - if ((desc->ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD) || !desc->lpSurface) - desc->dwFlags &= ~DDSD_LPSURFACE; - if (desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) { DWORD flippable = desc->ddsCaps.dwCaps & (DDSCAPS_FLIP | DDSCAPS_COMPLEX); @@ -5820,6 +5831,34 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ } } + /* If the surface is of the 'ALLOCONLOAD' type, ignore the LPSURFACE + * field. Frank Herbert's Dune specifies a NULL pointer for lpSurface. */ + if ((desc->ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD) || !desc->lpSurface) + desc->dwFlags &= ~DDSD_LPSURFACE; + if (desc->dwFlags & DDSD_LPSURFACE) + { + if (wined3d_desc.pool != WINED3D_POOL_SYSTEM_MEM) + { + WARN("User memory surfaces should be in the system memory pool.\n"); + HeapFree(GetProcessHeap(), 0, texture); + return DDERR_INVALIDCAPS; + } + + if (version < 4) + { + WARN("User memory surfaces not supported before version 4.\n"); + HeapFree(GetProcessHeap(), 0, texture); + return DDERR_INVALIDPARAMS; + } + + if (!(desc->dwFlags & DDSD_PITCH)) + { + WARN("User memory surfaces should explicitly specify the pitch.\n"); + HeapFree(GetProcessHeap(), 0, texture); + return DDERR_INVALIDPARAMS; + } + } + if (desc->ddsCaps.dwCaps & (DDSCAPS_OVERLAY)) wined3d_desc.usage |= WINED3DUSAGE_OVERLAY; @@ -6050,34 +6089,36 @@ HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, s else surface->surface_desc.u1.dwLinearSize = max(4, desc->dwWidth) * max(4, desc->dwHeight); } - else + else if (!(desc->dwFlags & DDSD_LPSURFACE)) { - surface->surface_desc.dwFlags |= DDSD_PITCH; - surface->surface_desc.u1.lPitch = wined3d_surface_get_pitch(wined3d_surface); + desc->dwFlags |= DDSD_PITCH; + desc->u1.lPitch = wined3d_surface_get_pitch(wined3d_surface); } if (desc->dwFlags & DDSD_LPSURFACE) { - UINT pitch = 0; - - if (desc->dwFlags & DDSD_PITCH) + if (desc->u1.lPitch < wined3d_surface_get_pitch(wined3d_surface) || desc->u1.lPitch & 3) { - pitch = desc->u1.lPitch; - surface->surface_desc.u1.lPitch = pitch; + WARN("Invalid pitch %u specified.\n", desc->u1.lPitch); + return DDERR_INVALIDPARAMS; } if (FAILED(hr = wined3d_surface_update_desc(wined3d_surface, wined3d_desc.width, wined3d_desc.height, wined3d_desc.format, WINED3D_MULTISAMPLE_NONE, 0, - desc->lpSurface, pitch))) + desc->lpSurface, desc->u1.lPitch))) { ERR("Failed to set surface memory, hr %#x.\n", hr); return hr; } + + desc->dwFlags &= ~DDSD_LPSURFACE; } wined3d_surface_incref(wined3d_surface); surface->wined3d_surface = wined3d_surface; *parent_ops = &ddraw_surface_wined3d_parent_ops; + wined3d_private_store_init(&surface->private_store); + return DD_OK; } diff --git a/dll/directx/wine/ddraw/utils.c b/dll/directx/wine/ddraw/utils.c index 6f9dd9c5059..daf0f6ca7d5 100644 --- a/dll/directx/wine/ddraw/utils.c +++ b/dll/directx/wine/ddraw/utils.c @@ -751,7 +751,7 @@ DDRAW_dump_pixelformat(const DDPIXELFORMAT *pf) case 16: cmd = "%04lx"; break; case 24: cmd = "%06lx"; break; case 32: cmd = "%08lx"; break; - default: ERR("Unexpected bit depth !\n"); cmd = "%d"; break; + default: ERR("Unexpected bit depth!\n"); cmd = "%d"; break; } TRACE(" R "); TRACE(cmd, pf->u2.dwRBitMask); TRACE(" G "); TRACE(cmd, pf->u3.dwGBitMask); diff --git a/dll/directx/wine/ddraw/vertexbuffer.c b/dll/directx/wine/ddraw/vertexbuffer.c index 4c0569808d0..842a3bd2ad7 100644 --- a/dll/directx/wine/ddraw/vertexbuffer.c +++ b/dll/directx/wine/ddraw/vertexbuffer.c @@ -240,7 +240,7 @@ static HRESULT WINAPI d3d_vertex_buffer7_Lock(IDirect3DVertexBuffer7 *iface, wined3d_flags |= WINED3D_MAP_READONLY; if (flags & DDLOCK_NOOVERWRITE) wined3d_flags |= WINED3D_MAP_NOOVERWRITE; - if (flags & DDLOCK_DISCARDCONTENTS && buffer->read_since_last_map) + if (flags & DDLOCK_DISCARDCONTENTS) { wined3d_flags |= WINED3D_MAP_DISCARD; @@ -274,9 +274,6 @@ static HRESULT WINAPI d3d_vertex_buffer7_Lock(IDirect3DVertexBuffer7 *iface, hr = wined3d_buffer_map(buffer->wineD3DVertexBuffer, 0, 0, (BYTE **)data, wined3d_flags); - if (SUCCEEDED(hr)) - buffer->read_since_last_map = FALSE; - wined3d_mutex_unlock(); return hr; diff --git a/dll/directx/wine/ddraw/viewport.c b/dll/directx/wine/ddraw/viewport.c index 373a1808460..42640055611 100644 --- a/dll/directx/wine/ddraw/viewport.c +++ b/dll/directx/wine/ddraw/viewport.c @@ -672,7 +672,7 @@ static HRESULT WINAPI d3d_viewport_Clear(IDirect3DViewport3 *iface, } if (This->active_device == NULL) { - ERR(" Trying to clear a viewport not attached to a device !\n"); + ERR(" Trying to clear a viewport not attached to a device!\n"); return D3DERR_VIEWPORTHASNODEVICE; } d3d_device3 = &This->active_device->IDirect3DDevice3_iface; @@ -682,7 +682,7 @@ static HRESULT WINAPI d3d_viewport_Clear(IDirect3DViewport3 *iface, if (flags & D3DCLEAR_TARGET) { if (This->background == NULL) { - ERR(" Trying to clear the color buffer without background material !\n"); + ERR(" Trying to clear the color buffer without background material!\n"); } else { diff --git a/dll/directx/wine/devenum/CMakeLists.txt b/dll/directx/wine/devenum/CMakeLists.txt index 52d6f4a01a7..5768de217ba 100644 --- a/dll/directx/wine/devenum/CMakeLists.txt +++ b/dll/directx/wine/devenum/CMakeLists.txt @@ -23,5 +23,6 @@ set_source_files_properties(devenum.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT set_module_type(devenum win32dll UNICODE) target_link_libraries(devenum strmiids uuid wine) add_importlibs(devenum advapi32 ole32 oleaut32 winmm user32 avicap32 msvcrt kernel32 ntdll) +add_delay_importlibs(devenum msvfw32) add_pch(devenum devenum_private.h SOURCE) add_cd_file(TARGET devenum DESTINATION reactos/system32 FOR all) diff --git a/dll/directx/wine/devenum/createdevenum.c b/dll/directx/wine/devenum/createdevenum.c index c69849b69b3..29ba0e8ca33 100644 --- a/dll/directx/wine/devenum/createdevenum.c +++ b/dll/directx/wine/devenum/createdevenum.c @@ -26,12 +26,13 @@ #include "devenum_private.h" #include +#include #include "resource.h" extern HINSTANCE DEVENUM_hInstance; -const WCHAR wszInstanceKeyName[] ={'I','n','s','t','a','n','c','e',0}; +const WCHAR wszInstanceKeyName[] ={'\\','I','n','s','t','a','n','c','e',0}; static const WCHAR wszRegSeparator[] = {'\\', 0 }; static const WCHAR wszActiveMovieKey[] = {'S','o','f','t','w','a','r','e','\\', @@ -101,12 +102,18 @@ static ULONG WINAPI DEVENUM_ICreateDevEnum_Release(ICreateDevEnum * iface) return 1; /* non-heap based object */ } +static BOOL IsSpecialCategory(const CLSID *clsid) +{ + return IsEqualGUID(clsid, &CLSID_AudioRendererCategory) || + IsEqualGUID(clsid, &CLSID_AudioInputDeviceCategory) || + IsEqualGUID(clsid, &CLSID_VideoInputDeviceCategory) || + IsEqualGUID(clsid, &CLSID_VideoCompressorCategory) || + IsEqualGUID(clsid, &CLSID_MidiRendererCategory); +} + HRESULT DEVENUM_GetCategoryKey(REFCLSID clsidDeviceClass, HKEY *pBaseKey, WCHAR *wszRegKeyName, UINT maxLen) { - if (IsEqualGUID(clsidDeviceClass, &CLSID_AudioRendererCategory) || - IsEqualGUID(clsidDeviceClass, &CLSID_AudioInputDeviceCategory) || - IsEqualGUID(clsidDeviceClass, &CLSID_VideoInputDeviceCategory) || - IsEqualGUID(clsidDeviceClass, &CLSID_MidiRendererCategory)) + if (IsSpecialCategory(clsidDeviceClass)) { *pBaseKey = HKEY_CURRENT_USER; strcpyW(wszRegKeyName, wszActiveMovieKey); @@ -123,13 +130,57 @@ HRESULT DEVENUM_GetCategoryKey(REFCLSID clsidDeviceClass, HKEY *pBaseKey, WCHAR if (!StringFromGUID2(clsidDeviceClass, wszRegKeyName + CLSID_STR_LEN, maxLen - CLSID_STR_LEN)) return E_OUTOFMEMORY; - strcatW(wszRegKeyName, wszRegSeparator); strcatW(wszRegKeyName, wszInstanceKeyName); } return S_OK; } +static HKEY open_category_key(const CLSID *clsid) +{ + WCHAR key_name[sizeof(wszInstanceKeyName)/sizeof(WCHAR) + CHARS_IN_GUID-1 + 6 /* strlen("CLSID\") */], *ptr; + HKEY ret; + + strcpyW(key_name, clsid_keyname); + ptr = key_name + strlenW(key_name); + *ptr++ = '\\'; + + if (!StringFromGUID2(clsid, ptr, CHARS_IN_GUID)) + return NULL; + + ptr += strlenW(ptr); + strcpyW(ptr, wszInstanceKeyName); + + if (RegOpenKeyExW(HKEY_CLASSES_ROOT, key_name, 0, KEY_READ, &ret) != ERROR_SUCCESS) { + WARN("Could not open %s\n", debugstr_w(key_name)); + return NULL; + } + + return ret; +} + +static HKEY open_special_category_key(const CLSID *clsid, BOOL create) +{ + WCHAR key_name[sizeof(wszActiveMovieKey)/sizeof(WCHAR) + CHARS_IN_GUID-1]; + HKEY ret; + LONG res; + + strcpyW(key_name, wszActiveMovieKey); + if (!StringFromGUID2(clsid, key_name + sizeof(wszActiveMovieKey)/sizeof(WCHAR)-1, CHARS_IN_GUID)) + return NULL; + + if(create) + res = RegCreateKeyW(HKEY_CURRENT_USER, key_name, &ret); + else + res = RegOpenKeyExW(HKEY_CURRENT_USER, key_name, 0, KEY_READ, &ret); + if (res != ERROR_SUCCESS) { + WARN("Could not open %s\n", debugstr_w(key_name)); + return NULL; + } + + return ret; +} + static void DEVENUM_ReadPinTypes(HKEY hkeyPinKey, REGFILTERPINS *rgPin) { HKEY hkeyTypes = NULL; @@ -455,9 +506,7 @@ static HRESULT WINAPI DEVENUM_ICreateDevEnum_CreateClassEnumerator( IEnumMoniker **ppEnumMoniker, DWORD dwFlags) { - WCHAR wszRegKey[MAX_PATH]; - HKEY hkey; - HKEY hbasekey; + HKEY hkey, special_hkey = NULL; HRESULT hr; TRACE("(%p)->(%s, %p, %x)\n", iface, debugstr_guid(clsidDeviceClass), ppEnumMoniker, dwFlags); @@ -472,32 +521,29 @@ static HRESULT WINAPI DEVENUM_ICreateDevEnum_CreateClassEnumerator( DEVENUM_RegisterLegacyAmFilters(); } - hr = DEVENUM_GetCategoryKey(clsidDeviceClass, &hbasekey, wszRegKey, MAX_PATH); - if (FAILED(hr)) - return hr; - - if (IsEqualGUID(clsidDeviceClass, &CLSID_AudioRendererCategory) || - IsEqualGUID(clsidDeviceClass, &CLSID_AudioInputDeviceCategory) || - IsEqualGUID(clsidDeviceClass, &CLSID_VideoInputDeviceCategory) || - IsEqualGUID(clsidDeviceClass, &CLSID_MidiRendererCategory)) + if (IsSpecialCategory(clsidDeviceClass)) { hr = DEVENUM_CreateSpecialCategories(); if (FAILED(hr)) return hr; - if (RegOpenKeyW(hbasekey, wszRegKey, &hkey) != ERROR_SUCCESS) + + special_hkey = open_special_category_key(clsidDeviceClass, FALSE); + if (!special_hkey) { ERR("Couldn't open registry key for special device: %s\n", debugstr_guid(clsidDeviceClass)); return S_FALSE; } } - else if (RegOpenKeyW(hbasekey, wszRegKey, &hkey) != ERROR_SUCCESS) + + hkey = open_category_key(clsidDeviceClass); + if (!hkey && !special_hkey) { FIXME("Category %s not found\n", debugstr_guid(clsidDeviceClass)); return S_FALSE; } - return DEVENUM_IEnumMoniker_Construct(hkey, ppEnumMoniker); + return DEVENUM_IEnumMoniker_Construct(hkey, special_hkey, ppEnumMoniker); } /********************************************************************** @@ -548,6 +594,44 @@ static HRESULT DEVENUM_CreateAMCategoryKey(const CLSID * clsidCategory) return res; } +static void register_vfw_codecs(void) +{ + WCHAR avico_clsid_str[CHARS_IN_GUID]; + HKEY basekey, key; + ICINFO icinfo; + DWORD i, res; + + static const WCHAR CLSIDW[] = {'C','L','S','I','D',0}; + static const WCHAR FccHandlerW[] = {'F','c','c','H','a','n','d','l','e','r',0}; + static const WCHAR FriendlyNameW[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0}; + + StringFromGUID2(&CLSID_AVICo, avico_clsid_str, sizeof(avico_clsid_str)/sizeof(WCHAR)); + + basekey = open_special_category_key(&CLSID_VideoCompressorCategory, TRUE); + if(!basekey) { + ERR("Could not create key\n"); + return; + } + + for(i=0; ICInfo(FCC('v','i','d','c'), i, &icinfo); i++) { + WCHAR fcc_str[5] = {LOBYTE(LOWORD(icinfo.fccHandler)), HIBYTE(LOWORD(icinfo.fccHandler)), + LOBYTE(HIWORD(icinfo.fccHandler)), HIBYTE(HIWORD(icinfo.fccHandler))}; + + res = RegCreateKeyW(basekey, fcc_str, &key); + if(res != ERROR_SUCCESS) + continue; + + RegSetValueExW(key, CLSIDW, 0, REG_SZ, (const BYTE*)avico_clsid_str, sizeof(avico_clsid_str)); + RegSetValueExW(key, FccHandlerW, 0, REG_SZ, (const BYTE*)fcc_str, sizeof(fcc_str)); + RegSetValueExW(key, FriendlyNameW, 0, REG_SZ, (const BYTE*)icinfo.szName, (strlenW(icinfo.szName)+1)*sizeof(WCHAR)); + /* FIXME: Set ClassManagerFlags and FilterData values */ + + RegCloseKey(key); + } + + RegCloseKey(basekey); +} + static HANDLE DEVENUM_populate_handle; static const WCHAR DEVENUM_populate_handle_nameW[] = {'_','_','W','I','N','E','_', @@ -598,6 +682,8 @@ static HRESULT DEVENUM_CreateSpecialCategories(void) RegDeleteTreeW(basekey, path); if (SUCCEEDED(DEVENUM_GetCategoryKey(&CLSID_MidiRendererCategory, &basekey, path, MAX_PATH))) RegDeleteTreeW(basekey, path); + if (SUCCEEDED(DEVENUM_GetCategoryKey(&CLSID_VideoCompressorCategory, &basekey, path, MAX_PATH))) + RegDeleteTreeW(basekey, path); rf2.dwVersion = 2; rf2.dwMerit = MERIT_PREFERRED; @@ -877,6 +963,9 @@ static HRESULT DEVENUM_CreateSpecialCategories(void) if (pMapper) IFilterMapper2_Release(pMapper); + + register_vfw_codecs(); + SetEvent(DEVENUM_populate_handle); return res; } diff --git a/dll/directx/wine/devenum/devenum_classes.idl b/dll/directx/wine/devenum/devenum_classes.idl index 872291026e8..81052e15825 100644 --- a/dll/directx/wine/devenum/devenum_classes.idl +++ b/dll/directx/wine/devenum/devenum_classes.idl @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ helpstring("System Device Enum"), threading(both), diff --git a/dll/directx/wine/devenum/devenum_private.h b/dll/directx/wine/devenum/devenum_private.h index 35d4d46ba90..32e71da6839 100644 --- a/dll/directx/wine/devenum/devenum_private.h +++ b/dll/directx/wine/devenum/devenum_private.h @@ -77,7 +77,7 @@ typedef struct } MediaCatMoniker; MediaCatMoniker * DEVENUM_IMediaCatMoniker_Construct(void) DECLSPEC_HIDDEN; -HRESULT DEVENUM_IEnumMoniker_Construct(HKEY hkey, IEnumMoniker ** ppEnumMoniker) DECLSPEC_HIDDEN; +HRESULT DEVENUM_IEnumMoniker_Construct(HKEY hkey, HKEY special_hkey, IEnumMoniker ** ppEnumMoniker) DECLSPEC_HIDDEN; extern ClassFactoryImpl DEVENUM_ClassFactory DECLSPEC_HIDDEN; extern ICreateDevEnum DEVENUM_CreateDevEnum DECLSPEC_HIDDEN; diff --git a/dll/directx/wine/devenum/mediacatenum.c b/dll/directx/wine/devenum/mediacatenum.c index 58022096831..3f28d2675cd 100644 --- a/dll/directx/wine/devenum/mediacatenum.c +++ b/dll/directx/wine/devenum/mediacatenum.c @@ -32,7 +32,9 @@ typedef struct IEnumMoniker IEnumMoniker_iface; LONG ref; DWORD index; + DWORD subkey_cnt; HKEY hkey; + HKEY special_hkey; } EnumMonikerImpl; typedef struct @@ -714,6 +716,8 @@ static ULONG WINAPI DEVENUM_IEnumMoniker_Release(IEnumMoniker *iface) if (!ref) { + if(This->special_hkey) + RegCloseKey(This->special_hkey); RegCloseKey(This->hkey); CoTaskMemFree(This); DEVENUM_UnlockModule(); @@ -735,7 +739,12 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(IEnumMoniker *iface, ULONG celt, while (fetched < celt) { - res = RegEnumKeyW(This->hkey, This->index, buffer, sizeof(buffer) / sizeof(WCHAR)); + if(This->index+fetched < This->subkey_cnt) + res = RegEnumKeyW(This->hkey, This->index+fetched, buffer, sizeof(buffer) / sizeof(WCHAR)); + else if(This->special_hkey) + res = RegEnumKeyW(This->special_hkey, This->index+fetched-This->subkey_cnt, buffer, sizeof(buffer) / sizeof(WCHAR)); + else + break; if (res != ERROR_SUCCESS) { break; @@ -744,7 +753,8 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(IEnumMoniker *iface, ULONG celt, if (!pMoniker) return E_OUTOFMEMORY; - if (RegOpenKeyW(This->hkey, buffer, &pMoniker->hkey) != ERROR_SUCCESS) + if (RegOpenKeyW(This->index+fetched < This->subkey_cnt ? This->hkey : This->special_hkey, + buffer, &pMoniker->hkey) != ERROR_SUCCESS) { IMoniker_Release(&pMoniker->IMoniker_iface); break; @@ -769,17 +779,16 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(IEnumMoniker *iface, ULONG celt, static HRESULT WINAPI DEVENUM_IEnumMoniker_Skip(IEnumMoniker *iface, ULONG celt) { EnumMonikerImpl *This = impl_from_IEnumMoniker(iface); - DWORD subKeys; + DWORD special_subkeys = 0; TRACE("(%p)->(%d)\n", iface, celt); /* Before incrementing, check if there are any more values to run through. Some programs use the Skip() function to get the number of devices */ - if(RegQueryInfoKeyW(This->hkey, NULL, NULL, NULL, &subKeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) - { - return S_FALSE; - } - if((This->index + celt) >= subKeys) + if(This->special_hkey) + RegQueryInfoKeyW(This->special_hkey, NULL, NULL, NULL, &special_subkeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + + if((This->index + celt) >= This->subkey_cnt + special_subkeys) { return S_FALSE; } @@ -821,7 +830,7 @@ static const IEnumMonikerVtbl IEnumMoniker_Vtbl = DEVENUM_IEnumMoniker_Clone }; -HRESULT DEVENUM_IEnumMoniker_Construct(HKEY hkey, IEnumMoniker ** ppEnumMoniker) +HRESULT DEVENUM_IEnumMoniker_Construct(HKEY hkey, HKEY special_hkey, IEnumMoniker ** ppEnumMoniker) { EnumMonikerImpl * pEnumMoniker = CoTaskMemAlloc(sizeof(EnumMonikerImpl)); if (!pEnumMoniker) @@ -831,9 +840,14 @@ HRESULT DEVENUM_IEnumMoniker_Construct(HKEY hkey, IEnumMoniker ** ppEnumMoniker) pEnumMoniker->ref = 1; pEnumMoniker->index = 0; pEnumMoniker->hkey = hkey; + pEnumMoniker->special_hkey = special_hkey; *ppEnumMoniker = &pEnumMoniker->IEnumMoniker_iface; + if(RegQueryInfoKeyW(pEnumMoniker->hkey, NULL, NULL, NULL, &pEnumMoniker->subkey_cnt, NULL, NULL, NULL, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) + pEnumMoniker->subkey_cnt = 0; + + DEVENUM_LockModule(); return S_OK; diff --git a/dll/directx/wine/dinput/device.c b/dll/directx/wine/dinput/device.c index 2abde287402..715e03dcb2d 100644 --- a/dll/directx/wine/dinput/device.c +++ b/dll/directx/wine/dinput/device.c @@ -561,7 +561,7 @@ static DWORD semantic_to_obj_id(IDirectInputDeviceImpl* This, DWORD dwSemantic) DWORD type = (0x0000ff00 & dwSemantic) >> 8; DWORD offset = 0x000000ff & dwSemantic; DWORD obj_instance = 0; - DWORD found = 0; + BOOL found = FALSE; int i; for (i = 0; i < This->data_format.wine_df->dwNumObjs; i++) @@ -571,7 +571,7 @@ static DWORD semantic_to_obj_id(IDirectInputDeviceImpl* This, DWORD dwSemantic) if (odf->dwOfs == offset) { obj_instance = DIDFT_GETINSTANCE(odf->dwType); - found = 1; + found = TRUE; break; } } @@ -705,8 +705,8 @@ HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); WCHAR username[MAX_PATH]; DWORD username_size = MAX_PATH; - int i, has_actions = 0; - BOOL load_success = FALSE; + int i; + BOOL load_success = FALSE, has_actions = FALSE; /* Unless asked the contrary by these flags, try to load a previous mapping */ if (!(dwFlags & DIDBAM_HWDEFAULTS)) @@ -746,7 +746,7 @@ HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, lpdiaf->rgoAction[i].dwObjID = obj_id; lpdiaf->rgoAction[i].guidInstance = This->guid; lpdiaf->rgoAction[i].dwHow = DIAH_DEFAULT; - has_actions = 1; + has_actions = TRUE; } } else if (!(dwFlags & DIDBAM_PRESERVE)) diff --git a/dll/directx/wine/dinput/dinput_classes.idl b/dll/directx/wine/dinput/dinput_classes.idl index 1945b57efde..1471f554dfb 100644 --- a/dll/directx/wine/dinput/dinput_classes.idl +++ b/dll/directx/wine/dinput/dinput_classes.idl @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ helpstring("DirectInput Object"), threading(both), diff --git a/dll/directx/wine/dinput/effect_linuxinput.c b/dll/directx/wine/dinput/effect_linuxinput.c index da1fb85dff5..3f172172494 100644 --- a/dll/directx/wine/dinput/effect_linuxinput.c +++ b/dll/directx/wine/dinput/effect_linuxinput.c @@ -57,7 +57,7 @@ struct LinuxInputEffectImpl struct ff_effect effect; /* Effect data */ int gain; /* Effect gain */ - int first_axis_is_x; + BOOL first_axis_is_x; int* fd; /* Parent device */ struct list *entry; /* Entry into the parent's list of effects */ }; diff --git a/dll/directx/wine/dinput/joystick.c b/dll/directx/wine/dinput/joystick.c index 5019efdd239..a67596ff0b8 100644 --- a/dll/directx/wine/dinput/joystick.c +++ b/dll/directx/wine/dinput/joystick.c @@ -706,7 +706,7 @@ HRESULT WINAPI JoystickWGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface, { JoystickGenericImpl *This = impl_from_IDirectInputDevice8W(iface); unsigned int i, j; - int has_actions = 0; + BOOL has_actions = FALSE; DWORD object_types[] = { DIDFT_AXIS, DIDFT_BUTTON }; DWORD type_map[] = { DIDFT_RELAXIS, DIDFT_PSHBUTTON }; @@ -737,7 +737,7 @@ HRESULT WINAPI JoystickWGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface, lpdiaf->rgoAction[i].guidInstance = This->base.guid; lpdiaf->rgoAction[i].dwHow = DIAH_DEFAULT; - has_actions = 1; + has_actions = TRUE; /* No need to try other types if the action was already mapped */ break; diff --git a/dll/directx/wine/dinput/joystick_linux.c b/dll/directx/wine/dinput/joystick_linux.c index 04d0d039d12..10aa350c068 100644 --- a/dll/directx/wine/dinput/joystick_linux.c +++ b/dll/directx/wine/dinput/joystick_linux.c @@ -160,7 +160,7 @@ static INT find_joystick_devices(void) if (ioctl(fd, JSIOCGAXMAP, axes_map) < 0) { - WARN("ioctl(%s,JSIOCGNAME) failed: %s\n", joydev.device, strerror(errno)); + WARN("ioctl(%s,JSIOCGAXMAP) failed: %s\n", joydev.device, strerror(errno)); joydev.dev_axes_map = NULL; } else @@ -669,8 +669,7 @@ static void joy_polldev(LPDIRECTINPUTDEVICE8A iface) } } if (inst_id >= 0) - queue_event(iface, inst_id, - value, jse.time, This->generic.base.dinput->evsequence++); + queue_event(iface, inst_id, value, GetCurrentTime(), This->generic.base.dinput->evsequence++); } } diff --git a/dll/directx/wine/dinput/joystick_linuxinput.c b/dll/directx/wine/dinput/joystick_linuxinput.c index 896155304b1..2b754f2bd43 100644 --- a/dll/directx/wine/dinput/joystick_linuxinput.c +++ b/dll/directx/wine/dinput/joystick_linuxinput.c @@ -78,7 +78,7 @@ struct JoyDev { char *name; GUID guid; - int has_ff; + BOOL has_ff; int num_effects; /* data returned by EVIOCGBIT for caps, EV_ABS, EV_KEY, and EV_FF */ @@ -165,7 +165,7 @@ static void find_joydevs(void) char buf[MAX_PATH]; struct JoyDev joydev = {0}; int fd; - int no_ff_check = 0; + BOOL no_ff_check = FALSE; int j; struct JoyDev *new_joydevs; struct input_id device_id = {0}; @@ -175,7 +175,7 @@ static void find_joydevs(void) if ((fd = open(buf, O_RDWR)) == -1) { fd = open(buf, O_RDONLY); - no_ff_check = 1; + no_ff_check = TRUE; } if (fd == -1) @@ -186,19 +186,19 @@ static void find_joydevs(void) if (ioctl(fd, EVIOCGBIT(0, sizeof(joydev.evbits)), joydev.evbits) == -1) { - WARN("ioct(EVIOCGBIT, 0) failed: %d %s\n", errno, strerror(errno)); + WARN("ioctl(EVIOCGBIT, 0) failed: %d %s\n", errno, strerror(errno)); close(fd); continue; } if (ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(joydev.absbits)), joydev.absbits) == -1) { - WARN("ioct(EVIOCGBIT, EV_ABS) failed: %d %s\n", errno, strerror(errno)); + WARN("ioctl(EVIOCGBIT, EV_ABS) failed: %d %s\n", errno, strerror(errno)); close(fd); continue; } if (ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(joydev.keybits)), joydev.keybits) == -1) { - WARN("ioct(EVIOCGBIT, EV_KEY) failed: %d %s\n", errno, strerror(errno)); + WARN("ioctl(EVIOCGBIT, EV_KEY) failed: %d %s\n", errno, strerror(errno)); close(fd); continue; } @@ -256,7 +256,7 @@ static void find_joydevs(void) joydev.num_effects > 0) { TRACE(" ... with force feedback\n"); - joydev.has_ff = 1; + joydev.has_ff = TRUE; } #endif @@ -277,7 +277,7 @@ static void find_joydevs(void) } if (ioctl(fd, EVIOCGID, &device_id) == -1) - WARN("ioct(EVIOCGBIT, EV_ABS) failed: %d %s\n", errno, strerror(errno)); + WARN("ioctl(EVIOCGID) failed: %d %s\n", errno, strerror(errno)); else { joydev.vendor_id = device_id.vendor; @@ -854,7 +854,7 @@ static void joy_polldev(LPDIRECTINPUTDEVICE8A iface) } if (inst_id >= 0) queue_event(iface, inst_id, - value, ie.time.tv_usec, This->generic.base.dinput->evsequence++); + value, GetCurrentTime(), This->generic.base.dinput->evsequence++); } } diff --git a/dll/directx/wine/dinput/joystick_osx.c b/dll/directx/wine/dinput/joystick_osx.c index 6058cc06482..d5f54c23b3d 100644 --- a/dll/directx/wine/dinput/joystick_osx.c +++ b/dll/directx/wine/dinput/joystick_osx.c @@ -95,8 +95,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); -static IOHIDManagerRef gIOHIDManagerRef = NULL; -static CFArrayRef gCollections = NULL; +static CFMutableArrayRef device_main_elements = NULL; typedef struct JoystickImpl JoystickImpl; static const IDirectInputDevice8AVtbl JoystickAvt; @@ -108,7 +107,7 @@ struct JoystickImpl /* osx private */ int id; - CFMutableArrayRef elementCFArrayRef; + CFArrayRef elements; ObjProps **propmap; FFDeviceObjectReference ff; struct list effects; @@ -181,36 +180,85 @@ static void CFSetApplierFunctionCopyToCFArray(const void *value, void *context) CFArrayAppendValue( ( CFMutableArrayRef ) context, value ); } +static const char* debugstr_cf(CFTypeRef t) +{ + CFStringRef s; + const char* ret; + + if (!t) return "(null)"; + + if (CFGetTypeID(t) == CFStringGetTypeID()) + s = t; + else + s = CFCopyDescription(t); + ret = CFStringGetCStringPtr(s, kCFStringEncodingUTF8); + if (ret) ret = debugstr_a(ret); + if (!ret) + { + const UniChar* u = CFStringGetCharactersPtr(s); + if (u) + ret = debugstr_wn((const WCHAR*)u, CFStringGetLength(s)); + } + if (!ret) + { + UniChar buf[200]; + int len = min(CFStringGetLength(s), sizeof(buf)/sizeof(buf[0])); + CFStringGetCharacters(s, CFRangeMake(0, len), buf); + ret = debugstr_wn(buf, len); + } + if (s != t) CFRelease(s); + return ret; +} + +static const char* debugstr_device(IOHIDDeviceRef device) +{ + return wine_dbg_sprintf("", device, + debugstr_cf(IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductKey)))); +} + +static const char* debugstr_element(IOHIDElementRef element) +{ + return wine_dbg_sprintf("", element, + IOHIDElementGetType(element), IOHIDElementGetUsagePage(element), + IOHIDElementGetUsage(element), IOHIDElementGetDevice(element)); +} + static IOHIDDeviceRef get_device_ref(int id) { - IOHIDElementRef tIOHIDElementRef; - IOHIDDeviceRef tIOHIDDeviceRef; + IOHIDElementRef device_main_element; + IOHIDDeviceRef hid_device; - if (!gCollections) + TRACE("id %d\n", id); + + if (!device_main_elements || id >= CFArrayGetCount(device_main_elements)) return 0; - tIOHIDElementRef = (IOHIDElementRef)CFArrayGetValueAtIndex(gCollections, id); - if (!tIOHIDElementRef) + device_main_element = (IOHIDElementRef)CFArrayGetValueAtIndex(device_main_elements, id); + if (!device_main_element) { ERR("Invalid Element requested %i\n",id); return 0; } - tIOHIDDeviceRef = IOHIDElementGetDevice(tIOHIDElementRef); - if (!tIOHIDDeviceRef) + hid_device = IOHIDElementGetDevice(device_main_element); + if (!hid_device) { ERR("Invalid Device requested %i\n",id); return 0; } - return tIOHIDDeviceRef; + TRACE("-> %s\n", debugstr_device(hid_device)); + return hid_device; } static HRESULT get_ff(IOHIDDeviceRef device, FFDeviceObjectReference *ret) { io_service_t service; CFMutableDictionaryRef matching; - CFTypeRef type; + CFTypeRef location_id; + HRESULT hr; + + TRACE("device %s\n", debugstr_device(device)); matching = IOServiceMatching(kIOHIDDeviceKey); if(!matching){ @@ -218,61 +266,67 @@ static HRESULT get_ff(IOHIDDeviceRef device, FFDeviceObjectReference *ret) return DIERR_DEVICENOTREG; } - type = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDLocationIDKey)); - if(!matching){ + location_id = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDLocationIDKey)); + if(!location_id){ CFRelease(matching); WARN("IOHIDDeviceGetProperty failed, force feedback disabled\n"); return DIERR_DEVICENOTREG; } - CFDictionaryAddValue(matching, CFSTR(kIOHIDLocationIDKey), type); + CFDictionaryAddValue(matching, CFSTR(kIOHIDLocationIDKey), location_id); service = IOServiceGetMatchingService(kIOMasterPortDefault, matching); - if(!ret) - return FFIsForceFeedback(service) == FF_OK ? S_OK : S_FALSE; + if (ret) + hr = osx_to_win32_hresult(FFCreateDevice(service, ret)); + else + hr = FFIsForceFeedback(service) == FF_OK ? S_OK : S_FALSE; - return osx_to_win32_hresult(FFCreateDevice(service, ret)); + IOObjectRelease(service); + TRACE("-> hr 0x%08x *ret %p\n", hr, ret ? *ret : NULL); + return hr; } -static CFMutableDictionaryRef creates_osx_device_match(int usage) +static CFMutableDictionaryRef create_osx_device_match(int usage) { CFMutableDictionaryRef result; + TRACE("usage %d\n", usage); + result = CFDictionaryCreateMutable( kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks ); if ( result ) { int number = kHIDPage_GenericDesktop; - CFNumberRef pageCFNumberRef = CFNumberCreate( kCFAllocatorDefault, + CFNumberRef page = CFNumberCreate( kCFAllocatorDefault, kCFNumberIntType, &number); - if ( pageCFNumberRef ) + if (page) { - CFNumberRef usageCFNumberRef; + CFNumberRef cf_usage; - CFDictionarySetValue( result, CFSTR( kIOHIDDeviceUsagePageKey ), - pageCFNumberRef ); - CFRelease( pageCFNumberRef ); + CFDictionarySetValue( result, CFSTR( kIOHIDDeviceUsagePageKey ), page ); + CFRelease( page ); - usageCFNumberRef = CFNumberCreate( kCFAllocatorDefault, + cf_usage = CFNumberCreate( kCFAllocatorDefault, kCFNumberIntType, &usage); - if ( usageCFNumberRef ) + if (cf_usage) { - CFDictionarySetValue( result, CFSTR( kIOHIDDeviceUsageKey ), - usageCFNumberRef ); - CFRelease( usageCFNumberRef ); + CFDictionarySetValue( result, CFSTR( kIOHIDDeviceUsageKey ), cf_usage ); + CFRelease( cf_usage ); } else { ERR("CFNumberCreate() failed.\n"); + CFRelease(result); return NULL; } } else { ERR("CFNumberCreate failed.\n"); + CFRelease(result); return NULL; } } @@ -285,76 +339,86 @@ static CFMutableDictionaryRef creates_osx_device_match(int usage) return result; } -static CFIndex find_top_level(IOHIDDeviceRef tIOHIDDeviceRef, CFArrayRef topLevels) +static CFIndex find_top_level(IOHIDDeviceRef hid_device, CFMutableArrayRef main_elements) { - CFArrayRef gElementCFArrayRef; - CFIndex numTops = 0; + CFArrayRef elements; + CFIndex total = 0; - if (!tIOHIDDeviceRef) + TRACE("hid_device %s\n", debugstr_device(hid_device)); + + if (!hid_device) return 0; - gElementCFArrayRef = IOHIDDeviceCopyMatchingElements(tIOHIDDeviceRef, NULL, 0); + elements = IOHIDDeviceCopyMatchingElements(hid_device, NULL, 0); - if (gElementCFArrayRef) + if (elements) { - CFIndex idx, cnt = CFArrayGetCount(gElementCFArrayRef); + CFIndex idx, cnt = CFArrayGetCount(elements); for (idx=0; idx total %d\n", (int)total); + return total; } -static void get_element_children(IOHIDElementRef tElement, CFArrayRef childElements) +static void get_element_children(IOHIDElementRef element, CFMutableArrayRef all_children) { CFIndex idx, cnt; - CFArrayRef tElementChildrenArray = IOHIDElementGetChildren(tElement); + CFArrayRef element_children = IOHIDElementGetChildren(element); - cnt = CFArrayGetCount(tElementChildrenArray); - if (cnt < 1) - return; + TRACE("element %s\n", debugstr_element(element)); + + cnt = CFArrayGetCount(element_children); /* Either add the element to the array or grab its children */ for (idx=0; idx usage2) + return kCFCompareGreaterThan; + return kCFCompareEqualTo; } static void get_osx_device_elements(JoystickImpl *device, int axis_map[8]) { - IOHIDElementRef tIOHIDElementRef; - CFArrayRef gElementCFArrayRef; - DWORD axes = 0; + IOHIDElementRef device_main_element; + CFMutableArrayRef elements; DWORD sliders = 0; - DWORD buttons = 0; - DWORD povs = 0; - device->elementCFArrayRef = NULL; + TRACE("device %p device->id %d\n", device, device->id); - if (!gCollections) + device->elements = NULL; + + if (!device_main_elements || device->id >= CFArrayGetCount(device_main_elements)) return; - tIOHIDElementRef = (IOHIDElementRef)CFArrayGetValueAtIndex(gCollections, device->id); - - if (!tIOHIDElementRef) + device_main_element = (IOHIDElementRef)CFArrayGetValueAtIndex(device_main_elements, device->id); + TRACE("device_main_element %s\n", debugstr_element(device_main_element)); + if (!device_main_element) return; - gElementCFArrayRef = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); - get_element_children(tIOHIDElementRef, gElementCFArrayRef); + elements = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); + get_element_children(device_main_element, elements); - if (gElementCFArrayRef) + if (elements) { - CFIndex idx, cnt = CFArrayGetCount( gElementCFArrayRef ); - /* build our element array in the order that dinput expects */ - device->elementCFArrayRef = CFArrayCreateMutable(NULL,0,NULL); + CFIndex idx, cnt = CFArrayGetCount( elements ); + CFMutableArrayRef axes = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); + CFMutableArrayRef buttons = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); + CFMutableArrayRef povs = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); for ( idx = 0; idx < cnt; idx++ ) { - IOHIDElementRef tIOHIDElementRef = ( IOHIDElementRef ) CFArrayGetValueAtIndex( gElementCFArrayRef, idx ); - int eleType = IOHIDElementGetType( tIOHIDElementRef ); - switch(eleType) + IOHIDElementRef element = ( IOHIDElementRef ) CFArrayGetValueAtIndex( elements, idx ); + int type = IOHIDElementGetType( element ); + + TRACE("element %s\n", debugstr_element(element)); + + switch(type) { case kIOHIDElementTypeInput_Button: { - int usagePage = IOHIDElementGetUsagePage( tIOHIDElementRef ); - if (usagePage != kHIDPage_Button) + int usage_page = IOHIDElementGetUsagePage( element ); + TRACE("kIOHIDElementTypeInput_Button usage_page %d\n", usage_page); + if (usage_page != kHIDPage_Button) { /* avoid strange elements found on the 360 controller */ continue; } - if (buttons < 128) - { - CFArrayInsertValueAtIndex(device->elementCFArrayRef, (axes+povs+buttons), tIOHIDElementRef); - buttons++; - } + if (CFArrayGetCount(buttons) < 128) + CFArrayAppendValue(buttons, element); break; } case kIOHIDElementTypeInput_Axis: { - CFArrayInsertValueAtIndex(device->elementCFArrayRef, axes, tIOHIDElementRef); - axes++; + TRACE("kIOHIDElementTypeInput_Axis\n"); + CFArrayAppendValue(axes, element); break; } case kIOHIDElementTypeInput_Misc: { - uint32_t usage = IOHIDElementGetUsage( tIOHIDElementRef ); + uint32_t usage = IOHIDElementGetUsage( element ); switch(usage) { case kHIDUsage_GD_Hatswitch: { - CFArrayInsertValueAtIndex(device->elementCFArrayRef, (axes+povs), tIOHIDElementRef); - povs++; + TRACE("kIOHIDElementTypeInput_Misc / kHIDUsage_GD_Hatswitch\n"); + CFArrayAppendValue(povs, element); break; } case kHIDUsage_GD_Slider: @@ -538,53 +607,65 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8]) case kHIDUsage_GD_Ry: case kHIDUsage_GD_Rz: { - CFArrayInsertValueAtIndex(device->elementCFArrayRef, axes, tIOHIDElementRef); - axis_map[axes]=usage; - axes++; + TRACE("kIOHIDElementTypeInput_Misc / kHIDUsage_GD_* (%d)\n", usage); + axis_map[CFArrayGetCount(axes)]=usage; + CFArrayAppendValue(axes, element); break; } default: - FIXME("Unhandled usage %i\n",usage); + FIXME("kIOHIDElementTypeInput_Misc / Unhandled usage %i\n", usage); } break; } default: - FIXME("Unhandled type %i\n",eleType); + FIXME("Unhandled type %i\n",type); } } + + /* Sort buttons into correct order */ + CFArraySortValues(buttons, CFRangeMake(0, CFArrayGetCount(buttons)), button_usage_comparator, NULL); + + device->generic.devcaps.dwAxes = CFArrayGetCount(axes); + device->generic.devcaps.dwButtons = CFArrayGetCount(buttons); + device->generic.devcaps.dwPOVs = CFArrayGetCount(povs); + + TRACE("axes %u povs %u buttons %u\n", device->generic.devcaps.dwAxes, device->generic.devcaps.dwPOVs, + device->generic.devcaps.dwButtons); + + /* build our element array in the order that dinput expects */ + CFArrayAppendArray(axes, povs, CFRangeMake(0, device->generic.devcaps.dwPOVs)); + CFArrayAppendArray(axes, buttons, CFRangeMake(0, device->generic.devcaps.dwButtons)); + device->elements = axes; + axes = NULL; + + CFRelease(povs); + CFRelease(buttons); + CFRelease(elements); } - - device->generic.devcaps.dwAxes = axes; - device->generic.devcaps.dwButtons = buttons; - device->generic.devcaps.dwPOVs = povs; - - /* Sort buttons into correct order */ - for (buttons = 0; buttons < device->generic.devcaps.dwButtons; buttons++) + else { - IOHIDElementRef tIOHIDElementRef = ( IOHIDElementRef ) CFArrayGetValueAtIndex( device->elementCFArrayRef, axes+povs+buttons); - uint32_t usage = IOHIDElementGetUsage( tIOHIDElementRef ); - usage --; /* usage is 1 indexed we need 0 indexed */ - if (usage == buttons) - continue; - - insert_sort_button(axes+povs, tIOHIDElementRef, device->elementCFArrayRef,buttons,usage); + device->generic.devcaps.dwAxes = 0; + device->generic.devcaps.dwButtons = 0; + device->generic.devcaps.dwPOVs = 0; } } static void get_osx_device_elements_props(JoystickImpl *device) { - CFArrayRef gElementCFArrayRef = device->elementCFArrayRef; + TRACE("device %p\n", device); - if (gElementCFArrayRef) + if (device->elements) { - CFIndex idx, cnt = CFArrayGetCount( gElementCFArrayRef ); + CFIndex idx, cnt = CFArrayGetCount( device->elements ); for ( idx = 0; idx < cnt; idx++ ) { - IOHIDElementRef tIOHIDElementRef = ( IOHIDElementRef ) CFArrayGetValueAtIndex( gElementCFArrayRef, idx ); + IOHIDElementRef element = ( IOHIDElementRef ) CFArrayGetValueAtIndex( device->elements, idx ); - device->generic.props[idx].lDevMin = IOHIDElementGetLogicalMin(tIOHIDElementRef); - device->generic.props[idx].lDevMax = IOHIDElementGetLogicalMax(tIOHIDElementRef); + TRACE("element %s\n", debugstr_element(element)); + + device->generic.props[idx].lDevMin = IOHIDElementGetLogicalMin(element); + device->generic.props[idx].lDevMax = IOHIDElementGetLogicalMax(element); device->generic.props[idx].lMin = 0; device->generic.props[idx].lMax = 0xffff; device->generic.props[idx].lDeadZone = 0; @@ -596,46 +677,49 @@ static void get_osx_device_elements_props(JoystickImpl *device) static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface) { JoystickImpl *device = impl_from_IDirectInputDevice8A(iface); - IOHIDElementRef tIOHIDTopElementRef; - IOHIDDeviceRef tIOHIDDeviceRef; - CFArrayRef gElementCFArrayRef = device->elementCFArrayRef; + IOHIDElementRef device_main_element; + IOHIDDeviceRef hid_device; - TRACE("polling device %i\n",device->id); + TRACE("device %p device->id %i\n", device, device->id); - if (!gCollections) + if (!device_main_elements || device->id >= CFArrayGetCount(device_main_elements)) return; - tIOHIDTopElementRef = (IOHIDElementRef) CFArrayGetValueAtIndex(gCollections, device->id); - tIOHIDDeviceRef = IOHIDElementGetDevice(tIOHIDTopElementRef); - - if (!tIOHIDDeviceRef) + device_main_element = (IOHIDElementRef) CFArrayGetValueAtIndex(device_main_elements, device->id); + hid_device = IOHIDElementGetDevice(device_main_element); + TRACE("main element %s hid_device %s\n", debugstr_element(device_main_element), debugstr_device(hid_device)); + if (!hid_device) return; - if (gElementCFArrayRef) + if (device->elements) { int button_idx = 0; int pov_idx = 0; int slider_idx = 0; int inst_id; - CFIndex idx, cnt = CFArrayGetCount( gElementCFArrayRef ); + CFIndex idx, cnt = CFArrayGetCount( device->elements ); for ( idx = 0; idx < cnt; idx++ ) { IOHIDValueRef valueRef; int val, oldVal, newVal; - IOHIDElementRef tIOHIDElementRef = ( IOHIDElementRef ) CFArrayGetValueAtIndex( gElementCFArrayRef, idx ); - int eleType = IOHIDElementGetType( tIOHIDElementRef ); + IOHIDElementRef element = ( IOHIDElementRef ) CFArrayGetValueAtIndex( device->elements, idx ); + int type = IOHIDElementGetType( element ); - switch(eleType) + TRACE("element %s\n", debugstr_element(element)); + + switch(type) { case kIOHIDElementTypeInput_Button: + TRACE("kIOHIDElementTypeInput_Button\n"); if(button_idx < 128) { - IOHIDDeviceGetValue(tIOHIDDeviceRef, tIOHIDElementRef, &valueRef); + IOHIDDeviceGetValue(hid_device, element, &valueRef); val = IOHIDValueGetIntegerValue(valueRef); newVal = val ? 0x80 : 0x0; oldVal = device->generic.js.rgbButtons[button_idx]; device->generic.js.rgbButtons[button_idx] = newVal; + TRACE("valueRef %s val %d oldVal %d newVal %d\n", debugstr_cf(valueRef), val, oldVal, newVal); if (oldVal != newVal) { inst_id = DIDFT_MAKEINSTANCE(button_idx) | DIDFT_PSHBUTTON; @@ -646,12 +730,13 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface) break; case kIOHIDElementTypeInput_Misc: { - uint32_t usage = IOHIDElementGetUsage( tIOHIDElementRef ); + uint32_t usage = IOHIDElementGetUsage( element ); switch(usage) { case kHIDUsage_GD_Hatswitch: { - IOHIDDeviceGetValue(tIOHIDDeviceRef, tIOHIDElementRef, &valueRef); + TRACE("kIOHIDElementTypeInput_Misc / kHIDUsage_GD_Hatswitch\n"); + IOHIDDeviceGetValue(hid_device, element, &valueRef); val = IOHIDValueGetIntegerValue(valueRef); oldVal = device->generic.js.rgdwPOV[pov_idx]; if (val >= 8) @@ -659,6 +744,7 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface) else newVal = val * 4500; device->generic.js.rgdwPOV[pov_idx] = newVal; + TRACE("valueRef %s val %d oldVal %d newVal %d\n", debugstr_cf(valueRef), val, oldVal, newVal); if (oldVal != newVal) { inst_id = DIDFT_MAKEINSTANCE(pov_idx) | DIDFT_POV; @@ -677,48 +763,56 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface) { int wine_obj = -1; - IOHIDDeviceGetValue(tIOHIDDeviceRef, tIOHIDElementRef, &valueRef); + IOHIDDeviceGetValue(hid_device, element, &valueRef); val = IOHIDValueGetIntegerValue(valueRef); newVal = joystick_map_axis(&device->generic.props[idx], val); switch (usage) { case kHIDUsage_GD_X: + TRACE("kIOHIDElementTypeInput_Misc / kHIDUsage_GD_X\n"); wine_obj = 0; oldVal = device->generic.js.lX; device->generic.js.lX = newVal; break; case kHIDUsage_GD_Y: + TRACE("kIOHIDElementTypeInput_Misc / kHIDUsage_GD_Y\n"); wine_obj = 1; oldVal = device->generic.js.lY; device->generic.js.lY = newVal; break; case kHIDUsage_GD_Z: + TRACE("kIOHIDElementTypeInput_Misc / kHIDUsage_GD_Z\n"); wine_obj = 2; oldVal = device->generic.js.lZ; device->generic.js.lZ = newVal; break; case kHIDUsage_GD_Rx: + TRACE("kIOHIDElementTypeInput_Misc / kHIDUsage_GD_Rx\n"); wine_obj = 3; oldVal = device->generic.js.lRx; device->generic.js.lRx = newVal; break; case kHIDUsage_GD_Ry: + TRACE("kIOHIDElementTypeInput_Misc / kHIDUsage_GD_Ry\n"); wine_obj = 4; oldVal = device->generic.js.lRy; device->generic.js.lRy = newVal; break; case kHIDUsage_GD_Rz: + TRACE("kIOHIDElementTypeInput_Misc / kHIDUsage_GD_Rz\n"); wine_obj = 5; oldVal = device->generic.js.lRz; device->generic.js.lRz = newVal; break; case kHIDUsage_GD_Slider: + TRACE("kIOHIDElementTypeInput_Misc / kHIDUsage_GD_Slider\n"); wine_obj = 6 + slider_idx; oldVal = device->generic.js.rglSlider[slider_idx]; device->generic.js.rglSlider[slider_idx] = newVal; slider_idx ++; break; } + TRACE("valueRef %s val %d oldVal %d newVal %d\n", debugstr_cf(valueRef), val, oldVal, newVal); if ((wine_obj != -1) && (oldVal != newVal)) { @@ -729,12 +823,12 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface) break; } default: - FIXME("unhandled usage %i\n",usage); + FIXME("kIOHIDElementTypeInput_Misc / unhandled usage %i\n", usage); } break; } default: - FIXME("Unhandled type %i\n",eleType); + FIXME("Unhandled type %i\n",type); } } } @@ -753,6 +847,8 @@ static INT find_joystick_devices(void) static HRESULT joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id) { + TRACE("dwDevType %u dwFlags 0x%08x version 0x%04x id %d\n", dwDevType, dwFlags, version, id); + if (id >= find_joystick_devices()) return E_FAIL; if ((dwDevType == 0) || @@ -792,6 +888,8 @@ static HRESULT joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS char name[MAX_PATH]; char friendly[32]; + TRACE("dwDevType %u dwFlags 0x%08x version 0x%04x id %d\n", dwDevType, dwFlags, version, id); + if (id >= find_joystick_devices()) return E_FAIL; if ((dwDevType == 0) || @@ -841,13 +939,13 @@ static const char *osx_ff_axis_name(UInt8 axis) return ret; } -static int osx_axis_has_ff(FFCAPABILITIES *ffcaps, UInt8 axis) +static BOOL osx_axis_has_ff(FFCAPABILITIES *ffcaps, UInt8 axis) { int i; for(i = 0; i < ffcaps->numFfAxes; ++i) if(ffcaps->ffAxes[i] == axis) - return 1; - return 0; + return TRUE; + return FALSE; } static HRESULT alloc_device(REFGUID rguid, IDirectInputImpl *dinput, @@ -948,7 +1046,8 @@ static HRESULT alloc_device(REFGUID rguid, IDirectInputImpl *dinput, for (i = 0; i < newDevice->generic.devcaps.dwAxes; i++) { - int wine_obj = -1, has_ff = 0; + int wine_obj = -1; + BOOL has_ff = FALSE; switch (axis_map[i]) { case kHIDUsage_GD_X: @@ -1026,6 +1125,7 @@ static HRESULT alloc_device(REFGUID rguid, IDirectInputImpl *dinput, newDevice->generic.devcaps.dwFFDriverVersion = 0; if (TRACE_ON(dinput)) { + TRACE("allocated device %p\n", newDevice); _dump_DIDATAFORMAT(newDevice->generic.base.data_format.wine_df); _dump_DIDEVCAPS(&newDevice->generic.devcaps); } @@ -1036,6 +1136,8 @@ static HRESULT alloc_device(REFGUID rguid, IDirectInputImpl *dinput, FAILED: hr = DIERR_OUTOFMEMORY; + if (newDevice->ff) FFReleaseDevice(newDevice->ff); + if (newDevice->elements) CFRelease(newDevice->elements); if (df) HeapFree(GetProcessHeap(), 0, df->rgodf); HeapFree(GetProcessHeap(), 0, df); release_DataFormat(&newDevice->generic.base.data_format); diff --git a/dll/directx/wine/dinput/keyboard.c b/dll/directx/wine/dinput/keyboard.c index 21415f505be..28e7bd23ce8 100644 --- a/dll/directx/wine/dinput/keyboard.c +++ b/dll/directx/wine/dinput/keyboard.c @@ -110,7 +110,7 @@ static int KeyboardCallback( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM EnterCriticalSection(&This->base.crit); queue_event(iface, DIDFT_MAKEINSTANCE(dik_code) | DIDFT_PSHBUTTON, - new_diks, hook->time, This->base.dinput->evsequence++); + new_diks, GetCurrentTime(), This->base.dinput->evsequence++); LeaveCriticalSection(&This->base.crit); return ret; diff --git a/dll/directx/wine/dinput8/dinput8.idl b/dll/directx/wine/dinput8/dinput8.idl index 4e988f4ca9e..2f9d3e80e9b 100644 --- a/dll/directx/wine/dinput8/dinput8.idl +++ b/dll/directx/wine/dinput8/dinput8.idl @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ helpstring("DirectInput8 Object"), threading(both), diff --git a/dll/directx/wine/dinput8/dinput8_main.c b/dll/directx/wine/dinput8/dinput8_main.c index 121dbfbb1e8..eb545ed7a3f 100644 --- a/dll/directx/wine/dinput8/dinput8_main.c +++ b/dll/directx/wine/dinput8/dinput8_main.c @@ -61,7 +61,7 @@ HRESULT WINAPI DECLSPEC_HOTPATCH DirectInput8Create(HINSTANCE hinst, DWORD dwVer IDirectInputA *pDI; HRESULT hr, hrCo; - TRACE("hInst (%p), dwVersion: %d, riid (%s), punkOuter (%p))\n", hinst, dwVersion, debugstr_guid(riid), punkOuter); + TRACE("hInst (%p), dwVersion: %d, riid (%s), punkOuter (%p)\n", hinst, dwVersion, debugstr_guid(riid), punkOuter); if (!ppDI) return E_POINTER; diff --git a/dll/directx/wine/dmusic/collection.c b/dll/directx/wine/dmusic/collection.c index 330f3d55e3b..797709372ef 100644 --- a/dll/directx/wine/dmusic/collection.c +++ b/dll/directx/wine/dmusic/collection.c @@ -49,31 +49,22 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_QueryInt TRACE("(%p/%p)->(%s, %p)\n", iface, This, debugstr_dmguid(riid), ret_iface); - if (IsEqualIID(riid, &IID_IUnknown) || - IsEqualIID(riid, &IID_IDirectMusicCollection)) - { - *ret_iface = iface; - IDirectMusicCollection_AddRef(iface); - return S_OK; - } - else if (IsEqualIID(riid, &IID_IDirectMusicObject)) - { - *ret_iface = &This->IDirectMusicObject_iface; - IDirectMusicCollection_AddRef(iface); - return S_OK; - } - else if (IsEqualIID(riid, &IID_IPersistStream)) - { - *ret_iface = &This->IPersistStream_iface; - IDirectMusicCollection_AddRef(iface); - return S_OK; - } - *ret_iface = NULL; - WARN("(%p/%p)->(%s, %p): not found\n", iface, This, debugstr_dmguid(riid), ret_iface); + if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicCollection)) + *ret_iface = iface; + else if (IsEqualIID(riid, &IID_IDirectMusicObject)) + *ret_iface = &This->IDirectMusicObject_iface; + else if (IsEqualIID(riid, &IID_IPersistStream)) + *ret_iface = &This->IPersistStream_iface; + else + { + WARN("(%p/%p)->(%s, %p): not found\n", iface, This, debugstr_dmguid(riid), ret_iface); + return E_NOINTERFACE; + } - return E_NOINTERFACE; + IUnknown_AddRef((IUnknown*)*ret_iface); + return S_OK; } static ULONG WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_AddRef(LPDIRECTMUSICCOLLECTION iface) @@ -191,7 +182,9 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_GetDescripto TRACE("(%p/%p)->(%p)\n", iface, This, pDesc); - /* I think we shouldn't return pointer here since then values can be changed; it'd be a mess */ + if (!pDesc) + return E_POINTER; + memcpy (pDesc, This->pDesc, This->pDesc->dwSize); return S_OK; @@ -199,7 +192,9 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_GetDescripto static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_SetDescriptor(LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) { - IDirectMusicCollectionImpl *This = impl_from_IDirectMusicObject(iface); + IDirectMusicCollectionImpl *This = impl_from_IDirectMusicObject(iface); + HRESULT ret = S_OK; + TRACE("(%p, %p)\n", iface, pDesc); @@ -216,7 +211,10 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_SetDescripto if (pDesc->dwValidData & DMUS_OBJ_OBJECT) This->pDesc->guidObject = pDesc->guidObject; if (pDesc->dwValidData & DMUS_OBJ_CLASS) - This->pDesc->guidClass = pDesc->guidClass; + { + pDesc->dwValidData &= ~DMUS_OBJ_CLASS; + ret = S_FALSE; + } if (pDesc->dwValidData & DMUS_OBJ_NAME) lstrcpynW(This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) @@ -239,7 +237,7 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_SetDescripto /* add new flags */ This->pDesc->dwValidData |= pDesc->dwValidData; - return S_OK; + return ret; } static HRESULT read_from_stream(IStream *stream, void *data, ULONG size) @@ -272,7 +270,7 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescrip /* FIXME: should this be determined from stream? */ desc->dwValidData |= DMUS_OBJ_CLASS; - desc->guidClass = CLSID_DirectMusicCollection; + desc->guidClass = This->pDesc->guidClass; hr = read_from_stream(stream, &chunk, sizeof(FOURCC) + sizeof(DWORD)); if (FAILED(hr)) @@ -292,7 +290,7 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescrip TRACE_(dmfile)(": RIFF chunk of type %s", debugstr_fourcc(chunk.fccID)); StreamSize = chunk.dwSize - sizeof(FOURCC); - if (chunk.fccID != mmioFOURCC('D','L','S',' ')) { + if (chunk.fccID != FOURCC_DLS) { TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); liMove.QuadPart = StreamSize; IStream_Seek(stream, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ @@ -342,7 +340,7 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescrip ListCount[0] = 0; switch (chunk.fccID) { /* pure INFO list, such can be found in dls collections */ - case mmioFOURCC('I','N','F','O'): + case DMUS_FOURCC_INFO_LIST: TRACE_(dmfile)(": INFO list\n"); do { hr = read_from_stream(stream, &chunk, sizeof(FOURCC) + sizeof(DWORD)); @@ -561,7 +559,7 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_Load(LPPERSISTST ListSize[0] = chunk.dwSize - sizeof(FOURCC); ListCount[0] = 0; switch (chunk.fccID) { - case mmioFOURCC('I','N','F','O'): { + case DMUS_FOURCC_INFO_LIST: { TRACE_(dmfile)(": INFO list\n"); do { IStream_Read(stream, &chunk, sizeof(FOURCC) + sizeof(DWORD), NULL); @@ -815,12 +813,16 @@ static const IPersistStreamVtbl DirectMusicCollection_PersistStream_Vtbl = { HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) { IDirectMusicCollectionImpl* obj; - + HRESULT hr; + + *ppobj = NULL; + if (pUnkOuter) + return CLASS_E_NOAGGREGATION; + obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicCollectionImpl)); - if (NULL == obj) { - *ppobj = NULL; - return E_OUTOFMEMORY; - } + if (!obj) + return E_OUTOFMEMORY; + obj->IDirectMusicCollection_iface.lpVtbl = &DirectMusicCollection_Collection_Vtbl; obj->IDirectMusicObject_iface.lpVtbl = &DirectMusicCollection_Object_Vtbl; obj->IPersistStream_iface.lpVtbl = &DirectMusicCollection_PersistStream_Vtbl; @@ -828,8 +830,11 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID, LPVOID* p DM_STRUCT_INIT(obj->pDesc); obj->pDesc->dwValidData |= DMUS_OBJ_CLASS; obj->pDesc->guidClass = CLSID_DirectMusicCollection; - obj->ref = 0; /* will be inited by QueryInterface */ + obj->ref = 1; list_init (&obj->Instruments); - return IDirectMusicCollection_QueryInterface(&obj->IDirectMusicCollection_iface, lpcGUID, ppobj); + hr = IDirectMusicCollection_QueryInterface(&obj->IDirectMusicCollection_iface, lpcGUID, ppobj); + IDirectMusicCollection_Release(&obj->IDirectMusicCollection_iface); + + return hr; } diff --git a/dll/directx/wine/dmusic/dmusic.c b/dll/directx/wine/dmusic/dmusic.c index 6991c20d49a..fb73112162c 100644 --- a/dll/directx/wine/dmusic/dmusic.c +++ b/dll/directx/wine/dmusic/dmusic.c @@ -406,6 +406,8 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicImpl(LPCGUID riid, LPVOID* ret_iface, LPU TRACE("(%p,%p,%p)\n", riid, ret_iface, unkouter); *ret_iface = NULL; + if (unkouter) + return CLASS_E_NOAGGREGATION; dmusic = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusic8Impl)); if (!dmusic) diff --git a/dll/directx/wine/dmusic/dmusic.idl b/dll/directx/wine/dmusic/dmusic.idl index efa0b9652b1..99b54c5229d 100644 --- a/dll/directx/wine/dmusic/dmusic.idl +++ b/dll/directx/wine/dmusic/dmusic.idl @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ threading(both), progid("Microsoft.DirectMusic.1"), diff --git a/dll/directx/wine/dmusic/dmusic_main.c b/dll/directx/wine/dmusic/dmusic_main.c index 655713cf3a5..3aae6168dd0 100644 --- a/dll/directx/wine/dmusic/dmusic_main.c +++ b/dll/directx/wine/dmusic/dmusic_main.c @@ -221,7 +221,6 @@ const char *debugstr_dmguid (const GUID *id) { /* CLSIDs */ GE(CLSID_AudioVBScript), GE(CLSID_DirectMusic), - GE(CLSID_DirectMusicAudioPath), GE(CLSID_DirectMusicAudioPathConfig), GE(CLSID_DirectMusicAuditionTrack), GE(CLSID_DirectMusicBand), diff --git a/dll/directx/wine/dmusic/port.c b/dll/directx/wine/dmusic/port.c index 18a9d52d7f4..a7824c3710d 100644 --- a/dll/directx/wine/dmusic/port.c +++ b/dll/directx/wine/dmusic/port.c @@ -685,7 +685,7 @@ HRESULT DMUSIC_CreateSynthPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkou HRESULT hr = E_FAIL; int i; - TRACE("(%p,%p,%p,%p,%p%d)\n", guid, object, unkouter, port_params, port_caps, device); + TRACE("(%p,%p,%p,%p,%p,%d)\n", guid, object, unkouter, port_params, port_caps, device); *object = NULL; diff --git a/dll/directx/wine/dmusic/regsvr.c b/dll/directx/wine/dmusic/regsvr.c deleted file mode 100644 index dc82e86e67f..00000000000 --- a/dll/directx/wine/dmusic/regsvr.c +++ /dev/null @@ -1,473 +0,0 @@ -/* - * self-registerable dll functions for dmusic.dll - * - * Copyright (C) 2003 John K. Hohm - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "dmusic_private.h" - -/* - * Near the bottom of this file are the exported DllRegisterServer and - * DllUnregisterServer, which make all this worthwhile. - */ - -/*********************************************************************** - * interface for self-registering - */ -struct regsvr_interface { - IID const *iid; /* NULL for end of list */ - LPCSTR name; /* can be NULL to omit */ - IID const *base_iid; /* can be NULL to omit */ - int num_methods; /* can be <0 to omit */ - CLSID const *ps_clsid; /* can be NULL to omit */ - CLSID const *ps_clsid32; /* can be NULL to omit */ -}; - -static HRESULT register_interfaces(struct regsvr_interface const *list); -static HRESULT unregister_interfaces(struct regsvr_interface const *list); - -struct regsvr_coclass { - CLSID const *clsid; /* NULL for end of list */ - LPCSTR name; /* can be NULL to omit */ - LPCSTR ips; /* can be NULL to omit */ - LPCSTR ips32; /* can be NULL to omit */ - LPCSTR ips32_tmodel; /* can be NULL to omit */ - LPCSTR progid; /* can be NULL to omit */ - LPCSTR viprogid; /* can be NULL to omit */ - LPCSTR progid_extra; /* can be NULL to omit */ -}; - -static HRESULT register_coclasses(struct regsvr_coclass const *list); -static HRESULT unregister_coclasses(struct regsvr_coclass const *list); - -/*********************************************************************** - * static string constants - */ -static WCHAR const interface_keyname[10] = { - 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', 0 }; -static WCHAR const base_ifa_keyname[14] = { - 'B', 'a', 's', 'e', 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', - 'e', 0 }; -static WCHAR const num_methods_keyname[11] = { - 'N', 'u', 'm', 'M', 'e', 't', 'h', 'o', 'd', 's', 0 }; -static WCHAR const ps_clsid_keyname[15] = { - 'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's', - 'i', 'd', 0 }; -static WCHAR const ps_clsid32_keyname[17] = { - 'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's', - 'i', 'd', '3', '2', 0 }; -static WCHAR const clsid_keyname[6] = { - 'C', 'L', 'S', 'I', 'D', 0 }; -static WCHAR const curver_keyname[7] = { - 'C', 'u', 'r', 'V', 'e', 'r', 0 }; -static WCHAR const ips_keyname[13] = { - 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r', - 0 }; -static WCHAR const ips32_keyname[15] = { - 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r', - '3', '2', 0 }; -static WCHAR const progid_keyname[7] = { - 'P', 'r', 'o', 'g', 'I', 'D', 0 }; -static WCHAR const viprogid_keyname[25] = { - 'V', 'e', 'r', 's', 'i', 'o', 'n', 'I', 'n', 'd', 'e', 'p', - 'e', 'n', 'd', 'e', 'n', 't', 'P', 'r', 'o', 'g', 'I', 'D', - 0 }; -static char const tmodel_valuename[] = "ThreadingModel"; - -/*********************************************************************** - * static helper functions - */ -static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid); -static LONG register_key_defvalueW(HKEY base, WCHAR const *name, - WCHAR const *value); -static LONG register_key_defvalueA(HKEY base, WCHAR const *name, - char const *value); -static LONG register_progid(WCHAR const *clsid, - char const *progid, char const *curver_progid, - char const *name, char const *extra); - -/*********************************************************************** - * register_interfaces - */ -static HRESULT register_interfaces(struct regsvr_interface const *list) { - LONG res = ERROR_SUCCESS; - HKEY interface_key; - - res = RegCreateKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &interface_key, NULL); - if (res != ERROR_SUCCESS) goto error_return; - - for (; res == ERROR_SUCCESS && list->iid; ++list) { - WCHAR buf[39]; - HKEY iid_key; - - StringFromGUID2(list->iid, buf, 39); - res = RegCreateKeyExW(interface_key, buf, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &iid_key, NULL); - if (res != ERROR_SUCCESS) goto error_close_interface_key; - - if (list->name) { - res = RegSetValueExA(iid_key, NULL, 0, REG_SZ, - (CONST BYTE*)(list->name), - strlen(list->name) + 1); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - if (list->base_iid) { - res = register_key_guid(iid_key, base_ifa_keyname, list->base_iid); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - if (0 <= list->num_methods) { - static WCHAR const fmt[3] = { '%', 'd', 0 }; - HKEY key; - - res = RegCreateKeyExW(iid_key, num_methods_keyname, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &key, NULL); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - - sprintfW(buf, fmt, list->num_methods); - res = RegSetValueExW(key, NULL, 0, REG_SZ, - (CONST BYTE*)buf, - (lstrlenW(buf) + 1) * sizeof(WCHAR)); - RegCloseKey(key); - - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - if (list->ps_clsid) { - res = register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - if (list->ps_clsid32) { - res = register_key_guid(iid_key, ps_clsid32_keyname, list->ps_clsid32); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - error_close_iid_key: - RegCloseKey(iid_key); - } - -error_close_interface_key: - RegCloseKey(interface_key); -error_return: - return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; -} - -/*********************************************************************** - * unregister_interfaces - */ -static HRESULT unregister_interfaces(struct regsvr_interface const *list) { - LONG res = ERROR_SUCCESS; - HKEY interface_key; - - res = RegOpenKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, - KEY_READ | KEY_WRITE, &interface_key); - if (res == ERROR_FILE_NOT_FOUND) return S_OK; - if (res != ERROR_SUCCESS) goto error_return; - - for (; res == ERROR_SUCCESS && list->iid; ++list) { - WCHAR buf[39]; - - StringFromGUID2(list->iid, buf, 39); - res = RegDeleteTreeW(interface_key, buf); - if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; - } - - RegCloseKey(interface_key); -error_return: - return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; -} - -/*********************************************************************** - * register_coclasses - */ -static HRESULT register_coclasses(struct regsvr_coclass const *list) { - LONG res = ERROR_SUCCESS; - HKEY coclass_key; - - res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL); - if (res != ERROR_SUCCESS) goto error_return; - - for (; res == ERROR_SUCCESS && list->clsid; ++list) { - WCHAR buf[39]; - HKEY clsid_key; - - StringFromGUID2(list->clsid, buf, 39); - res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL); - if (res != ERROR_SUCCESS) goto error_close_coclass_key; - - if (list->name) { - res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ, - (CONST BYTE*)(list->name), - strlen(list->name) + 1); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - if (list->ips) { - res = register_key_defvalueA(clsid_key, ips_keyname, list->ips); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - if (list->ips32) { - HKEY ips32_key; - - res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, - &ips32_key, NULL); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - - res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ, - (CONST BYTE*)list->ips32, - lstrlenA(list->ips32) + 1); - if (res == ERROR_SUCCESS && list->ips32_tmodel) - res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ, - (CONST BYTE*)list->ips32_tmodel, - strlen(list->ips32_tmodel) + 1); - RegCloseKey(ips32_key); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - if (list->progid) { - res = register_key_defvalueA(clsid_key, progid_keyname, - list->progid); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - - res = register_progid(buf, list->progid, NULL, - list->name, list->progid_extra); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - if (list->viprogid) { - res = register_key_defvalueA(clsid_key, viprogid_keyname, - list->viprogid); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - - res = register_progid(buf, list->viprogid, list->progid, - list->name, list->progid_extra); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - error_close_clsid_key: - RegCloseKey(clsid_key); - } - -error_close_coclass_key: - RegCloseKey(coclass_key); -error_return: - return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; -} - -/*********************************************************************** - * unregister_coclasses - */ -static HRESULT unregister_coclasses(struct regsvr_coclass const *list) { - LONG res = ERROR_SUCCESS; - HKEY coclass_key; - - res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, - KEY_READ | KEY_WRITE, &coclass_key); - if (res == ERROR_FILE_NOT_FOUND) return S_OK; - if (res != ERROR_SUCCESS) goto error_return; - - for (; res == ERROR_SUCCESS && list->clsid; ++list) { - WCHAR buf[39]; - - StringFromGUID2(list->clsid, buf, 39); - res = RegDeleteTreeW(coclass_key, buf); - if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; - if (res != ERROR_SUCCESS) goto error_close_coclass_key; - - if (list->progid) { - res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->progid); - if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; - if (res != ERROR_SUCCESS) goto error_close_coclass_key; - } - - if (list->viprogid) { - res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->viprogid); - if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; - if (res != ERROR_SUCCESS) goto error_close_coclass_key; - } - } - -error_close_coclass_key: - RegCloseKey(coclass_key); -error_return: - return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; -} - -/*********************************************************************** - * regsvr_key_guid - */ -static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid) { - WCHAR buf[39]; - - StringFromGUID2(guid, buf, 39); - return register_key_defvalueW(base, name, buf); -} - -/*********************************************************************** - * regsvr_key_defvalueW - */ -static LONG register_key_defvalueW( - HKEY base, - WCHAR const *name, - WCHAR const *value) { - LONG res; - HKEY key; - - res = RegCreateKeyExW(base, name, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &key, NULL); - if (res != ERROR_SUCCESS) return res; - res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value, - (lstrlenW(value) + 1) * sizeof(WCHAR)); - RegCloseKey(key); - return res; -} - -/*********************************************************************** - * regsvr_key_defvalueA - */ -static LONG register_key_defvalueA( - HKEY base, - WCHAR const *name, - char const *value) { - LONG res; - HKEY key; - - res = RegCreateKeyExW(base, name, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &key, NULL); - if (res != ERROR_SUCCESS) return res; - res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value, - lstrlenA(value) + 1); - RegCloseKey(key); - return res; -} - -/*********************************************************************** - * regsvr_progid - */ -static LONG register_progid( - WCHAR const *clsid, - char const *progid, - char const *curver_progid, - char const *name, - char const *extra) { - LONG res; - HKEY progid_key; - - res = RegCreateKeyExA(HKEY_CLASSES_ROOT, progid, 0, - NULL, 0, KEY_READ | KEY_WRITE, NULL, - &progid_key, NULL); - if (res != ERROR_SUCCESS) return res; - - if (name) { - res = RegSetValueExA(progid_key, NULL, 0, REG_SZ, - (CONST BYTE*)name, strlen(name) + 1); - if (res != ERROR_SUCCESS) goto error_close_progid_key; - } - - if (clsid) { - res = register_key_defvalueW(progid_key, clsid_keyname, clsid); - if (res != ERROR_SUCCESS) goto error_close_progid_key; - } - - if (curver_progid) { - res = register_key_defvalueA(progid_key, curver_keyname, - curver_progid); - if (res != ERROR_SUCCESS) goto error_close_progid_key; - } - - if (extra) { - HKEY extra_key; - - res = RegCreateKeyExA(progid_key, extra, 0, - NULL, 0, KEY_READ | KEY_WRITE, NULL, - &extra_key, NULL); - if (res == ERROR_SUCCESS) - RegCloseKey(extra_key); - } - -error_close_progid_key: - RegCloseKey(progid_key); - return res; -} - -/*********************************************************************** - * coclass list - */ -static struct regsvr_coclass const coclass_list[] = { - { &CLSID_DirectMusic, - "DirectMusic", - NULL, - "dmusic.dll", - "Both", - "Microsoft.DirectMusic.1", - "Microsoft.DirectMusic" - }, - { &CLSID_DirectMusicCollection, - "DirectMusicCollection", - NULL, - "dmusic.dll", - "Both", - "Microsoft.DirectMusicCollection.1", - "Microsoft.DirectMusicCollection" - }, - { NULL } /* list terminator */ -}; - -/*********************************************************************** - * interface list - */ - -static struct regsvr_interface const interface_list[] = { - { NULL } /* list terminator */ -}; - -/*********************************************************************** - * DllRegisterServer (DMUSIC.3) - */ -HRESULT WINAPI DllRegisterServer(void) -{ - HRESULT hr; - - TRACE("\n"); - - hr = register_coclasses(coclass_list); - if (SUCCEEDED(hr)) - hr = register_interfaces(interface_list); - return hr; -} - -/*********************************************************************** - * DllUnregisterServer (DMUSIC.4) - */ -HRESULT WINAPI DllUnregisterServer(void) -{ - HRESULT hr; - - TRACE("\n"); - - hr = unregister_coclasses(coclass_list); - if (SUCCEEDED(hr)) - hr = unregister_interfaces(interface_list); - return hr; -} diff --git a/dll/directx/wine/dplayx/dplay.c b/dll/directx/wine/dplayx/dplay.c index 01243fd7ff8..96ef87ff15c 100644 --- a/dll/directx/wine/dplayx/dplay.c +++ b/dll/directx/wine/dplayx/dplay.c @@ -149,9 +149,7 @@ static BOOL DP_CreateDirectPlay2( LPVOID lpDP ) This->dp2->spData.lpCB->dwVersion = DPSP_MAJORVERSION; /* This is the pointer to the service provider */ - if( FAILED( DPSP_CreateInterface( &IID_IDirectPlaySP, - (LPVOID*)&This->dp2->spData.lpISP, This ) ) - ) + if ( FAILED( dplaysp_create( &IID_IDirectPlaySP, (void**)&This->dp2->spData.lpISP, This ) ) ) { /* FIXME: Memory leak */ return FALSE; @@ -163,8 +161,7 @@ static BOOL DP_CreateDirectPlay2( LPVOID lpDP ) sizeof( *This->dp2->dplspData.lpCB ) ); This->dp2->dplspData.lpCB->dwSize = sizeof( *This->dp2->dplspData.lpCB ); - if( FAILED( DPLSP_CreateInterface( &IID_IDPLobbySP, - (LPVOID*)&This->dp2->dplspData.lpISP, This ) ) + if( FAILED( dplobbysp_create( &IID_IDPLobbySP, (void**)&This->dp2->dplspData.lpISP, This ) ) ) { /* FIXME: Memory leak */ @@ -303,28 +300,17 @@ HRESULT DP_HandleMessage( IDirectPlayImpl *This, const void *lpcMessageBody, case DPMSGCMD_GETNAMETABLEREPLY: case DPMSGCMD_NEWPLAYERIDREPLY: -#if 0 - if( wCommandId == DPMSGCMD_NEWPLAYERIDREPLY ) - DebugBreak(); -#endif DP_MSG_ReplyReceived( This, wCommandId, lpcMessageBody, dwMessageBodySize ); break; -#if 1 case DPMSGCMD_JUSTENVELOPE: TRACE( "GOT THE SELF MESSAGE: %p -> 0x%08x\n", lpcMessageHeader, ((const DWORD *)lpcMessageHeader)[1] ); NS_SetLocalAddr( This->dp2->lpNameServerData, lpcMessageHeader, 20 ); DP_MSG_ReplyReceived( This, wCommandId, lpcMessageBody, dwMessageBodySize ); -#endif case DPMSGCMD_FORWARDADDPLAYER: -#if 0 - DebugBreak(); -#endif -#if 1 TRACE( "Sending message to self to get my addr\n" ); DP_MSG_ToSelf( This, 1 ); /* This is a hack right now */ -#endif break; case DPMSGCMD_FORWARDADDPLAYERNACK: @@ -1650,7 +1636,7 @@ static HRESULT DP_IF_CreatePlayer( IDirectPlayImpl *This, void *lpMsgHdr, DPID * } #if 1 - if( This->dp2->bHostInterface == FALSE ) + if( !This->dp2->bHostInterface ) { /* Let the name server know about the creation of this player */ /* FIXME: Is this only to be done for the creation of a server player or @@ -4624,7 +4610,7 @@ static HMODULE DP_LoadSP( LPCGUID lpcGuid, LPSPINITDATA lpSpData, LPBOOL lpbIsDp FILETIME filetime; (i == 0) ? (searchSubKey = spSubKey ) : (searchSubKey = lpSubKey ); - *lpbIsDpSp = (i == 0) ? TRUE : FALSE; + *lpbIsDpSp = (i == 0); /* Need to loop over the service providers in the registry */ diff --git a/dll/directx/wine/dplayx/dplay_global.h b/dll/directx/wine/dplayx/dplay_global.h index 6acb120b87f..f5473d0f435 100644 --- a/dll/directx/wine/dplayx/dplay_global.h +++ b/dll/directx/wine/dplayx/dplay_global.h @@ -200,7 +200,7 @@ extern LPVOID DPSP_CreateSPPlayerData(void) DECLSPEC_HIDDEN; extern HRESULT dplay_create( REFIID riid, void **ppv ) DECLSPEC_HIDDEN; extern HRESULT dplobby_create( REFIID riid, void **ppv ) DECLSPEC_HIDDEN; -extern HRESULT DPSP_CreateInterface( REFIID riid, void **ppvObj, IDirectPlayImpl *dp ) DECLSPEC_HIDDEN; -extern HRESULT DPLSP_CreateInterface( REFIID riid, void **ppvObj, IDirectPlayImpl *dp ) DECLSPEC_HIDDEN; +extern HRESULT dplaysp_create( REFIID riid, void **ppv, IDirectPlayImpl *dp ) DECLSPEC_HIDDEN; +extern HRESULT dplobbysp_create( REFIID riid, void **ppv, IDirectPlayImpl *dp ) DECLSPEC_HIDDEN; #endif /* __WINE_DPLAY_GLOBAL_INCLUDED */ diff --git a/dll/directx/wine/dplayx/dplaysp.c b/dll/directx/wine/dplayx/dplaysp.c index d01e1c102b5..2322a311d07 100644 --- a/dll/directx/wine/dplayx/dplaysp.c +++ b/dll/directx/wine/dplayx/dplaysp.c @@ -22,46 +22,16 @@ /* FIXME: Need to add interface locking inside procedures */ -/* Prototypes */ -static BOOL DPSP_CreateIUnknown( LPVOID lpSP ); -static BOOL DPSP_DestroyIUnknown( LPVOID lpSP ); -static BOOL DPSP_CreateDirectPlaySP( void *lpSP, IDirectPlayImpl *dp ); -static BOOL DPSP_DestroyDirectPlaySP( LPVOID lpSP ); - -/* Predefine the interface */ -typedef struct IDirectPlaySPImpl IDirectPlaySPImpl; - -typedef struct tagDirectPlaySPIUnknownData +typedef struct IDirectPlaySPImpl { - LONG ulObjRef; - CRITICAL_SECTION DPSP_lock; -} DirectPlaySPIUnknownData; - -typedef struct tagDirectPlaySPData -{ - LPVOID lpSpRemoteData; - DWORD dwSpRemoteDataSize; /* Size of data pointed to by lpSpRemoteData */ - - LPVOID lpSpLocalData; - DWORD dwSpLocalDataSize; /* Size of data pointed to by lpSpLocalData */ - + IDirectPlaySP IDirectPlaySP_iface; + LONG ref; + void *remote_data; + DWORD remote_data_size; + void *local_data; + DWORD local_data_size; IDirectPlayImpl *dplay; /* FIXME: This should perhaps be iface not impl */ - -} DirectPlaySPData; - -#define DPSP_IMPL_FIELDS \ - LONG ulInterfaceRef; \ - DirectPlaySPIUnknownData* unk; \ - DirectPlaySPData* sp; - -struct IDirectPlaySPImpl -{ - const IDirectPlaySPVtbl *lpVtbl; - DPSP_IMPL_FIELDS -}; - -/* Forward declaration of virtual tables */ -static const IDirectPlaySPVtbl directPlaySPVT; +} IDirectPlaySPImpl; /* This structure is passed to the DP object for safe keeping */ typedef struct tagDP_SPPLAYERDATA @@ -73,202 +43,60 @@ typedef struct tagDP_SPPLAYERDATA DWORD dwPlayerRemoteDataSize; } DP_SPPLAYERDATA, *LPDP_SPPLAYERDATA; -/* Create the SP interface */ -HRESULT DPSP_CreateInterface( REFIID riid, void **ppvObj, IDirectPlayImpl *dp ) + +static inline IDirectPlaySPImpl *impl_from_IDirectPlaySP( IDirectPlaySP *iface ) { - TRACE( " for %s\n", debugstr_guid( riid ) ); + return CONTAINING_RECORD( iface, IDirectPlaySPImpl, IDirectPlaySP_iface ); +} - *ppvObj = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( IDirectPlaySPImpl ) ); +static HRESULT WINAPI IDirectPlaySPImpl_QueryInterface( IDirectPlaySP *iface, REFIID riid, + void **ppv ) +{ + TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid( riid ), ppv ); - if( *ppvObj == NULL ) + if ( IsEqualGUID( &IID_IUnknown, riid ) || IsEqualGUID( &IID_IDirectPlaySP, riid ) ) { - return DPERR_OUTOFMEMORY; - } - - if( IsEqualGUID( &IID_IDirectPlaySP, riid ) ) - { - IDirectPlaySPImpl *This = *ppvObj; - This->lpVtbl = &directPlaySPVT; - } - else - { - /* Unsupported interface */ - HeapFree( GetProcessHeap(), 0, *ppvObj ); - *ppvObj = NULL; - - return E_NOINTERFACE; - } - - /* Initialize it */ - if( DPSP_CreateIUnknown( *ppvObj ) && - DPSP_CreateDirectPlaySP( *ppvObj, dp ) - ) - { - IDirectPlaySP_AddRef( (LPDIRECTPLAYSP)*ppvObj ); + *ppv = iface; + IDirectPlaySP_AddRef( iface ); return S_OK; } - /* Initialize failed, destroy it */ - DPSP_DestroyDirectPlaySP( *ppvObj ); - DPSP_DestroyIUnknown( *ppvObj ); - - HeapFree( GetProcessHeap(), 0, *ppvObj ); - *ppvObj = NULL; - - return DPERR_NOMEMORY; + FIXME( "Unsupported interface %s\n", debugstr_guid( riid ) ); + *ppv = NULL; + return E_NOINTERFACE; } -static BOOL DPSP_CreateIUnknown( LPVOID lpSP ) +static ULONG WINAPI IDirectPlaySPImpl_AddRef( IDirectPlaySP *iface ) { - IDirectPlaySPImpl *This = lpSP; + IDirectPlaySPImpl *This = impl_from_IDirectPlaySP( iface ); + ULONG ref = InterlockedIncrement( &This->ref ); - This->unk = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->unk) ) ); + TRACE( "(%p) ref=%d\n", This, ref ); - if ( This->unk == NULL ) - { - return FALSE; - } - - InitializeCriticalSection( &This->unk->DPSP_lock ); - This->unk->DPSP_lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IDirectPlaySPImpl*->DirectPlaySPIUnknownData*->DPSP_lock"); - - return TRUE; + return ref; } -static BOOL DPSP_DestroyIUnknown( LPVOID lpSP ) +static ULONG WINAPI IDirectPlaySPImpl_Release( IDirectPlaySP *iface ) { - IDirectPlaySPImpl *This = lpSP; + IDirectPlaySPImpl *This = impl_from_IDirectPlaySP( iface ); + ULONG ref = InterlockedDecrement( &This->ref ); - This->unk->DPSP_lock.DebugInfo->Spare[0] = 0; - DeleteCriticalSection( &This->unk->DPSP_lock ); - HeapFree( GetProcessHeap(), 0, This->unk ); + TRACE( "(%p) ref=%d\n", This, ref ); - return TRUE; -} - - -static BOOL DPSP_CreateDirectPlaySP( void *lpSP, IDirectPlayImpl *dp ) -{ - IDirectPlaySPImpl *This = lpSP; - - This->sp = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->sp) ) ); - - if ( This->sp == NULL ) - { - return FALSE; - } - - This->sp->dplay = dp; - - return TRUE; -} - -static BOOL DPSP_DestroyDirectPlaySP( LPVOID lpSP ) -{ - IDirectPlaySPImpl *This = lpSP; - - HeapFree( GetProcessHeap(), 0, This->sp->lpSpRemoteData ); - HeapFree( GetProcessHeap(), 0, This->sp->lpSpLocalData ); - - /* FIXME: Need to delete player queue */ - - HeapFree( GetProcessHeap(), 0, This->sp ); - return TRUE; -} - -/* Interface implementation */ - -static HRESULT WINAPI DPSP_QueryInterface -( LPDIRECTPLAYSP iface, - REFIID riid, - LPVOID* ppvObj ) -{ - IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface; - TRACE("(%p)->(%s,%p)\n", This, debugstr_guid( riid ), ppvObj ); - - *ppvObj = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( *This ) ); - - if( *ppvObj == NULL ) - { - return DPERR_OUTOFMEMORY; - } - - CopyMemory( *ppvObj, This, sizeof( *This ) ); - (*(IDirectPlaySPImpl**)ppvObj)->ulInterfaceRef = 0; - - if( IsEqualGUID( &IID_IDirectPlaySP, riid ) ) - { - IDirectPlaySPImpl *This = *ppvObj; - This->lpVtbl = &directPlaySPVT; - } - else - { - /* Unsupported interface */ - HeapFree( GetProcessHeap(), 0, *ppvObj ); - *ppvObj = NULL; - - return E_NOINTERFACE; - } - - IDirectPlaySP_AddRef( (LPDIRECTPLAYSP)*ppvObj ); - - return S_OK; -} - -static ULONG WINAPI DPSP_AddRef -( LPDIRECTPLAYSP iface ) -{ - ULONG ulInterfaceRefCount, ulObjRefCount; - IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface; - - ulObjRefCount = InterlockedIncrement( &This->unk->ulObjRef ); - ulInterfaceRefCount = InterlockedIncrement( &This->ulInterfaceRef ); - - TRACE( "ref count incremented to %u:%u for %p\n", - ulInterfaceRefCount, ulObjRefCount, This ); - - return ulObjRefCount; -} - -static ULONG WINAPI DPSP_Release -( LPDIRECTPLAYSP iface ) -{ - ULONG ulInterfaceRefCount, ulObjRefCount; - IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface; - - ulObjRefCount = InterlockedDecrement( &This->unk->ulObjRef ); - ulInterfaceRefCount = InterlockedDecrement( &This->ulInterfaceRef ); - - TRACE( "ref count decremented to %u:%u for %p\n", - ulInterfaceRefCount, ulObjRefCount, This ); - - /* Deallocate if this is the last reference to the object */ - if( ulObjRefCount == 0 ) - { - DPSP_DestroyDirectPlaySP( This ); - DPSP_DestroyIUnknown( This ); - } - - if( ulInterfaceRefCount == 0 ) + if( !ref ) { + HeapFree( GetProcessHeap(), 0, This->remote_data ); + HeapFree( GetProcessHeap(), 0, This->local_data ); HeapFree( GetProcessHeap(), 0, This ); } - return ulInterfaceRefCount; + return ref; } -static HRESULT WINAPI IDirectPlaySPImpl_AddMRUEntry -( LPDIRECTPLAYSP iface, - LPCWSTR lpSection, - LPCWSTR lpKey, - LPCVOID lpData, - DWORD dwDataSize, - DWORD dwMaxEntries -) +static HRESULT WINAPI IDirectPlaySPImpl_AddMRUEntry( IDirectPlaySP *iface, LPCWSTR lpSection, + LPCWSTR lpKey, const void *lpData, DWORD dwDataSize, DWORD dwMaxEntries ) { - IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface; + IDirectPlaySPImpl *This = impl_from_IDirectPlaySP( iface ); /* Should be able to call the comctl32 undocumented MRU routines. I suspect that the interface works appropriately */ @@ -278,17 +106,11 @@ static HRESULT WINAPI IDirectPlaySPImpl_AddMRUEntry return DP_OK; } -static HRESULT WINAPI IDirectPlaySPImpl_CreateAddress -( LPDIRECTPLAYSP iface, - REFGUID guidSP, - REFGUID guidDataType, - LPCVOID lpData, - DWORD dwDataSize, - LPVOID lpAddress, - LPDWORD lpdwAddressSize -) +static HRESULT WINAPI IDirectPlaySPImpl_CreateAddress( IDirectPlaySP *iface, REFGUID guidSP, + REFGUID guidDataType, const void *lpData, DWORD dwDataSize, void *lpAddress, + DWORD *lpdwAddressSize ) { - IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface; + IDirectPlaySPImpl *This = impl_from_IDirectPlaySP( iface ); FIXME( "(%p)->(%s,%s,%p,0x%08x,%p,%p): stub\n", This, debugstr_guid(guidSP), debugstr_guid(guidDataType), @@ -297,15 +119,11 @@ static HRESULT WINAPI IDirectPlaySPImpl_CreateAddress return DP_OK; } -static HRESULT WINAPI IDirectPlaySPImpl_EnumAddress -( LPDIRECTPLAYSP iface, - LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, - LPCVOID lpAddress, - DWORD dwAddressSize, - LPVOID lpContext -) +static HRESULT WINAPI IDirectPlaySPImpl_EnumAddress( IDirectPlaySP *iface, + LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, const void *lpAddress, DWORD dwAddressSize, + void *lpContext ) { - IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface; + IDirectPlaySPImpl *This = impl_from_IDirectPlaySP( iface ); TRACE( "(%p)->(%p,%p,0x%08x,%p)\n", This, lpEnumAddressCallback, lpAddress, dwAddressSize, lpContext ); @@ -315,31 +133,23 @@ static HRESULT WINAPI IDirectPlaySPImpl_EnumAddress return DP_OK; } -static HRESULT WINAPI IDirectPlaySPImpl_EnumMRUEntries -( LPDIRECTPLAYSP iface, - LPCWSTR lpSection, - LPCWSTR lpKey, - LPENUMMRUCALLBACK lpEnumMRUCallback, - LPVOID lpContext -) +static HRESULT WINAPI IDirectPlaySPImpl_EnumMRUEntries( IDirectPlaySP *iface, LPCWSTR lpSection, + LPCWSTR lpKey, LPENUMMRUCALLBACK lpEnumMRUCallback, void *lpContext ) { - IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface; + IDirectPlaySPImpl *This = impl_from_IDirectPlaySP( iface ); /* Should be able to call the comctl32 undocumented MRU routines. I suspect that the interface works appropriately */ - FIXME( "(%p)->(%p,%p,%p,%p,): stub\n", + FIXME( "(%p)->(%p,%p,%p,%p): stub\n", This, lpSection, lpKey, lpEnumMRUCallback, lpContext ); return DP_OK; } -static HRESULT WINAPI IDirectPlaySPImpl_GetPlayerFlags -( LPDIRECTPLAYSP iface, - DPID idPlayer, - LPDWORD lpdwPlayerFlags -) +static HRESULT WINAPI IDirectPlaySPImpl_GetPlayerFlags( IDirectPlaySP *iface, DPID idPlayer, + DWORD *lpdwPlayerFlags ) { - IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface; + IDirectPlaySPImpl *This = impl_from_IDirectPlaySP( iface ); FIXME( "(%p)->(0x%08x,%p): stub\n", This, idPlayer, lpdwPlayerFlags ); @@ -347,22 +157,17 @@ static HRESULT WINAPI IDirectPlaySPImpl_GetPlayerFlags return DP_OK; } -static HRESULT WINAPI IDirectPlaySPImpl_GetSPPlayerData -( LPDIRECTPLAYSP iface, - DPID idPlayer, - LPVOID* lplpData, - LPDWORD lpdwDataSize, - DWORD dwFlags -) +static HRESULT WINAPI IDirectPlaySPImpl_GetSPPlayerData( IDirectPlaySP *iface, DPID idPlayer, + void **lplpData, DWORD *lpdwDataSize, DWORD dwFlags ) { + IDirectPlaySPImpl *This = impl_from_IDirectPlaySP( iface ); HRESULT hr; LPDP_SPPLAYERDATA lpPlayerData; - IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface; TRACE( "(%p)->(0x%08x,%p,%p,0x%08x)\n", This, idPlayer, lplpData, lpdwDataSize, dwFlags ); - hr = DP_GetSPPlayerData( This->sp->dplay, idPlayer, (LPVOID*)&lpPlayerData ); + hr = DP_GetSPPlayerData( This->dplay, idPlayer, (void**)&lpPlayerData ); if( FAILED(hr) ) { @@ -390,21 +195,16 @@ static HRESULT WINAPI IDirectPlaySPImpl_GetSPPlayerData return hr; } -static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage -( LPDIRECTPLAYSP iface, - LPVOID lpMessageBody, - DWORD dwMessageBodySize, - LPVOID lpMessageHeader -) +static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage( IDirectPlaySP *iface, void *lpMessageBody, + DWORD dwMessageBodySize, void *lpMessageHeader ) { + IDirectPlaySPImpl *This = impl_from_IDirectPlaySP( iface ); LPDPMSG_SENDENVELOPE lpMsg = lpMessageBody; HRESULT hr = DPERR_GENERIC; WORD wCommandId; WORD wVersion; DPSP_REPLYDATA data; - IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface; - FIXME( "(%p)->(%p,0x%08x,%p): mostly stub\n", This, lpMessageBody, dwMessageBodySize, lpMessageHeader ); @@ -434,9 +234,8 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage data.dwMessageSize = 0; /* Pass this message to the dplay interface to handle */ - hr = DP_HandleMessage( This->sp->dplay, lpMessageBody, dwMessageBodySize, - lpMessageHeader, wCommandId, wVersion, - &data.lpMessage, &data.dwMessageSize ); + hr = DP_HandleMessage( This->dplay, lpMessageBody, dwMessageBodySize, lpMessageHeader, + wCommandId, wVersion, &data.lpMessage, &data.dwMessageSize ); if( FAILED(hr) ) { @@ -450,7 +249,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage data.idNameServer = 0; data.lpISP = iface; - hr = (This->sp->dplay->dp2->spData.lpCB->Reply)( &data ); + hr = This->dplay->dp2->spData.lpCB->Reply( &data ); if( FAILED(hr) ) { @@ -704,25 +503,17 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage #endif } -static HRESULT WINAPI IDirectPlaySPImpl_SetSPPlayerData -( LPDIRECTPLAYSP iface, - DPID idPlayer, - LPVOID lpData, - DWORD dwDataSize, - DWORD dwFlags -) +static HRESULT WINAPI IDirectPlaySPImpl_SetSPPlayerData( IDirectPlaySP *iface, DPID idPlayer, + void *lpData, DWORD dwDataSize, DWORD dwFlags ) { + IDirectPlaySPImpl *This = impl_from_IDirectPlaySP( iface ); HRESULT hr; LPDP_SPPLAYERDATA lpPlayerEntry; LPVOID lpPlayerData; - IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface; + TRACE( "(%p)->(0x%08x,%p,0x%08x,0x%08x)\n", This, idPlayer, lpData, dwDataSize, dwFlags ); -/* TRACE( "Called on process 0x%08lx\n", GetCurrentProcessId() ); */ - TRACE( "(%p)->(0x%08x,%p,0x%08x,0x%08x)\n", - This, idPlayer, lpData, dwDataSize, dwFlags ); - - hr = DP_GetSPPlayerData( This->sp->dplay, idPlayer, (LPVOID*)&lpPlayerEntry ); + hr = DP_GetSPPlayerData( This->dplay, idPlayer, (void**)&lpPlayerEntry ); if( FAILED(hr) ) { /* Player must not exist */ @@ -743,20 +534,16 @@ static HRESULT WINAPI IDirectPlaySPImpl_SetSPPlayerData lpPlayerEntry->dwPlayerRemoteDataSize = dwDataSize; } - hr = DP_SetSPPlayerData( This->sp->dplay, idPlayer, lpPlayerEntry ); + hr = DP_SetSPPlayerData( This->dplay, idPlayer, lpPlayerEntry ); return hr; } -static HRESULT WINAPI IDirectPlaySPImpl_CreateCompoundAddress -( LPDIRECTPLAYSP iface, - LPCDPCOMPOUNDADDRESSELEMENT lpElements, - DWORD dwElementCount, - LPVOID lpAddress, - LPDWORD lpdwAddressSize -) +static HRESULT WINAPI IDirectPlaySPImpl_CreateCompoundAddress( IDirectPlaySP *iface, + const DPCOMPOUNDADDRESSELEMENT *lpElements, DWORD dwElementCount, void *lpAddress, + DWORD *lpdwAddressSize ) { - IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface; + IDirectPlaySPImpl *This = impl_from_IDirectPlaySP( iface ); FIXME( "(%p)->(%p,0x%08x,%p,%p): stub\n", This, lpElements, dwElementCount, lpAddress, lpdwAddressSize ); @@ -764,19 +551,13 @@ static HRESULT WINAPI IDirectPlaySPImpl_CreateCompoundAddress return DP_OK; } -static HRESULT WINAPI IDirectPlaySPImpl_GetSPData -( LPDIRECTPLAYSP iface, - LPVOID* lplpData, - LPDWORD lpdwDataSize, - DWORD dwFlags -) +static HRESULT WINAPI IDirectPlaySPImpl_GetSPData( IDirectPlaySP *iface, void **lplpData, + DWORD *lpdwDataSize, DWORD dwFlags ) { + IDirectPlaySPImpl *This = impl_from_IDirectPlaySP( iface ); HRESULT hr = DP_OK; - IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface; -/* TRACE( "Called on process 0x%08lx\n", GetCurrentProcessId() ); */ - TRACE( "(%p)->(%p,%p,0x%08x)\n", - This, lplpData, lpdwDataSize, dwFlags ); + TRACE( "(%p)->(%p,%p,0x%08x)\n", This, lplpData, lpdwDataSize, dwFlags ); #if 0 /* This is what the documentation says... */ @@ -800,42 +581,31 @@ static HRESULT WINAPI IDirectPlaySPImpl_GetSPData /* Yes, we're supposed to return a pointer to the memory we have stored! */ if( dwFlags == DPSET_REMOTE ) { - *lpdwDataSize = This->sp->dwSpRemoteDataSize; - *lplpData = This->sp->lpSpRemoteData; + *lpdwDataSize = This->remote_data_size; + *lplpData = This->remote_data; - if( This->sp->lpSpRemoteData == NULL ) - { + if( !This->remote_data ) hr = DPERR_GENERIC; - } } else if( dwFlags == DPSET_LOCAL ) { - *lpdwDataSize = This->sp->dwSpLocalDataSize; - *lplpData = This->sp->lpSpLocalData; + *lpdwDataSize = This->local_data_size; + *lplpData = This->local_data; - if( This->sp->lpSpLocalData == NULL ) - { + if( !This->local_data ) hr = DPERR_GENERIC; - } } return hr; } -static HRESULT WINAPI IDirectPlaySPImpl_SetSPData -( LPDIRECTPLAYSP iface, - LPVOID lpData, - DWORD dwDataSize, - DWORD dwFlags -) +static HRESULT WINAPI IDirectPlaySPImpl_SetSPData( IDirectPlaySP *iface, void *lpData, + DWORD dwDataSize, DWORD dwFlags ) { + IDirectPlaySPImpl *This = impl_from_IDirectPlaySP( iface ); LPVOID lpSpData; - IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface; - -/* TRACE( "Called on process 0x%08lx\n", GetCurrentProcessId() ); */ - TRACE( "(%p)->(%p,0x%08x,0x%08x)\n", - This, lpData, dwDataSize, dwFlags ); + TRACE( "(%p)->(%p,0x%08x,0x%08x)\n", This, lpData, dwDataSize, dwFlags ); #if 0 /* This is what the documentation says... */ @@ -860,27 +630,24 @@ static HRESULT WINAPI IDirectPlaySPImpl_SetSPData /* If we have data already allocated, free it and replace it */ if( dwFlags == DPSET_REMOTE ) { - HeapFree( GetProcessHeap(), 0, This->sp->lpSpRemoteData ); - This->sp->dwSpRemoteDataSize = dwDataSize; - This->sp->lpSpRemoteData = lpSpData; + HeapFree( GetProcessHeap(), 0, This->remote_data ); + This->remote_data_size = dwDataSize; + This->remote_data = lpSpData; } else if ( dwFlags == DPSET_LOCAL ) { - HeapFree( GetProcessHeap(), 0, This->sp->lpSpLocalData ); - This->sp->lpSpLocalData = lpSpData; - This->sp->dwSpLocalDataSize = dwDataSize; + HeapFree( GetProcessHeap(), 0, This->local_data ); + This->local_data = lpSpData; + This->local_data_size = dwDataSize; } return DP_OK; } -static VOID WINAPI IDirectPlaySPImpl_SendComplete -( LPDIRECTPLAYSP iface, - LPVOID unknownA, - DWORD unknownB -) +static void WINAPI IDirectPlaySPImpl_SendComplete( IDirectPlaySP *iface, void *unknownA, + DWORD unknownB ) { - IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface; + IDirectPlaySPImpl *This = impl_from_IDirectPlaySP( iface ); FIXME( "(%p)->(%p,0x%08x): stub\n", This, unknownA, unknownB ); @@ -888,11 +655,9 @@ static VOID WINAPI IDirectPlaySPImpl_SendComplete static const IDirectPlaySPVtbl directPlaySPVT = { - - DPSP_QueryInterface, - DPSP_AddRef, - DPSP_Release, - + IDirectPlaySPImpl_QueryInterface, + IDirectPlaySPImpl_AddRef, + IDirectPlaySPImpl_Release, IDirectPlaySPImpl_AddMRUEntry, IDirectPlaySPImpl_CreateAddress, IDirectPlaySPImpl_EnumAddress, @@ -907,6 +672,27 @@ static const IDirectPlaySPVtbl directPlaySPVT = IDirectPlaySPImpl_SendComplete }; +HRESULT dplaysp_create( REFIID riid, void **ppv, IDirectPlayImpl *dp ) +{ + IDirectPlaySPImpl *obj; + HRESULT hr; + + TRACE( "(%s, %p)\n", debugstr_guid( riid ), ppv ); + + *ppv = NULL; + obj = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *obj ) ); + if ( !obj ) + return DPERR_OUTOFMEMORY; + + obj->IDirectPlaySP_iface.lpVtbl = &directPlaySPVT; + obj->ref = 1; + obj->dplay = dp; + + hr = IDirectPlaySP_QueryInterface( &obj->IDirectPlaySP_iface, riid, ppv ); + IDirectPlaySP_Release( &obj->IDirectPlaySP_iface ); + + return hr; +} /* DP external interfaces to call into DPSP interface */ diff --git a/dll/directx/wine/dplayx/dplayx.idl b/dll/directx/wine/dplayx/dplayx.idl index cf9dd206535..901a2dcff21 100644 --- a/dll/directx/wine/dplayx/dplayx.idl +++ b/dll/directx/wine/dplayx/dplayx.idl @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ helpstring("DirectPlay Object"), threading(both), diff --git a/dll/directx/wine/dplayx/dplayx_global.c b/dll/directx/wine/dplayx/dplayx_global.c index 723744cf06e..f5e2f42316c 100644 --- a/dll/directx/wine/dplayx/dplayx_global.c +++ b/dll/directx/wine/dplayx/dplayx_global.c @@ -66,9 +66,10 @@ static LPVOID lpSharedStaticData = NULL; typedef struct { - DWORD used; - DWORD data[dwBlockSize-sizeof(DWORD)]; + BOOL used; + BYTE data[dwBlockSize - sizeof(BOOL)]; } DPLAYX_MEM_SLICE; +C_ASSERT(sizeof(DPLAYX_MEM_SLICE) == dwBlockSize); static DPLAYX_MEM_SLICE* lpMemArea; @@ -83,10 +84,10 @@ static void DPLAYX_PrivHeapFree( LPVOID addr ) return; } - lpAddrStart = (char*)addr - sizeof(DWORD); /* Find block header */ + lpAddrStart = CONTAINING_RECORD(addr, DPLAYX_MEM_SLICE, data); /* Find block header */ dwBlockUsed = ((BYTE*)lpAddrStart - (BYTE*)lpMemArea)/dwBlockSize; - lpMemArea[ dwBlockUsed ].used = 0; + lpMemArea[ dwBlockUsed ].used = FALSE; } static LPVOID DPLAYX_PrivHeapAlloc( DWORD flags, DWORD size ) @@ -94,20 +95,20 @@ static LPVOID DPLAYX_PrivHeapAlloc( DWORD flags, DWORD size ) LPVOID lpvArea = NULL; UINT uBlockUsed; - if( size > (dwBlockSize - sizeof(DWORD)) ) + if( size > (dwBlockSize - sizeof(BOOL)) ) { FIXME( "Size exceeded. Request of 0x%08x\n", size ); - size = dwBlockSize - sizeof(DWORD); + size = dwBlockSize - sizeof(BOOL); } /* Find blank area */ uBlockUsed = 0; - while( ( lpMemArea[ uBlockUsed ].used != 0 ) && ( uBlockUsed <= dwMaxBlock ) ) { uBlockUsed++; } + while( lpMemArea[ uBlockUsed ].used && uBlockUsed <= dwMaxBlock ) { uBlockUsed++; } if( uBlockUsed <= dwMaxBlock ) { /* Set the area used */ - lpMemArea[ uBlockUsed ].used = 1; + lpMemArea[ uBlockUsed ].used = TRUE; lpvArea = lpMemArea[ uBlockUsed ].data; } else @@ -1183,7 +1184,7 @@ LPCSTR DPLAYX_HresultToString(HRESULT hr) /* For errors not in the list, return HRESULT as a string This part is not thread safe */ WARN( "Unknown error 0x%08x\n", hr ); - wsprintfA( szTempStr, "0x%08lx", hr ); + wsprintfA( szTempStr, "0x%08x", hr ); return szTempStr; } } diff --git a/dll/directx/wine/dplayx/lobbysp.c b/dll/directx/wine/dplayx/lobbysp.c index 3ed5e989eec..7b1da09cf17 100644 --- a/dll/directx/wine/dplayx/lobbysp.c +++ b/dll/directx/wine/dplayx/lobbysp.c @@ -20,395 +20,180 @@ #include "dplayx_global.h" -/* Prototypes */ -static BOOL DPLSP_CreateIUnknown( LPVOID lpSP ); -static BOOL DPLSP_DestroyIUnknown( LPVOID lpSP ); -static BOOL DPLSP_CreateDPLobbySP( void *lpSP, IDirectPlayImpl *dp ); -static BOOL DPLSP_DestroyDPLobbySP( LPVOID lpSP ); - -/* Predefine the interface */ -typedef struct IDPLobbySPImpl IDPLobbySPImpl; - -typedef struct tagDPLobbySPIUnknownData -{ - LONG ulObjRef; - CRITICAL_SECTION DPLSP_lock; -} DPLobbySPIUnknownData; - -typedef struct tagDPLobbySPData +typedef struct IDPLobbySPImpl { + IDPLobbySP IDPLobbySP_iface; + LONG ref; IDirectPlayImpl *dplay; -} DPLobbySPData; +} IDPLobbySPImpl; -#define DPLSP_IMPL_FIELDS \ - LONG ulInterfaceRef; \ - DPLobbySPIUnknownData* unk; \ - DPLobbySPData* sp; - -struct IDPLobbySPImpl +static inline IDPLobbySPImpl *impl_from_IDPLobbySP(IDPLobbySP *iface) { - const IDPLobbySPVtbl *lpVtbl; - DPLSP_IMPL_FIELDS -}; + return CONTAINING_RECORD(iface, IDPLobbySPImpl, IDPLobbySP_iface); +} -/* Forward declaration of virtual tables */ -static const IDPLobbySPVtbl dpLobbySPVT; - -HRESULT DPLSP_CreateInterface( REFIID riid, void **ppvObj, IDirectPlayImpl *dp ) +static HRESULT WINAPI IDPLobbySPImpl_QueryInterface( IDPLobbySP *iface, REFIID riid, + void **ppv ) { - TRACE( " for %s\n", debugstr_guid( riid ) ); + TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid( riid ), ppv ); - *ppvObj = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( IDPLobbySPImpl ) ); - - if( *ppvObj == NULL ) + if ( IsEqualGUID( &IID_IUnknown, riid ) || IsEqualGUID( &IID_IDPLobbySP, riid ) ) { - return DPERR_OUTOFMEMORY; - } - - if( IsEqualGUID( &IID_IDPLobbySP, riid ) ) - { - IDPLobbySPImpl *This = *ppvObj; - This->lpVtbl = &dpLobbySPVT; - } - else - { - /* Unsupported interface */ - HeapFree( GetProcessHeap(), 0, *ppvObj ); - *ppvObj = NULL; - - return E_NOINTERFACE; - } - - /* Initialize it */ - if( DPLSP_CreateIUnknown( *ppvObj ) && - DPLSP_CreateDPLobbySP( *ppvObj, dp ) - ) - { - IDPLobbySP_AddRef( (LPDPLOBBYSP)*ppvObj ); + *ppv = iface; + IDPLobbySP_AddRef(iface); return S_OK; } - /* Initialize failed, destroy it */ - DPLSP_DestroyDPLobbySP( *ppvObj ); - DPLSP_DestroyIUnknown( *ppvObj ); - - HeapFree( GetProcessHeap(), 0, *ppvObj ); - *ppvObj = NULL; - - return DPERR_NOMEMORY; + FIXME("Unsupported interface %s\n", debugstr_guid(riid)); + *ppv = NULL; + return E_NOINTERFACE; } -static BOOL DPLSP_CreateIUnknown( LPVOID lpSP ) +static ULONG WINAPI IDPLobbySPImpl_AddRef( IDPLobbySP *iface ) { - IDPLobbySPImpl *This = lpSP; + IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface ); + ULONG ref = InterlockedIncrement( &This->ref ); - This->unk = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->unk) ) ); + TRACE( "(%p) ref=%d\n", This, ref ); - if ( This->unk == NULL ) - { - return FALSE; - } - - InitializeCriticalSection( &This->unk->DPLSP_lock ); - This->unk->DPLSP_lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IDPLobbySPImpl*->DPLobbySPIUnknownData*->DPLSP_lock"); - - return TRUE; + return ref; } -static BOOL DPLSP_DestroyIUnknown( LPVOID lpSP ) +static ULONG WINAPI IDPLobbySPImpl_Release( IDPLobbySP *iface ) { - IDPLobbySPImpl *This = lpSP; + IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface ); + ULONG ref = InterlockedDecrement( &This->ref ); - This->unk->DPLSP_lock.DebugInfo->Spare[0] = 0; - DeleteCriticalSection( &This->unk->DPLSP_lock ); - HeapFree( GetProcessHeap(), 0, This->unk ); + TRACE( "(%p) ref=%d\n", This, ref ); - return TRUE; -} - -static BOOL DPLSP_CreateDPLobbySP( void *lpSP, IDirectPlayImpl *dp ) -{ - IDPLobbySPImpl *This = lpSP; - - This->sp = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->sp) ) ); - - if ( This->sp == NULL ) - { - return FALSE; - } - - This->sp->dplay = dp; - - return TRUE; -} - -static BOOL DPLSP_DestroyDPLobbySP( LPVOID lpSP ) -{ - IDPLobbySPImpl *This = lpSP; - - HeapFree( GetProcessHeap(), 0, This->sp ); - - return TRUE; -} - -static -HRESULT WINAPI DPLSP_QueryInterface -( LPDPLOBBYSP iface, - REFIID riid, - LPVOID* ppvObj -) -{ - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; - TRACE("(%p)->(%s,%p)\n", This, debugstr_guid( riid ), ppvObj ); - - *ppvObj = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( *This ) ); - - if( *ppvObj == NULL ) - { - return DPERR_OUTOFMEMORY; - } - - CopyMemory( *ppvObj, This, sizeof( *This ) ); - (*(IDPLobbySPImpl**)ppvObj)->ulInterfaceRef = 0; - - if( IsEqualGUID( &IID_IDPLobbySP, riid ) ) - { - IDPLobbySPImpl *This = *ppvObj; - This->lpVtbl = &dpLobbySPVT; - } - else - { - /* Unsupported interface */ - HeapFree( GetProcessHeap(), 0, *ppvObj ); - *ppvObj = NULL; - - return E_NOINTERFACE; - } - - IDPLobbySP_AddRef( (LPDPLOBBYSP)*ppvObj ); - - return S_OK; -} - -static -ULONG WINAPI DPLSP_AddRef -( LPDPLOBBYSP iface ) -{ - ULONG ulInterfaceRefCount, ulObjRefCount; - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; - - ulObjRefCount = InterlockedIncrement( &This->unk->ulObjRef ); - ulInterfaceRefCount = InterlockedIncrement( &This->ulInterfaceRef ); - - TRACE( "ref count incremented to %u:%u for %p\n", - ulInterfaceRefCount, ulObjRefCount, This ); - - return ulObjRefCount; -} - -static -ULONG WINAPI DPLSP_Release -( LPDPLOBBYSP iface ) -{ - ULONG ulInterfaceRefCount, ulObjRefCount; - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; - - ulObjRefCount = InterlockedDecrement( &This->unk->ulObjRef ); - ulInterfaceRefCount = InterlockedDecrement( &This->ulInterfaceRef ); - - TRACE( "ref count decremented to %u:%u for %p\n", - ulInterfaceRefCount, ulObjRefCount, This ); - - /* Deallocate if this is the last reference to the object */ - if( ulObjRefCount == 0 ) - { - DPLSP_DestroyDPLobbySP( This ); - DPLSP_DestroyIUnknown( This ); - } - - if( ulInterfaceRefCount == 0 ) - { + if( !ref ) HeapFree( GetProcessHeap(), 0, This ); - } - return ulInterfaceRefCount; + return ref; } -static -HRESULT WINAPI IDPLobbySPImpl_AddGroupToGroup -( LPDPLOBBYSP iface, - LPSPDATA_ADDREMOTEGROUPTOGROUP argtg -) +static HRESULT WINAPI IDPLobbySPImpl_AddGroupToGroup( IDPLobbySP *iface, + SPDATA_ADDREMOTEGROUPTOGROUP *argtg ) { - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; + IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface ); FIXME( "(%p)->(%p):stub\n", This, argtg ); return DP_OK; } -static -HRESULT WINAPI IDPLobbySPImpl_AddPlayerToGroup -( LPDPLOBBYSP iface, - LPSPDATA_ADDREMOTEPLAYERTOGROUP arptg -) +static HRESULT WINAPI IDPLobbySPImpl_AddPlayerToGroup( IDPLobbySP *iface, + SPDATA_ADDREMOTEPLAYERTOGROUP *arptg ) { - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; + IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface ); FIXME( "(%p)->(%p):stub\n", This, arptg ); return DP_OK; } -static -HRESULT WINAPI IDPLobbySPImpl_CreateGroup -( LPDPLOBBYSP iface, - LPSPDATA_CREATEREMOTEGROUP crg -) +static HRESULT WINAPI IDPLobbySPImpl_CreateGroup( IDPLobbySP *iface, + SPDATA_CREATEREMOTEGROUP *crg ) { - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; + IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface ); FIXME( "(%p)->(%p):stub\n", This, crg ); return DP_OK; } -static -HRESULT WINAPI IDPLobbySPImpl_CreateGroupInGroup -( LPDPLOBBYSP iface, - LPSPDATA_CREATEREMOTEGROUPINGROUP crgig -) +static HRESULT WINAPI IDPLobbySPImpl_CreateGroupInGroup( IDPLobbySP *iface, + SPDATA_CREATEREMOTEGROUPINGROUP *crgig ) { - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; + IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface ); FIXME( "(%p)->(%p):stub\n", This, crgig ); return DP_OK; } -static -HRESULT WINAPI IDPLobbySPImpl_DeleteGroupFromGroup -( LPDPLOBBYSP iface, - LPSPDATA_DELETEREMOTEGROUPFROMGROUP drgfg -) +static HRESULT WINAPI IDPLobbySPImpl_DeleteGroupFromGroup( IDPLobbySP *iface, + SPDATA_DELETEREMOTEGROUPFROMGROUP *drgfg ) { - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; + IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface ); FIXME( "(%p)->(%p):stub\n", This, drgfg ); return DP_OK; } -static -HRESULT WINAPI IDPLobbySPImpl_DeletePlayerFromGroup -( LPDPLOBBYSP iface, - LPSPDATA_DELETEREMOTEPLAYERFROMGROUP drpfg -) +static HRESULT WINAPI IDPLobbySPImpl_DeletePlayerFromGroup( IDPLobbySP *iface, + SPDATA_DELETEREMOTEPLAYERFROMGROUP *drpfg ) { - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; + IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface ); FIXME( "(%p)->(%p):stub\n", This, drpfg ); return DP_OK; } -static -HRESULT WINAPI IDPLobbySPImpl_DestroyGroup -( LPDPLOBBYSP iface, - LPSPDATA_DESTROYREMOTEGROUP drg -) +static HRESULT WINAPI IDPLobbySPImpl_DestroyGroup( IDPLobbySP *iface, + SPDATA_DESTROYREMOTEGROUP *drg ) { - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; + IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface ); FIXME( "(%p)->(%p):stub\n", This, drg ); return DP_OK; } -static -HRESULT WINAPI IDPLobbySPImpl_EnumSessionsResponse -( LPDPLOBBYSP iface, - LPSPDATA_ENUMSESSIONSRESPONSE er -) +static HRESULT WINAPI IDPLobbySPImpl_EnumSessionsResponse( IDPLobbySP *iface, + SPDATA_ENUMSESSIONSRESPONSE *er ) { - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; + IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface ); FIXME( "(%p)->(%p):stub\n", This, er ); return DP_OK; } -static -HRESULT WINAPI IDPLobbySPImpl_GetSPDataPointer -( LPDPLOBBYSP iface, - LPVOID* lplpData -) +static HRESULT WINAPI IDPLobbySPImpl_GetSPDataPointer( IDPLobbySP *iface, LPVOID* lplpData ) { - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; + IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface ); FIXME( "(%p)->(%p):stub\n", This, lplpData ); return DP_OK; } -static -HRESULT WINAPI IDPLobbySPImpl_HandleMessage -( LPDPLOBBYSP iface, - LPSPDATA_HANDLEMESSAGE hm -) +static HRESULT WINAPI IDPLobbySPImpl_HandleMessage( IDPLobbySP *iface, SPDATA_HANDLEMESSAGE *hm ) { - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; + IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface ); FIXME( "(%p)->(%p):stub\n", This, hm ); return DP_OK; } -static -HRESULT WINAPI IDPLobbySPImpl_SendChatMessage -( LPDPLOBBYSP iface, - LPSPDATA_CHATMESSAGE cm -) +static HRESULT WINAPI IDPLobbySPImpl_SendChatMessage( IDPLobbySP *iface, + SPDATA_CHATMESSAGE *cm ) { - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; + IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface ); FIXME( "(%p)->(%p):stub\n", This, cm ); return DP_OK; } -static -HRESULT WINAPI IDPLobbySPImpl_SetGroupName -( LPDPLOBBYSP iface, - LPSPDATA_SETREMOTEGROUPNAME srgn -) +static HRESULT WINAPI IDPLobbySPImpl_SetGroupName( IDPLobbySP *iface, + SPDATA_SETREMOTEGROUPNAME *srgn ) { - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; + IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface ); FIXME( "(%p)->(%p):stub\n", This, srgn ); return DP_OK; } -static -HRESULT WINAPI IDPLobbySPImpl_SetPlayerName -( LPDPLOBBYSP iface, - LPSPDATA_SETREMOTEPLAYERNAME srpn -) +static HRESULT WINAPI IDPLobbySPImpl_SetPlayerName( IDPLobbySP *iface, + SPDATA_SETREMOTEPLAYERNAME *srpn ) { - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; + IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface ); FIXME( "(%p)->(%p):stub\n", This, srpn ); return DP_OK; } -static -HRESULT WINAPI IDPLobbySPImpl_SetSessionDesc -( LPDPLOBBYSP iface, - LPSPDATA_SETSESSIONDESC ssd -) +static HRESULT WINAPI IDPLobbySPImpl_SetSessionDesc( IDPLobbySP *iface, + SPDATA_SETSESSIONDESC *ssd ) { - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; + IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface ); FIXME( "(%p)->(%p):stub\n", This, ssd ); return DP_OK; } -static -HRESULT WINAPI IDPLobbySPImpl_SetSPDataPointer -( LPDPLOBBYSP iface, - LPVOID lpData -) +static HRESULT WINAPI IDPLobbySPImpl_SetSPDataPointer( IDPLobbySP *iface, void *lpData ) { - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; + IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface ); FIXME( "(%p)->(%p):stub\n", This, lpData ); return DP_OK; } -static -HRESULT WINAPI IDPLobbySPImpl_StartSession -( LPDPLOBBYSP iface, - LPSPDATA_STARTSESSIONCOMMAND ssc -) +static HRESULT WINAPI IDPLobbySPImpl_StartSession( IDPLobbySP *iface, + SPDATA_STARTSESSIONCOMMAND *ssc ) { - IDPLobbySPImpl *This = (IDPLobbySPImpl *)iface; + IDPLobbySPImpl *This = impl_from_IDPLobbySP( iface ); FIXME( "(%p)->(%p):stub\n", This, ssc ); return DP_OK; } @@ -416,11 +201,9 @@ HRESULT WINAPI IDPLobbySPImpl_StartSession static const IDPLobbySPVtbl dpLobbySPVT = { - - DPLSP_QueryInterface, - DPLSP_AddRef, - DPLSP_Release, - + IDPLobbySPImpl_QueryInterface, + IDPLobbySPImpl_AddRef, + IDPLobbySPImpl_Release, IDPLobbySPImpl_AddGroupToGroup, IDPLobbySPImpl_AddPlayerToGroup, IDPLobbySPImpl_CreateGroup, @@ -437,5 +220,26 @@ static const IDPLobbySPVtbl dpLobbySPVT = IDPLobbySPImpl_SetSessionDesc, IDPLobbySPImpl_SetSPDataPointer, IDPLobbySPImpl_StartSession - }; + +HRESULT dplobbysp_create( REFIID riid, void **ppv, IDirectPlayImpl *dp ) +{ + IDPLobbySPImpl *obj; + HRESULT hr; + + TRACE( "(%s, %p)\n", debugstr_guid( riid ), ppv ); + + *ppv = NULL; + obj = HeapAlloc( GetProcessHeap(), 0, sizeof( *obj ) ); + if ( !obj ) + return DPERR_OUTOFMEMORY; + + obj->IDPLobbySP_iface.lpVtbl = &dpLobbySPVT; + obj->ref = 1; + obj->dplay = dp; + + hr = IDPLobbySP_QueryInterface( &obj->IDPLobbySP_iface, riid, ppv ); + IDPLobbySP_Release( &obj->IDPLobbySP_iface ); + + return hr; +} diff --git a/dll/directx/wine/dxdiagn/dxdiagn.idl b/dll/directx/wine/dxdiagn/dxdiagn.idl index 3a6b88fe04b..45828fcbc62 100644 --- a/dll/directx/wine/dxdiagn/dxdiagn.idl +++ b/dll/directx/wine/dxdiagn/dxdiagn.idl @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ helpstring("DxDiagProvider Class"), threading(apartment), diff --git a/dll/directx/wine/dxdiagn/provider.c b/dll/directx/wine/dxdiagn/provider.c index 093a34d3365..deac71b06bf 100644 --- a/dll/directx/wine/dxdiagn/provider.c +++ b/dll/directx/wine/dxdiagn/provider.c @@ -52,6 +52,9 @@ static const WCHAR szSubSysId[] = {'s','z','S','u','b','S','y','s','I','d',0}; static const WCHAR szRevisionId[] = {'s','z','R','e','v','i','s','i','o','n','I','d',0}; static const WCHAR dwRefreshRate[] = {'d','w','R','e','f','r','e','s','h','R','a','t','e',0}; static const WCHAR szManufacturer[] = {'s','z','M','a','n','u','f','a','c','t','u','r','e','r',0}; +static const WCHAR szChipType[] = {'s','z','C','h','i','p','T','y','p','e',0}; +static const WCHAR szDACType[] = {'s','z','D','A','C','T','y','p','e',0}; +static const WCHAR szRevision[] = {'s','z','R','e','v','i','s','i','o','n',0}; struct IDxDiagProviderImpl { @@ -898,10 +901,15 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node static const WCHAR id_fmtW[] = {'0','x','%','0','4','x',0}; static const WCHAR subsysid_fmtW[] = {'0','x','%','0','8','x',0}; static const WCHAR mem_fmt[] = {'%','.','1','f',' ','M','B',0}; + static const WCHAR b3DAccelerationExists[] = {'b','3','D','A','c','c','e','l','e','r','a','t','i','o','n','E','x','i','s','t','s',0}; + static const WCHAR b3DAccelerationEnabled[] = {'b','3','D','A','c','c','e','l','e','r','a','t','i','o','n','E','n','a','b','l','e','d',0}; + static const WCHAR bDDAccelerationEnabled[] = {'b','D','D','A','c','c','e','l','e','r','a','t','i','o','n','E','n','a','b','l','e','d',0}; D3DADAPTER_IDENTIFIER9 adapter_info; D3DDISPLAYMODE adapter_mode; + D3DCAPS9 device_caps; DWORD available_mem = 0; + BOOL hardware_accel; snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), adapterid_fmtW, index); display_adapter = allocate_information_node(buffer); @@ -1002,6 +1010,18 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node if (FAILED(hr)) goto cleanup; + hr = add_bstr_property(display_adapter, szChipType, szEmpty); + if (FAILED(hr)) + goto cleanup; + + hr = add_bstr_property(display_adapter, szDACType, szEmpty); + if (FAILED(hr)) + goto cleanup; + + hr = add_bstr_property(display_adapter, szRevision, szEmpty); + if (FAILED(hr)) + goto cleanup; + if (!get_texture_memory(&adapter_info.DeviceIdentifier, &available_mem)) WARN("get_texture_memory helper failed\n"); @@ -1014,6 +1034,21 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node hr = add_bstr_property(display_adapter, szDisplayMemoryEnglish, buffer); if (FAILED(hr)) goto cleanup; + + hr = IDirect3D9_GetDeviceCaps(pDirect3D9, index, D3DDEVTYPE_HAL, &device_caps); + hardware_accel = SUCCEEDED(hr); + + hr = add_bool_property(display_adapter, b3DAccelerationEnabled, hardware_accel); + if (FAILED(hr)) + goto cleanup; + + hr = add_bool_property(display_adapter, b3DAccelerationExists, hardware_accel); + if (FAILED(hr)) + goto cleanup; + + hr = add_bool_property(display_adapter, bDDAccelerationEnabled, hardware_accel); + if (FAILED(hr)) + goto cleanup; } hr = S_OK; @@ -1028,7 +1063,7 @@ static HRESULT fill_display_information_fallback(IDxDiagContainerImpl_Container static const WCHAR *empty_properties[] = {szDeviceIdentifier, szVendorId, szDeviceId, szKeyDeviceKey, szKeyDeviceID, szDriverName, szDriverVersion, szSubSysId, szRevisionId, - szManufacturer}; + szManufacturer, szChipType, szDACType, szRevision}; IDxDiagContainerImpl_Container *display_adapter; HRESULT hr; @@ -1603,16 +1638,17 @@ static HRESULT build_directshowfilters_tree(IDxDiagContainerImpl_Container *node } hr = fill_filter_container(subcont, pMoniker); + IMoniker_Release(pMoniker); if (FAILED(hr)) { + WARN("Skipping invalid filter\n"); free_information_tree(subcont); - IMoniker_Release(pMoniker); - break; + hr = S_OK; + continue; } add_subcontainer(node, subcont); i++; - IMoniker_Release(pMoniker); } IEnumMoniker_Release(pEnum); diff --git a/dll/directx/wine/dxgi/adapter.c b/dll/directx/wine/dxgi/adapter.c index 6195c30a174..b6d26953b1c 100644 --- a/dll/directx/wine/dxgi/adapter.c +++ b/dll/directx/wine/dxgi/adapter.c @@ -33,6 +33,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_QueryInterface(IWineDXGIAdapter *i if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDXGIObject) || IsEqualGUID(riid, &IID_IDXGIAdapter) + || IsEqualGUID(riid, &IID_IDXGIAdapter1) || IsEqualGUID(riid, &IID_IWineDXGIAdapter)) { IUnknown_AddRef(iface); @@ -130,9 +131,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_EnumOutputs(IWineDXGIAdapter *ifac return S_OK; } -static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC *desc) +static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc1(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC1 *desc) { - struct dxgi_adapter *This = impl_from_IWineDXGIAdapter(iface); + struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface); struct wined3d_adapter_identifier adapter_id; char description[128]; struct wined3d *wined3d; @@ -140,38 +141,57 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, D TRACE("iface %p, desc %p.\n", iface, desc); - if (!desc) return E_INVALIDARG; + if (!desc) + return E_INVALIDARG; - wined3d = IWineDXGIFactory_get_wined3d(This->parent); + wined3d = IWineDXGIFactory_get_wined3d(adapter->parent); adapter_id.driver_size = 0; adapter_id.description = description; adapter_id.description_size = sizeof(description); adapter_id.device_name_size = 0; EnterCriticalSection(&dxgi_cs); - hr = wined3d_get_adapter_identifier(wined3d, This->ordinal, 0, &adapter_id); + hr = wined3d_get_adapter_identifier(wined3d, adapter->ordinal, 0, &adapter_id); wined3d_decref(wined3d); LeaveCriticalSection(&dxgi_cs); - if (SUCCEEDED(hr)) - { - if (!MultiByteToWideChar(CP_ACP, 0, description, -1, desc->Description, 128)) - { - DWORD err = GetLastError(); - ERR("Failed to translate description %s (%#x).\n", debugstr_a(description), err); - hr = E_FAIL; - } + if (FAILED(hr)) + return hr; - desc->VendorId = adapter_id.vendor_id; - desc->DeviceId = adapter_id.device_id; - desc->SubSysId = adapter_id.subsystem_id; - desc->Revision = adapter_id.revision; - desc->DedicatedVideoMemory = adapter_id.video_memory; - desc->DedicatedSystemMemory = 0; /* FIXME */ - desc->SharedSystemMemory = 0; /* FIXME */ - memcpy(&desc->AdapterLuid, &adapter_id.adapter_luid, sizeof(desc->AdapterLuid)); + if (!MultiByteToWideChar(CP_ACP, 0, description, -1, desc->Description, 128)) + { + DWORD err = GetLastError(); + ERR("Failed to translate description %s (%#x).\n", debugstr_a(description), err); + hr = E_FAIL; } + desc->VendorId = adapter_id.vendor_id; + desc->DeviceId = adapter_id.device_id; + desc->SubSysId = adapter_id.subsystem_id; + desc->Revision = adapter_id.revision; + desc->DedicatedVideoMemory = adapter_id.video_memory; + desc->DedicatedSystemMemory = 0; /* FIXME */ + desc->SharedSystemMemory = 0; /* FIXME */ + memcpy(&desc->AdapterLuid, &adapter_id.adapter_luid, sizeof(desc->AdapterLuid)); + desc->Flags = 0; + + return hr; +} + +static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC *desc) +{ + DXGI_ADAPTER_DESC1 desc1; + HRESULT hr; + + TRACE("iface %p, desc %p.\n", iface, desc); + + if (!desc) + return E_INVALIDARG; + + if (FAILED(hr = dxgi_adapter_GetDesc1(iface, &desc1))) + return hr; + memcpy(desc, &desc1, sizeof(*desc)); + return hr; } @@ -209,6 +229,8 @@ static const struct IWineDXGIAdapterVtbl dxgi_adapter_vtbl = dxgi_adapter_EnumOutputs, dxgi_adapter_GetDesc, dxgi_adapter_CheckInterfaceSupport, + /* IDXGIAdapter1 methods */ + dxgi_adapter_GetDesc1, /* IWineDXGIAdapter methods */ dxgi_adapter_get_ordinal, }; diff --git a/dll/directx/wine/dxgi/dxgi.spec b/dll/directx/wine/dxgi/dxgi.spec index 853d8e28d13..2232f88df07 100644 --- a/dll/directx/wine/dxgi/dxgi.spec +++ b/dll/directx/wine/dxgi/dxgi.spec @@ -1,3 +1,4 @@ @ stdcall CreateDXGIFactory(ptr ptr) +@ stdcall CreateDXGIFactory1(ptr ptr) @ stdcall DXGID3D10CreateDevice(ptr ptr ptr long ptr ptr) @ stdcall DXGID3D10RegisterLayers(ptr long) diff --git a/dll/directx/wine/dxgi/dxgi_main.c b/dll/directx/wine/dxgi/dxgi_main.c index e20be15917d..a12f3a6048f 100644 --- a/dll/directx/wine/dxgi/dxgi_main.c +++ b/dll/directx/wine/dxgi/dxgi_main.c @@ -43,55 +43,35 @@ static void dxgi_main_cleanup(void) DeleteCriticalSection(&dxgi_cs); } -BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) +BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, void *reserved) { - TRACE("fdwReason %u\n", fdwReason); - - switch(fdwReason) + switch (reason) { case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(hInstDLL); + DisableThreadLibraryCalls(inst); break; case DLL_PROCESS_DETACH: - if (lpv) break; - dxgi_main_cleanup(); + if (!reserved) + dxgi_main_cleanup(); break; } return TRUE; } -HRESULT WINAPI CreateDXGIFactory(REFIID riid, void **factory) +HRESULT WINAPI CreateDXGIFactory1(REFIID riid, void **factory) { - struct dxgi_factory *object; - HRESULT hr; - TRACE("riid %s, factory %p\n", debugstr_guid(riid), factory); - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if (!object) - { - ERR("Failed to allocate DXGI factory object memory\n"); - *factory = NULL; - return E_OUTOFMEMORY; - } + return dxgi_factory_create(riid, factory, TRUE); +} - hr = dxgi_factory_init(object); - if (FAILED(hr)) - { - WARN("Failed to initialize swapchain, hr %#x.\n", hr); - HeapFree(GetProcessHeap(), 0, object); - *factory = NULL; - return hr; - } +HRESULT WINAPI CreateDXGIFactory(REFIID riid, void **factory) +{ + TRACE("riid %s, factory %p\n", debugstr_guid(riid), factory); - TRACE("Created IDXGIFactory %p\n", object); - - hr = IDXGIFactory_QueryInterface((IDXGIFactory *)object, riid, factory); - IDXGIFactory_Release((IDXGIFactory *)object); - - return hr; + return dxgi_factory_create(riid, factory, FALSE); } static BOOL get_layer(enum dxgi_device_layer_id id, struct dxgi_device_layer *layer) @@ -125,8 +105,7 @@ static HRESULT register_d3d10core_layers(HMODULE d3d10core) HMODULE mod; BOOL ret; - ret = GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCSTR)d3d10core, &mod); - if (!ret) + if (!(ret = GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (const char *)d3d10core, &mod))) { LeaveCriticalSection(&dxgi_cs); return E_FAIL; diff --git a/dll/directx/wine/dxgi/dxgi_private.h b/dll/directx/wine/dxgi/dxgi_private.h index 1921e9a5ffb..15d8e21a986 100644 --- a/dll/directx/wine/dxgi/dxgi_private.h +++ b/dll/directx/wine/dxgi/dxgi_private.h @@ -90,10 +90,11 @@ struct dxgi_factory LONG refcount; struct wined3d *wined3d; UINT adapter_count; - IDXGIAdapter **adapters; + IWineDXGIAdapter **adapters; + BOOL extended; }; -HRESULT dxgi_factory_init(struct dxgi_factory *factory) DECLSPEC_HIDDEN; +HRESULT dxgi_factory_create(REFIID riid, void **factory, BOOL extended) DECLSPEC_HIDDEN; /* IDXGIDevice */ struct dxgi_device diff --git a/dll/directx/wine/dxgi/factory.c b/dll/directx/wine/dxgi/factory.c index 55705665905..a0c0937a301 100644 --- a/dll/directx/wine/dxgi/factory.c +++ b/dll/directx/wine/dxgi/factory.c @@ -28,11 +28,14 @@ static inline struct dxgi_factory *impl_from_IWineDXGIFactory(IWineDXGIFactory * static HRESULT STDMETHODCALLTYPE dxgi_factory_QueryInterface(IWineDXGIFactory *iface, REFIID riid, void **object) { + struct dxgi_factory *factory = impl_from_IWineDXGIFactory(iface); + TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object); if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDXGIObject) || IsEqualGUID(riid, &IID_IDXGIFactory) + || (factory->extended && IsEqualGUID(riid, &IID_IDXGIFactory1)) || IsEqualGUID(riid, &IID_IWineDXGIFactory)) { IUnknown_AddRef(iface); @@ -69,7 +72,7 @@ static ULONG STDMETHODCALLTYPE dxgi_factory_Release(IWineDXGIFactory *iface) for (i = 0; i < This->adapter_count; ++i) { - IDXGIAdapter_Release(This->adapters[i]); + IWineDXGIAdapter_Release(This->adapters[i]); } HeapFree(GetProcessHeap(), 0, This->adapters); @@ -119,29 +122,38 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_GetParent(IWineDXGIFactory *iface, /* IDXGIFactory methods */ -static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters(IWineDXGIFactory *iface, - UINT adapter_idx, IDXGIAdapter **adapter) +static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters1(IWineDXGIFactory *iface, + UINT adapter_idx, IDXGIAdapter1 **adapter) { - struct dxgi_factory *This = impl_from_IWineDXGIFactory(iface); + struct dxgi_factory *factory = impl_from_IWineDXGIFactory(iface); TRACE("iface %p, adapter_idx %u, adapter %p\n", iface, adapter_idx, adapter); - if (!adapter) return DXGI_ERROR_INVALID_CALL; + if (!adapter) + return DXGI_ERROR_INVALID_CALL; - if (adapter_idx >= This->adapter_count) + if (adapter_idx >= factory->adapter_count) { *adapter = NULL; return DXGI_ERROR_NOT_FOUND; } - *adapter = This->adapters[adapter_idx]; - IDXGIAdapter_AddRef(*adapter); + *adapter = (IDXGIAdapter1 *)factory->adapters[adapter_idx]; + IDXGIAdapter1_AddRef(*adapter); TRACE("Returning adapter %p\n", *adapter); return S_OK; } +static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters(IWineDXGIFactory *iface, + UINT adapter_idx, IDXGIAdapter **adapter) +{ + TRACE("iface %p, adapter_idx %u, adapter %p\n", iface, adapter_idx, adapter); + + return dxgi_factory_EnumAdapters1(iface, adapter_idx, (IDXGIAdapter1 **)adapter); +} + static HRESULT STDMETHODCALLTYPE dxgi_factory_MakeWindowAssociation(IWineDXGIFactory *iface, HWND window, UINT flags) { FIXME("iface %p, window %p, flags %#x stub!\n\n", iface, window, flags); @@ -258,6 +270,13 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSoftwareAdapter(IWineDXGIFac return E_NOTIMPL; } +static BOOL STDMETHODCALLTYPE dxgi_factory_IsCurrent(IWineDXGIFactory *iface) +{ + FIXME("iface %p stub!\n", iface); + + return TRUE; +} + /* IWineDXGIFactory methods */ static struct wined3d * STDMETHODCALLTYPE dxgi_factory_get_wined3d(IWineDXGIFactory *iface) @@ -289,11 +308,14 @@ static const struct IWineDXGIFactoryVtbl dxgi_factory_vtbl = dxgi_factory_GetWindowAssociation, dxgi_factory_CreateSwapChain, dxgi_factory_CreateSoftwareAdapter, + /* IDXGIFactory1 methods */ + dxgi_factory_EnumAdapters1, + dxgi_factory_IsCurrent, /* IWineDXGIFactory methods */ dxgi_factory_get_wined3d, }; -HRESULT dxgi_factory_init(struct dxgi_factory *factory) +static HRESULT dxgi_factory_init(struct dxgi_factory *factory, BOOL extended) { HRESULT hr; UINT i; @@ -302,7 +324,7 @@ HRESULT dxgi_factory_init(struct dxgi_factory *factory) factory->refcount = 1; EnterCriticalSection(&dxgi_cs); - factory->wined3d = wined3d_create(10, 0); + factory->wined3d = wined3d_create(0); if (!factory->wined3d) { LeaveCriticalSection(&dxgi_cs); @@ -330,7 +352,7 @@ HRESULT dxgi_factory_init(struct dxgi_factory *factory) for (j = 0; j < i; ++j) { - IDXGIAdapter_Release(factory->adapters[j]); + IWineDXGIAdapter_Release(factory->adapters[j]); } hr = E_OUTOFMEMORY; goto fail; @@ -346,14 +368,16 @@ HRESULT dxgi_factory_init(struct dxgi_factory *factory) HeapFree(GetProcessHeap(), 0, adapter); for (j = 0; j < i; ++j) { - IDXGIAdapter_Release(factory->adapters[j]); + IWineDXGIAdapter_Release(factory->adapters[j]); } goto fail; } - factory->adapters[i] = (IDXGIAdapter *)adapter; + factory->adapters[i] = &adapter->IWineDXGIAdapter_iface; } + factory->extended = extended; + return S_OK; fail: @@ -363,3 +387,26 @@ fail: LeaveCriticalSection(&dxgi_cs); return hr; } + +HRESULT dxgi_factory_create(REFIID riid, void **factory, BOOL extended) +{ + struct dxgi_factory *object; + HRESULT hr; + + if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) + return E_OUTOFMEMORY; + + if (FAILED(hr = dxgi_factory_init(object, extended))) + { + WARN("Failed to initialize factory, hr %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + + TRACE("Created factory %p.\n", object); + + hr = IWineDXGIFactory_QueryInterface(&object->IWineDXGIFactory_iface, riid, factory); + IWineDXGIFactory_Release(&object->IWineDXGIFactory_iface); + + return hr; +} diff --git a/dll/directx/wine/dxgi/guid.c b/dll/directx/wine/dxgi/guid.c index c971ac461a6..69259442ed1 100644 --- a/dll/directx/wine/dxgi/guid.c +++ b/dll/directx/wine/dxgi/guid.c @@ -5,6 +5,7 @@ #define WIN32_NO_STATUS #define _INC_WINDOWS #define COM_NO_WINDOWS_H +#define COBJMACROS #include #include diff --git a/dll/directx/wine/dxgi/output.c b/dll/directx/wine/dxgi/output.c index 1a9f9e4fc19..1b8c64781eb 100644 --- a/dll/directx/wine/dxgi/output.c +++ b/dll/directx/wine/dxgi/output.c @@ -127,9 +127,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa iface, debug_dxgi_format(format), flags, mode_count, desc); if (!mode_count) - { - return S_OK; - } + return DXGI_ERROR_INVALID_CALL; if (format == DXGI_FORMAT_UNKNOWN) { @@ -152,7 +150,14 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa return S_OK; } - *mode_count = min(*mode_count,max_count); + if (max_count > *mode_count) + { + wined3d_decref(wined3d); + LeaveCriticalSection(&dxgi_cs); + return DXGI_ERROR_MORE_DATA; + } + + *mode_count = max_count; for (i = 0; i < *mode_count; ++i) { diff --git a/dll/directx/wine/dxgi/surface.c b/dll/directx/wine/dxgi/surface.c index bd12cc6ccce..5aae215c064 100644 --- a/dll/directx/wine/dxgi/surface.c +++ b/dll/directx/wine/dxgi/surface.c @@ -66,10 +66,7 @@ static ULONG STDMETHODCALLTYPE dxgi_surface_inner_Release(IUnknown *iface) TRACE("%p decreasing refcount to %u.\n", surface, refcount); if (!refcount) - { - IDXGIDevice_Release(surface->device); HeapFree(GetProcessHeap(), 0, surface); - } return refcount; } @@ -205,7 +202,6 @@ HRESULT dxgi_surface_init(struct dxgi_surface *surface, IDXGIDevice *device, IUn surface->refcount = 1; surface->outer_unknown = outer ? outer : &surface->IUnknown_iface; surface->device = device; - IDXGIDevice_AddRef(device); return S_OK; } diff --git a/dll/directx/wine/qedit/CMakeLists.txt b/dll/directx/wine/qedit/CMakeLists.txt index 00f965b7dbf..5d844ac1ee3 100644 --- a/dll/directx/wine/qedit/CMakeLists.txt +++ b/dll/directx/wine/qedit/CMakeLists.txt @@ -15,7 +15,7 @@ add_library(qedit SHARED ${CMAKE_CURRENT_BINARY_DIR}/qedit.def) set_module_type(qedit win32dll) -target_link_libraries(qedit strmiids uuid wine) +target_link_libraries(qedit strmbase strmiids uuid wine) add_importlibs(qedit ole32 oleaut32 msvcrt kernel32 ntdll) add_pch(qedit qedit_private.h SOURCE) add_cd_file(TARGET qedit DESTINATION reactos/system32 FOR all) diff --git a/dll/directx/wine/qedit/qedit_classes.idl b/dll/directx/wine/qedit/qedit_classes.idl index 3106f4c7426..138e1a6396c 100644 --- a/dll/directx/wine/qedit/qedit_classes.idl +++ b/dll/directx/wine/qedit/qedit_classes.idl @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ threading(both), uuid(65bd0711-24d2-4ff7-9324-ed2e5d3abafa) diff --git a/dll/directx/wine/qedit/samplegrabber.c b/dll/directx/wine/qedit/samplegrabber.c index edae0ae27da..3af5c3c2cef 100644 --- a/dll/directx/wine/qedit/samplegrabber.c +++ b/dll/directx/wine/qedit/samplegrabber.c @@ -19,165 +19,14 @@ #include "qedit_private.h" +#include + static const WCHAR vendor_name[] = { 'W', 'i', 'n', 'e', 0 }; static const WCHAR pin_in_name[] = { 'I', 'n', 0 }; static const WCHAR pin_out_name[] = { 'O', 'u', 't', 0 }; -static IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount); static IEnumMediaTypes *mediaenum_create(const AM_MEDIA_TYPE *mtype); -/* Fixed pins enumerator, holds filter referenced */ -typedef struct _PE_Impl { - IEnumPins pe; - IBaseFilter *filter; - LONG refCount; - ULONG numPins; - ULONG index; - IPin *pins[0]; -} PE_Impl; - - -/* IEnumPins interface implementation */ - -/* IUnknown */ -static ULONG WINAPI -Fixed_IEnumPins_AddRef(IEnumPins *iface) -{ - PE_Impl *This = (PE_Impl *)iface; - ULONG refCount = InterlockedIncrement(&This->refCount); - TRACE("(%p) new ref = %u\n", This, refCount); - return refCount; -} - -/* IUnknown */ -static ULONG WINAPI -Fixed_IEnumPins_Release(IEnumPins *iface) -{ - PE_Impl *This = (PE_Impl *)iface; - ULONG refCount = InterlockedDecrement(&This->refCount); - TRACE("(%p) new ref = %u\n", This, refCount); - if (refCount == 0) - { - IBaseFilter_Release(This->filter); - CoTaskMemFree(This); - return 0; - } - return refCount; -} - -/* IUnknown */ -static HRESULT WINAPI -Fixed_IEnumPins_QueryInterface(IEnumPins *iface, REFIID riid, void **ppvObject) -{ - PE_Impl *This = (PE_Impl *)iface; - TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); - - if (IsEqualIID(riid, &IID_IUnknown) || - IsEqualIID(riid, &IID_IEnumPins)) { - Fixed_IEnumPins_AddRef(iface); - *ppvObject = This->pins; - return S_OK; - } - *ppvObject = NULL; - WARN("(%p, %s,%p): not found\n", This, debugstr_guid(riid), ppvObject); - return E_NOINTERFACE; -} - -/* IEnumPins */ -static HRESULT WINAPI -Fixed_IEnumPins_Next(IEnumPins *iface, ULONG nPins, IPin **pins, ULONG *fetched) -{ - PE_Impl *This = (PE_Impl *)iface; - ULONG count = 0; - TRACE("(%p)->(%u, %p, %p) index = %u\n", This, nPins, pins, fetched, This->index); - if (!nPins) - return E_INVALIDARG; - if (!pins || ((nPins != 1) && !fetched)) - return E_POINTER; - while ((count < nPins) && (This->index < This->numPins)) { - IPin *pin = This->pins[This->index++]; - IPin_AddRef(pin); - pins[count++] = pin; - } - if (fetched) - *fetched = count; - return (count == nPins) ? S_OK : S_FALSE; -} - -/* IEnumPins */ -static HRESULT WINAPI -Fixed_IEnumPins_Skip(IEnumPins *iface, ULONG nPins) -{ - PE_Impl *This = (PE_Impl *)iface; - TRACE("(%p)->(%u) index = %u\n", This, nPins, This->index); - nPins += This->index; - if (nPins >= This->numPins) { - This->index = This->numPins; - return S_FALSE; - } - This->index = nPins; - return S_OK; -} - -/* IEnumPins */ -static HRESULT WINAPI -Fixed_IEnumPins_Reset(IEnumPins *iface) -{ - PE_Impl *This = (PE_Impl *)iface; - TRACE("(%p)->() index = %u\n", This, This->index); - This->index = 0; - return S_OK; -} - -/* IEnumPins */ -static HRESULT WINAPI -Fixed_IEnumPins_Clone(IEnumPins *iface, IEnumPins **pins) -{ - PE_Impl *This = (PE_Impl *)iface; - TRACE("(%p)->(%p) index = %u\n", This, pins, This->index); - if (!pins) - return E_POINTER; - *pins = pinsenum_create(This->filter, This->pins, This->numPins); - if (!*pins) - return E_OUTOFMEMORY; - ((PE_Impl *)*pins)->index = This->index; - return S_OK; -} - - -/* Virtual tables and constructor */ - -static const IEnumPinsVtbl IEnumPins_VTable = -{ - Fixed_IEnumPins_QueryInterface, - Fixed_IEnumPins_AddRef, - Fixed_IEnumPins_Release, - Fixed_IEnumPins_Next, - Fixed_IEnumPins_Skip, - Fixed_IEnumPins_Reset, - Fixed_IEnumPins_Clone, -}; - -static IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount) -{ - ULONG len = sizeof(PE_Impl) + (pinCount * sizeof(IPin *)); - PE_Impl *obj = CoTaskMemAlloc(len); - if (obj) { - ULONG i; - ZeroMemory(obj, len); - obj->pe.lpVtbl = &IEnumPins_VTable; - obj->refCount = 1; - obj->filter = filter; - obj->numPins = pinCount; - obj->index = 0; - for (i=0; ipins[i] = pins[i]; - IBaseFilter_AddRef(filter); - } - return &obj->pe; -} - - /* Single media type enumerator */ typedef struct _ME_Impl { IEnumMediaTypes me; @@ -353,22 +202,16 @@ static inline SG_Pin *impl_from_IPin(IPin *iface) /* Sample Grabber filter implementation */ typedef struct _SG_Impl { IUnknown IUnknown_inner; - IBaseFilter IBaseFilter_iface; + BaseFilter filter; ISampleGrabber ISampleGrabber_iface; - IMemInputPin IMemInputPin_iface; /* IMediaSeeking and IMediaPosition are implemented by ISeekingPassThru */ IUnknown* seekthru_unk; - /* TODO: IQualityControl */ IUnknown *outer_unk; - LONG ref; - CRITICAL_SECTION critSect; - FILTER_INFO info; - FILTER_STATE state; AM_MEDIA_TYPE mtype; SG_Pin pin_in; SG_Pin pin_out; + IMemInputPin IMemInputPin_iface; IMemAllocator *allocator; - IReferenceClock *refClock; IMemInputPin *memOutput; ISampleGrabberCB *grabberIface; LONG grabberMethod; @@ -388,9 +231,14 @@ static inline SG_Impl *impl_from_IUnknown(IUnknown *iface) return CONTAINING_RECORD(iface, SG_Impl, IUnknown_inner); } +static inline SG_Impl *impl_from_BaseFilter(BaseFilter *iface) +{ + return CONTAINING_RECORD(iface, SG_Impl, filter); +} + static inline SG_Impl *impl_from_IBaseFilter(IBaseFilter *iface) { - return CONTAINING_RECORD(iface, SG_Impl, IBaseFilter_iface); + return CONTAINING_RECORD(iface, SG_Impl, filter.IBaseFilter_iface); } static inline SG_Impl *impl_from_ISampleGrabber(ISampleGrabber *iface) @@ -408,12 +256,10 @@ static inline SG_Impl *impl_from_IMemInputPin(IMemInputPin *iface) static void SampleGrabber_cleanup(SG_Impl *This) { TRACE("(%p)\n", This); - if (This->info.pGraph) - WARN("(%p) still joined to filter graph %p\n", This, This->info.pGraph); + if (This->filter.filterInfo.pGraph) + WARN("(%p) still joined to filter graph %p\n", This, This->filter.filterInfo.pGraph); if (This->allocator) IMemAllocator_Release(This->allocator); - if (This->refClock) - IReferenceClock_Release(This->refClock); if (This->memOutput) IMemInputPin_Release(This->memOutput); if (This->grabberIface) @@ -424,8 +270,6 @@ static void SampleGrabber_cleanup(SG_Impl *This) CoTaskMemFree(This->bufferData); if(This->seekthru_unk) IUnknown_Release(This->seekthru_unk); - This->critSect.DebugInfo->Spare[0] = 0; - DeleteCriticalSection(&This->critSect); } /* SampleGrabber inner IUnknown */ @@ -440,17 +284,13 @@ static HRESULT WINAPI SampleGrabber_QueryInterface(IUnknown *iface, REFIID riid, *ppv = &This->IUnknown_inner; else if (IsEqualIID(riid, &IID_IPersist) || IsEqualIID(riid, &IID_IMediaFilter) || IsEqualIID(riid, &IID_IBaseFilter)) - *ppv = &This->IBaseFilter_iface; + *ppv = &This->filter.IBaseFilter_iface; else if (IsEqualIID(riid, &IID_ISampleGrabber)) *ppv = &This->ISampleGrabber_iface; - else if (IsEqualIID(riid, &IID_IMemInputPin)) - *ppv = &This->IMemInputPin_iface; else if (IsEqualIID(riid, &IID_IMediaPosition)) return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv); else if (IsEqualIID(riid, &IID_IMediaSeeking)) return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv); - else if (IsEqualIID(riid, &IID_IQualityControl)) - FIXME("IQualityControl not implemented\n"); else WARN("(%p, %s,%p): not found\n", This, debugstr_guid(riid), ppv); @@ -464,9 +304,9 @@ static HRESULT WINAPI SampleGrabber_QueryInterface(IUnknown *iface, REFIID riid, static ULONG WINAPI SampleGrabber_AddRef(IUnknown *iface) { SG_Impl *This = impl_from_IUnknown(iface); - ULONG ref = InterlockedIncrement(&This->ref); + ULONG ref = BaseFilterImpl_AddRef(&This->filter.IBaseFilter_iface); - TRACE("(%p) new ref = %u\n", This, ref); + TRACE("(%p) ref=%d\n", This, ref); return ref; } @@ -474,9 +314,9 @@ static ULONG WINAPI SampleGrabber_AddRef(IUnknown *iface) static ULONG WINAPI SampleGrabber_Release(IUnknown *iface) { SG_Impl *This = impl_from_IUnknown(iface); - ULONG ref = InterlockedDecrement(&This->ref); + ULONG ref = BaseFilterImpl_Release(&This->filter.IBaseFilter_iface); - TRACE("(%p) new ref = %u\n", This, ref); + TRACE("(%p) ref=%d\n", This, ref); if (ref == 0) { @@ -494,6 +334,32 @@ static const IUnknownVtbl samplegrabber_vtbl = SampleGrabber_Release, }; +static IPin *WINAPI SampleGrabber_GetPin(BaseFilter *iface, int pos) +{ + SG_Impl *This = impl_from_BaseFilter(iface); + IPin *pin; + + if (pos == 0) + pin = &This->pin_in.IPin_iface; + else if (pos == 1) + pin = &This->pin_out.IPin_iface; + else + return NULL; + + IPin_AddRef(pin); + return pin; +} + +static LONG WINAPI SampleGrabber_GetPinCount(BaseFilter *iface) +{ + return 2; +} + +static const BaseFilterFuncTable basefunc_vtbl = { + SampleGrabber_GetPin, + SampleGrabber_GetPinCount +}; + /* Helper that buffers data and/or calls installed sample callbacks */ static void SampleGrabber_callback(SG_Impl *This, IMediaSample *sample) { @@ -505,7 +371,7 @@ static void SampleGrabber_callback(SG_Impl *This, IMediaSample *sample) if (size >= 0 && SUCCEEDED(IMediaSample_GetPointer(sample, &data))) { if (!data) size = 0; - EnterCriticalSection(&This->critSect); + EnterCriticalSection(&This->filter.csFilter); if (This->bufferLen != size) { if (This->bufferData) CoTaskMemFree(This->bufferData); @@ -514,7 +380,7 @@ static void SampleGrabber_callback(SG_Impl *This, IMediaSample *sample) } if (size) CopyMemory(This->bufferData, data, size); - LeaveCriticalSection(&This->critSect); + LeaveCriticalSection(&This->filter.csFilter); } } if (!This->grabberIface) @@ -580,24 +446,13 @@ SampleGrabber_IBaseFilter_Release(IBaseFilter *iface) return IUnknown_Release(This->outer_unk); } -/* IPersist */ -static HRESULT WINAPI -SampleGrabber_IBaseFilter_GetClassID(IBaseFilter *iface, CLSID *pClassID) -{ - TRACE("(%p)\n", pClassID); - if (!pClassID) - return E_POINTER; - *pClassID = CLSID_SampleGrabber; - return S_OK; -} - /* IMediaFilter */ static HRESULT WINAPI SampleGrabber_IBaseFilter_Stop(IBaseFilter *iface) { SG_Impl *This = impl_from_IBaseFilter(iface); TRACE("(%p)\n", This); - This->state = State_Stopped; + This->filter.state = State_Stopped; return S_OK; } @@ -607,7 +462,7 @@ SampleGrabber_IBaseFilter_Pause(IBaseFilter *iface) { SG_Impl *This = impl_from_IBaseFilter(iface); TRACE("(%p)\n", This); - This->state = State_Paused; + This->filter.state = State_Paused; return S_OK; } @@ -617,68 +472,10 @@ SampleGrabber_IBaseFilter_Run(IBaseFilter *iface, REFERENCE_TIME tStart) { SG_Impl *This = impl_from_IBaseFilter(iface); TRACE("(%p)\n", This); - This->state = State_Running; + This->filter.state = State_Running; return S_OK; } -/* IMediaFilter */ -static HRESULT WINAPI -SampleGrabber_IBaseFilter_GetState(IBaseFilter *iface, DWORD msTout, FILTER_STATE *state) -{ - SG_Impl *This = impl_from_IBaseFilter(iface); - TRACE("(%p)->(%u, %p)\n", This, msTout, state); - if (!state) - return E_POINTER; - *state = This->state; - return S_OK; -} - -/* IMediaFilter */ -static HRESULT WINAPI -SampleGrabber_IBaseFilter_SetSyncSource(IBaseFilter *iface, IReferenceClock *clock) -{ - SG_Impl *This = impl_from_IBaseFilter(iface); - TRACE("(%p)->(%p)\n", This, clock); - if (clock != This->refClock) - { - if (clock) - IReferenceClock_AddRef(clock); - if (This->refClock) - IReferenceClock_Release(This->refClock); - This->refClock = clock; - } - return S_OK; -} - -/* IMediaFilter */ -static HRESULT WINAPI -SampleGrabber_IBaseFilter_GetSyncSource(IBaseFilter *iface, IReferenceClock **clock) -{ - SG_Impl *This = impl_from_IBaseFilter(iface); - TRACE("(%p)->(%p)\n", This, clock); - if (!clock) - return E_POINTER; - if (This->refClock) - IReferenceClock_AddRef(This->refClock); - *clock = This->refClock; - return S_OK; -} - -/* IBaseFilter */ -static HRESULT WINAPI -SampleGrabber_IBaseFilter_EnumPins(IBaseFilter *iface, IEnumPins **pins) -{ - SG_Impl *This = impl_from_IBaseFilter(iface); - IPin *pin[2]; - TRACE("(%p)->(%p)\n", This, pins); - if (!pins) - return E_POINTER; - pin[0] = &This->pin_in.IPin_iface; - pin[1] = &This->pin_out.IPin_iface; - *pins = pinsenum_create(iface, pin, 2); - return *pins ? S_OK : E_OUTOFMEMORY; -} - /* IBaseFilter */ static HRESULT WINAPI SampleGrabber_IBaseFilter_FindPin(IBaseFilter *iface, LPCWSTR id, IPin **pin) @@ -703,30 +500,17 @@ SampleGrabber_IBaseFilter_FindPin(IBaseFilter *iface, LPCWSTR id, IPin **pin) return VFW_E_NOT_FOUND; } -/* IBaseFilter */ -static HRESULT WINAPI -SampleGrabber_IBaseFilter_QueryFilterInfo(IBaseFilter *iface, FILTER_INFO *info) -{ - SG_Impl *This = impl_from_IBaseFilter(iface); - TRACE("(%p)->(%p)\n", This, info); - if (!info) - return E_POINTER; - if (This->info.pGraph) - IFilterGraph_AddRef(This->info.pGraph); - *info = This->info; - return S_OK; -} - /* IBaseFilter */ static HRESULT WINAPI SampleGrabber_IBaseFilter_JoinFilterGraph(IBaseFilter *iface, IFilterGraph *graph, LPCWSTR name) { SG_Impl *This = impl_from_IBaseFilter(iface); + TRACE("(%p)->(%p, %s)\n", This, graph, debugstr_w(name)); - This->info.pGraph = graph; - if (name) - lstrcpynW(This->info.achName,name,MAX_FILTER_NAME); + + BaseFilterImpl_JoinFilterGraph(iface, graph, name); This->oneShot = OneShot_None; + return S_OK; } @@ -828,14 +612,14 @@ SampleGrabber_ISampleGrabber_SetBufferSamples(ISampleGrabber *iface, BOOL buffer { SG_Impl *This = impl_from_ISampleGrabber(iface); TRACE("(%p)->(%u)\n", This, bufferEm); - EnterCriticalSection(&This->critSect); + EnterCriticalSection(&This->filter.csFilter); if (bufferEm) { if (This->bufferLen < 0) This->bufferLen = 0; } else This->bufferLen = -1; - LeaveCriticalSection(&This->critSect); + LeaveCriticalSection(&This->filter.csFilter); return S_OK; } @@ -848,7 +632,7 @@ SampleGrabber_ISampleGrabber_GetCurrentBuffer(ISampleGrabber *iface, LONG *bufSi TRACE("(%p)->(%p, %p)\n", This, bufSize, buffer); if (!bufSize) return E_POINTER; - EnterCriticalSection(&This->critSect); + EnterCriticalSection(&This->filter.csFilter); if (!This->pin_in.pair) ret = VFW_E_NOT_CONNECTED; else if (This->bufferLen < 0) @@ -864,7 +648,7 @@ SampleGrabber_ISampleGrabber_GetCurrentBuffer(ISampleGrabber *iface, LONG *bufSi } *bufSize = This->bufferLen; } - LeaveCriticalSection(&This->critSect); + LeaveCriticalSection(&This->filter.csFilter); return ret; } @@ -970,7 +754,7 @@ SampleGrabber_IMemInputPin_Receive(IMemInputPin *iface, IMediaSample *sample) TRACE("(%p)->(%p) output = %p, grabber = %p\n", This, sample, This->memOutput, This->grabberIface); if (!sample) return E_POINTER; - if ((This->state != State_Running) || (This->oneShot == OneShot_Past)) + if ((This->filter.state != State_Running) || (This->oneShot == OneShot_Past)) return S_FALSE; SampleGrabber_callback(This, sample); hr = This->memOutput ? IMemInputPin_Receive(This->memOutput, sample) : S_OK; @@ -992,7 +776,7 @@ SampleGrabber_IMemInputPin_ReceiveMultiple(IMemInputPin *iface, IMediaSample **s TRACE("(%p)->(%p, %u, %p) output = %p, grabber = %p\n", This, samples, nSamples, nProcessed, This->memOutput, This->grabberIface); if (!samples || !nProcessed) return E_POINTER; - if ((This->state != State_Running) || (This->oneShot == OneShot_Past)) + if ((This->filter.state != State_Running) || (This->oneShot == OneShot_Past)) return S_FALSE; for (idx = 0; idx < nSamples; idx++) SampleGrabber_callback(This, samples[idx]); @@ -1072,7 +856,7 @@ SampleGrabber_Out_IPin_Connect(IPin *iface, IPin *receiver, const AM_MEDIA_TYPE return E_POINTER; if (This->pair) return VFW_E_ALREADY_CONNECTED; - if (This->sg->state != State_Stopped) + if (This->sg->filter.state != State_Stopped) return VFW_E_NOT_STOPPED; if (type) { TRACE("Media type: %s/%s ssize: %u format: %s (%u bytes)\n", @@ -1120,7 +904,7 @@ SampleGrabber_In_IPin_ReceiveConnection(IPin *iface, IPin *connector, const AM_M return E_POINTER; if (This->pair) return VFW_E_ALREADY_CONNECTED; - if (This->sg->state != State_Stopped) + if (This->sg->filter.state != State_Stopped) return VFW_E_NOT_STOPPED; if (type) { TRACE("Media type: %s/%s ssize: %u format: %s (%u bytes)\n", @@ -1172,7 +956,7 @@ SampleGrabber_In_IPin_Disconnect(IPin *iface) SG_Pin *This = impl_from_IPin(iface); TRACE("(%p)->() pair = %p\n", This, This->pair); - if (This->sg->state != State_Stopped) + if (This->sg->filter.state != State_Stopped) return VFW_E_NOT_STOPPED; if (This->pair) { This->pair = NULL; @@ -1188,7 +972,7 @@ SampleGrabber_Out_IPin_Disconnect(IPin *iface) SG_Pin *This = impl_from_IPin(iface); TRACE("(%p)->() pair = %p\n", This, This->pair); - if (This->sg->state != State_Stopped) + if (This->sg->filter.state != State_Stopped) return VFW_E_NOT_STOPPED; if (This->pair) { This->pair = NULL; @@ -1246,8 +1030,8 @@ SampleGrabber_IPin_QueryPinInfo(IPin *iface, PIN_INFO *info) TRACE("(%p)->(%p)\n", This, info); if (!info) return E_POINTER; - IBaseFilter_AddRef(&This->sg->IBaseFilter_iface); - info->pFilter = &This->sg->IBaseFilter_iface; + info->pFilter = &This->sg->filter.IBaseFilter_iface; + IBaseFilter_AddRef(info->pFilter); info->dir = This->dir; lstrcpynW(info->achName,This->name,MAX_PIN_NAME); return S_OK; @@ -1374,16 +1158,16 @@ static const IBaseFilterVtbl IBaseFilter_VTable = SampleGrabber_IBaseFilter_QueryInterface, SampleGrabber_IBaseFilter_AddRef, SampleGrabber_IBaseFilter_Release, - SampleGrabber_IBaseFilter_GetClassID, + BaseFilterImpl_GetClassID, SampleGrabber_IBaseFilter_Stop, SampleGrabber_IBaseFilter_Pause, SampleGrabber_IBaseFilter_Run, - SampleGrabber_IBaseFilter_GetState, - SampleGrabber_IBaseFilter_SetSyncSource, - SampleGrabber_IBaseFilter_GetSyncSource, - SampleGrabber_IBaseFilter_EnumPins, + BaseFilterImpl_GetState, + BaseFilterImpl_SetSyncSource, + BaseFilterImpl_GetSyncSource, + BaseFilterImpl_EnumPins, SampleGrabber_IBaseFilter_FindPin, - SampleGrabber_IBaseFilter_QueryFilterInfo, + BaseFilterImpl_QueryFilterInfo, SampleGrabber_IBaseFilter_JoinFilterGraph, SampleGrabber_IBaseFilter_QueryVendorInfo, }; @@ -1474,9 +1258,9 @@ HRESULT SampleGrabber_create(IUnknown *pUnkOuter, LPVOID *ppv) } ZeroMemory(obj, sizeof(SG_Impl)); - obj->ref = 1; + BaseFilter_Init(&obj->filter, &IBaseFilter_VTable, &CLSID_SampleGrabber, + (DWORD_PTR)(__FILE__ ": SG_Impl.csFilter"), &basefunc_vtbl); obj->IUnknown_inner.lpVtbl = &samplegrabber_vtbl; - obj->IBaseFilter_iface.lpVtbl = &IBaseFilter_VTable; obj->ISampleGrabber_iface.lpVtbl = &ISampleGrabber_VTable; obj->IMemInputPin_iface.lpVtbl = &IMemInputPin_VTable; obj->pin_in.IPin_iface.lpVtbl = &IPin_In_VTable; @@ -1489,16 +1273,10 @@ HRESULT SampleGrabber_create(IUnknown *pUnkOuter, LPVOID *ppv) obj->pin_out.name = pin_out_name; obj->pin_out.sg = obj; obj->pin_out.pair = NULL; - InitializeCriticalSection(&obj->critSect); - obj->critSect.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SG_Impl.critSect"); - obj->info.achName[0] = 0; - obj->info.pGraph = NULL; - obj->state = State_Stopped; obj->mtype.majortype = GUID_NULL; obj->mtype.subtype = MEDIASUBTYPE_None; obj->mtype.formattype = FORMAT_None; obj->allocator = NULL; - obj->refClock = NULL; obj->memOutput = NULL; obj->grabberIface = NULL; obj->grabberMethod = -1; diff --git a/dll/directx/wine/quartz/avisplit.c b/dll/directx/wine/quartz/avisplit.c index 1ae30ad75d6..f3c8ddce968 100644 --- a/dll/directx/wine/quartz/avisplit.c +++ b/dll/directx/wine/quartz/avisplit.c @@ -47,7 +47,7 @@ typedef struct StreamData DWORD entries; AVISTDINDEX **stdindex; DWORD frames; - DWORD seek; + BOOL seek; /* Position, in index units */ DWORD pos, pos_next, index, index_next; @@ -431,7 +431,7 @@ static HRESULT AVISplitter_first_request(LPVOID iface) stream->index_next = stream->index; /* This was sent after stopped->paused or stopped->playing, so set seek */ - stream->seek = 1; + stream->seek = TRUE; /* There should be a packet queued from AVISplitter_next_request last time * It needs to be done now because this is the only way to ensure that every @@ -956,7 +956,7 @@ static HRESULT AVISplitter_InitializeStreams(AVISplitterImpl *This) DWORD y; DWORD64 frames = 0; - stream->seek = 1; + stream->seek = TRUE; if (stream->stdindex) { @@ -1303,7 +1303,7 @@ static HRESULT WINAPI AVISplitter_seek(IMediaSeeking *iface) pin->dwSamplesProcessed = 0; stream->index = 0; stream->pos = 0; - stream->seek = 1; + stream->seek = TRUE; if (stream->stdindex) { DWORD y, z = 0; @@ -1379,7 +1379,7 @@ static HRESULT WINAPI AVISplitter_seek(IMediaSeeking *iface) stream->index = 0; } stream->preroll = preroll; - stream->seek = 1; + stream->seek = TRUE; } LeaveCriticalSection(&This->Parser.filter.csFilter); diff --git a/dll/directx/wine/quartz/control_tlb.idl b/dll/directx/wine/quartz/control_tlb.idl index 6d1855252a7..b131a1ba3a8 100644 --- a/dll/directx/wine/quartz/control_tlb.idl +++ b/dll/directx/wine/quartz/control_tlb.idl @@ -14,4 +14,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep regtypelib + #include "control.idl" diff --git a/dll/directx/wine/quartz/filesource.c b/dll/directx/wine/quartz/filesource.c index be07306225f..4a26313ba2c 100644 --- a/dll/directx/wine/quartz/filesource.c +++ b/dll/directx/wine/quartz/filesource.c @@ -911,14 +911,13 @@ static HRESULT WINAPI FileAsyncReaderPin_DecideBufferSize(BaseOutputPin *iface, return IMemAllocator_SetProperties(pAlloc, &This->allocProps, &actual); } -static const BasePinFuncTable output_BaseFuncTable = { - NULL, - FileAsyncReaderPin_AttemptConnection, - BasePinImpl_GetMediaTypeVersion, - FileAsyncReaderPin_GetMediaType -}; - static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { + { + NULL, + FileAsyncReaderPin_AttemptConnection, + BasePinImpl_GetMediaTypeVersion, + FileAsyncReaderPin_GetMediaType + }, FileAsyncReaderPin_DecideBufferSize, BaseOutputPinImpl_DecideAllocator, BaseOutputPinImpl_BreakConnect @@ -933,7 +932,7 @@ static HRESULT FileAsyncReader_Construct(HANDLE hFile, IBaseFilter * pBaseFilter piOutput.dir = PINDIR_OUTPUT; piOutput.pFilter = pBaseFilter; strcpyW(piOutput.achName, wszOutputPinName); - hr = BaseOutputPin_Construct(&FileAsyncReaderPin_Vtbl, sizeof(FileAsyncReader), &piOutput, &output_BaseFuncTable, &output_BaseOutputFuncTable, pCritSec, ppPin); + hr = BaseOutputPin_Construct(&FileAsyncReaderPin_Vtbl, sizeof(FileAsyncReader), &piOutput, &output_BaseOutputFuncTable, pCritSec, ppPin); if (SUCCEEDED(hr)) { diff --git a/dll/directx/wine/quartz/filtergraph.c b/dll/directx/wine/quartz/filtergraph.c index 2edcdfc8cb0..9aff4a2d610 100644 --- a/dll/directx/wine/quartz/filtergraph.c +++ b/dll/directx/wine/quartz/filtergraph.c @@ -67,7 +67,7 @@ static int EventsQueue_Destroy(EventsQueue* omr) return TRUE; } -static int EventsQueue_PutEvent(EventsQueue* omr, const Event* evt) +static BOOL EventsQueue_PutEvent(EventsQueue* omr, const Event* evt) { EnterCriticalSection(&omr->msg_crst); if (omr->msg_toget == ((omr->msg_tosave + 1) % omr->ring_buffer_size)) @@ -96,7 +96,7 @@ static int EventsQueue_PutEvent(EventsQueue* omr, const Event* evt) return TRUE; } -static int EventsQueue_GetEvent(EventsQueue* omr, Event* evt, LONG msTimeOut) +static BOOL EventsQueue_GetEvent(EventsQueue* omr, Event* evt, LONG msTimeOut) { if (WaitForSingleObject(omr->msg_event, msTimeOut) != WAIT_OBJECT_0) return FALSE; @@ -356,7 +356,7 @@ static HRESULT WINAPI FilterGraph2_AddFilter(IFilterGraph2 *iface, IBaseFilter * HRESULT hr; int i,j; WCHAR* wszFilterName = NULL; - int duplicate_name = FALSE; + BOOL duplicate_name = FALSE; TRACE("(%p/%p)->(%p, %s (%p))\n", This, iface, pFilter, debugstr_w(pName), pName); @@ -429,7 +429,7 @@ static HRESULT WINAPI FilterGraph2_AddFilter(IFilterGraph2 *iface, IBaseFilter * This->filterCapacity = newCapacity; } - hr = IBaseFilter_JoinFilterGraph(pFilter, (IFilterGraph *)This, wszFilterName); + hr = IBaseFilter_JoinFilterGraph(pFilter, (IFilterGraph *)&This->IFilterGraph2_iface, wszFilterName); if (SUCCEEDED(hr)) { @@ -469,7 +469,7 @@ static HRESULT WINAPI FilterGraph2_RemoveFilter(IFilterGraph2 *iface, IBaseFilte if (This->defaultclock && This->refClockProvider == pFilter) { IMediaFilter_SetSyncSource(&This->IMediaFilter_iface, NULL); - This->defaultclock = 1; + This->defaultclock = TRUE; } TRACE("Removing filter %s\n", debugstr_w(This->pFilterNames[i])); @@ -1481,7 +1481,7 @@ static HRESULT WINAPI FilterGraph2_RenderFile(IFilterGraph2 *iface, LPCWSTR lpcw IEnumPins* penumpins = NULL; HRESULT hr; BOOL partial = FALSE; - HRESULT any = FALSE; + BOOL any = FALSE; TRACE("(%p/%p)->(%s, %s)\n", This, iface, debugstr_w(lpcwstrFile), debugstr_w(lpcwstrPlayList)); @@ -1659,7 +1659,7 @@ static HRESULT WINAPI FilterGraph2_AddSourceFilter(IFilterGraph2 *iface, LPCWSTR } /* The file has been already loaded */ - IFileSourceFilter_GetCurFile(pfile, &filename, &mt); + hr = IFileSourceFilter_GetCurFile(pfile, &filename, &mt); if (FAILED(hr)) { WARN("GetCurFile (%x)\n", hr); goto error; @@ -5257,7 +5257,7 @@ static HRESULT WINAPI MediaFilter_SetSyncSource(IMediaFilter *iface, IReferenceC IMediaEventSink *pEventSink; HRESULT eshr; - eshr = IMediaFilter_QueryInterface(iface, &IID_IMediaEventSink, (LPVOID)&pEventSink); + eshr = IMediaFilter_QueryInterface(iface, &IID_IMediaEventSink, (void **)&pEventSink); if (SUCCEEDED(eshr)) { IMediaEventSink_Notify(pEventSink, EC_CLOCK_CHANGED, 0, 0); diff --git a/dll/directx/wine/quartz/main.c b/dll/directx/wine/quartz/main.c index 1c16b1f5904..8c0e8803bfe 100644 --- a/dll/directx/wine/quartz/main.c +++ b/dll/directx/wine/quartz/main.c @@ -69,6 +69,7 @@ static const struct object_creation_info object_creation[] = { &CLSID_MPEG1Splitter, MPEGSplitter_create }, { &CLSID_VideoRenderer, VideoRenderer_create }, { &CLSID_NullRenderer, NullRenderer_create }, + { &CLSID_VideoMixingRenderer, VMR7Impl_create }, { &CLSID_VideoMixingRenderer9, VMR9Impl_create }, { &CLSID_VideoRendererDefault, VideoRendererDefault_create }, { &CLSID_DSoundRender, DSoundRender_create }, diff --git a/dll/directx/wine/quartz/parser.c b/dll/directx/wine/quartz/parser.c index 709e62b73c6..8476838984b 100644 --- a/dll/directx/wine/quartz/parser.c +++ b/dll/directx/wine/quartz/parser.c @@ -405,14 +405,13 @@ HRESULT WINAPI Parser_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo) return BaseFilterImpl_QueryVendorInfo(iface, pVendorInfo); } -static const BasePinFuncTable output_BaseFuncTable = { - NULL, - BaseOutputPinImpl_AttemptConnection, - BasePinImpl_GetMediaTypeVersion, - Parser_OutputPin_GetMediaType -}; - static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { + { + NULL, + BaseOutputPinImpl_AttemptConnection, + BasePinImpl_GetMediaTypeVersion, + Parser_OutputPin_GetMediaType + }, Parser_OutputPin_DecideBufferSize, Parser_OutputPin_DecideAllocator, Parser_OutputPin_BreakConnect @@ -428,7 +427,7 @@ HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PR This->ppPins = CoTaskMemAlloc((This->cStreams + 2) * sizeof(IPin *)); memcpy(This->ppPins, ppOldPins, (This->cStreams + 1) * sizeof(IPin *)); - hr = BaseOutputPin_Construct(&Parser_OutputPin_Vtbl, sizeof(Parser_OutputPin), piOutput, &output_BaseFuncTable, &output_BaseOutputFuncTable, &This->filter.csFilter, This->ppPins + (This->cStreams + 1)); + hr = BaseOutputPin_Construct(&Parser_OutputPin_Vtbl, sizeof(Parser_OutputPin), piOutput, &output_BaseOutputFuncTable, &This->filter.csFilter, This->ppPins + (This->cStreams + 1)); if (SUCCEEDED(hr)) { diff --git a/dll/directx/wine/quartz/pin.c b/dll/directx/wine/quartz/pin.c index 93dcbbbfa09..efa0ec01a5e 100644 --- a/dll/directx/wine/quartz/pin.c +++ b/dll/directx/wine/quartz/pin.c @@ -256,7 +256,7 @@ HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const ALLOCATOR_PROPERTIES props; props.cBuffers = 3; - props.cbBuffer = 64 * 1024; /* 64k bytes */ + props.cbBuffer = 64 * 1024; /* 64 KB */ props.cbAlign = 1; props.cbPrefix = 0; @@ -589,7 +589,7 @@ static HRESULT PullPin_InitProcessing(PullPin * This) assert(WaitForSingleObject(This->thread_sleepy, 0) == WAIT_TIMEOUT); This->state = Req_Sleepy; - /* AddRef the filter to make sure it and it's pins will be around + /* AddRef the filter to make sure it and its pins will be around * as long as the thread */ IBaseFilter_AddRef(This->pin.pinInfo.pFilter); diff --git a/dll/directx/wine/quartz/quartz_private.h b/dll/directx/wine/quartz/quartz_private.h index 10cc56ab1c2..ae3a276fda1 100644 --- a/dll/directx/wine/quartz/quartz_private.h +++ b/dll/directx/wine/quartz/quartz_private.h @@ -72,6 +72,7 @@ HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC HRESULT QUARTZ_CreateSystemClock(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; HRESULT WAVEParser_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; +HRESULT VMR7Impl_create(IUnknown *pUnkOuter, LPVOID *ppv) DECLSPEC_HIDDEN; HRESULT VMR9Impl_create(IUnknown *pUnkOuter, LPVOID *ppv) DECLSPEC_HIDDEN; HRESULT EnumMonikerImpl_Create(IMoniker ** ppMoniker, ULONG nMonikerCount, IEnumMoniker ** ppEnum) DECLSPEC_HIDDEN; diff --git a/dll/directx/wine/quartz/quartz_strmif.idl b/dll/directx/wine/quartz/quartz_strmif.idl index ed7abe6b21a..44dc668ae51 100644 --- a/dll/directx/wine/quartz/quartz_strmif.idl +++ b/dll/directx/wine/quartz/quartz_strmif.idl @@ -16,6 +16,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep proxy +#pragma makedep register + cpp_quote("#include ") #include "strmif.idl" @@ -151,6 +154,13 @@ coclass ACMWrapper { interface IBaseFilter; } ] coclass WAVEParser { interface IBaseFilter; } +[ + helpstring("Video Mixing Renderer"), + threading(both), + uuid(b87beb7b-8d29-423f-ae4d-6582c10175ac) +] +coclass VideoMixingRenderer { interface IBaseFilter; } + [ helpstring("Video Mixing Renderer 9"), threading(both), diff --git a/dll/directx/wine/quartz/quartz_strmif.rgs b/dll/directx/wine/quartz/quartz_strmif.rgs index 69c6a05c7fa..5c090335f87 100644 --- a/dll/directx/wine/quartz/quartz_strmif.rgs +++ b/dll/directx/wine/quartz/quartz_strmif.rgs @@ -261,6 +261,10 @@ HKCR { InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' } } + '{B87BEB7B-8D29-423F-AE4D-6582C10175AC}' = s 'Video Mixing Renderer' + { + InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' } + } '{51B4ABF3-748F-4E3B-A276-C828330E926A}' = s 'Video Mixing Renderer 9' { InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' } diff --git a/dll/directx/wine/quartz/regsvr.c b/dll/directx/wine/quartz/regsvr.c index 3c516111f53..bbf519c8877 100644 --- a/dll/directx/wine/quartz/regsvr.c +++ b/dll/directx/wine/quartz/regsvr.c @@ -177,8 +177,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) if (res != ERROR_SUCCESS) goto error_close_interface_key; if (list->name) { - res = RegSetValueExA(iid_key, NULL, 0, REG_SZ, - (CONST BYTE*)(list->name), + res = RegSetValueExA(iid_key, NULL, 0, REG_SZ, (const BYTE*)list->name, strlen(list->name) + 1); if (res != ERROR_SUCCESS) goto error_close_iid_key; } @@ -197,8 +196,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) if (res != ERROR_SUCCESS) goto error_close_iid_key; sprintfW(buf, fmt, list->num_methods); - res = RegSetValueExW(key, NULL, 0, REG_SZ, - (CONST BYTE*)buf, + res = RegSetValueExW(key, NULL, 0, REG_SZ, (const BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); RegCloseKey(key); @@ -273,8 +271,7 @@ static HRESULT register_coclasses(struct regsvr_coclass const *list) if (res != ERROR_SUCCESS) goto error_close_coclass_key; if (list->name) { - res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ, - (CONST BYTE*)(list->name), + res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ, (const BYTE*)list->name, strlen(list->name) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -292,12 +289,11 @@ static HRESULT register_coclasses(struct regsvr_coclass const *list) &ips32_key, NULL); if (res != ERROR_SUCCESS) goto error_close_clsid_key; - res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ, - (CONST BYTE*)list->ips32, + res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ, (const BYTE*)list->ips32, lstrlenA(list->ips32) + 1); if (res == ERROR_SUCCESS && list->ips32_tmodel) res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ, - (CONST BYTE*)list->ips32_tmodel, + (const BYTE*)list->ips32_tmodel, strlen(list->ips32_tmodel) + 1); RegCloseKey(ips32_key); if (res != ERROR_SUCCESS) goto error_close_clsid_key; @@ -402,14 +398,14 @@ static HRESULT register_mediatypes_parsing(struct regsvr_mediatype_parsing const if (res != ERROR_SUCCESS) goto error_close_keys; StringFromGUID2(&CLSID_AsyncReader, buf, 39); - res = RegSetValueExW(subtype_key, sourcefilter_valuename, 0, REG_SZ, (CONST BYTE*)buf, + res = RegSetValueExW(subtype_key, sourcefilter_valuename, 0, REG_SZ, (const BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); if (res != ERROR_SUCCESS) goto error_close_keys; for(i = 0; list->line[i]; i++) { char buffer[3]; wsprintfA(buffer, "%d", i); - res = RegSetValueExA(subtype_key, buffer, 0, REG_SZ, (CONST BYTE*)list->line[i], + res = RegSetValueExA(subtype_key, buffer, 0, REG_SZ, (const BYTE*)list->line[i], lstrlenA(list->line[i])); if (res != ERROR_SUCCESS) goto error_close_keys; } @@ -452,17 +448,17 @@ static HRESULT register_mediatypes_extension(struct regsvr_mediatype_extension c if (res != ERROR_SUCCESS) break; StringFromGUID2(list->majortype, buf, 39); - res = RegSetValueExW(extension_key, mediatype_name, 0, REG_SZ, (CONST BYTE*)buf, + res = RegSetValueExW(extension_key, mediatype_name, 0, REG_SZ, (const BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); if (res != ERROR_SUCCESS) goto error_close_key; StringFromGUID2(list->subtype, buf, 39); - res = RegSetValueExW(extension_key, subtype_valuename, 0, REG_SZ, (CONST BYTE*)buf, + res = RegSetValueExW(extension_key, subtype_valuename, 0, REG_SZ, (const BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); if (res != ERROR_SUCCESS) goto error_close_key; StringFromGUID2(&CLSID_AsyncReader, buf, 39); - res = RegSetValueExW(extension_key, sourcefilter_valuename, 0, REG_SZ, (CONST BYTE*)buf, + res = RegSetValueExW(extension_key, sourcefilter_valuename, 0, REG_SZ, (const BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); if (res != ERROR_SUCCESS) goto error_close_key; @@ -682,7 +678,7 @@ static LONG register_key_defvalueW( res = RegCreateKeyExW(base, name, 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) return res; - res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value, + res = RegSetValueExW(key, NULL, 0, REG_SZ, (const BYTE*)value, (lstrlenW(value) + 1) * sizeof(WCHAR)); RegCloseKey(key); return res; @@ -702,8 +698,7 @@ static LONG register_key_defvalueA( res = RegCreateKeyExW(base, name, 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) return res; - res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value, - lstrlenA(value) + 1); + res = RegSetValueExA(key, NULL, 0, REG_SZ, (const BYTE*)value, lstrlenA(value) + 1); RegCloseKey(key); return res; } @@ -727,8 +722,7 @@ static LONG register_progid( if (res != ERROR_SUCCESS) return res; if (name) { - res = RegSetValueExA(progid_key, NULL, 0, REG_SZ, - (CONST BYTE*)name, strlen(name) + 1); + res = RegSetValueExA(progid_key, NULL, 0, REG_SZ, (const BYTE*)name, strlen(name) + 1); if (res != ERROR_SUCCESS) goto error_close_progid_key; } @@ -938,6 +932,18 @@ static struct regsvr_filter const filter_list[] = { { 0xFFFFFFFF }, } }, + { &CLSID_VideoMixingRenderer, + &CLSID_LegacyAmFilterCategory, + {'V','i','d','e','o',' ','M','i','x','i','n','g',' ','R','e','n','d','e','r','e','r',0}, + 0x200000, + { { REG_PINFLAG_B_RENDERER, + { { &MEDIATYPE_Video, &GUID_NULL }, + { NULL } + }, + }, + { 0xFFFFFFFF }, + } + }, { &CLSID_VideoMixingRenderer9, &CLSID_LegacyAmFilterCategory, {'V','i','d','e','o',' ','M','i','x','i','n','g',' ','R','e','n','d','e','r','e','r',' ','9',0}, diff --git a/dll/directx/wine/quartz/videorenderer.c b/dll/directx/wine/quartz/videorenderer.c index 4070a8f65d4..42b29f1a447 100644 --- a/dll/directx/wine/quartz/videorenderer.c +++ b/dll/directx/wine/quartz/videorenderer.c @@ -1009,7 +1009,7 @@ HRESULT VideoRenderer_create(IUnknown *pUnkOuter, void **ppv) pVideoRenderer->IUnknown_inner.lpVtbl = &IInner_VTable; pVideoRenderer->IAMFilterMiscFlags_iface.lpVtbl = &IAMFilterMiscFlags_Vtbl; - pVideoRenderer->init = 0; + pVideoRenderer->init = FALSE; ZeroMemory(&pVideoRenderer->SourceRect, sizeof(RECT)); ZeroMemory(&pVideoRenderer->DestRect, sizeof(RECT)); ZeroMemory(&pVideoRenderer->WindowPos, sizeof(RECT)); diff --git a/dll/directx/wine/quartz/vmr9.c b/dll/directx/wine/quartz/vmr9.c index 3ddf5b79e1c..5968ac9dead 100644 --- a/dll/directx/wine/quartz/vmr9.c +++ b/dll/directx/wine/quartz/vmr9.c @@ -24,18 +24,25 @@ #include #include +#include -typedef struct +struct quartz_vmr { BaseRenderer renderer; BaseControlWindow baseControlWindow; BaseControlVideo baseControlVideo; IUnknown IUnknown_inner; + IAMCertifiedOutputProtection IAMCertifiedOutputProtection_iface; IAMFilterMiscFlags IAMFilterMiscFlags_iface; + IVMRFilterConfig IVMRFilterConfig_iface; IVMRFilterConfig9 IVMRFilterConfig9_iface; - IVMRWindowlessControl9 IVMRWindowlessControl9_iface; + IVMRMonitorConfig IVMRMonitorConfig_iface; + IVMRMonitorConfig9 IVMRMonitorConfig9_iface; + IVMRSurfaceAllocatorNotify IVMRSurfaceAllocatorNotify_iface; IVMRSurfaceAllocatorNotify9 IVMRSurfaceAllocatorNotify9_iface; + IVMRWindowlessControl IVMRWindowlessControl_iface; + IVMRWindowlessControl9 IVMRWindowlessControl9_iface; IVMRSurfaceAllocatorEx9 *allocator; IVMRImagePresenter9 *presenter; @@ -68,51 +75,81 @@ typedef struct RECT target_rect; LONG VideoWidth; LONG VideoHeight; -} VMR9Impl; +}; -static inline VMR9Impl *impl_from_inner_IUnknown(IUnknown *iface) +static inline struct quartz_vmr *impl_from_inner_IUnknown(IUnknown *iface) { - return CONTAINING_RECORD(iface, VMR9Impl, IUnknown_inner); + return CONTAINING_RECORD(iface, struct quartz_vmr, IUnknown_inner); } -static inline VMR9Impl *impl_from_BaseWindow( BaseWindow *wnd ) +static inline struct quartz_vmr *impl_from_BaseWindow(BaseWindow *wnd) { - return CONTAINING_RECORD(wnd, VMR9Impl, baseControlWindow.baseWindow); + return CONTAINING_RECORD(wnd, struct quartz_vmr, baseControlWindow.baseWindow); } -static inline VMR9Impl *impl_from_IVideoWindow( IVideoWindow *iface) +static inline struct quartz_vmr *impl_from_IVideoWindow(IVideoWindow *iface) { - return CONTAINING_RECORD(iface, VMR9Impl, baseControlWindow.IVideoWindow_iface); + return CONTAINING_RECORD(iface, struct quartz_vmr, baseControlWindow.IVideoWindow_iface); } -static inline VMR9Impl *impl_from_BaseControlVideo( BaseControlVideo *cvid ) +static inline struct quartz_vmr *impl_from_BaseControlVideo(BaseControlVideo *cvid) { - return CONTAINING_RECORD(cvid, VMR9Impl, baseControlVideo); + return CONTAINING_RECORD(cvid, struct quartz_vmr, baseControlVideo); } -static inline VMR9Impl *impl_from_IBasicVideo( IBasicVideo *iface) +static inline struct quartz_vmr *impl_from_IBasicVideo(IBasicVideo *iface) { - return CONTAINING_RECORD(iface, VMR9Impl, baseControlVideo.IBasicVideo_iface); + return CONTAINING_RECORD(iface, struct quartz_vmr, baseControlVideo.IBasicVideo_iface); } -static inline VMR9Impl *impl_from_IAMFilterMiscFlags( IAMFilterMiscFlags *iface) +static inline struct quartz_vmr *impl_from_IAMCertifiedOutputProtection(IAMCertifiedOutputProtection *iface) { - return CONTAINING_RECORD(iface, VMR9Impl, IAMFilterMiscFlags_iface); + return CONTAINING_RECORD(iface, struct quartz_vmr, IAMCertifiedOutputProtection_iface); } -static inline VMR9Impl *impl_from_IVMRFilterConfig9( IVMRFilterConfig9 *iface) +static inline struct quartz_vmr *impl_from_IAMFilterMiscFlags(IAMFilterMiscFlags *iface) { - return CONTAINING_RECORD(iface, VMR9Impl, IVMRFilterConfig9_iface); + return CONTAINING_RECORD(iface, struct quartz_vmr, IAMFilterMiscFlags_iface); } -static inline VMR9Impl *impl_from_IVMRWindowlessControl9( IVMRWindowlessControl9 *iface) +static inline struct quartz_vmr *impl_from_IVMRFilterConfig(IVMRFilterConfig *iface) { - return CONTAINING_RECORD(iface, VMR9Impl, IVMRWindowlessControl9_iface); + return CONTAINING_RECORD(iface, struct quartz_vmr, IVMRFilterConfig_iface); } -static inline VMR9Impl *impl_from_IVMRSurfaceAllocatorNotify9( IVMRSurfaceAllocatorNotify9 *iface) +static inline struct quartz_vmr *impl_from_IVMRFilterConfig9(IVMRFilterConfig9 *iface) { - return CONTAINING_RECORD(iface, VMR9Impl, IVMRSurfaceAllocatorNotify9_iface); + return CONTAINING_RECORD(iface, struct quartz_vmr, IVMRFilterConfig9_iface); +} + +static inline struct quartz_vmr *impl_from_IVMRMonitorConfig(IVMRMonitorConfig *iface) +{ + return CONTAINING_RECORD(iface, struct quartz_vmr, IVMRMonitorConfig_iface); +} + +static inline struct quartz_vmr *impl_from_IVMRMonitorConfig9(IVMRMonitorConfig9 *iface) +{ + return CONTAINING_RECORD(iface, struct quartz_vmr, IVMRMonitorConfig9_iface); +} + +static inline struct quartz_vmr *impl_from_IVMRSurfaceAllocatorNotify(IVMRSurfaceAllocatorNotify *iface) +{ + return CONTAINING_RECORD(iface, struct quartz_vmr, IVMRSurfaceAllocatorNotify_iface); +} + +static inline struct quartz_vmr *impl_from_IVMRSurfaceAllocatorNotify9(IVMRSurfaceAllocatorNotify9 *iface) +{ + return CONTAINING_RECORD(iface, struct quartz_vmr, IVMRSurfaceAllocatorNotify9_iface); +} + +static inline struct quartz_vmr *impl_from_IVMRWindowlessControl(IVMRWindowlessControl *iface) +{ + return CONTAINING_RECORD(iface, struct quartz_vmr, IVMRWindowlessControl_iface); +} + +static inline struct quartz_vmr *impl_from_IVMRWindowlessControl9(IVMRWindowlessControl9 *iface) +{ + return CONTAINING_RECORD(iface, struct quartz_vmr, IVMRWindowlessControl9_iface); } typedef struct @@ -136,7 +173,7 @@ typedef struct BOOL reset; VMR9AllocationInfo info; - VMR9Impl* pVMR9; + struct quartz_vmr* pVMR9; IVMRSurfaceAllocatorNotify9 *SurfaceAllocatorNotify; } VMR9DefaultAllocatorPresenterImpl; @@ -150,9 +187,10 @@ static inline VMR9DefaultAllocatorPresenterImpl *impl_from_IVMRSurfaceAllocatorE return CONTAINING_RECORD(iface, VMR9DefaultAllocatorPresenterImpl, IVMRSurfaceAllocatorEx9_iface); } -static HRESULT VMR9DefaultAllocatorPresenterImpl_create(VMR9Impl *parent, LPVOID * ppv); +static HRESULT VMR9DefaultAllocatorPresenterImpl_create(struct quartz_vmr *parent, LPVOID * ppv); -static DWORD VMR9_SendSampleData(VMR9Impl *This, VMR9PresentationInfo *info, LPBYTE data, DWORD size) +static DWORD VMR9_SendSampleData(struct quartz_vmr *This, VMR9PresentationInfo *info, LPBYTE data, + DWORD size) { AM_MEDIA_TYPE *amt; HRESULT hr = S_OK; @@ -221,7 +259,7 @@ static DWORD VMR9_SendSampleData(VMR9Impl *This, VMR9PresentationInfo *info, LPB static HRESULT WINAPI VMR9_DoRenderSample(BaseRenderer *iface, IMediaSample * pSample) { - VMR9Impl *This = (VMR9Impl *)iface; + struct quartz_vmr *This = (struct quartz_vmr*)iface; LPBYTE pbSrcStream = NULL; long cbSrcStream = 0; REFERENCE_TIME tStart, tStop; @@ -286,7 +324,7 @@ static HRESULT WINAPI VMR9_DoRenderSample(BaseRenderer *iface, IMediaSample * pS static HRESULT WINAPI VMR9_CheckMediaType(BaseRenderer *iface, const AM_MEDIA_TYPE * pmt) { - VMR9Impl *This = (VMR9Impl*)iface; + struct quartz_vmr *This = (struct quartz_vmr*)iface; if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video) || !pmt->pbFormat) return S_FALSE; @@ -323,7 +361,7 @@ static HRESULT WINAPI VMR9_CheckMediaType(BaseRenderer *iface, const AM_MEDIA_TY return S_OK; } -static HRESULT VMR9_maybe_init(VMR9Impl *This, BOOL force) +static HRESULT VMR9_maybe_init(struct quartz_vmr *This, BOOL force) { VMR9AllocationInfo info; DWORD buffers; @@ -382,7 +420,7 @@ static HRESULT VMR9_maybe_init(VMR9Impl *This, BOOL force) static VOID WINAPI VMR9_OnStartStreaming(BaseRenderer* iface) { - VMR9Impl *This = (VMR9Impl*)iface; + struct quartz_vmr *This = (struct quartz_vmr*)iface; TRACE("(%p)\n", This); @@ -400,7 +438,7 @@ static VOID WINAPI VMR9_OnStartStreaming(BaseRenderer* iface) static VOID WINAPI VMR9_OnStopStreaming(BaseRenderer* iface) { - VMR9Impl *This = (VMR9Impl*)iface; + struct quartz_vmr *This = (struct quartz_vmr*)iface; TRACE("(%p)\n", This); @@ -418,7 +456,7 @@ static HRESULT WINAPI VMR9_ShouldDrawSampleNow(BaseRenderer *This, IMediaSample static HRESULT WINAPI VMR9_CompleteConnect(BaseRenderer *This, IPin *pReceivePin) { - VMR9Impl *pVMR9 = (VMR9Impl*)This; + struct quartz_vmr *pVMR9 = (struct quartz_vmr*)This; HRESULT hr = S_OK; TRACE("(%p)\n", This); @@ -434,7 +472,7 @@ static HRESULT WINAPI VMR9_CompleteConnect(BaseRenderer *This, IPin *pReceivePin static HRESULT WINAPI VMR9_BreakConnect(BaseRenderer *This) { - VMR9Impl *pVMR9 = (VMR9Impl*)This; + struct quartz_vmr *pVMR9 = (struct quartz_vmr*)This; HRESULT hr = S_OK; if (!pVMR9->mode) @@ -488,7 +526,7 @@ static LPWSTR WINAPI VMR9_GetClassWindowStyles(BaseWindow *This, DWORD *pClassSt static RECT WINAPI VMR9_GetDefaultRect(BaseWindow *This) { - VMR9Impl* pVMR9 = impl_from_BaseWindow(This); + struct quartz_vmr* pVMR9 = impl_from_BaseWindow(This); static RECT defRect; defRect.left = defRect.top = 0; @@ -500,7 +538,7 @@ static RECT WINAPI VMR9_GetDefaultRect(BaseWindow *This) static BOOL WINAPI VMR9_OnSize(BaseWindow *This, LONG Width, LONG Height) { - VMR9Impl* pVMR9 = impl_from_BaseWindow(This); + struct quartz_vmr* pVMR9 = impl_from_BaseWindow(This); TRACE("WM_SIZE %d %d\n", Width, Height); GetClientRect(This->hWnd, &pVMR9->target_rect); @@ -522,14 +560,14 @@ static const BaseWindowFuncTable renderer_BaseWindowFuncTable = { static HRESULT WINAPI VMR9_GetSourceRect(BaseControlVideo* This, RECT *pSourceRect) { - VMR9Impl* pVMR9 = impl_from_BaseControlVideo(This); + struct quartz_vmr* pVMR9 = impl_from_BaseControlVideo(This); CopyRect(pSourceRect,&pVMR9->source_rect); return S_OK; } static HRESULT WINAPI VMR9_GetStaticImage(BaseControlVideo* This, LONG *pBufferSize, LONG *pDIBImage) { - VMR9Impl* pVMR9 = impl_from_BaseControlVideo(This); + struct quartz_vmr* pVMR9 = impl_from_BaseControlVideo(This); BITMAPINFOHEADER *bmiHeader; LONG needed_size; AM_MEDIA_TYPE *amt = &pVMR9->renderer.pInputPin->pin.mtCurrent; @@ -588,14 +626,14 @@ static HRESULT WINAPI VMR9_GetStaticImage(BaseControlVideo* This, LONG *pBufferS static HRESULT WINAPI VMR9_GetTargetRect(BaseControlVideo* This, RECT *pTargetRect) { - VMR9Impl* pVMR9 = impl_from_BaseControlVideo(This); + struct quartz_vmr* pVMR9 = impl_from_BaseControlVideo(This); CopyRect(pTargetRect,&pVMR9->target_rect); return S_OK; } static VIDEOINFOHEADER* WINAPI VMR9_GetVideoFormat(BaseControlVideo* This) { - VMR9Impl* pVMR9 = impl_from_BaseControlVideo(This); + struct quartz_vmr* pVMR9 = impl_from_BaseControlVideo(This); AM_MEDIA_TYPE *pmt; TRACE("(%p/%p)\n", pVMR9, This); @@ -617,7 +655,7 @@ static VIDEOINFOHEADER* WINAPI VMR9_GetVideoFormat(BaseControlVideo* This) static HRESULT WINAPI VMR9_IsDefaultSourceRect(BaseControlVideo* This) { - VMR9Impl* pVMR9 = impl_from_BaseControlVideo(This); + struct quartz_vmr* pVMR9 = impl_from_BaseControlVideo(This); FIXME("(%p/%p)->(): stub !!!\n", pVMR9, This); return S_OK; @@ -625,7 +663,7 @@ static HRESULT WINAPI VMR9_IsDefaultSourceRect(BaseControlVideo* This) static HRESULT WINAPI VMR9_IsDefaultTargetRect(BaseControlVideo* This) { - VMR9Impl* pVMR9 = impl_from_BaseControlVideo(This); + struct quartz_vmr* pVMR9 = impl_from_BaseControlVideo(This); FIXME("(%p/%p)->(): stub !!!\n", pVMR9, This); return S_OK; @@ -633,7 +671,7 @@ static HRESULT WINAPI VMR9_IsDefaultTargetRect(BaseControlVideo* This) static HRESULT WINAPI VMR9_SetDefaultSourceRect(BaseControlVideo* This) { - VMR9Impl* pVMR9 = impl_from_BaseControlVideo(This); + struct quartz_vmr* pVMR9 = impl_from_BaseControlVideo(This); pVMR9->source_rect.left = 0; pVMR9->source_rect.top = 0; @@ -646,7 +684,7 @@ static HRESULT WINAPI VMR9_SetDefaultSourceRect(BaseControlVideo* This) static HRESULT WINAPI VMR9_SetDefaultTargetRect(BaseControlVideo* This) { RECT rect; - VMR9Impl* pVMR9 = impl_from_BaseControlVideo(This); + struct quartz_vmr* pVMR9 = impl_from_BaseControlVideo(This); if (!GetClientRect(pVMR9->baseControlWindow.baseWindow.hWnd, &rect)) return E_FAIL; @@ -661,14 +699,14 @@ static HRESULT WINAPI VMR9_SetDefaultTargetRect(BaseControlVideo* This) static HRESULT WINAPI VMR9_SetSourceRect(BaseControlVideo* This, RECT *pSourceRect) { - VMR9Impl* pVMR9 = impl_from_BaseControlVideo(This); + struct quartz_vmr* pVMR9 = impl_from_BaseControlVideo(This); CopyRect(&pVMR9->source_rect,pSourceRect); return S_OK; } static HRESULT WINAPI VMR9_SetTargetRect(BaseControlVideo* This, RECT *pTargetRect) { - VMR9Impl* pVMR9 = impl_from_BaseControlVideo(This); + struct quartz_vmr* pVMR9 = impl_from_BaseControlVideo(This); CopyRect(&pVMR9->target_rect,pTargetRect); return S_OK; } @@ -688,7 +726,7 @@ static const BaseControlVideoFuncTable renderer_BaseControlVideoFuncTable = { static HRESULT WINAPI VMR9Inner_QueryInterface(IUnknown * iface, REFIID riid, LPVOID * ppv) { - VMR9Impl *This = impl_from_inner_IUnknown(iface); + struct quartz_vmr *This = impl_from_inner_IUnknown(iface); TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv); if (This->bAggregatable) @@ -702,14 +740,26 @@ static HRESULT WINAPI VMR9Inner_QueryInterface(IUnknown * iface, REFIID riid, LP *ppv = &This->baseControlWindow.IVideoWindow_iface; else if (IsEqualIID(riid, &IID_IBasicVideo)) *ppv = &This->baseControlVideo.IBasicVideo_iface; + else if (IsEqualIID(riid, &IID_IAMCertifiedOutputProtection)) + *ppv = &This->IAMCertifiedOutputProtection_iface; else if (IsEqualIID(riid, &IID_IAMFilterMiscFlags)) *ppv = &This->IAMFilterMiscFlags_iface; + else if (IsEqualIID(riid, &IID_IVMRFilterConfig)) + *ppv = &This->IVMRFilterConfig_iface; else if (IsEqualIID(riid, &IID_IVMRFilterConfig9)) *ppv = &This->IVMRFilterConfig9_iface; - else if (IsEqualIID(riid, &IID_IVMRWindowlessControl9) && This->mode == VMR9Mode_Windowless) - *ppv = &This->IVMRWindowlessControl9_iface; + else if (IsEqualIID(riid, &IID_IVMRMonitorConfig)) + *ppv = &This->IVMRMonitorConfig_iface; + else if (IsEqualIID(riid, &IID_IVMRMonitorConfig9)) + *ppv = &This->IVMRMonitorConfig9_iface; + else if (IsEqualIID(riid, &IID_IVMRSurfaceAllocatorNotify) && This->mode == (VMR9Mode)VMRMode_Renderless) + *ppv = &This->IVMRSurfaceAllocatorNotify_iface; else if (IsEqualIID(riid, &IID_IVMRSurfaceAllocatorNotify9) && This->mode == VMR9Mode_Renderless) *ppv = &This->IVMRSurfaceAllocatorNotify9_iface; + else if (IsEqualIID(riid, &IID_IVMRWindowlessControl) && This->mode == (VMR9Mode)VMRMode_Windowless) + *ppv = &This->IVMRWindowlessControl_iface; + else if (IsEqualIID(riid, &IID_IVMRWindowlessControl9) && This->mode == VMR9Mode_Windowless) + *ppv = &This->IVMRWindowlessControl9_iface; else { HRESULT hr; @@ -740,8 +790,6 @@ static HRESULT WINAPI VMR9Inner_QueryInterface(IUnknown * iface, REFIID riid, LP FIXME("No interface for IID_IVMRDeinterlaceControl9\n"); else if (IsEqualIID(riid, &IID_IVMRMixerBitmap9)) FIXME("No interface for IID_IVMRMixerBitmap9\n"); - else if (IsEqualIID(riid, &IID_IVMRMonitorConfig9)) - FIXME("No interface for IID_IVMRMonitorConfig9\n"); else if (IsEqualIID(riid, &IID_IVMRMixerControl9)) FIXME("No interface for IID_IVMRMixerControl9\n"); else @@ -752,7 +800,7 @@ static HRESULT WINAPI VMR9Inner_QueryInterface(IUnknown * iface, REFIID riid, LP static ULONG WINAPI VMR9Inner_AddRef(IUnknown * iface) { - VMR9Impl *This = impl_from_inner_IUnknown(iface); + struct quartz_vmr *This = impl_from_inner_IUnknown(iface); ULONG refCount = BaseFilterImpl_AddRef(&This->renderer.filter.IBaseFilter_iface); TRACE("(%p/%p)->() AddRef from %d\n", This, iface, refCount - 1); @@ -762,7 +810,7 @@ static ULONG WINAPI VMR9Inner_AddRef(IUnknown * iface) static ULONG WINAPI VMR9Inner_Release(IUnknown * iface) { - VMR9Impl *This = impl_from_inner_IUnknown(iface); + struct quartz_vmr *This = impl_from_inner_IUnknown(iface); ULONG refCount = BaseRendererImpl_Release(&This->renderer.filter.IBaseFilter_iface); TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1); @@ -771,7 +819,7 @@ static ULONG WINAPI VMR9Inner_Release(IUnknown * iface) { TRACE("Destroying\n"); BaseControlWindow_Destroy(&This->baseControlWindow); - CloseHandle(This->hD3d9); + FreeLibrary(This->hD3d9); if (This->allocator) IVMRSurfaceAllocatorEx9_Release(This->allocator); @@ -799,7 +847,7 @@ static const IUnknownVtbl IInner_VTable = static HRESULT WINAPI VMR9_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv) { - VMR9Impl *This = (VMR9Impl *)iface; + struct quartz_vmr *This = (struct quartz_vmr*)iface; if (This->bAggregatable) This->bUnkOuterValid = TRUE; @@ -829,7 +877,7 @@ static HRESULT WINAPI VMR9_QueryInterface(IBaseFilter * iface, REFIID riid, LPVO static ULONG WINAPI VMR9_AddRef(IBaseFilter * iface) { - VMR9Impl *This = (VMR9Impl *)iface; + struct quartz_vmr *This = (struct quartz_vmr*)iface; LONG ret; if (This->outer_unk && This->bUnkOuterValid) @@ -844,7 +892,7 @@ static ULONG WINAPI VMR9_AddRef(IBaseFilter * iface) static ULONG WINAPI VMR9_Release(IBaseFilter * iface) { - VMR9Impl *This = (VMR9Impl *)iface; + struct quartz_vmr *This = (struct quartz_vmr*)iface; LONG ret; if (This->outer_unk && This->bUnkOuterValid) @@ -859,7 +907,7 @@ static ULONG WINAPI VMR9_Release(IBaseFilter * iface) return 0; } -static const IBaseFilterVtbl VMR9_Vtbl = +static const IBaseFilterVtbl VMR_Vtbl = { VMR9_QueryInterface, VMR9_AddRef, @@ -881,7 +929,7 @@ static const IBaseFilterVtbl VMR9_Vtbl = /*** IUnknown methods ***/ static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface, REFIID riid, LPVOID*ppvObj) { - VMR9Impl *This = impl_from_IVideoWindow(iface); + struct quartz_vmr *This = impl_from_IVideoWindow(iface); TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj); @@ -890,7 +938,7 @@ static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface, REFIID rii static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) { - VMR9Impl *This = impl_from_IVideoWindow(iface); + struct quartz_vmr *This = impl_from_IVideoWindow(iface); TRACE("(%p/%p)->()\n", This, iface); @@ -899,7 +947,7 @@ static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) static ULONG WINAPI Videowindow_Release(IVideoWindow *iface) { - VMR9Impl *This = impl_from_IVideoWindow(iface); + struct quartz_vmr *This = impl_from_IVideoWindow(iface); TRACE("(%p/%p)->()\n", This, iface); @@ -959,7 +1007,7 @@ static const IVideoWindowVtbl IVideoWindow_VTable = /*** IUnknown methods ***/ static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface, REFIID riid, LPVOID * ppvObj) { - VMR9Impl *This = impl_from_IBasicVideo(iface); + struct quartz_vmr *This = impl_from_IBasicVideo(iface); TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj); @@ -968,7 +1016,7 @@ static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface, REFIID riid, static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) { - VMR9Impl *This = impl_from_IBasicVideo(iface); + struct quartz_vmr *This = impl_from_IBasicVideo(iface); TRACE("(%p/%p)->()\n", This, iface); @@ -977,7 +1025,7 @@ static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) static ULONG WINAPI Basicvideo_Release(IBasicVideo *iface) { - VMR9Impl *This = impl_from_IBasicVideo(iface); + struct quartz_vmr *This = impl_from_IBasicVideo(iface); TRACE("(%p/%p)->()\n", This, iface); @@ -1027,18 +1075,86 @@ static const IBasicVideoVtbl IBasicVideo_VTable = BaseControlVideoImpl_IsUsingDefaultDestination }; +static HRESULT WINAPI AMCertifiedOutputProtection_QueryInterface(IAMCertifiedOutputProtection *iface, + REFIID riid, void **ppv) +{ + struct quartz_vmr *This = impl_from_IAMCertifiedOutputProtection(iface); + return VMR9_QueryInterface(&This->renderer.filter.IBaseFilter_iface, riid, ppv); +} + +static ULONG WINAPI AMCertifiedOutputProtection_AddRef(IAMCertifiedOutputProtection *iface) +{ + struct quartz_vmr *This = impl_from_IAMCertifiedOutputProtection(iface); + return VMR9_AddRef(&This->renderer.filter.IBaseFilter_iface); +} + +static ULONG WINAPI AMCertifiedOutputProtection_Release(IAMCertifiedOutputProtection *iface) +{ + struct quartz_vmr *This = impl_from_IAMCertifiedOutputProtection(iface); + return VMR9_Release(&This->renderer.filter.IBaseFilter_iface); +} + +static HRESULT WINAPI AMCertifiedOutputProtection_KeyExchange(IAMCertifiedOutputProtection *iface, + GUID* pRandom, BYTE** VarLenCertGH, + DWORD* pdwLengthCertGH) +{ + struct quartz_vmr *This = impl_from_IAMCertifiedOutputProtection(iface); + + FIXME("(%p/%p)->(%p, %p, %p) stub\n", iface, This, pRandom, VarLenCertGH, pdwLengthCertGH); + return VFW_E_NO_COPP_HW; +} + +static HRESULT WINAPI AMCertifiedOutputProtection_SessionSequenceStart(IAMCertifiedOutputProtection *iface, + AMCOPPSignature* pSig) +{ + struct quartz_vmr *This = impl_from_IAMCertifiedOutputProtection(iface); + + FIXME("(%p/%p)->(%p) stub\n", iface, This, pSig); + return VFW_E_NO_COPP_HW; +} + +static HRESULT WINAPI AMCertifiedOutputProtection_ProtectionCommand(IAMCertifiedOutputProtection *iface, + const AMCOPPCommand* cmd) +{ + struct quartz_vmr *This = impl_from_IAMCertifiedOutputProtection(iface); + + FIXME("(%p/%p)->(%p) stub\n", iface, This, cmd); + return VFW_E_NO_COPP_HW; +} + +static HRESULT WINAPI AMCertifiedOutputProtection_ProtectionStatus(IAMCertifiedOutputProtection *iface, + const AMCOPPStatusInput* pStatusInput, + AMCOPPStatusOutput* pStatusOutput) +{ + struct quartz_vmr *This = impl_from_IAMCertifiedOutputProtection(iface); + + FIXME("(%p/%p)->(%p, %p) stub\n", iface, This, pStatusInput, pStatusOutput); + return VFW_E_NO_COPP_HW; +} + +static const IAMCertifiedOutputProtectionVtbl IAMCertifiedOutputProtection_Vtbl = +{ + AMCertifiedOutputProtection_QueryInterface, + AMCertifiedOutputProtection_AddRef, + AMCertifiedOutputProtection_Release, + AMCertifiedOutputProtection_KeyExchange, + AMCertifiedOutputProtection_SessionSequenceStart, + AMCertifiedOutputProtection_ProtectionCommand, + AMCertifiedOutputProtection_ProtectionStatus +}; + static HRESULT WINAPI AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags *iface, REFIID riid, void **ppv) { - VMR9Impl *This = impl_from_IAMFilterMiscFlags(iface); + struct quartz_vmr *This = impl_from_IAMFilterMiscFlags(iface); return VMR9_QueryInterface(&This->renderer.filter.IBaseFilter_iface, riid, ppv); } static ULONG WINAPI AMFilterMiscFlags_AddRef(IAMFilterMiscFlags *iface) { - VMR9Impl *This = impl_from_IAMFilterMiscFlags(iface); + struct quartz_vmr *This = impl_from_IAMFilterMiscFlags(iface); return VMR9_AddRef(&This->renderer.filter.IBaseFilter_iface); } static ULONG WINAPI AMFilterMiscFlags_Release(IAMFilterMiscFlags *iface) { - VMR9Impl *This = impl_from_IAMFilterMiscFlags(iface); + struct quartz_vmr *This = impl_from_IAMFilterMiscFlags(iface); return VMR9_Release(&This->renderer.filter.IBaseFilter_iface); } @@ -1053,27 +1169,406 @@ static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl = { AMFilterMiscFlags_GetMiscFlags }; +static HRESULT WINAPI VMR7FilterConfig_QueryInterface(IVMRFilterConfig *iface, REFIID riid, + void** ppv) +{ + struct quartz_vmr *This = impl_from_IVMRFilterConfig(iface); + return VMR9_QueryInterface(&This->renderer.filter.IBaseFilter_iface, riid, ppv); +} + +static ULONG WINAPI VMR7FilterConfig_AddRef(IVMRFilterConfig *iface) +{ + struct quartz_vmr *This = impl_from_IVMRFilterConfig(iface); + return VMR9_AddRef(&This->renderer.filter.IBaseFilter_iface); +} + +static ULONG WINAPI VMR7FilterConfig_Release(IVMRFilterConfig *iface) +{ + struct quartz_vmr *This = impl_from_IVMRFilterConfig(iface); + return VMR9_Release(&This->renderer.filter.IBaseFilter_iface); +} + +static HRESULT WINAPI VMR7FilterConfig_SetImageCompositor(IVMRFilterConfig *iface, + IVMRImageCompositor *compositor) +{ + struct quartz_vmr *This = impl_from_IVMRFilterConfig(iface); + + FIXME("(%p/%p)->(%p) stub\n", iface, This, compositor); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7FilterConfig_SetNumberOfStreams(IVMRFilterConfig *iface, DWORD max) +{ + struct quartz_vmr *This = impl_from_IVMRFilterConfig(iface); + + FIXME("(%p/%p)->(%u) stub\n", iface, This, max); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7FilterConfig_GetNumberOfStreams(IVMRFilterConfig *iface, DWORD *max) +{ + struct quartz_vmr *This = impl_from_IVMRFilterConfig(iface); + + FIXME("(%p/%p)->(%p) stub\n", iface, This, max); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7FilterConfig_SetRenderingPrefs(IVMRFilterConfig *iface, DWORD renderflags) +{ + struct quartz_vmr *This = impl_from_IVMRFilterConfig(iface); + + FIXME("(%p/%p)->(%u) stub\n", iface, This, renderflags); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7FilterConfig_GetRenderingPrefs(IVMRFilterConfig *iface, DWORD *renderflags) +{ + struct quartz_vmr *This = impl_from_IVMRFilterConfig(iface); + + FIXME("(%p/%p)->(%p) stub\n", iface, This, renderflags); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7FilterConfig_SetRenderingMode(IVMRFilterConfig *iface, DWORD mode) +{ + struct quartz_vmr *This = impl_from_IVMRFilterConfig(iface); + + FIXME("(%p/%p)->(%u) stub\n", iface, This, mode); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7FilterConfig_GetRenderingMode(IVMRFilterConfig *iface, DWORD *mode) +{ + struct quartz_vmr *This = impl_from_IVMRFilterConfig(iface); + + TRACE("(%p/%p)->(%p) stub\n", iface, This, mode); + if (!mode) return E_POINTER; + + if (This->mode) + *mode = This->mode; + else + *mode = VMRMode_Windowed; + + return S_OK; +} + +static const IVMRFilterConfigVtbl VMR7_FilterConfig_Vtbl = +{ + VMR7FilterConfig_QueryInterface, + VMR7FilterConfig_AddRef, + VMR7FilterConfig_Release, + VMR7FilterConfig_SetImageCompositor, + VMR7FilterConfig_SetNumberOfStreams, + VMR7FilterConfig_GetNumberOfStreams, + VMR7FilterConfig_SetRenderingPrefs, + VMR7FilterConfig_GetRenderingPrefs, + VMR7FilterConfig_SetRenderingMode, + VMR7FilterConfig_GetRenderingMode +}; + +struct get_available_monitors_args +{ + VMRMONITORINFO *info7; + VMR9MonitorInfo *info9; + DWORD arraysize; + DWORD numdev; +}; + +static BOOL CALLBACK get_available_monitors_proc(HMONITOR hmon, HDC hdc, LPRECT lprc, LPARAM lparam) +{ + struct get_available_monitors_args *args = (struct get_available_monitors_args *)lparam; + MONITORINFOEXW mi; + + if (args->info7 || args->info9) + { + + if (!args->arraysize) + return FALSE; + + mi.cbSize = sizeof(mi); + if (!GetMonitorInfoW(hmon, (MONITORINFO*)&mi)) + return TRUE; + + /* fill VMRMONITORINFO struct */ + if (args->info7) + { + VMRMONITORINFO *info = args->info7++; + memset(info, 0, sizeof(*info)); + + if (args->numdev > 0) + { + info->guid.pGUID = &info->guid.GUID; + info->guid.GUID.Data4[7] = args->numdev; + } + else + info->guid.pGUID = NULL; + + CopyRect(&info->rcMonitor, &mi.rcMonitor); + info->hMon = hmon; + info->dwFlags = mi.dwFlags; + + lstrcpynW(info->szDevice, mi.szDevice, sizeof(info->szDevice)/sizeof(WCHAR)); + + /* FIXME: how to get these values? */ + info->szDescription[0] = 0; + } + + /* fill VMR9MonitorInfo struct */ + if (args->info9) + { + VMR9MonitorInfo *info = args->info9++; + memset(info, 0, sizeof(*info)); + + info->uDevID = 0; /* FIXME */ + CopyRect(&info->rcMonitor, &mi.rcMonitor); + info->hMon = hmon; + info->dwFlags = mi.dwFlags; + + lstrcpynW(info->szDevice, mi.szDevice, sizeof(info->szDevice)/sizeof(WCHAR)); + + /* FIXME: how to get these values? */ + info->szDescription[0] = 0; + info->dwVendorId = 0; + info->dwDeviceId = 0; + info->dwSubSysId = 0; + info->dwRevision = 0; + } + + args->arraysize--; + } + + args->numdev++; + return TRUE; +} + +static HRESULT WINAPI VMR7MonitorConfig_QueryInterface(IVMRMonitorConfig *iface, REFIID riid, + LPVOID * ppv) +{ + struct quartz_vmr *This = impl_from_IVMRMonitorConfig(iface); + return VMR9_QueryInterface(&This->renderer.filter.IBaseFilter_iface, riid, ppv); +} + +static ULONG WINAPI VMR7MonitorConfig_AddRef(IVMRMonitorConfig *iface) +{ + struct quartz_vmr *This = impl_from_IVMRMonitorConfig(iface); + return VMR9_AddRef(&This->renderer.filter.IBaseFilter_iface); +} + +static ULONG WINAPI VMR7MonitorConfig_Release(IVMRMonitorConfig *iface) +{ + struct quartz_vmr *This = impl_from_IVMRMonitorConfig(iface); + return VMR9_Release(&This->renderer.filter.IBaseFilter_iface); +} + +static HRESULT WINAPI VMR7MonitorConfig_SetMonitor(IVMRMonitorConfig *iface, const VMRGUID *pGUID) +{ + struct quartz_vmr *This = impl_from_IVMRMonitorConfig(iface); + + FIXME("(%p/%p)->(%p) stub\n", iface, This, pGUID); + + if (!pGUID) + return E_POINTER; + + return S_OK; +} + +static HRESULT WINAPI VMR7MonitorConfig_GetMonitor(IVMRMonitorConfig *iface, VMRGUID *pGUID) +{ + struct quartz_vmr *This = impl_from_IVMRMonitorConfig(iface); + + FIXME("(%p/%p)->(%p) stub\n", iface, This, pGUID); + + if (!pGUID) + return E_POINTER; + + pGUID->pGUID = NULL; /* default DirectDraw device */ + return S_OK; +} + +static HRESULT WINAPI VMR7MonitorConfig_SetDefaultMonitor(IVMRMonitorConfig *iface, + const VMRGUID *pGUID) +{ + struct quartz_vmr *This = impl_from_IVMRMonitorConfig(iface); + + FIXME("(%p/%p)->(%p) stub\n", iface, This, pGUID); + + if (!pGUID) + return E_POINTER; + + return S_OK; +} + +static HRESULT WINAPI VMR7MonitorConfig_GetDefaultMonitor(IVMRMonitorConfig *iface, VMRGUID *pGUID) +{ + struct quartz_vmr *This = impl_from_IVMRMonitorConfig(iface); + + FIXME("(%p/%p)->(%p) stub\n", iface, This, pGUID); + + if (!pGUID) + return E_POINTER; + + pGUID->pGUID = NULL; /* default DirectDraw device */ + return S_OK; +} + +static HRESULT WINAPI VMR7MonitorConfig_GetAvailableMonitors(IVMRMonitorConfig *iface, + VMRMONITORINFO *info, DWORD arraysize, + DWORD *numdev) +{ + struct quartz_vmr *This = impl_from_IVMRMonitorConfig(iface); + struct get_available_monitors_args args; + + FIXME("(%p/%p)->(%p, %u, %p) semi-stub\n", iface, This, info, arraysize, numdev); + + if (!numdev) + return E_POINTER; + + if (info && arraysize == 0) + return E_INVALIDARG; + + args.info7 = info; + args.info9 = NULL; + args.arraysize = arraysize; + args.numdev = 0; + EnumDisplayMonitors(NULL, NULL, get_available_monitors_proc, (LPARAM)&args); + + *numdev = args.numdev; + return S_OK; +} + +static const IVMRMonitorConfigVtbl VMR7_MonitorConfig_Vtbl = +{ + VMR7MonitorConfig_QueryInterface, + VMR7MonitorConfig_AddRef, + VMR7MonitorConfig_Release, + VMR7MonitorConfig_SetMonitor, + VMR7MonitorConfig_GetMonitor, + VMR7MonitorConfig_SetDefaultMonitor, + VMR7MonitorConfig_GetDefaultMonitor, + VMR7MonitorConfig_GetAvailableMonitors +}; + +static HRESULT WINAPI VMR9MonitorConfig_QueryInterface(IVMRMonitorConfig9 *iface, REFIID riid, + LPVOID * ppv) +{ + struct quartz_vmr *This = impl_from_IVMRMonitorConfig9(iface); + return VMR9_QueryInterface(&This->renderer.filter.IBaseFilter_iface, riid, ppv); +} + +static ULONG WINAPI VMR9MonitorConfig_AddRef(IVMRMonitorConfig9 *iface) +{ + struct quartz_vmr *This = impl_from_IVMRMonitorConfig9(iface); + return VMR9_AddRef(&This->renderer.filter.IBaseFilter_iface); +} + +static ULONG WINAPI VMR9MonitorConfig_Release(IVMRMonitorConfig9 *iface) +{ + struct quartz_vmr *This = impl_from_IVMRMonitorConfig9(iface); + return VMR9_Release(&This->renderer.filter.IBaseFilter_iface); +} + +static HRESULT WINAPI VMR9MonitorConfig_SetMonitor(IVMRMonitorConfig9 *iface, UINT uDev) +{ + struct quartz_vmr *This = impl_from_IVMRMonitorConfig9(iface); + + FIXME("(%p/%p)->(%u) stub\n", iface, This, uDev); + + return S_OK; +} + +static HRESULT WINAPI VMR9MonitorConfig_GetMonitor(IVMRMonitorConfig9 *iface, UINT *uDev) +{ + struct quartz_vmr *This = impl_from_IVMRMonitorConfig9(iface); + + FIXME("(%p/%p)->(%p) stub\n", iface, This, uDev); + + if (!uDev) + return E_POINTER; + + *uDev = 0; + return S_OK; +} + +static HRESULT WINAPI VMR9MonitorConfig_SetDefaultMonitor(IVMRMonitorConfig9 *iface, UINT uDev) +{ + struct quartz_vmr *This = impl_from_IVMRMonitorConfig9(iface); + + FIXME("(%p/%p)->(%u) stub\n", iface, This, uDev); + + return S_OK; +} + +static HRESULT WINAPI VMR9MonitorConfig_GetDefaultMonitor(IVMRMonitorConfig9 *iface, UINT *uDev) +{ + struct quartz_vmr *This = impl_from_IVMRMonitorConfig9(iface); + + FIXME("(%p/%p)->(%p) stub\n", iface, This, uDev); + + if (!uDev) + return E_POINTER; + + *uDev = 0; + return S_OK; +} + +static HRESULT WINAPI VMR9MonitorConfig_GetAvailableMonitors(IVMRMonitorConfig9 *iface, + VMR9MonitorInfo *info, DWORD arraysize, + DWORD *numdev) +{ + struct quartz_vmr *This = impl_from_IVMRMonitorConfig9(iface); + struct get_available_monitors_args args; + + FIXME("(%p/%p)->(%p, %u, %p) semi-stub\n", iface, This, info, arraysize, numdev); + + if (!numdev) + return E_POINTER; + + if (info && arraysize == 0) + return E_INVALIDARG; + + args.info7 = NULL; + args.info9 = info; + args.arraysize = arraysize; + args.numdev = 0; + EnumDisplayMonitors(NULL, NULL, get_available_monitors_proc, (LPARAM)&args); + + *numdev = args.numdev; + return S_OK; +} + +static const IVMRMonitorConfig9Vtbl VMR9_MonitorConfig_Vtbl = +{ + VMR9MonitorConfig_QueryInterface, + VMR9MonitorConfig_AddRef, + VMR9MonitorConfig_Release, + VMR9MonitorConfig_SetMonitor, + VMR9MonitorConfig_GetMonitor, + VMR9MonitorConfig_SetDefaultMonitor, + VMR9MonitorConfig_GetDefaultMonitor, + VMR9MonitorConfig_GetAvailableMonitors +}; + static HRESULT WINAPI VMR9FilterConfig_QueryInterface(IVMRFilterConfig9 *iface, REFIID riid, LPVOID * ppv) { - VMR9Impl *This = impl_from_IVMRFilterConfig9(iface); + struct quartz_vmr *This = impl_from_IVMRFilterConfig9(iface); return VMR9_QueryInterface(&This->renderer.filter.IBaseFilter_iface, riid, ppv); } static ULONG WINAPI VMR9FilterConfig_AddRef(IVMRFilterConfig9 *iface) { - VMR9Impl *This = impl_from_IVMRFilterConfig9(iface); + struct quartz_vmr *This = impl_from_IVMRFilterConfig9(iface); return VMR9_AddRef(&This->renderer.filter.IBaseFilter_iface); } static ULONG WINAPI VMR9FilterConfig_Release(IVMRFilterConfig9 *iface) { - VMR9Impl *This = impl_from_IVMRFilterConfig9(iface); + struct quartz_vmr *This = impl_from_IVMRFilterConfig9(iface); return VMR9_Release(&This->renderer.filter.IBaseFilter_iface); } static HRESULT WINAPI VMR9FilterConfig_SetImageCompositor(IVMRFilterConfig9 *iface, IVMRImageCompositor9 *compositor) { - VMR9Impl *This = impl_from_IVMRFilterConfig9(iface); + struct quartz_vmr *This = impl_from_IVMRFilterConfig9(iface); FIXME("(%p/%p)->(%p) stub\n", iface, This, compositor); return E_NOTIMPL; @@ -1081,7 +1576,7 @@ static HRESULT WINAPI VMR9FilterConfig_SetImageCompositor(IVMRFilterConfig9 *ifa static HRESULT WINAPI VMR9FilterConfig_SetNumberOfStreams(IVMRFilterConfig9 *iface, DWORD max) { - VMR9Impl *This = impl_from_IVMRFilterConfig9(iface); + struct quartz_vmr *This = impl_from_IVMRFilterConfig9(iface); FIXME("(%p/%p)->(%u) stub\n", iface, This, max); return E_NOTIMPL; @@ -1089,7 +1584,7 @@ static HRESULT WINAPI VMR9FilterConfig_SetNumberOfStreams(IVMRFilterConfig9 *ifa static HRESULT WINAPI VMR9FilterConfig_GetNumberOfStreams(IVMRFilterConfig9 *iface, DWORD *max) { - VMR9Impl *This = impl_from_IVMRFilterConfig9(iface); + struct quartz_vmr *This = impl_from_IVMRFilterConfig9(iface); FIXME("(%p/%p)->(%p) stub\n", iface, This, max); return E_NOTIMPL; @@ -1097,7 +1592,7 @@ static HRESULT WINAPI VMR9FilterConfig_GetNumberOfStreams(IVMRFilterConfig9 *ifa static HRESULT WINAPI VMR9FilterConfig_SetRenderingPrefs(IVMRFilterConfig9 *iface, DWORD renderflags) { - VMR9Impl *This = impl_from_IVMRFilterConfig9(iface); + struct quartz_vmr *This = impl_from_IVMRFilterConfig9(iface); FIXME("(%p/%p)->(%u) stub\n", iface, This, renderflags); return E_NOTIMPL; @@ -1105,7 +1600,7 @@ static HRESULT WINAPI VMR9FilterConfig_SetRenderingPrefs(IVMRFilterConfig9 *ifac static HRESULT WINAPI VMR9FilterConfig_GetRenderingPrefs(IVMRFilterConfig9 *iface, DWORD *renderflags) { - VMR9Impl *This = impl_from_IVMRFilterConfig9(iface); + struct quartz_vmr *This = impl_from_IVMRFilterConfig9(iface); FIXME("(%p/%p)->(%p) stub\n", iface, This, renderflags); return E_NOTIMPL; @@ -1114,7 +1609,7 @@ static HRESULT WINAPI VMR9FilterConfig_GetRenderingPrefs(IVMRFilterConfig9 *ifac static HRESULT WINAPI VMR9FilterConfig_SetRenderingMode(IVMRFilterConfig9 *iface, DWORD mode) { HRESULT hr = S_OK; - VMR9Impl *This = impl_from_IVMRFilterConfig9(iface); + struct quartz_vmr *This = impl_from_IVMRFilterConfig9(iface); TRACE("(%p/%p)->(%u)\n", iface, This, mode); @@ -1167,7 +1662,7 @@ static HRESULT WINAPI VMR9FilterConfig_SetRenderingMode(IVMRFilterConfig9 *iface static HRESULT WINAPI VMR9FilterConfig_GetRenderingMode(IVMRFilterConfig9 *iface, DWORD *mode) { - VMR9Impl *This = impl_from_IVMRFilterConfig9(iface); + struct quartz_vmr *This = impl_from_IVMRFilterConfig9(iface); TRACE("(%p/%p)->(%p) stub\n", iface, This, mode); if (!mode) @@ -1195,27 +1690,238 @@ static const IVMRFilterConfig9Vtbl VMR9_FilterConfig_Vtbl = VMR9FilterConfig_GetRenderingMode }; +static HRESULT WINAPI VMR7WindowlessControl_QueryInterface(IVMRWindowlessControl *iface, REFIID riid, + LPVOID * ppv) +{ + struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface); + return VMR9_QueryInterface(&This->renderer.filter.IBaseFilter_iface, riid, ppv); +} + +static ULONG WINAPI VMR7WindowlessControl_AddRef(IVMRWindowlessControl *iface) +{ + struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface); + return VMR9_AddRef(&This->renderer.filter.IBaseFilter_iface); +} + +static ULONG WINAPI VMR7WindowlessControl_Release(IVMRWindowlessControl *iface) +{ + struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface); + return VMR9_Release(&This->renderer.filter.IBaseFilter_iface); +} + +static HRESULT WINAPI VMR7WindowlessControl_GetNativeVideoSize(IVMRWindowlessControl *iface, + LONG *width, LONG *height, + LONG *arwidth, LONG *arheight) +{ + struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface); + TRACE("(%p/%p)->(%p, %p, %p, %p)\n", iface, This, width, height, arwidth, arheight); + + if (!width || !height || !arwidth || !arheight) + { + ERR("Got no pointer\n"); + return E_POINTER; + } + + *width = This->bmiheader.biWidth; + *height = This->bmiheader.biHeight; + *arwidth = This->bmiheader.biWidth; + *arheight = This->bmiheader.biHeight; + + return S_OK; +} + +static HRESULT WINAPI VMR7WindowlessControl_GetMinIdealVideoSize(IVMRWindowlessControl *iface, + LONG *width, LONG *height) +{ + struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface); + + FIXME("(%p/%p)->(...) stub\n", iface, This); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7WindowlessControl_GetMaxIdealVideoSize(IVMRWindowlessControl *iface, + LONG *width, LONG *height) +{ + struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface); + + FIXME("(%p/%p)->(...) stub\n", iface, This); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7WindowlessControl_SetVideoPosition(IVMRWindowlessControl *iface, + const RECT *source, const RECT *dest) +{ + struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface); + + TRACE("(%p/%p)->(%p, %p)\n", iface, This, source, dest); + + EnterCriticalSection(&This->renderer.filter.csFilter); + + if (source) + This->source_rect = *source; + if (dest) + { + This->target_rect = *dest; + if (This->baseControlWindow.baseWindow.hWnd) + { + FIXME("Output rectangle: starting at %dx%d, up to point %dx%d\n", + dest->left, dest->top, dest->right, dest->bottom); + SetWindowPos(This->baseControlWindow.baseWindow.hWnd, NULL, + dest->left, dest->top, dest->right - dest->left, dest->bottom-dest->top, + SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOOWNERZORDER|SWP_NOREDRAW); + } + } + + LeaveCriticalSection(&This->renderer.filter.csFilter); + + return S_OK; +} + +static HRESULT WINAPI VMR7WindowlessControl_GetVideoPosition(IVMRWindowlessControl *iface, + RECT *source, RECT *dest) +{ + struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface); + + if (source) + *source = This->source_rect; + + if (dest) + *dest = This->target_rect; + + FIXME("(%p/%p)->(%p/%p) stub\n", iface, This, source, dest); + return S_OK; +} + +static HRESULT WINAPI VMR7WindowlessControl_GetAspectRatioMode(IVMRWindowlessControl *iface, + DWORD *mode) +{ + struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface); + + FIXME("(%p/%p)->(...) stub\n", iface, This); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7WindowlessControl_SetAspectRatioMode(IVMRWindowlessControl *iface, + DWORD mode) +{ + struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface); + + FIXME("(%p/%p)->(...) stub\n", iface, This); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7WindowlessControl_SetVideoClippingWindow(IVMRWindowlessControl *iface, + HWND hwnd) +{ + struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface); + + FIXME("(%p/%p)->(...) stub\n", iface, This); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7WindowlessControl_RepaintVideo(IVMRWindowlessControl *iface, + HWND hwnd, HDC hdc) +{ + struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface); + + FIXME("(%p/%p)->(...) stub\n", iface, This); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7WindowlessControl_DisplayModeChanged(IVMRWindowlessControl *iface) +{ + struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface); + + FIXME("(%p/%p)->(...) stub\n", iface, This); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7WindowlessControl_GetCurrentImage(IVMRWindowlessControl *iface, + BYTE **dib) +{ + struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface); + + FIXME("(%p/%p)->(...) stub\n", iface, This); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7WindowlessControl_SetBorderColor(IVMRWindowlessControl *iface, + COLORREF color) +{ + struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface); + + FIXME("(%p/%p)->(...) stub\n", iface, This); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7WindowlessControl_GetBorderColor(IVMRWindowlessControl *iface, + COLORREF *color) +{ + struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface); + + FIXME("(%p/%p)->(...) stub\n", iface, This); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7WindowlessControl_SetColorKey(IVMRWindowlessControl *iface, COLORREF color) +{ + struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface); + + FIXME("(%p/%p)->(...) stub\n", iface, This); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7WindowlessControl_GetColorKey(IVMRWindowlessControl *iface, COLORREF *color) +{ + struct quartz_vmr *This = impl_from_IVMRWindowlessControl(iface); + + FIXME("(%p/%p)->(...) stub\n", iface, This); + return E_NOTIMPL; +} + +static const IVMRWindowlessControlVtbl VMR7_WindowlessControl_Vtbl = +{ + VMR7WindowlessControl_QueryInterface, + VMR7WindowlessControl_AddRef, + VMR7WindowlessControl_Release, + VMR7WindowlessControl_GetNativeVideoSize, + VMR7WindowlessControl_GetMinIdealVideoSize, + VMR7WindowlessControl_GetMaxIdealVideoSize, + VMR7WindowlessControl_SetVideoPosition, + VMR7WindowlessControl_GetVideoPosition, + VMR7WindowlessControl_GetAspectRatioMode, + VMR7WindowlessControl_SetAspectRatioMode, + VMR7WindowlessControl_SetVideoClippingWindow, + VMR7WindowlessControl_RepaintVideo, + VMR7WindowlessControl_DisplayModeChanged, + VMR7WindowlessControl_GetCurrentImage, + VMR7WindowlessControl_SetBorderColor, + VMR7WindowlessControl_GetBorderColor, + VMR7WindowlessControl_SetColorKey, + VMR7WindowlessControl_GetColorKey +}; + static HRESULT WINAPI VMR9WindowlessControl_QueryInterface(IVMRWindowlessControl9 *iface, REFIID riid, LPVOID * ppv) { - VMR9Impl *This = impl_from_IVMRWindowlessControl9(iface); + struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface); return VMR9_QueryInterface(&This->renderer.filter.IBaseFilter_iface, riid, ppv); } static ULONG WINAPI VMR9WindowlessControl_AddRef(IVMRWindowlessControl9 *iface) { - VMR9Impl *This = impl_from_IVMRWindowlessControl9(iface); + struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface); return VMR9_AddRef(&This->renderer.filter.IBaseFilter_iface); } static ULONG WINAPI VMR9WindowlessControl_Release(IVMRWindowlessControl9 *iface) { - VMR9Impl *This = impl_from_IVMRWindowlessControl9(iface); + struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface); return VMR9_Release(&This->renderer.filter.IBaseFilter_iface); } static HRESULT WINAPI VMR9WindowlessControl_GetNativeVideoSize(IVMRWindowlessControl9 *iface, LONG *width, LONG *height, LONG *arwidth, LONG *arheight) { - VMR9Impl *This = impl_from_IVMRWindowlessControl9(iface); + struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface); TRACE("(%p/%p)->(%p, %p, %p, %p)\n", iface, This, width, height, arwidth, arheight); if (!width || !height || !arwidth || !arheight) @@ -1234,7 +1940,7 @@ static HRESULT WINAPI VMR9WindowlessControl_GetNativeVideoSize(IVMRWindowlessCon static HRESULT WINAPI VMR9WindowlessControl_GetMinIdealVideoSize(IVMRWindowlessControl9 *iface, LONG *width, LONG *height) { - VMR9Impl *This = impl_from_IVMRWindowlessControl9(iface); + struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface); FIXME("(%p/%p)->(...) stub\n", iface, This); return E_NOTIMPL; @@ -1242,7 +1948,7 @@ static HRESULT WINAPI VMR9WindowlessControl_GetMinIdealVideoSize(IVMRWindowlessC static HRESULT WINAPI VMR9WindowlessControl_GetMaxIdealVideoSize(IVMRWindowlessControl9 *iface, LONG *width, LONG *height) { - VMR9Impl *This = impl_from_IVMRWindowlessControl9(iface); + struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface); FIXME("(%p/%p)->(...) stub\n", iface, This); return E_NOTIMPL; @@ -1250,7 +1956,7 @@ static HRESULT WINAPI VMR9WindowlessControl_GetMaxIdealVideoSize(IVMRWindowlessC static HRESULT WINAPI VMR9WindowlessControl_SetVideoPosition(IVMRWindowlessControl9 *iface, const RECT *source, const RECT *dest) { - VMR9Impl *This = impl_from_IVMRWindowlessControl9(iface); + struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface); TRACE("(%p/%p)->(%p, %p)\n", iface, This, source, dest); @@ -1276,7 +1982,7 @@ static HRESULT WINAPI VMR9WindowlessControl_SetVideoPosition(IVMRWindowlessContr static HRESULT WINAPI VMR9WindowlessControl_GetVideoPosition(IVMRWindowlessControl9 *iface, RECT *source, RECT *dest) { - VMR9Impl *This = impl_from_IVMRWindowlessControl9(iface); + struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface); if (source) *source = This->source_rect; @@ -1290,7 +1996,7 @@ static HRESULT WINAPI VMR9WindowlessControl_GetVideoPosition(IVMRWindowlessContr static HRESULT WINAPI VMR9WindowlessControl_GetAspectRatioMode(IVMRWindowlessControl9 *iface, DWORD *mode) { - VMR9Impl *This = impl_from_IVMRWindowlessControl9(iface); + struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface); FIXME("(%p/%p)->(...) stub\n", iface, This); return E_NOTIMPL; @@ -1298,7 +2004,7 @@ static HRESULT WINAPI VMR9WindowlessControl_GetAspectRatioMode(IVMRWindowlessCon static HRESULT WINAPI VMR9WindowlessControl_SetAspectRatioMode(IVMRWindowlessControl9 *iface, DWORD mode) { - VMR9Impl *This = impl_from_IVMRWindowlessControl9(iface); + struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface); FIXME("(%p/%p)->(...) stub\n", iface, This); return E_NOTIMPL; @@ -1306,7 +2012,7 @@ static HRESULT WINAPI VMR9WindowlessControl_SetAspectRatioMode(IVMRWindowlessCon static HRESULT WINAPI VMR9WindowlessControl_SetVideoClippingWindow(IVMRWindowlessControl9 *iface, HWND hwnd) { - VMR9Impl *This = impl_from_IVMRWindowlessControl9(iface); + struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface); TRACE("(%p/%p)->(%p)\n", iface, This, hwnd); @@ -1321,7 +2027,7 @@ static HRESULT WINAPI VMR9WindowlessControl_SetVideoClippingWindow(IVMRWindowles static HRESULT WINAPI VMR9WindowlessControl_RepaintVideo(IVMRWindowlessControl9 *iface, HWND hwnd, HDC hdc) { - VMR9Impl *This = impl_from_IVMRWindowlessControl9(iface); + struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface); HRESULT hr; FIXME("(%p/%p)->(...) semi-stub\n", iface, This); @@ -1350,7 +2056,7 @@ static HRESULT WINAPI VMR9WindowlessControl_RepaintVideo(IVMRWindowlessControl9 static HRESULT WINAPI VMR9WindowlessControl_DisplayModeChanged(IVMRWindowlessControl9 *iface) { - VMR9Impl *This = impl_from_IVMRWindowlessControl9(iface); + struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface); FIXME("(%p/%p)->(...) stub\n", iface, This); return E_NOTIMPL; @@ -1358,7 +2064,7 @@ static HRESULT WINAPI VMR9WindowlessControl_DisplayModeChanged(IVMRWindowlessCon static HRESULT WINAPI VMR9WindowlessControl_GetCurrentImage(IVMRWindowlessControl9 *iface, BYTE **dib) { - VMR9Impl *This = impl_from_IVMRWindowlessControl9(iface); + struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface); FIXME("(%p/%p)->(...) stub\n", iface, This); return E_NOTIMPL; @@ -1366,7 +2072,7 @@ static HRESULT WINAPI VMR9WindowlessControl_GetCurrentImage(IVMRWindowlessContro static HRESULT WINAPI VMR9WindowlessControl_SetBorderColor(IVMRWindowlessControl9 *iface, COLORREF color) { - VMR9Impl *This = impl_from_IVMRWindowlessControl9(iface); + struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface); FIXME("(%p/%p)->(...) stub\n", iface, This); return E_NOTIMPL; @@ -1374,7 +2080,7 @@ static HRESULT WINAPI VMR9WindowlessControl_SetBorderColor(IVMRWindowlessControl static HRESULT WINAPI VMR9WindowlessControl_GetBorderColor(IVMRWindowlessControl9 *iface, COLORREF *color) { - VMR9Impl *This = impl_from_IVMRWindowlessControl9(iface); + struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface); FIXME("(%p/%p)->(...) stub\n", iface, This); return E_NOTIMPL; @@ -1400,27 +2106,113 @@ static const IVMRWindowlessControl9Vtbl VMR9_WindowlessControl_Vtbl = VMR9WindowlessControl_GetBorderColor }; +static HRESULT WINAPI VMR7SurfaceAllocatorNotify_QueryInterface(IVMRSurfaceAllocatorNotify *iface, + REFIID riid, LPVOID * ppv) +{ + struct quartz_vmr *This = impl_from_IVMRSurfaceAllocatorNotify(iface); + return VMR9_QueryInterface(&This->renderer.filter.IBaseFilter_iface, riid, ppv); +} + +static ULONG WINAPI VMR7SurfaceAllocatorNotify_AddRef(IVMRSurfaceAllocatorNotify *iface) +{ + struct quartz_vmr *This = impl_from_IVMRSurfaceAllocatorNotify(iface); + return VMR9_AddRef(&This->renderer.filter.IBaseFilter_iface); +} + +static ULONG WINAPI VMR7SurfaceAllocatorNotify_Release(IVMRSurfaceAllocatorNotify *iface) +{ + struct quartz_vmr *This = impl_from_IVMRSurfaceAllocatorNotify(iface); + return VMR9_Release(&This->renderer.filter.IBaseFilter_iface); +} + +static HRESULT WINAPI VMR7SurfaceAllocatorNotify_AdviseSurfaceAllocator(IVMRSurfaceAllocatorNotify *iface, + DWORD_PTR id, + IVMRSurfaceAllocator *alloc) +{ + struct quartz_vmr *This = impl_from_IVMRSurfaceAllocatorNotify(iface); + + FIXME("(%p/%p)->(...) stub\n", iface, This); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7SurfaceAllocatorNotify_SetDDrawDevice(IVMRSurfaceAllocatorNotify *iface, + IDirectDraw7 *device, HMONITOR monitor) +{ + struct quartz_vmr *This = impl_from_IVMRSurfaceAllocatorNotify(iface); + + FIXME("(%p/%p)->(...) stub\n", iface, This); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7SurfaceAllocatorNotify_ChangeDDrawDevice(IVMRSurfaceAllocatorNotify *iface, + IDirectDraw7 *device, HMONITOR monitor) +{ + struct quartz_vmr *This = impl_from_IVMRSurfaceAllocatorNotify(iface); + + FIXME("(%p/%p)->(...) stub\n", iface, This); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7SurfaceAllocatorNotify_RestoreDDrawSurfaces(IVMRSurfaceAllocatorNotify *iface) +{ + struct quartz_vmr *This = impl_from_IVMRSurfaceAllocatorNotify(iface); + + FIXME("(%p/%p)->(...) stub\n", iface, This); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7SurfaceAllocatorNotify_NotifyEvent(IVMRSurfaceAllocatorNotify *iface, LONG code, + LONG_PTR param1, LONG_PTR param2) +{ + struct quartz_vmr *This = impl_from_IVMRSurfaceAllocatorNotify(iface); + + FIXME("(%p/%p)->(...) stub\n", iface, This); + return E_NOTIMPL; +} + +static HRESULT WINAPI VMR7SurfaceAllocatorNotify_SetBorderColor(IVMRSurfaceAllocatorNotify *iface, + COLORREF clrBorder) +{ + struct quartz_vmr *This = impl_from_IVMRSurfaceAllocatorNotify(iface); + + FIXME("(%p/%p)->(...) stub\n", iface, This); + return E_NOTIMPL; +} + +static const IVMRSurfaceAllocatorNotifyVtbl VMR7_SurfaceAllocatorNotify_Vtbl = +{ + VMR7SurfaceAllocatorNotify_QueryInterface, + VMR7SurfaceAllocatorNotify_AddRef, + VMR7SurfaceAllocatorNotify_Release, + VMR7SurfaceAllocatorNotify_AdviseSurfaceAllocator, + VMR7SurfaceAllocatorNotify_SetDDrawDevice, + VMR7SurfaceAllocatorNotify_ChangeDDrawDevice, + VMR7SurfaceAllocatorNotify_RestoreDDrawSurfaces, + VMR7SurfaceAllocatorNotify_NotifyEvent, + VMR7SurfaceAllocatorNotify_SetBorderColor +}; + static HRESULT WINAPI VMR9SurfaceAllocatorNotify_QueryInterface(IVMRSurfaceAllocatorNotify9 *iface, REFIID riid, LPVOID * ppv) { - VMR9Impl *This = impl_from_IVMRSurfaceAllocatorNotify9(iface); + struct quartz_vmr *This = impl_from_IVMRSurfaceAllocatorNotify9(iface); return VMR9_QueryInterface(&This->renderer.filter.IBaseFilter_iface, riid, ppv); } static ULONG WINAPI VMR9SurfaceAllocatorNotify_AddRef(IVMRSurfaceAllocatorNotify9 *iface) { - VMR9Impl *This = impl_from_IVMRSurfaceAllocatorNotify9(iface); + struct quartz_vmr *This = impl_from_IVMRSurfaceAllocatorNotify9(iface); return VMR9_AddRef(&This->renderer.filter.IBaseFilter_iface); } static ULONG WINAPI VMR9SurfaceAllocatorNotify_Release(IVMRSurfaceAllocatorNotify9 *iface) { - VMR9Impl *This = impl_from_IVMRSurfaceAllocatorNotify9(iface); + struct quartz_vmr *This = impl_from_IVMRSurfaceAllocatorNotify9(iface); return VMR9_Release(&This->renderer.filter.IBaseFilter_iface); } static HRESULT WINAPI VMR9SurfaceAllocatorNotify_AdviseSurfaceAllocator(IVMRSurfaceAllocatorNotify9 *iface, DWORD_PTR id, IVMRSurfaceAllocator9 *alloc) { - VMR9Impl *This = impl_from_IVMRSurfaceAllocatorNotify9(iface); + struct quartz_vmr *This = impl_from_IVMRSurfaceAllocatorNotify9(iface); /* FIXME: This code is not tested!!! */ FIXME("(%p/%p)->(...) stub\n", iface, This); @@ -1446,7 +2238,7 @@ static HRESULT WINAPI VMR9SurfaceAllocatorNotify_AdviseSurfaceAllocator(IVMRSurf static HRESULT WINAPI VMR9SurfaceAllocatorNotify_SetD3DDevice(IVMRSurfaceAllocatorNotify9 *iface, IDirect3DDevice9 *device, HMONITOR monitor) { - VMR9Impl *This = impl_from_IVMRSurfaceAllocatorNotify9(iface); + struct quartz_vmr *This = impl_from_IVMRSurfaceAllocatorNotify9(iface); FIXME("(%p/%p)->(...) semi-stub\n", iface, This); if (This->allocator_d3d9_dev) @@ -1460,7 +2252,7 @@ static HRESULT WINAPI VMR9SurfaceAllocatorNotify_SetD3DDevice(IVMRSurfaceAllocat static HRESULT WINAPI VMR9SurfaceAllocatorNotify_ChangeD3DDevice(IVMRSurfaceAllocatorNotify9 *iface, IDirect3DDevice9 *device, HMONITOR monitor) { - VMR9Impl *This = impl_from_IVMRSurfaceAllocatorNotify9(iface); + struct quartz_vmr *This = impl_from_IVMRSurfaceAllocatorNotify9(iface); FIXME("(%p/%p)->(...) semi-stub\n", iface, This); if (This->allocator_d3d9_dev) @@ -1474,7 +2266,7 @@ static HRESULT WINAPI VMR9SurfaceAllocatorNotify_ChangeD3DDevice(IVMRSurfaceAllo static HRESULT WINAPI VMR9SurfaceAllocatorNotify_AllocateSurfaceHelper(IVMRSurfaceAllocatorNotify9 *iface, VMR9AllocationInfo *allocinfo, DWORD *numbuffers, IDirect3DSurface9 **surface) { - VMR9Impl *This = impl_from_IVMRSurfaceAllocatorNotify9(iface); + struct quartz_vmr *This = impl_from_IVMRSurfaceAllocatorNotify9(iface); DWORD i; HRESULT hr = S_OK; @@ -1542,13 +2334,13 @@ static HRESULT WINAPI VMR9SurfaceAllocatorNotify_AllocateSurfaceHelper(IVMRSurfa static HRESULT WINAPI VMR9SurfaceAllocatorNotify_NotifyEvent(IVMRSurfaceAllocatorNotify9 *iface, LONG code, LONG_PTR param1, LONG_PTR param2) { - VMR9Impl *This = impl_from_IVMRSurfaceAllocatorNotify9(iface); + struct quartz_vmr *This = impl_from_IVMRSurfaceAllocatorNotify9(iface); FIXME("(%p/%p)->(...) stub\n", iface, This); return E_NOTIMPL; } -static const IVMRSurfaceAllocatorNotify9Vtbl IVMRSurfaceAllocatorNotify9_Vtbl = +static const IVMRSurfaceAllocatorNotify9Vtbl VMR9_SurfaceAllocatorNotify_Vtbl = { VMR9SurfaceAllocatorNotify_QueryInterface, VMR9SurfaceAllocatorNotify_AddRef, @@ -1560,67 +2352,92 @@ static const IVMRSurfaceAllocatorNotify9Vtbl IVMRSurfaceAllocatorNotify9_Vtbl = VMR9SurfaceAllocatorNotify_NotifyEvent }; -HRESULT VMR9Impl_create(IUnknown * outer_unk, LPVOID * ppv) +static HRESULT vmr_create(IUnknown *outer_unk, LPVOID *ppv, const CLSID *clsid) { HRESULT hr; - VMR9Impl * pVMR9; + struct quartz_vmr* pVMR; TRACE("(%p, %p)\n", outer_unk, ppv); *ppv = NULL; - pVMR9 = CoTaskMemAlloc(sizeof(VMR9Impl)); + pVMR = CoTaskMemAlloc(sizeof(struct quartz_vmr)); - pVMR9->hD3d9 = LoadLibraryA("d3d9.dll"); - if (!pVMR9->hD3d9 ) + pVMR->hD3d9 = LoadLibraryA("d3d9.dll"); + if (!pVMR->hD3d9 ) { WARN("Could not load d3d9.dll\n"); - CoTaskMemFree(pVMR9); + CoTaskMemFree(pVMR); return VFW_E_DDRAW_CAPS_NOT_SUITABLE; } - pVMR9->outer_unk = outer_unk; - pVMR9->bUnkOuterValid = FALSE; - pVMR9->bAggregatable = FALSE; - pVMR9->IUnknown_inner.lpVtbl = &IInner_VTable; - pVMR9->IAMFilterMiscFlags_iface.lpVtbl = &IAMFilterMiscFlags_Vtbl; + pVMR->outer_unk = outer_unk; + pVMR->bUnkOuterValid = FALSE; + pVMR->bAggregatable = FALSE; + pVMR->IUnknown_inner.lpVtbl = &IInner_VTable; + pVMR->IAMCertifiedOutputProtection_iface.lpVtbl = &IAMCertifiedOutputProtection_Vtbl; + pVMR->IAMFilterMiscFlags_iface.lpVtbl = &IAMFilterMiscFlags_Vtbl; - pVMR9->mode = 0; - pVMR9->allocator_d3d9_dev = NULL; - pVMR9->allocator_mon= NULL; - pVMR9->num_surfaces = pVMR9->cur_surface = 0; - pVMR9->allocator = NULL; - pVMR9->presenter = NULL; - pVMR9->hWndClippingWindow = NULL; - pVMR9->IVMRFilterConfig9_iface.lpVtbl = &VMR9_FilterConfig_Vtbl; - pVMR9->IVMRWindowlessControl9_iface.lpVtbl = &VMR9_WindowlessControl_Vtbl; - pVMR9->IVMRSurfaceAllocatorNotify9_iface.lpVtbl = &IVMRSurfaceAllocatorNotify9_Vtbl; + pVMR->mode = 0; + pVMR->allocator_d3d9_dev = NULL; + pVMR->allocator_mon= NULL; + pVMR->num_surfaces = pVMR->cur_surface = 0; + pVMR->allocator = NULL; + pVMR->presenter = NULL; + pVMR->hWndClippingWindow = NULL; + pVMR->IVMRFilterConfig_iface.lpVtbl = &VMR7_FilterConfig_Vtbl; + pVMR->IVMRFilterConfig9_iface.lpVtbl = &VMR9_FilterConfig_Vtbl; + pVMR->IVMRMonitorConfig_iface.lpVtbl = &VMR7_MonitorConfig_Vtbl; + pVMR->IVMRMonitorConfig9_iface.lpVtbl = &VMR9_MonitorConfig_Vtbl; + pVMR->IVMRSurfaceAllocatorNotify_iface.lpVtbl = &VMR7_SurfaceAllocatorNotify_Vtbl; + pVMR->IVMRSurfaceAllocatorNotify9_iface.lpVtbl = &VMR9_SurfaceAllocatorNotify_Vtbl; + pVMR->IVMRWindowlessControl_iface.lpVtbl = &VMR7_WindowlessControl_Vtbl; + pVMR->IVMRWindowlessControl9_iface.lpVtbl = &VMR9_WindowlessControl_Vtbl; + + if (IsEqualGUID(clsid, &CLSID_VideoMixingRenderer)) + hr = BaseRenderer_Init(&pVMR->renderer, &VMR_Vtbl, outer_unk, &CLSID_VideoMixingRenderer, + (DWORD_PTR)(__FILE__ ": VMR7Impl.csFilter"), &BaseFuncTable); + else + hr = BaseRenderer_Init(&pVMR->renderer, &VMR_Vtbl, outer_unk, &CLSID_VideoMixingRenderer9, + (DWORD_PTR)(__FILE__ ": VMR9Impl.csFilter"), &BaseFuncTable); - hr = BaseRenderer_Init(&pVMR9->renderer, &VMR9_Vtbl, outer_unk, &CLSID_VideoMixingRenderer9, (DWORD_PTR)(__FILE__ ": VMR9Impl.csFilter"), &BaseFuncTable); if (FAILED(hr)) goto fail; - hr = BaseControlWindow_Init(&pVMR9->baseControlWindow, &IVideoWindow_VTable, &pVMR9->renderer.filter, &pVMR9->renderer.filter.csFilter, &pVMR9->renderer.pInputPin->pin, &renderer_BaseWindowFuncTable); + hr = BaseControlWindow_Init(&pVMR->baseControlWindow, &IVideoWindow_VTable, &pVMR->renderer.filter, + &pVMR->renderer.filter.csFilter, &pVMR->renderer.pInputPin->pin, + &renderer_BaseWindowFuncTable); if (FAILED(hr)) goto fail; - hr = BaseControlVideo_Init(&pVMR9->baseControlVideo, &IBasicVideo_VTable, &pVMR9->renderer.filter, &pVMR9->renderer.filter.csFilter, &pVMR9->renderer.pInputPin->pin, &renderer_BaseControlVideoFuncTable); + hr = BaseControlVideo_Init(&pVMR->baseControlVideo, &IBasicVideo_VTable, &pVMR->renderer.filter, + &pVMR->renderer.filter.csFilter, &pVMR->renderer.pInputPin->pin, + &renderer_BaseControlVideoFuncTable); if (FAILED(hr)) goto fail; - *ppv = (LPVOID)pVMR9; - ZeroMemory(&pVMR9->source_rect, sizeof(RECT)); - ZeroMemory(&pVMR9->target_rect, sizeof(RECT)); - TRACE("Created at %p\n", pVMR9); + *ppv = (LPVOID)pVMR; + ZeroMemory(&pVMR->source_rect, sizeof(RECT)); + ZeroMemory(&pVMR->target_rect, sizeof(RECT)); + TRACE("Created at %p\n", pVMR); return hr; fail: - BaseRendererImpl_Release(&pVMR9->renderer.filter.IBaseFilter_iface); - CloseHandle(pVMR9->hD3d9); - CoTaskMemFree(pVMR9); + BaseRendererImpl_Release(&pVMR->renderer.filter.IBaseFilter_iface); + FreeLibrary(pVMR->hD3d9); + CoTaskMemFree(pVMR); return hr; } +HRESULT VMR7Impl_create(IUnknown *outer_unk, LPVOID *ppv) +{ + return vmr_create(outer_unk, ppv, &CLSID_VideoMixingRenderer); +} + +HRESULT VMR9Impl_create(IUnknown *outer_unk, LPVOID *ppv) +{ + return vmr_create(outer_unk, ppv, &CLSID_VideoMixingRenderer9); +} static HRESULT WINAPI VMR9_ImagePresenter_QueryInterface(IVMRImagePresenter9 *iface, REFIID riid, LPVOID * ppv) @@ -2229,7 +3046,7 @@ static IDirect3D9 *init_d3d9(HMODULE d3d9_handle) return d3d9_create(D3D_SDK_VERSION); } -static HRESULT VMR9DefaultAllocatorPresenterImpl_create(VMR9Impl *parent, LPVOID * ppv) +static HRESULT VMR9DefaultAllocatorPresenterImpl_create(struct quartz_vmr *parent, LPVOID * ppv) { HRESULT hr = S_OK; int i; diff --git a/dll/directx/wine/wined3d/arb_program_shader.c b/dll/directx/wine/wined3d/arb_program_shader.c index 2d30dd2d5f5..3519c783b1c 100644 --- a/dll/directx/wine/wined3d/arb_program_shader.c +++ b/dll/directx/wine/wined3d/arb_program_shader.c @@ -9,7 +9,7 @@ * Copyright 2006 Ivan Gyurdiev * Copyright 2006 Jason Green * Copyright 2006 Henri Verbeet - * Copyright 2007-2011, 2013 Stefan Dösinger for CodeWeavers + * Copyright 2007-2011, 2013-2014 Stefan Dösinger for CodeWeavers * Copyright 2009 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or @@ -1786,6 +1786,11 @@ static void shader_hw_map2gl(const struct wined3d_shader_instruction *ins) static void shader_hw_nop(const struct wined3d_shader_instruction *ins) {} +static DWORD shader_arb_select_component(DWORD swizzle, DWORD component) +{ + return ((swizzle >> 2 * component) & 0x3) * 0x55; +} + static void shader_hw_mov(const struct wined3d_shader_instruction *ins) { const struct wined3d_shader *shader = ins->ctx->shader; @@ -1856,7 +1861,7 @@ static void shader_hw_mov(const struct wined3d_shader_instruction *ins) * with more than one component. Thus replicate the first source argument over all * 4 components. For example, .xyzw -> .x (or better: .xxxx), .zwxy -> .z, etc) */ struct wined3d_shader_src_param tmp_src = ins->src[0]; - tmp_src.swizzle = (tmp_src.swizzle & 0x3) * 0x55; + tmp_src.swizzle = shader_arb_select_component(tmp_src.swizzle, 0); shader_arb_get_src_param(ins, &tmp_src, 0, src0_param); shader_addline(buffer, "ARL A0.x, %s;\n", src0_param); } @@ -2466,30 +2471,36 @@ static void shader_hw_mnxn(const struct wined3d_shader_instruction *ins) } } -static void shader_hw_rcp(const struct wined3d_shader_instruction *ins) +static DWORD abs_modifier(DWORD mod, BOOL *need_abs) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + *need_abs = FALSE; - char dst[50]; - char src[50]; - - shader_arb_get_dst_param(ins, &ins->dst[0], dst); /* Destination */ - shader_arb_get_src_param(ins, &ins->src[0], 0, src); - if (ins->src[0].swizzle == WINED3DSP_NOSWIZZLE) + switch(mod) { - /* Dx sdk says .x is used if no swizzle is given, but our test shows that - * .w is used - */ - strcat(src, ".w"); + case WINED3DSPSM_NONE: return WINED3DSPSM_ABS; + case WINED3DSPSM_NEG: return WINED3DSPSM_ABS; + case WINED3DSPSM_BIAS: *need_abs = TRUE; return WINED3DSPSM_BIAS; + case WINED3DSPSM_BIASNEG: *need_abs = TRUE; return WINED3DSPSM_BIASNEG; + case WINED3DSPSM_SIGN: *need_abs = TRUE; return WINED3DSPSM_SIGN; + case WINED3DSPSM_SIGNNEG: *need_abs = TRUE; return WINED3DSPSM_SIGNNEG; + case WINED3DSPSM_COMP: *need_abs = TRUE; return WINED3DSPSM_COMP; + case WINED3DSPSM_X2: *need_abs = TRUE; return WINED3DSPSM_X2; + case WINED3DSPSM_X2NEG: *need_abs = TRUE; return WINED3DSPSM_X2NEG; + case WINED3DSPSM_DZ: *need_abs = TRUE; return WINED3DSPSM_DZ; + case WINED3DSPSM_DW: *need_abs = TRUE; return WINED3DSPSM_DW; + case WINED3DSPSM_ABS: return WINED3DSPSM_ABS; + case WINED3DSPSM_ABSNEG: return WINED3DSPSM_ABS; } - - shader_addline(buffer, "RCP%s %s, %s;\n", shader_arb_get_modifier(ins), dst, src); + FIXME("Unknown modifier %u\n", mod); + return mod; } static void shader_hw_scalar_op(const struct wined3d_shader_instruction *ins) { struct wined3d_shader_buffer *buffer = ins->ctx->buffer; const char *instruction; + struct wined3d_shader_src_param src0_copy = ins->src[0]; + BOOL need_abs = FALSE; char dst[50]; char src[50]; @@ -2498,24 +2509,46 @@ static void shader_hw_scalar_op(const struct wined3d_shader_instruction *ins) { case WINED3DSIH_RSQ: instruction = "RSQ"; break; case WINED3DSIH_RCP: instruction = "RCP"; break; - case WINED3DSIH_EXP: instruction = "EX2"; break; - case WINED3DSIH_EXPP: instruction = "EXP"; break; + case WINED3DSIH_EXPP: + if (ins->ctx->reg_maps->shader_version.major < 2) + { + instruction = "EXP"; + break; + } + /* Drop through. */ + case WINED3DSIH_EXP: + instruction = "EX2"; + break; + case WINED3DSIH_LOG: + case WINED3DSIH_LOGP: + /* The precision requirements suggest that LOGP matches ARBvp's LOG + * instruction, but notice that the output of those instructions is + * different. */ + src0_copy.modifiers = abs_modifier(src0_copy.modifiers, &need_abs); + instruction = "LG2"; + break; default: instruction = ""; FIXME("Unhandled opcode %#x\n", ins->handler_idx); break; } + /* Dx sdk says .x is used if no swizzle is given, but our test shows that + * .w is used. */ + src0_copy.swizzle = shader_arb_select_component(src0_copy.swizzle, 3); + shader_arb_get_dst_param(ins, &ins->dst[0], dst); /* Destination */ - shader_arb_get_src_param(ins, &ins->src[0], 0, src); - if (ins->src[0].swizzle == WINED3DSP_NOSWIZZLE) + shader_arb_get_src_param(ins, &src0_copy, 0, src); + + if(need_abs) { - /* Dx sdk says .x is used if no swizzle is given, but our test shows that - * .w is used - */ - strcat(src, ".w"); + shader_addline(buffer, "ABS TA.w, %s;\n", src); + shader_addline(buffer, "%s%s %s, TA.w;\n", instruction, shader_arb_get_modifier(ins), dst); + } + else + { + shader_addline(buffer, "%s%s %s, %s;\n", instruction, shader_arb_get_modifier(ins), dst, src); } - shader_addline(buffer, "%s%s %s, %s;\n", instruction, shader_arb_get_modifier(ins), dst, src); } static void shader_hw_nrm(const struct wined3d_shader_instruction *ins) @@ -2755,64 +2788,6 @@ static void shader_hw_dsy(const struct wined3d_shader_instruction *ins) shader_addline(buffer, "MUL%s %s, %s, ycorrection.y;\n", shader_arb_get_modifier(ins), dst, dst_name); } -static DWORD abs_modifier(DWORD mod, BOOL *need_abs) -{ - *need_abs = FALSE; - - switch(mod) - { - case WINED3DSPSM_NONE: return WINED3DSPSM_ABS; - case WINED3DSPSM_NEG: return WINED3DSPSM_ABS; - case WINED3DSPSM_BIAS: *need_abs = TRUE; return WINED3DSPSM_BIAS; - case WINED3DSPSM_BIASNEG: *need_abs = TRUE; return WINED3DSPSM_BIASNEG; - case WINED3DSPSM_SIGN: *need_abs = TRUE; return WINED3DSPSM_SIGN; - case WINED3DSPSM_SIGNNEG: *need_abs = TRUE; return WINED3DSPSM_SIGNNEG; - case WINED3DSPSM_COMP: *need_abs = TRUE; return WINED3DSPSM_COMP; - case WINED3DSPSM_X2: *need_abs = TRUE; return WINED3DSPSM_X2; - case WINED3DSPSM_X2NEG: *need_abs = TRUE; return WINED3DSPSM_X2NEG; - case WINED3DSPSM_DZ: *need_abs = TRUE; return WINED3DSPSM_DZ; - case WINED3DSPSM_DW: *need_abs = TRUE; return WINED3DSPSM_DW; - case WINED3DSPSM_ABS: return WINED3DSPSM_ABS; - case WINED3DSPSM_ABSNEG: return WINED3DSPSM_ABS; - } - FIXME("Unknown modifier %u\n", mod); - return mod; -} - -static void shader_hw_log(const struct wined3d_shader_instruction *ins) -{ - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; - char src0[50], dst[50]; - struct wined3d_shader_src_param src0_copy = ins->src[0]; - BOOL need_abs = FALSE; - const char *instr; - - switch(ins->handler_idx) - { - case WINED3DSIH_LOG: instr = "LG2"; break; - case WINED3DSIH_LOGP: instr = "LOG"; break; - default: - ERR("Unexpected instruction %d\n", ins->handler_idx); - return; - } - - /* LOG and LOGP operate on the absolute value of the input */ - src0_copy.modifiers = abs_modifier(src0_copy.modifiers, &need_abs); - - shader_arb_get_dst_param(ins, &ins->dst[0], dst); - shader_arb_get_src_param(ins, &src0_copy, 0, src0); - - if(need_abs) - { - shader_addline(buffer, "ABS TA, %s;\n", src0); - shader_addline(buffer, "%s%s %s, TA;\n", instr, shader_arb_get_modifier(ins), dst); - } - else - { - shader_addline(buffer, "%s%s %s, %s;\n", instr, shader_arb_get_modifier(ins), dst, src0); - } -} - static void shader_hw_pow(const struct wined3d_shader_instruction *ins) { struct wined3d_shader_buffer *buffer = ins->ctx->buffer; @@ -5046,8 +5021,12 @@ static BOOL shader_arb_allocate_context_data(struct wined3d_context *context) static void shader_arb_free_context_data(struct wined3d_context *context) { - struct shader_arb_priv *priv = context->swapchain->device->shader_priv; + struct shader_arb_priv *priv; + if (!context->swapchain) + return; + + priv = context->swapchain->device->shader_priv; if (priv->last_context == context) priv->last_context = NULL; } @@ -5233,8 +5212,8 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL /* WINED3DSIH_LABEL */ shader_hw_label, /* WINED3DSIH_LD */ NULL, /* WINED3DSIH_LIT */ shader_hw_map2gl, - /* WINED3DSIH_LOG */ shader_hw_log, - /* WINED3DSIH_LOGP */ shader_hw_log, + /* WINED3DSIH_LOG */ shader_hw_scalar_op, + /* WINED3DSIH_LOGP */ shader_hw_scalar_op, /* WINED3DSIH_LOOP */ shader_hw_loop, /* WINED3DSIH_LRP */ shader_hw_lrp, /* WINED3DSIH_LT */ NULL, @@ -5254,7 +5233,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL /* WINED3DSIH_NRM */ shader_hw_nrm, /* WINED3DSIH_PHASE */ shader_hw_nop, /* WINED3DSIH_POW */ shader_hw_pow, - /* WINED3DSIH_RCP */ shader_hw_rcp, + /* WINED3DSIH_RCP */ shader_hw_scalar_op, /* WINED3DSIH_REP */ shader_hw_rep, /* WINED3DSIH_RET */ shader_hw_ret, /* WINED3DSIH_ROUND_NI */ NULL, @@ -6762,21 +6741,72 @@ const struct fragment_pipeline arbfp_fragment_pipeline = { arbfp_fragmentstate_template, }; -struct arbfp_blit_priv { - GLenum yuy2_rect_shader, yuy2_2d_shader; - GLenum uyvy_rect_shader, uyvy_2d_shader; - GLenum yv12_rect_shader, yv12_2d_shader; - GLenum p8_rect_shader, p8_2d_shader; +struct arbfp_blit_type +{ + enum complex_fixup fixup; + GLenum textype; +}; + +struct arbfp_blit_desc +{ + GLenum shader; + struct arbfp_blit_type type; + struct wine_rb_entry entry; +}; + +struct arbfp_blit_priv +{ + struct wine_rb_tree shaders; GLuint palette_texture; }; +static int arbfp_blit_type_compare(const void *key, const struct wine_rb_entry *entry) +{ + const struct arbfp_blit_type *ka = key; + const struct arbfp_blit_type *kb = &WINE_RB_ENTRY_VALUE(entry, const struct arbfp_blit_desc, entry)->type; + + if (ka->fixup != kb->fixup) + return ka->fixup < kb->fixup ? -1 : 1; + if (ka->textype != kb->textype) + return ka->textype < kb->textype ? -1 : 1; + return 0; +} + +/* Context activation is done by the caller. */ +static void arbfp_free_blit_shader(struct wine_rb_entry *entry, void *context) +{ + const struct wined3d_gl_info *gl_info = context; + struct arbfp_blit_desc *entry_arb = WINE_RB_ENTRY_VALUE(entry, struct arbfp_blit_desc, entry); + + GL_EXTCALL(glDeleteProgramsARB(1, &entry_arb->shader)); + checkGLcall("glDeleteProgramsARB(1, &entry_arb->shader)"); + HeapFree(GetProcessHeap(), 0, entry_arb); +} + +const struct wine_rb_functions wined3d_arbfp_blit_rb_functions = +{ + wined3d_rb_alloc, + wined3d_rb_realloc, + wined3d_rb_free, + arbfp_blit_type_compare, +}; + static HRESULT arbfp_blit_alloc(struct wined3d_device *device) { - device->blit_priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct arbfp_blit_priv)); - if(!device->blit_priv) { - ERR("Out of memory\n"); + struct arbfp_blit_priv *priv; + + if (!(priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*priv)))) + return E_OUTOFMEMORY; + + if (wine_rb_init(&priv->shaders, &wined3d_arbfp_blit_rb_functions) == -1) + { + ERR("Failed to initialize rbtree.\n"); + HeapFree(GetProcessHeap(), 0, priv); return E_OUTOFMEMORY; } + + device->blit_priv = priv; + return WINED3D_OK; } @@ -6786,15 +6816,8 @@ static void arbfp_blit_free(struct wined3d_device *device) const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; struct arbfp_blit_priv *priv = device->blit_priv; - GL_EXTCALL(glDeleteProgramsARB(1, &priv->yuy2_rect_shader)); - GL_EXTCALL(glDeleteProgramsARB(1, &priv->yuy2_2d_shader)); - GL_EXTCALL(glDeleteProgramsARB(1, &priv->uyvy_rect_shader)); - GL_EXTCALL(glDeleteProgramsARB(1, &priv->uyvy_2d_shader)); - GL_EXTCALL(glDeleteProgramsARB(1, &priv->yv12_rect_shader)); - GL_EXTCALL(glDeleteProgramsARB(1, &priv->yv12_2d_shader)); - GL_EXTCALL(glDeleteProgramsARB(1, &priv->p8_rect_shader)); - GL_EXTCALL(glDeleteProgramsARB(1, &priv->p8_2d_shader)); - checkGLcall("Delete yuv and p8 programs"); + wine_rb_destroy(&priv->shaders, arbfp_free_blit_shader, &device->adapter->gl_info); + checkGLcall("Delete blit programs"); if (priv->palette_texture) gl_info->gl_ops.gl.p_glDeleteTextures(1, &priv->palette_texture); @@ -6926,11 +6949,11 @@ static BOOL gen_yv12_read(struct wined3d_shader_buffer *buffer, GLenum textype, * | | * +----------------+-----------------+---- * | | | - * | U even rows | U odd rows | + * | V even rows | V odd rows | * | | | 1 * +----------------+------------------ - * | | | 3 - * | V even rows | V odd rows | + * | U even rows | U odd rows | * | | | * +----------------+-----------------+---- * | | | @@ -6997,7 +7020,7 @@ static BOOL gen_yv12_read(struct wined3d_shader_buffer *buffer, GLenum textype, shader_addline(buffer, "MAD temp.y, size.y, coef.w, size.y;\n"); shader_addline(buffer, "ADD temp.y, temp.y, -coef.y;\n"); shader_addline(buffer, "MIN texcrd.y, temp.y, texcrd.y;\n"); - shader_addline(buffer, "ADD temp.y, size.y, -coef.y;\n"); + shader_addline(buffer, "ADD temp.y, size.y, coef.y;\n"); shader_addline(buffer, "MAX texcrd.y, temp.y, texcrd.y;\n"); } /* Read the texture, put the result into the output register */ @@ -7040,6 +7063,154 @@ static BOOL gen_yv12_read(struct wined3d_shader_buffer *buffer, GLenum textype, return TRUE; } +static BOOL gen_nv12_read(struct wined3d_shader_buffer *buffer, GLenum textype, + char *luminance) +{ + const char *tex; + static const float nv12_coef[] + = {2.0f / 3.0f, 1.0f / 3.0f, 1.0f, 1.0f}; + + switch (textype) + { + case GL_TEXTURE_2D: + tex = "2D"; + break; + case GL_TEXTURE_RECTANGLE_ARB: + tex = "RECT"; + break; + default: + FIXME("Implement nv12 correction for non-2d, non-rect textures\n"); + return FALSE; + } + + /* NV12 surfaces contain a WxH sized luminance plane, followed by a (W/2)x(H/2) + * sized plane where each component is an UV pair. So the effective + * bitdepth is 12 bits per pixel If the whole texture is interpreted as luminance + * data it looks approximately like this: + * + * +----------------------------------+---- + * | | + * | | + * | | + * | | + * | | 2 + * | LUMINANCE | - + * | | 3 + * | | + * | | + * | | + * | | + * +----------------------------------+---- + * |UVUVUVUVUVUVUVUVUVUVUVUVUVUVUVUVUV| + * |UVUVUVUVUVUVUVUVUVUVUVUVUVUVUVUVUV| + * | | 1 + * | | - + * | | 3 + * | | + * | | + * +----------------------------------+---- + * + * When reading from rectangle textures, keep in mind that the input y coordinates + * go from 0 to d3d_height, whereas the opengl texture height is 1.5 * d3d_height. */ + + shader_addline(buffer, "PARAM nv12_coef = "); + shader_arb_append_imm_vec4(buffer, nv12_coef); + shader_addline(buffer, ";\n"); + + shader_addline(buffer, "MOV texcrd, fragment.texcoord[0];\n"); + /* We only have half the number of chroma pixels. */ + shader_addline(buffer, "MUL texcrd.x, texcrd.x, coef.y;\n"); + + if (textype == GL_TEXTURE_2D) + { + shader_addline(buffer, "RCP chroma.w, size.x;\n"); + shader_addline(buffer, "RCP chroma.z, size.y;\n"); + + shader_addline(buffer, "MAD texcrd.y, texcrd.y, nv12_coef.y, nv12_coef.x;\n"); + + /* We must not allow filtering horizontally, this would mix U and V. + * Vertical filtering is ok. However, bear in mind that the pixel center is at + * 0.5, so add 0.5. */ + + /* Convert to non-normalized coordinates so we can find the + * individual pixel. */ + shader_addline(buffer, "MUL texcrd.x, texcrd.x, size.x;\n"); + shader_addline(buffer, "FLR texcrd.x, texcrd.x;\n"); + /* Multiply by 2 since chroma components are stored in UV pixel pairs, + * add 0.5 to hit the center of the pixel. */ + shader_addline(buffer, "MAD texcrd.x, texcrd.x, coef.z, coef.y;\n"); + + /* Convert back to normalized coordinates. */ + shader_addline(buffer, "MUL texcrd.x, texcrd.x, chroma.w;\n"); + + /* Clamp, keep the half pixel origin in mind. */ + shader_addline(buffer, "MAD temp.y, coef.y, chroma.z, nv12_coef.x;\n"); + shader_addline(buffer, "MAX texcrd.y, temp.y, texcrd.y;\n"); + shader_addline(buffer, "MAD temp.y, -coef.y, chroma.z, nv12_coef.z;\n"); + shader_addline(buffer, "MIN texcrd.y, temp.y, texcrd.y;\n"); + } + else + { + /* Read from [size - size+size/2] */ + shader_addline(buffer, "MAD texcrd.y, texcrd.y, coef.y, size.y;\n"); + + shader_addline(buffer, "FLR texcrd.x, texcrd.x;\n"); + /* Multiply by 2 since chroma components are stored in UV pixel pairs, + * add 0.5 to hit the center of the pixel. */ + shader_addline(buffer, "MAD texcrd.x, texcrd.x, coef.z, coef.y;\n"); + + /* Clamp */ + shader_addline(buffer, "MAD temp.y, size.y, coef.y, size.y;\n"); + shader_addline(buffer, "ADD temp.y, temp.y, -coef.y;\n"); + shader_addline(buffer, "MIN texcrd.y, temp.y, texcrd.y;\n"); + shader_addline(buffer, "ADD temp.y, size.y, coef.y;\n"); + shader_addline(buffer, "MAX texcrd.y, temp.y, texcrd.y;\n"); + } + /* Read the texture, put the result into the output register. */ + shader_addline(buffer, "TEX temp, texcrd, texture[0], %s;\n", tex); + shader_addline(buffer, "MOV chroma.y, temp.w;\n"); + + if (textype == GL_TEXTURE_2D) + { + /* Add 1/size.x */ + shader_addline(buffer, "ADD texcrd.x, texcrd.x, chroma.w;\n"); + } + else + { + /* Add 1 */ + shader_addline(buffer, "ADD texcrd.x, texcrd.x, coef.x;\n"); + } + shader_addline(buffer, "TEX temp, texcrd, texture[0], %s;\n", tex); + shader_addline(buffer, "MOV chroma.x, temp.w;\n"); + + /* Sample the luminance value. It is in the top 2/3rd of the texture, so scale the y coordinate. + * Clamp the y coordinate to prevent the chroma values from bleeding into the sampled luminance + * values due to filtering. */ + shader_addline(buffer, "MOV texcrd, fragment.texcoord[0];\n"); + if (textype == GL_TEXTURE_2D) + { + /* Multiply the y coordinate by 2/3 and clamp it */ + shader_addline(buffer, "MUL texcrd.y, texcrd.y, nv12_coef.x;\n"); + shader_addline(buffer, "MAD temp.y, -coef.y, chroma.w, nv12_coef.x;\n"); + shader_addline(buffer, "MIN texcrd.y, temp.y, texcrd.y;\n"); + shader_addline(buffer, "TEX luminance, texcrd, texture[0], %s;\n", tex); + } + else + { + /* Reading from texture_rectangles is pretty straightforward, just use the unmodified + * texture coordinate. It is still a good idea to clamp it though, since the opengl texture + * is bigger + */ + shader_addline(buffer, "ADD temp.x, size.y, -coef.y;\n"); + shader_addline(buffer, "MIN texcrd.y, texcrd.y, size.x;\n"); + shader_addline(buffer, "TEX luminance, texcrd, texture[0], %s;\n", tex); + } + *luminance = 'a'; + + return TRUE; +} + +/* Context activation is done by the caller. */ static GLuint gen_p8_shader(struct arbfp_blit_priv *priv, const struct wined3d_gl_info *gl_info, GLenum textype) { @@ -7093,11 +7264,6 @@ static GLuint gen_p8_shader(struct arbfp_blit_priv *priv, shader_arb_dump_program_source(buffer.buffer); } - if (textype == GL_TEXTURE_RECTANGLE_ARB) - priv->p8_rect_shader = shader; - else - priv->p8_2d_shader = shader; - shader_buffer_free(&buffer); return shader; @@ -7224,6 +7390,14 @@ static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_ } break; + case COMPLEX_FIXUP_NV12: + if (!gen_nv12_read(&buffer, textype, &luminance_component)) + { + shader_buffer_free(&buffer); + return 0; + } + break; + default: FIXME("Unsupported YUV fixup %#x\n", yuv_fixup); shader_buffer_free(&buffer); @@ -7264,26 +7438,6 @@ static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_ shader_buffer_free(&buffer); - switch (yuv_fixup) - { - case COMPLEX_FIXUP_YUY2: - if (textype == GL_TEXTURE_RECTANGLE_ARB) priv->yuy2_rect_shader = shader; - else priv->yuy2_2d_shader = shader; - break; - - case COMPLEX_FIXUP_UYVY: - if (textype == GL_TEXTURE_RECTANGLE_ARB) priv->uyvy_rect_shader = shader; - else priv->uyvy_2d_shader = shader; - break; - - case COMPLEX_FIXUP_YV12: - if (textype == GL_TEXTURE_RECTANGLE_ARB) priv->yv12_rect_shader = shader; - else priv->yv12_2d_shader = shader; - break; - default: - ERR("Unsupported complex fixup: %d\n", yuv_fixup); - } - return shader; } @@ -7296,6 +7450,9 @@ static HRESULT arbfp_blit_set(void *blit_priv, struct wined3d_context *context, enum complex_fixup fixup; const struct wined3d_gl_info *gl_info = context->gl_info; GLenum textype = surface->container->target; + struct wine_rb_entry *entry; + struct arbfp_blit_type type; + struct arbfp_blit_desc *desc; if (surface->flags & SFLAG_CONVERTED) { @@ -7316,35 +7473,57 @@ static HRESULT arbfp_blit_set(void *blit_priv, struct wined3d_context *context, fixup = get_complex_fixup(surface->resource.format->color_fixup); - switch(fixup) + type.fixup = fixup; + type.textype = textype; + entry = wine_rb_get(&priv->shaders, &type); + if (entry) { - case COMPLEX_FIXUP_YUY2: - shader = textype == GL_TEXTURE_RECTANGLE_ARB ? priv->yuy2_rect_shader : priv->yuy2_2d_shader; - break; + desc = WINE_RB_ENTRY_VALUE(entry, struct arbfp_blit_desc, entry); + shader = desc->shader; + } + else + { + switch (fixup) + { + case COMPLEX_FIXUP_P8: + shader = gen_p8_shader(priv, gl_info, textype); + break; - case COMPLEX_FIXUP_UYVY: - shader = textype == GL_TEXTURE_RECTANGLE_ARB ? priv->uyvy_rect_shader : priv->uyvy_2d_shader; - break; + default: + shader = gen_yuv_shader(priv, gl_info, fixup, textype); + break; + } - case COMPLEX_FIXUP_YV12: - shader = textype == GL_TEXTURE_RECTANGLE_ARB ? priv->yv12_rect_shader : priv->yv12_2d_shader; - break; - - case COMPLEX_FIXUP_P8: - shader = textype == GL_TEXTURE_RECTANGLE_ARB ? priv->p8_rect_shader : priv->p8_2d_shader; - if (!shader) shader = gen_p8_shader(priv, gl_info, textype); - - upload_palette(surface, context); - break; - - default: + if (!shader) + { FIXME("Unsupported complex fixup %#x, not setting a shader\n", fixup); gl_info->gl_ops.gl.p_glEnable(textype); checkGLcall("glEnable(textype)"); return E_NOTIMPL; + } + + desc = HeapAlloc(GetProcessHeap(), 0, sizeof(*desc)); + if (!desc) + goto err_out; + + desc->type.textype = textype; + desc->type.fixup = fixup; + desc->shader = shader; + if (wine_rb_put(&priv->shaders, &desc->type, &desc->entry) == -1) + { +err_out: + ERR("Out of memory\n"); + GL_EXTCALL(glDeleteProgramsARB(1, &shader)); + checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &shader))"); + GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0)); + checkGLcall("glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0)"); + HeapFree(GetProcessHeap(), 0, desc); + return E_OUTOFMEMORY; + } } - if (!shader) shader = gen_yuv_shader(priv, gl_info, fixup, textype); + if (fixup == COMPLEX_FIXUP_P8) + upload_palette(surface, context); gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB); checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB)"); @@ -7424,6 +7603,7 @@ static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info, enum win case COMPLEX_FIXUP_YUY2: case COMPLEX_FIXUP_UYVY: case COMPLEX_FIXUP_YV12: + case COMPLEX_FIXUP_NV12: case COMPLEX_FIXUP_P8: TRACE("[OK]\n"); return TRUE; diff --git a/dll/directx/wine/wined3d/buffer.c b/dll/directx/wine/wined3d/buffer.c index 6a6fbcf2776..2bffe83e7ae 100644 --- a/dll/directx/wine/wined3d/buffer.c +++ b/dll/directx/wine/wined3d/buffer.c @@ -941,13 +941,20 @@ struct wined3d_resource * CDECL wined3d_buffer_get_resource(struct wined3d_buffe HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UINT size, BYTE **data, DWORD flags) { - BOOL dirty = buffer_is_dirty(buffer); LONG count; BYTE *base; TRACE("buffer %p, offset %u, size %u, data %p, flags %#x\n", buffer, offset, size, data, flags); flags = wined3d_resource_sanitize_map_flags(&buffer->resource, flags); + /* Filter redundant WINED3D_MAP_DISCARD maps. The 3DMark2001 multitexture + * fill rate test seems to depend on this. When we map a buffer with + * GL_MAP_INVALIDATE_BUFFER_BIT, the driver is free to discard the + * previous contents of the buffer. The r600g driver only does this when + * the buffer is currently in use, while the proprietary NVIDIA driver + * appears to do this unconditionally. */ + if (buffer->flags & WINED3D_BUFFER_DISCARD) + flags &= ~WINED3D_MAP_DISCARD; count = ++buffer->resource.map_count; if (buffer->buffer_object) @@ -1023,25 +1030,14 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN context_release(context); } } - else - { - if (dirty) - { - if (buffer->flags & WINED3D_BUFFER_NOSYNC && !(flags & WINED3D_MAP_NOOVERWRITE)) - { - buffer->flags &= ~WINED3D_BUFFER_NOSYNC; - } - } - else if(flags & WINED3D_MAP_NOOVERWRITE) - { - buffer->flags |= WINED3D_BUFFER_NOSYNC; - } - if (flags & WINED3D_MAP_DISCARD) - { - buffer->flags |= WINED3D_BUFFER_DISCARD; - } - } + if (flags & WINED3D_MAP_DISCARD) + buffer->flags |= WINED3D_BUFFER_DISCARD; + + if (!(flags & WINED3D_MAP_NOOVERWRITE)) + buffer->flags &= ~WINED3D_BUFFER_NOSYNC; + else if (!buffer_is_dirty(buffer)) + buffer->flags |= WINED3D_BUFFER_NOSYNC; } base = buffer->map_ptr ? buffer->map_ptr : buffer->resource.heap_memory; @@ -1114,6 +1110,7 @@ void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer) context_release(context); buffer_clear_dirty_areas(buffer); + buffer->map_ptr = NULL; } else if (buffer->flags & WINED3D_BUFFER_HASDESC) { diff --git a/dll/directx/wine/wined3d/context.c b/dll/directx/wine/wined3d/context.c index b9afbe1f8b4..a8d30335b43 100644 --- a/dll/directx/wine/wined3d/context.c +++ b/dll/directx/wine/wined3d/context.c @@ -606,6 +606,53 @@ void context_free_event_query(struct wined3d_event_query *query) context->free_event_queries[context->free_event_query_count++] = query->object; } +/* Context activation is done by the caller. */ +void context_alloc_timestamp_query(struct wined3d_context *context, struct wined3d_timestamp_query *query) +{ + const struct wined3d_gl_info *gl_info = context->gl_info; + + if (context->free_timestamp_query_count) + { + query->id = context->free_timestamp_queries[--context->free_timestamp_query_count]; + } + else + { + GL_EXTCALL(glGenQueriesARB(1, &query->id)); + checkGLcall("glGenQueriesARB"); + + TRACE("Allocated timestamp query %u in context %p.\n", query->id, context); + } + + query->context = context; + list_add_head(&context->timestamp_queries, &query->entry); +} + +void context_free_timestamp_query(struct wined3d_timestamp_query *query) +{ + struct wined3d_context *context = query->context; + + list_remove(&query->entry); + query->context = NULL; + + if (context->free_timestamp_query_count >= context->free_timestamp_query_size - 1) + { + UINT new_size = context->free_timestamp_query_size << 1; + GLuint *new_data = HeapReAlloc(GetProcessHeap(), 0, context->free_timestamp_queries, + new_size * sizeof(*context->free_timestamp_queries)); + + if (!new_data) + { + ERR("Failed to grow free list, leaking query %u in context %p.\n", query->id, context); + return; + } + + context->free_timestamp_query_size = new_size; + context->free_timestamp_queries = new_data; + } + + context->free_timestamp_queries[context->free_timestamp_query_count++] = query->id; +} + typedef void (context_fbo_entry_func_t)(struct wined3d_context *context, struct fbo_entry *entry); static void context_enum_surface_fbo_entries(const struct wined3d_device *device, @@ -711,11 +758,47 @@ void context_surface_update(struct wined3d_context *context, const struct wined3 } } -static BOOL context_set_pixel_format(const struct wined3d_gl_info *gl_info, HDC dc, int format) +static BOOL context_restore_pixel_format(struct wined3d_context *ctx) { - int current = GetPixelFormat(dc); + const struct wined3d_gl_info *gl_info = ctx->gl_info; + BOOL ret = FALSE; - if (current == format) return TRUE; + if (ctx->restore_pf && IsWindow(ctx->restore_pf_win)) + { + if (ctx->gl_info->supported[WGL_WINE_PIXEL_FORMAT_PASSTHROUGH]) + { + HDC dc = GetDC(ctx->restore_pf_win); + if (dc) + { + if (!(ret = GL_EXTCALL(wglSetPixelFormatWINE(dc, ctx->restore_pf)))) + { + ERR("wglSetPixelFormatWINE failed to restore pixel format %d on window %p.\n", + ctx->restore_pf, ctx->restore_pf_win); + } + ReleaseDC(ctx->restore_pf_win, dc); + } + } + else + { + ERR("can't restore pixel format %d on window %p\n", ctx->restore_pf, ctx->restore_pf_win); + } + } + + ctx->restore_pf = 0; + ctx->restore_pf_win = NULL; + return ret; +} + +static BOOL context_set_pixel_format(struct wined3d_context *context, HDC dc, BOOL private, int format) +{ + const struct wined3d_gl_info *gl_info = context->gl_info; + int current; + + if (dc == context->hdc && context->hdc_is_private && context->hdc_has_format) + return TRUE; + + current = GetPixelFormat(dc); + if (current == format) goto success; if (!current) { @@ -726,7 +809,10 @@ static BOOL context_set_pixel_format(const struct wined3d_gl_info *gl_info, HDC format, dc, GetLastError()); return FALSE; } - return TRUE; + + context->restore_pf = 0; + context->restore_pf_win = private ? NULL : WindowFromDC(dc); + goto success; } /* By default WGL doesn't allow pixel format adjustments but we need it @@ -735,13 +821,25 @@ static BOOL context_set_pixel_format(const struct wined3d_gl_info *gl_info, HDC * when really needed. */ if (gl_info->supported[WGL_WINE_PIXEL_FORMAT_PASSTHROUGH]) { + HWND win; + if (!GL_EXTCALL(wglSetPixelFormatWINE(dc, format))) { ERR("wglSetPixelFormatWINE failed to set pixel format %d on device context %p.\n", format, dc); return FALSE; } - return TRUE; + + win = private ? NULL : WindowFromDC(dc); + if (win != context->restore_pf_win) + { + context_restore_pixel_format(context); + + context->restore_pf = private ? 0 : current; + context->restore_pf_win = win; + } + + goto success; } /* OpenGL doesn't allow pixel format adjustments. Print an error and @@ -751,6 +849,11 @@ static BOOL context_set_pixel_format(const struct wined3d_gl_info *gl_info, HDC ERR("Unable to set pixel format %d on device context %p. Already using format %d.\n", format, dc, current); return TRUE; + +success: + if (dc == context->hdc && context->hdc_is_private) + context->hdc_has_format = TRUE; + return TRUE; } static BOOL context_set_gl_context(struct wined3d_context *ctx) @@ -758,7 +861,7 @@ static BOOL context_set_gl_context(struct wined3d_context *ctx) struct wined3d_swapchain *swapchain = ctx->swapchain; BOOL backup = FALSE; - if (!context_set_pixel_format(ctx->gl_info, ctx->hdc, ctx->pixel_format)) + if (!context_set_pixel_format(ctx, ctx->hdc, ctx->hdc_is_private, ctx->pixel_format)) { WARN("Failed to set pixel format %d on device context %p.\n", ctx->pixel_format, ctx->hdc); @@ -791,7 +894,7 @@ static BOOL context_set_gl_context(struct wined3d_context *ctx) return FALSE; } - if (!context_set_pixel_format(ctx->gl_info, dc, ctx->pixel_format)) + if (!context_set_pixel_format(ctx, dc, TRUE, ctx->pixel_format)) { ERR("Failed to set pixel format %d on device context %p.\n", ctx->pixel_format, dc); @@ -809,18 +912,12 @@ static BOOL context_set_gl_context(struct wined3d_context *ctx) ctx->valid = 1; } + ctx->needs_set = 0; return TRUE; } -static void context_restore_gl_context(const struct wined3d_gl_info *gl_info, HDC dc, HGLRC gl_ctx, int pf) +static void context_restore_gl_context(const struct wined3d_gl_info *gl_info, HDC dc, HGLRC gl_ctx) { - if (!context_set_pixel_format(gl_info, dc, pf)) - { - ERR("Failed to restore pixel format %d on device context %p.\n", pf, dc); - context_set_current(NULL); - return; - } - if (!wglMakeCurrent(dc, gl_ctx)) { ERR("Failed to restore GL context %p on device context %p, last error %#x.\n", @@ -837,53 +934,47 @@ static void context_update_window(struct wined3d_context *context) TRACE("Updating context %p window from %p to %p.\n", context, context->win_handle, context->swapchain->win_handle); - if (context->valid) + if (context->hdc) wined3d_release_dc(context->win_handle, context->hdc); - else - context->valid = 1; context->win_handle = context->swapchain->win_handle; + context->hdc_is_private = FALSE; + context->hdc_has_format = FALSE; + context->needs_set = 1; + context->valid = 1; if (!(context->hdc = GetDC(context->win_handle))) { ERR("Failed to get a device context for window %p.\n", context->win_handle); - goto err; + context->valid = 0; } - - if (!context_set_pixel_format(context->gl_info, context->hdc, context->pixel_format)) - { - ERR("Failed to set pixel format %d on device context %p.\n", - context->pixel_format, context->hdc); - goto err; - } - - context_set_gl_context(context); - - return; - -err: - context->valid = 0; } static void context_destroy_gl_resources(struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; + struct wined3d_timestamp_query *timestamp_query; struct wined3d_occlusion_query *occlusion_query; struct wined3d_event_query *event_query; struct fbo_entry *entry, *entry2; HGLRC restore_ctx; HDC restore_dc; unsigned int i; - int restore_pf; restore_ctx = wglGetCurrentContext(); restore_dc = wglGetCurrentDC(); - restore_pf = GetPixelFormat(restore_dc); - if (context->valid && restore_ctx != context->glCtx) - context_set_gl_context(context); - else + if (restore_ctx == context->glCtx) restore_ctx = NULL; + else if (context->valid) + context_set_gl_context(context); + + LIST_FOR_EACH_ENTRY(timestamp_query, &context->timestamp_queries, struct wined3d_timestamp_query, entry) + { + if (context->valid) + GL_EXTCALL(glDeleteQueriesARB(1, ×tamp_query->id)); + timestamp_query->context = NULL; + } LIST_FOR_EACH_ENTRY(occlusion_query, &context->occlusion_queries, struct wined3d_occlusion_query, entry) { @@ -925,6 +1016,9 @@ static void context_destroy_gl_resources(struct wined3d_context *context) GL_EXTCALL(glDeleteProgramsARB(1, &context->dummy_arbfp_prog)); } + if (gl_info->supported[ARB_TIMER_QUERY]) + GL_EXTCALL(glDeleteQueriesARB(context->free_timestamp_query_count, context->free_timestamp_queries)); + if (gl_info->supported[ARB_OCCLUSION_QUERY]) GL_EXTCALL(glDeleteQueriesARB(context->free_occlusion_query_count, context->free_occlusion_queries)); @@ -953,12 +1047,14 @@ static void context_destroy_gl_resources(struct wined3d_context *context) checkGLcall("context cleanup"); } + HeapFree(GetProcessHeap(), 0, context->free_timestamp_queries); HeapFree(GetProcessHeap(), 0, context->free_occlusion_queries); HeapFree(GetProcessHeap(), 0, context->free_event_queries); + context_restore_pixel_format(context); if (restore_ctx) { - context_restore_gl_context(gl_info, restore_dc, restore_ctx, restore_pf); + context_restore_gl_context(gl_info, restore_dc, restore_ctx); } else if (wglGetCurrentContext() && !wglMakeCurrent(NULL, NULL)) { @@ -1054,12 +1150,17 @@ void context_release(struct wined3d_context *context) WARN("Context %p is not the current context.\n", context); } - if (!--context->level && context->restore_ctx) + if (!--context->level) { - TRACE("Restoring GL context %p on device context %p.\n", context->restore_ctx, context->restore_dc); - context_restore_gl_context(context->gl_info, context->restore_dc, context->restore_ctx, context->restore_pf); - context->restore_ctx = NULL; - context->restore_dc = NULL; + if (context_restore_pixel_format(context)) + context->needs_set = 1; + if (context->restore_ctx) + { + TRACE("Restoring GL context %p on device context %p.\n", context->restore_ctx, context->restore_dc); + context_restore_gl_context(context->gl_info, context->restore_dc, context->restore_ctx); + context->restore_ctx = NULL; + context->restore_dc = NULL; + } } } @@ -1078,8 +1179,11 @@ static void context_enter(struct wined3d_context *context) current_gl, wglGetCurrentDC()); context->restore_ctx = current_gl; context->restore_dc = wglGetCurrentDC(); - context->restore_pf = GetPixelFormat(context->restore_dc); + context->needs_set = 1; } + else if (!context->needs_set && !(context->hdc_is_private && context->hdc_has_format) + && context->pixel_format != GetPixelFormat(context->hdc)) + context->needs_set = 1; } } @@ -1287,6 +1391,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, int swap_interval; DWORD state; HDC hdc; + BOOL hdc_is_private = FALSE; TRACE("swapchain %p, target %p, window %p.\n", swapchain, target, swapchain->win_handle); @@ -1304,6 +1409,13 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, if (!ret->draw_buffers) goto out; + ret->free_timestamp_query_size = 4; + ret->free_timestamp_queries = HeapAlloc(GetProcessHeap(), 0, + ret->free_timestamp_query_size * sizeof(*ret->free_timestamp_queries)); + if (!ret->free_timestamp_queries) + goto out; + list_init(&ret->timestamp_queries); + ret->free_occlusion_query_size = 4; ret->free_occlusion_queries = HeapAlloc(GetProcessHeap(), 0, ret->free_occlusion_query_size * sizeof(*ret->free_occlusion_queries)); @@ -1347,7 +1459,9 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, { WARN("Failed to retireve device context, trying swapchain backup.\n"); - if (!(hdc = swapchain_get_backup_dc(swapchain))) + if ((hdc = swapchain_get_backup_dc(swapchain))) + hdc_is_private = TRUE; + else { ERR("Failed to retrieve a device context.\n"); goto out; @@ -1396,7 +1510,9 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, context_enter(ret); - if (!context_set_pixel_format(gl_info, hdc, pixel_format)) + ret->gl_info = gl_info; + + if (!context_set_pixel_format(ret, hdc, hdc_is_private, pixel_format)) { ERR("Failed to set pixel format %d on device context %p.\n", pixel_format, hdc); context_release(ret); @@ -1451,7 +1567,6 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, goto out; } - ret->gl_info = gl_info; ret->d3d_info = &device->adapter->d3d_info; ret->state_table = device->StateTable; @@ -1474,7 +1589,10 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, ret->glCtx = ctx; ret->win_handle = swapchain->win_handle; ret->hdc = hdc; + ret->hdc_is_private = hdc_is_private; + ret->hdc_has_format = TRUE; ret->pixel_format = pixel_format; + ret->needs_set = 1; /* Set up the context defaults */ if (!context_set_current(ret)) @@ -1640,6 +1758,7 @@ out: device->shader_backend->shader_free_context_data(ret); HeapFree(GetProcessHeap(), 0, ret->free_event_queries); HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries); + HeapFree(GetProcessHeap(), 0, ret->free_timestamp_queries); HeapFree(GetProcessHeap(), 0, ret->draw_buffers); HeapFree(GetProcessHeap(), 0, ret->blit_targets); HeapFree(GetProcessHeap(), 0, ret); @@ -2992,9 +3111,9 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str context = swapchain_get_context(device->swapchains[0]); } + context_enter(context); context_update_window(context); context_setup_target(context, target); - context_enter(context); if (!context->valid) return context; if (context != current_context) @@ -3002,7 +3121,7 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str if (!context_set_current(context)) ERR("Failed to activate the new context.\n"); } - else if (context->restore_ctx) + else if (context->needs_set) { context_set_gl_context(context); } diff --git a/dll/directx/wine/wined3d/cs.c b/dll/directx/wine/wined3d/cs.c index 338a3e13971..f85cf982b1c 100644 --- a/dll/directx/wine/wined3d/cs.c +++ b/dll/directx/wine/wined3d/cs.c @@ -937,5 +937,6 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) { state_cleanup(&cs->state); HeapFree(GetProcessHeap(), 0, cs->fb.render_targets); + HeapFree(GetProcessHeap(), 0, cs->data); HeapFree(GetProcessHeap(), 0, cs); } diff --git a/dll/directx/wine/wined3d/device.c b/dll/directx/wine/wined3d/device.c index 7e60fe3b7ec..37d9acb24da 100644 --- a/dll/directx/wine/wined3d/device.c +++ b/dll/directx/wine/wined3d/device.c @@ -1008,9 +1008,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) if (!device->d3d_initialized) return WINED3DERR_INVALIDCALL; - /* Force making the context current again, to verify it is still valid - * (workaround for broken drivers) */ - context_set_current(NULL); /* I don't think that the interface guarantees that the device is destroyed from the same thread * it was created. Thus make sure a context is active for the glDelete* calls */ @@ -4129,7 +4126,19 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, } if (reset_state) + { + if (device->logo_texture) + { + wined3d_texture_decref(device->logo_texture); + device->logo_texture = NULL; + } + if (device->cursor_texture) + { + wined3d_texture_decref(device->cursor_texture); + device->cursor_texture = NULL; + } state_unbind_resources(&device->state); + } if (device->fb.render_targets) { diff --git a/dll/directx/wine/wined3d/directx.c b/dll/directx/wine/wined3d/directx.c index ffdcc664e6d..4ecbf6e7de3 100644 --- a/dll/directx/wine/wined3d/directx.c +++ b/dll/directx/wine/wined3d/directx.c @@ -50,6 +50,7 @@ enum wined3d_display_driver DRIVER_NVIDIA_GEFORCE2MX, DRIVER_NVIDIA_GEFORCEFX, DRIVER_NVIDIA_GEFORCE6, + DRIVER_VMWARE, DRIVER_UNKNOWN }; @@ -66,7 +67,6 @@ enum wined3d_gl_vendor GL_VENDOR_UNKNOWN, GL_VENDOR_APPLE, GL_VENDOR_FGLRX, - GL_VENDOR_INTEL, GL_VENDOR_MESA, GL_VENDOR_NVIDIA, }; @@ -91,6 +91,7 @@ static const struct wined3d_extension_map gl_extension_map[] = {"GL_APPLE_ycbcr_422", APPLE_YCBCR_422 }, /* ARB */ + {"GL_ARB_blend_func_extended", ARB_BLEND_FUNC_EXTENDED }, {"GL_ARB_color_buffer_float", ARB_COLOR_BUFFER_FLOAT }, {"GL_ARB_debug_output", ARB_DEBUG_OUTPUT }, {"GL_ARB_depth_buffer_float", ARB_DEPTH_BUFFER_FLOAT }, @@ -136,6 +137,7 @@ static const struct wined3d_extension_map gl_extension_map[] = {"GL_ARB_texture_non_power_of_two", ARB_TEXTURE_NON_POWER_OF_TWO }, {"GL_ARB_texture_rectangle", ARB_TEXTURE_RECTANGLE }, {"GL_ARB_texture_rg", ARB_TEXTURE_RG }, + {"GL_ARB_timer_query", ARB_TIMER_QUERY }, {"GL_ARB_vertex_array_bgra", ARB_VERTEX_ARRAY_BGRA }, {"GL_ARB_vertex_blend", ARB_VERTEX_BLEND }, {"GL_ARB_vertex_buffer_object", ARB_VERTEX_BUFFER_OBJECT }, @@ -601,7 +603,7 @@ static BOOL match_dx10_capable(const struct wined3d_gl_info *gl_info, const char /* DX9 cards support 40 single float varyings in hardware, most drivers report 32. ATI misreports * 44 varyings. So assume that if we have more than 44 varyings we have a dx10 card. * This detection is for the gl_ClipPos varying quirk. If a d3d9 card really supports more than 44 - * varyings and we subtract one in dx9 shaders its not going to hurt us because the dx9 limit is + * varyings and we subtract one in dx9 shaders it's not going to hurt us because the dx9 limit is * hardcoded * * dx10 cards usually have 64 varyings */ @@ -1166,6 +1168,9 @@ static const struct driver_version_information driver_version_table[] = {DRIVER_NVIDIA_GEFORCEFX, DRIVER_MODEL_NT5X, "nv4_disp.dll", 14, 11, 7516}, {DRIVER_NVIDIA_GEFORCE6, DRIVER_MODEL_NT5X, "nv4_disp.dll", 15, 12, 6658}, {DRIVER_NVIDIA_GEFORCE6, DRIVER_MODEL_NT6X, "nvd3dum.dll", 15, 12, 6658}, + + /* VMware */ + {DRIVER_VMWARE, DRIVER_MODEL_NT5X, "vm3dum.dll", 14, 1, 1134}, }; struct gpu_description @@ -1256,6 +1261,9 @@ static const struct gpu_description gpu_description_table[] = {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX670, "NVIDIA GeForce GTX 670", DRIVER_NVIDIA_GEFORCE6, 2048}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX670MX, "NVIDIA GeForce GTX 670MX", DRIVER_NVIDIA_GEFORCE6, 3072}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX680, "NVIDIA GeForce GTX 680", DRIVER_NVIDIA_GEFORCE6, 2048}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX750, "NVIDIA GeForce GTX 750", DRIVER_NVIDIA_GEFORCE6, 1024}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX750TI, "NVIDIA GeForce GTX 750 Ti", DRIVER_NVIDIA_GEFORCE6, 2048}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX760, "NVIDIA Geforce GTX 760", DRIVER_NVIDIA_GEFORCE6, 2048}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX765M, "NVIDIA GeForce GTX 765M", DRIVER_NVIDIA_GEFORCE6, 2048}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX770M, "NVIDIA GeForce GTX 770M", DRIVER_NVIDIA_GEFORCE6, 3072}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX770, "NVIDIA GeForce GTX 770", DRIVER_NVIDIA_GEFORCE6, 2048}, @@ -1294,6 +1302,10 @@ static const struct gpu_description gpu_description_table[] = {HW_VENDOR_AMD, CARD_AMD_RADEON_HD7700, "AMD Radeon HD 7700 Series", DRIVER_AMD_R600, 1024}, {HW_VENDOR_AMD, CARD_AMD_RADEON_HD7800, "AMD Radeon HD 7800 Series", DRIVER_AMD_R600, 2048}, {HW_VENDOR_AMD, CARD_AMD_RADEON_HD7900, "AMD Radeon HD 7900 Series", DRIVER_AMD_R600, 2048}, + + /* VMware */ + {HW_VENDOR_VMWARE, CARD_VMWARE_SVGA3D, "VMware SVGA 3D (Microsoft Corporation - WDDM)", DRIVER_VMWARE, 1024}, + /* Intel cards */ {HW_VENDOR_INTEL, CARD_INTEL_830M, "Intel(R) 82830M Graphics Controller", DRIVER_INTEL_GMA800, 32 }, {HW_VENDOR_INTEL, CARD_INTEL_855GM, "Intel(R) 82852/82855 GM/GME Graphics Controller", DRIVER_INTEL_GMA800, 32 }, @@ -1376,7 +1388,7 @@ static void init_driver_info(struct wined3d_driver_info *driver_info, } driver_info->device = device; - /* Set a default amount of video memory (64MB). In general this code isn't used unless the user + /* Set a default amount of video memory (64 MB). In general this code isn't used unless the user * overrides the pci ids to a card which is not in our database. */ driver_info->vidmem = WINE_DEFAULT_VIDMEM; @@ -1567,20 +1579,16 @@ static enum wined3d_gl_vendor wined3d_guess_gl_vendor(const struct wined3d_gl_in if (strstr(gl_vendor_string, "ATI")) return GL_VENDOR_FGLRX; - if (strstr(gl_vendor_string, "Intel(R)") - /* Intel switched from Intel(R) to Intel® recently, so just match Intel. */ - || strstr(gl_renderer, "Intel") - || strstr(gl_vendor_string, "Intel Inc.")) - return GL_VENDOR_INTEL; - if (strstr(gl_vendor_string, "Mesa") || strstr(gl_vendor_string, "X.Org") || strstr(gl_vendor_string, "Advanced Micro Devices, Inc.") || strstr(gl_vendor_string, "DRI R300 Project") || strstr(gl_vendor_string, "Tungsten Graphics, Inc") || strstr(gl_vendor_string, "VMware, Inc.") + || strstr(gl_vendor_string, "Intel") || strstr(gl_renderer, "Mesa") - || strstr(gl_renderer, "Gallium")) + || strstr(gl_renderer, "Gallium") + || strstr(gl_renderer, "Intel")) return GL_VENDOR_MESA; FIXME("Received unrecognized GL_VENDOR %s. Returning GL_VENDOR_UNKNOWN.\n", @@ -1614,6 +1622,9 @@ static enum wined3d_pci_vendor wined3d_guess_card_vendor(const char *gl_vendor_s || strstr(gl_vendor_string, "Intel Inc.")) return HW_VENDOR_INTEL; + if (strstr(gl_renderer, "SVGA3D")) + return HW_VENDOR_VMWARE; + if (strstr(gl_vendor_string, "Mesa") || strstr(gl_vendor_string, "Brian Paul") || strstr(gl_vendor_string, "Tungsten Graphics, Inc") @@ -1665,6 +1676,9 @@ static enum wined3d_pci_device select_card_nvidia_binary(const struct wined3d_gl {"GTX 770M", CARD_NVIDIA_GEFORCE_GTX770M}, /* Geforce 700 - midend high mobile */ {"GTX 770", CARD_NVIDIA_GEFORCE_GTX770}, /* Geforce 700 - highend */ {"GTX 765M", CARD_NVIDIA_GEFORCE_GTX765M}, /* Geforce 700 - midend high mobile */ + {"GTX 760", CARD_NVIDIA_GEFORCE_GTX760}, /* Geforce 700 - midend high */ + {"GTX 750 Ti", CARD_NVIDIA_GEFORCE_GTX750TI}, /* Geforce 700 - midend */ + {"GTX 750", CARD_NVIDIA_GEFORCE_GTX750}, /* Geforce 700 - midend */ {"GTX 680", CARD_NVIDIA_GEFORCE_GTX680}, /* Geforce 600 - highend */ {"GTX 670MX", CARD_NVIDIA_GEFORCE_GTX670MX}, /* Geforce 600 - highend */ {"GTX 670", CARD_NVIDIA_GEFORCE_GTX670}, /* Geforce 600 - midend high */ @@ -1971,7 +1985,7 @@ static enum wined3d_pci_device select_card_amd_binary(const struct wined3d_gl_in return CARD_AMD_RADEON_X700; } - /* Radeon Xpress Series - onboard, DX9b, Shader 2.0, 300-400MHz */ + /* Radeon Xpress Series - onboard, DX9b, Shader 2.0, 300-400 MHz */ if (strstr(gl_renderer, "Radeon Xpress")) { return CARD_AMD_RADEON_XPRESS_200M; @@ -2119,7 +2133,7 @@ static enum wined3d_pci_device select_card_amd_mesa(const struct wined3d_gl_info {"R420", CARD_AMD_RADEON_X700}, {"R410", CARD_AMD_RADEON_X700}, {"RV410", CARD_AMD_RADEON_X700}, - /* Radeon Xpress - onboard, DX9b, Shader 2.0, 300-400MHz */ + /* Radeon Xpress - onboard, DX9b, Shader 2.0, 300-400 MHz */ {"RS740", CARD_AMD_RADEON_XPRESS_200M}, {"RS690", CARD_AMD_RADEON_XPRESS_200M}, {"RS600", CARD_AMD_RADEON_XPRESS_200M}, @@ -2158,6 +2172,8 @@ static enum wined3d_pci_device select_card_nvidia_mesa(const struct wined3d_gl_i } cards[] = { + /* Maxwell */ + {"NV117", CARD_NVIDIA_GEFORCE_GTX750}, /* Kepler */ {"NVE6", CARD_NVIDIA_GEFORCE_GTX770M}, {"NVE4", CARD_NVIDIA_GEFORCE_GTX680}, @@ -2236,29 +2252,40 @@ static enum wined3d_pci_device select_card_nvidia_mesa(const struct wined3d_gl_i return PCI_DEVICE_NONE; } +static enum wined3d_pci_device select_card_vmware(const struct wined3d_gl_info *gl_info, const char *gl_renderer) +{ + if (strstr(gl_renderer, "SVGA3D")) + return CARD_VMWARE_SVGA3D; + + return PCI_DEVICE_NONE; +} + static const struct gl_vendor_selection { enum wined3d_gl_vendor gl_vendor; const char *description; /* Description of the card selector i.e. Apple OS/X Intel */ enum wined3d_pci_device (*select_card)(const struct wined3d_gl_info *gl_info, const char *gl_renderer); } -nvidia_gl_vendor_table[] = -{ - {GL_VENDOR_NVIDIA, "Nvidia binary driver", select_card_nvidia_binary}, - {GL_VENDOR_APPLE, "Apple OSX NVidia binary driver", select_card_nvidia_binary}, - {GL_VENDOR_MESA, "Mesa Nouveau driver", select_card_nvidia_mesa}, -}, amd_gl_vendor_table[] = { - {GL_VENDOR_APPLE, "Apple OSX AMD/ATI binary driver", select_card_amd_binary}, - {GL_VENDOR_FGLRX, "AMD/ATI binary driver", select_card_amd_binary}, - {GL_VENDOR_MESA, "Mesa AMD/ATI driver", select_card_amd_mesa}, + {GL_VENDOR_APPLE, "Apple OSX AMD/ATI binary driver", select_card_amd_binary}, + {GL_VENDOR_FGLRX, "AMD/ATI binary driver", select_card_amd_binary}, + {GL_VENDOR_MESA, "Mesa AMD/ATI driver", select_card_amd_mesa}, +}, +nvidia_gl_vendor_table[] = +{ + {GL_VENDOR_APPLE, "Apple OSX NVidia binary driver", select_card_nvidia_binary}, + {GL_VENDOR_MESA, "Mesa Nouveau driver", select_card_nvidia_mesa}, + {GL_VENDOR_NVIDIA, "Nvidia binary driver", select_card_nvidia_binary}, +}, +vmware_gl_vendor_table[] = +{ + {GL_VENDOR_MESA, "VMware driver", select_card_vmware}, }, intel_gl_vendor_table[] = { - {GL_VENDOR_APPLE, "Apple OSX Intel binary driver", select_card_intel}, - {GL_VENDOR_INTEL, "Mesa Intel driver", select_card_intel}, - {GL_VENDOR_MESA, "Mesa Intel driver", select_card_intel}, + {GL_VENDOR_APPLE, "Apple OSX Intel binary driver", select_card_intel}, + {GL_VENDOR_MESA, "Mesa Intel driver", select_card_intel}, }; static enum wined3d_pci_device select_card_fallback_nvidia(const struct wined3d_gl_info *gl_info) @@ -2331,14 +2358,17 @@ static const struct } card_vendor_table[] = { - {HW_VENDOR_NVIDIA, "Nvidia", nvidia_gl_vendor_table, - sizeof(nvidia_gl_vendor_table) / sizeof(nvidia_gl_vendor_table[0]), - select_card_fallback_nvidia}, - {HW_VENDOR_AMD, "AMD", amd_gl_vendor_table, - sizeof(amd_gl_vendor_table) / sizeof(amd_gl_vendor_table[0]), + {HW_VENDOR_AMD, "AMD", amd_gl_vendor_table, + sizeof(amd_gl_vendor_table) / sizeof(*amd_gl_vendor_table), select_card_fallback_amd}, - {HW_VENDOR_INTEL, "Intel", intel_gl_vendor_table, - sizeof(intel_gl_vendor_table) / sizeof(intel_gl_vendor_table[0]), + {HW_VENDOR_NVIDIA, "Nvidia", nvidia_gl_vendor_table, + sizeof(nvidia_gl_vendor_table) / sizeof(*nvidia_gl_vendor_table), + select_card_fallback_nvidia}, + {HW_VENDOR_VMWARE, "VMware", vmware_gl_vendor_table, + sizeof(vmware_gl_vendor_table) / sizeof(*vmware_gl_vendor_table), + select_card_fallback_amd}, + {HW_VENDOR_INTEL, "Intel", intel_gl_vendor_table, + sizeof(intel_gl_vendor_table) / sizeof(*intel_gl_vendor_table), select_card_fallback_intel}, }; @@ -2937,6 +2967,15 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter) if (!counter_bits) gl_info->supported[ARB_OCCLUSION_QUERY] = FALSE; } + if (gl_info->supported[ARB_TIMER_QUERY]) + { + GLint counter_bits; + + GL_EXTCALL(glGetQueryivARB(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS_ARB, &counter_bits)); + TRACE("Timestamp query counter has %d bits.\n", counter_bits); + if (!counter_bits) + gl_info->supported[ARB_TIMER_QUERY] = FALSE; + } if (!gl_info->supported[ATI_TEXTURE_MIRROR_ONCE] && gl_info->supported[EXT_TEXTURE_MIRROR_CLAMP]) { TRACE(" IMPLIED: ATI_texture_mirror_once support (by EXT_texture_mirror_clamp).\n"); @@ -3411,7 +3450,7 @@ HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d, const char *name = adapter->driver_info.name; len = min(strlen(name), identifier->driver_size - 1); memcpy(identifier->driver, name, len); - identifier->driver[len] = '\0'; + memset(&identifier->driver[len], 0, identifier->driver_size - len); } if (identifier->description_size) @@ -3419,7 +3458,7 @@ HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d, const char *description = adapter->driver_info.description; len = min(strlen(description), identifier->description_size - 1); memcpy(identifier->description, description, len); - identifier->description[len] = '\0'; + memset(&identifier->description[len], 0, identifier->description_size - len); } /* Note that d3d8 doesn't supply a device name. */ @@ -3998,8 +4037,7 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap enum wined3d_device_type device_type, enum wined3d_format_id display_format, enum wined3d_format_id backbuffer_format, BOOL windowed) { - UINT mode_count; - HRESULT hr; + BOOL present_conversion = wined3d->flags & WINED3D_PRESENT_CONVERSION; TRACE("wined3d %p, adapter_idx %u, device_type %s, display_format %s, backbuffer_format %s, windowed %#x.\n", wined3d, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(display_format), @@ -4012,10 +4050,7 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap * combination is available on the given adapter. In fullscreen mode microsoft specified * that the display format shouldn't provide alpha and that ignoring alpha the backbuffer * and display format should match exactly. - * In windowed mode format conversion can occur and this depends on the driver. When format - * conversion is done, this function should nevertheless fail and applications need to use - * CheckDeviceFormatConversion. - * At the moment we assume that fullscreen and windowed have the same capabilities. */ + * In windowed mode format conversion can occur and this depends on the driver. */ /* There are only 4 display formats. */ if (!(display_format == WINED3DFMT_B5G6R5_UNORM @@ -4027,72 +4062,88 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap return WINED3DERR_NOTAVAILABLE; } - /* If the requested display format is not available, don't continue. */ - mode_count = wined3d_get_adapter_mode_count(wined3d, adapter_idx, - display_format, WINED3D_SCANLINE_ORDERING_UNKNOWN); - if (!mode_count) + if (!windowed) { - TRACE("No available modes for display format %s.\n", debug_d3dformat(display_format)); - return WINED3DERR_NOTAVAILABLE; - } + /* If the requested display format is not available, don't continue. */ + if (!wined3d_get_adapter_mode_count(wined3d, adapter_idx, + display_format, WINED3D_SCANLINE_ORDERING_UNKNOWN)) + { + TRACE("No available modes for display format %s.\n", debug_d3dformat(display_format)); + return WINED3DERR_NOTAVAILABLE; + } - /* Windowed mode allows you to specify WINED3DFMT_UNKNOWN for the backbuffer format, - * it means 'reuse' the display format for the backbuffer. */ - if (!windowed && backbuffer_format == WINED3DFMT_UNKNOWN) - { - TRACE("backbuffer_format WINED3FMT_UNKNOWN only available in windowed mode.\n"); - return WINED3DERR_NOTAVAILABLE; + present_conversion = FALSE; } - - /* In FULLSCREEN mode WINED3DFMT_B5G6R5_UNORM can only be mixed with - * backbuffer format WINED3DFMT_B5G6R5_UNORM. */ - if (display_format == WINED3DFMT_B5G6R5_UNORM && backbuffer_format != WINED3DFMT_B5G6R5_UNORM) + else if (display_format == WINED3DFMT_B10G10R10A2_UNORM) { - TRACE("Unsupported display/backbuffer format combination %s / %s.\n", + /* WINED3DFMT_B10G10R10A2_UNORM is only allowed in fullscreen mode. */ + TRACE("Unsupported format combination %s / %s in windowed mode.\n", debug_d3dformat(display_format), debug_d3dformat(backbuffer_format)); return WINED3DERR_NOTAVAILABLE; } - /* In FULLSCREEN mode WINED3DFMT_B5G5R5X1_UNORM can only be mixed with - * backbuffer formats WINED3DFMT_B5G5R5X1_UNORM and - * WINED3DFMT_B5G5R5A1_UNORM. */ - if (display_format == WINED3DFMT_B5G5R5X1_UNORM - && !(backbuffer_format == WINED3DFMT_B5G5R5X1_UNORM || backbuffer_format == WINED3DFMT_B5G5R5A1_UNORM)) + if (present_conversion) { - TRACE("Unsupported display/backbuffer format combination %s / %s.\n", - debug_d3dformat(display_format), debug_d3dformat(backbuffer_format)); + /* Use the display format as back buffer format if the latter is + * WINED3DFMT_UNKNOWN. */ + if (backbuffer_format == WINED3DFMT_UNKNOWN) + backbuffer_format = display_format; + + if (FAILED(wined3d_check_device_format_conversion(wined3d, adapter_idx, + device_type, backbuffer_format, display_format))) + { + TRACE("Format conversion from %s to %s not supported.\n", + debug_d3dformat(backbuffer_format), debug_d3dformat(display_format)); + return WINED3DERR_NOTAVAILABLE; + } + } + else + { + /* When format conversion from the back buffer format to the display + * format is not allowed, only a limited number of combinations are + * valid. */ + + if (display_format == WINED3DFMT_B5G6R5_UNORM && backbuffer_format != WINED3DFMT_B5G6R5_UNORM) + { + TRACE("Unsupported format combination %s / %s.\n", + debug_d3dformat(display_format), debug_d3dformat(backbuffer_format)); + return WINED3DERR_NOTAVAILABLE; + } + + if (display_format == WINED3DFMT_B5G5R5X1_UNORM + && !(backbuffer_format == WINED3DFMT_B5G5R5X1_UNORM || backbuffer_format == WINED3DFMT_B5G5R5A1_UNORM)) + { + TRACE("Unsupported format combination %s / %s.\n", + debug_d3dformat(display_format), debug_d3dformat(backbuffer_format)); + return WINED3DERR_NOTAVAILABLE; + } + + if (display_format == WINED3DFMT_B8G8R8X8_UNORM + && !(backbuffer_format == WINED3DFMT_B8G8R8X8_UNORM || backbuffer_format == WINED3DFMT_B8G8R8A8_UNORM)) + { + TRACE("Unsupported format combination %s / %s.\n", + debug_d3dformat(display_format), debug_d3dformat(backbuffer_format)); + return WINED3DERR_NOTAVAILABLE; + } + + if (display_format == WINED3DFMT_B10G10R10A2_UNORM + && backbuffer_format != WINED3DFMT_B10G10R10A2_UNORM) + { + TRACE("Unsupported format combination %s / %s.\n", + debug_d3dformat(display_format), debug_d3dformat(backbuffer_format)); + return WINED3DERR_NOTAVAILABLE; + } + } + + /* Validate that the back buffer format is usable for render targets. */ + if (FAILED(wined3d_check_device_format(wined3d, adapter_idx, device_type, display_format, + WINED3DUSAGE_RENDERTARGET, WINED3D_RTYPE_SURFACE, backbuffer_format))) + { + TRACE("Format %s not allowed for render targets.\n", debug_d3dformat(backbuffer_format)); return WINED3DERR_NOTAVAILABLE; } - /* In FULLSCREEN mode WINED3DFMT_B8G8R8X8_UNORM can only be mixed with - * backbuffer formats WINED3DFMT_B8G8R8X8_UNORM and - * WINED3DFMT_B8G8R8A8_UNORM. */ - if (display_format == WINED3DFMT_B8G8R8X8_UNORM - && !(backbuffer_format == WINED3DFMT_B8G8R8X8_UNORM || backbuffer_format == WINED3DFMT_B8G8R8A8_UNORM)) - { - TRACE("Unsupported display/backbuffer format combination %s / %s.\n", - debug_d3dformat(display_format), debug_d3dformat(backbuffer_format)); - return WINED3DERR_NOTAVAILABLE; - } - - /* WINED3DFMT_B10G10R10A2_UNORM is only allowed in fullscreen mode and it - * can only be mixed with backbuffer format WINED3DFMT_B10G10R10A2_UNORM. */ - if (display_format == WINED3DFMT_B10G10R10A2_UNORM - && (backbuffer_format != WINED3DFMT_B10G10R10A2_UNORM || windowed)) - { - TRACE("Unsupported display/backbuffer format combination %s / %s.\n", - debug_d3dformat(display_format), debug_d3dformat(backbuffer_format)); - return WINED3DERR_NOTAVAILABLE; - } - - /* Use CheckDeviceFormat to see if the backbuffer_format is usable with the given display_format */ - hr = wined3d_check_device_format(wined3d, adapter_idx, device_type, display_format, - WINED3DUSAGE_RENDERTARGET, WINED3D_RTYPE_SURFACE, backbuffer_format); - if (FAILED(hr)) - TRACE("Unsupported display/backbuffer format combination %s / %s.\n", - debug_d3dformat(display_format), debug_d3dformat(backbuffer_format)); - - return hr; + return WINED3D_OK; } HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapter_idx, @@ -4197,6 +4248,8 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte WINED3DPCMPCAPS_NEVER | WINED3DPCMPCAPS_NOTEQUAL; + /* WINED3DPBLENDCAPS_BOTHINVSRCALPHA and WINED3DPBLENDCAPS_BOTHSRCALPHA + * are legacy settings for srcblend only. */ caps->SrcBlendCaps = WINED3DPBLENDCAPS_BOTHINVSRCALPHA | WINED3DPBLENDCAPS_BOTHSRCALPHA | WINED3DPBLENDCAPS_DESTALPHA | @@ -4221,12 +4274,9 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte WINED3DPBLENDCAPS_SRCALPHA | WINED3DPBLENDCAPS_SRCCOLOR | WINED3DPBLENDCAPS_ZERO; - /* NOTE: WINED3DPBLENDCAPS_SRCALPHASAT is not supported as dest blend factor, - * according to the glBlendFunc manpage - * - * WINED3DPBLENDCAPS_BOTHINVSRCALPHA and WINED3DPBLENDCAPS_BOTHSRCALPHA are - * legacy settings for srcblend only - */ + + if (gl_info->supported[ARB_BLEND_FUNC_EXTENDED]) + caps->DestBlendCaps |= WINED3DPBLENDCAPS_SRCALPHASAT; if (gl_info->supported[EXT_BLEND_COLOR]) { @@ -4439,8 +4489,8 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte caps->MaxAnisotropy = gl_info->limits.anisotropy; caps->MaxPointSize = gl_info->limits.pointsize_max; - caps->MaxPrimitiveCount = 0xfffff; /* For now set 2^20-1 which is used by most >=Geforce3/Radeon8500 cards */ - caps->MaxVertexIndex = 0xfffff; + caps->MaxPrimitiveCount = 0x555555; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */ + caps->MaxVertexIndex = 0xffffff; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */ caps->MaxStreams = MAX_STREAMS; caps->MaxStreamStride = 1024; @@ -4504,6 +4554,7 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte caps->MaxVShaderInstructionsExecuted = 65535; /* VS 3.0 needs at least 65535, some cards even use 2^32-1 */ caps->MaxVertexShader30InstructionSlots = max(512, adapter->gl_info.limits.arb_vs_instructions); + caps->VertexTextureFilterCaps = WINED3DPTFILTERCAPS_MINFPOINT | WINED3DPTFILTERCAPS_MAGFPOINT; } else if (caps->VertexShaderVersion == 2) { @@ -5170,9 +5221,8 @@ const struct wined3d_parent_ops wined3d_null_parent_ops = wined3d_null_wined3d_object_destroyed, }; -HRESULT wined3d_init(struct wined3d *wined3d, UINT version, DWORD flags) +HRESULT wined3d_init(struct wined3d *wined3d, DWORD flags) { - wined3d->dxVersion = version; wined3d->ref = 1; wined3d->flags = flags; diff --git a/dll/directx/wine/wined3d/query.c b/dll/directx/wine/wined3d/query.c index becea1b76f8..6ebb53c7eac 100644 --- a/dll/directx/wine/wined3d/query.c +++ b/dll/directx/wine/wined3d/query.c @@ -255,6 +255,14 @@ ULONG CDECL wined3d_query_decref(struct wined3d_query *query) if (oq->context) context_free_occlusion_query(oq); HeapFree(GetProcessHeap(), 0, query->extendedData); } + else if (query->type == WINED3D_QUERY_TYPE_TIMESTAMP) + { + struct wined3d_timestamp_query *tq = query->extendedData; + + if (tq->context) + context_free_timestamp_query(tq); + HeapFree(GetProcessHeap(), 0, query->extendedData); + } HeapFree(GetProcessHeap(), 0, query); } @@ -517,6 +525,148 @@ static HRESULT wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DW return WINED3D_OK; /* can be WINED3DERR_INVALIDCALL. */ } +static HRESULT wined3d_timestamp_query_ops_get_data(struct wined3d_query *query, + void *data, DWORD size, DWORD flags) +{ + struct wined3d_timestamp_query *tq = query->extendedData; + struct wined3d_device *device = query->device; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + struct wined3d_context *context; + UINT64 *u64data = data; + GLuint available; + GLuint64 timestamp; + HRESULT res; + + TRACE("(%p) : type D3DQUERY_TIMESTAMP, data %p, size %#x, flags %#x.\n", query, data, size, flags); + + if (!tq->context) + query->state = QUERY_CREATED; + + if (query->state == QUERY_CREATED) + { + /* D3D allows GetData on a new query, OpenGL doesn't. So just invent the data ourselves. */ + TRACE("Query wasn't yet started, returning S_OK.\n"); + if (u64data) + *u64data = 0; + return S_OK; + } + + if (tq->context->tid != GetCurrentThreadId()) + { + FIXME("%p Wrong thread, returning 1.\n", query); + if (u64data) + *u64data = 1; + return S_OK; + } + + context = context_acquire(query->device, tq->context->current_rt); + + GL_EXTCALL(glGetQueryObjectuivARB(tq->id, GL_QUERY_RESULT_AVAILABLE_ARB, &available)); + checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT_AVAILABLE)"); + TRACE("available %#x.\n", available); + + if (available) + { + if (u64data) + { + GL_EXTCALL(glGetQueryObjectui64v(tq->id, GL_QUERY_RESULT_ARB, ×tamp)); + checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT)"); + TRACE("Returning timestamp %s.\n", wine_dbgstr_longlong(timestamp)); + *u64data = timestamp; + } + res = S_OK; + } + else + { + res = S_FALSE; + } + + context_release(context); + + return res; +} + +static HRESULT wined3d_timestamp_query_ops_issue(struct wined3d_query *query, DWORD flags) +{ + struct wined3d_device *device = query->device; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + + TRACE("query %p, flags %#x.\n", query, flags); + + if (gl_info->supported[ARB_TIMER_QUERY]) + { + struct wined3d_timestamp_query *tq = query->extendedData; + struct wined3d_context *context; + + if (flags & WINED3DISSUE_BEGIN) + { + WARN("Ignoring WINED3DISSUE_BEGIN with a TIMESTAMP query.\n"); + } + if (flags & WINED3DISSUE_END) + { + if (tq->context) + context_free_timestamp_query(tq); + context = context_acquire(query->device, NULL); + context_alloc_timestamp_query(context, tq); + GL_EXTCALL(glQueryCounter(tq->id, GL_TIMESTAMP)); + checkGLcall("glQueryCounter()"); + context_release(context); + } + } + else + { + ERR("Timestamp queries not supported.\n"); + } + + if (flags & WINED3DISSUE_END) + query->state = QUERY_SIGNALLED; + + return WINED3D_OK; +} + +static HRESULT wined3d_timestamp_disjoint_query_ops_get_data(struct wined3d_query *query, + void *data, DWORD size, DWORD flags) +{ + TRACE("(%p) : type D3DQUERY_TIMESTAMP_DISJOINT, data %p, size %#x, flags %#x.\n", query, data, size, flags); + + if (query->type == WINED3D_QUERY_TYPE_TIMESTAMP_DISJOINT) + { + struct wined3d_query_data_timestamp_disjoint *disjoint_data = data; + + if (query->state == QUERY_BUILDING) + { + TRACE("Query is building, returning S_FALSE.\n"); + return S_FALSE; + } + + if (disjoint_data) + { + disjoint_data->disjoint = FALSE; + disjoint_data->frequency = 1000 * 1000 * 1000; + } + } + else + { + UINT64 *u64data = data; + + if (u64data) + *u64data = 1000 * 1000 * 1000; + } + return S_OK; +} + +static HRESULT wined3d_timestamp_disjoint_query_ops_issue(struct wined3d_query *query, DWORD flags) +{ + TRACE("query %p, flags %#x.\n", query, flags); + + if (flags & WINED3DISSUE_BEGIN) + query->state = QUERY_BUILDING; + if (flags & WINED3DISSUE_END) + query->state = QUERY_SIGNALLED; + + return WINED3D_OK; +} + static const struct wined3d_query_ops event_query_ops = { wined3d_event_query_ops_get_data, @@ -529,6 +679,18 @@ static const struct wined3d_query_ops occlusion_query_ops = wined3d_occlusion_query_ops_issue, }; +static const struct wined3d_query_ops timestamp_query_ops = +{ + wined3d_timestamp_query_ops_get_data, + wined3d_timestamp_query_ops_issue, +}; + +static const struct wined3d_query_ops timestamp_disjoint_query_ops = +{ + wined3d_timestamp_disjoint_query_ops_get_data, + wined3d_timestamp_disjoint_query_ops_issue, +}; + static HRESULT query_init(struct wined3d_query *query, struct wined3d_device *device, enum wined3d_query_type type) { const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; @@ -573,12 +735,41 @@ static HRESULT query_init(struct wined3d_query *query, struct wined3d_device *de } break; + case WINED3D_QUERY_TYPE_TIMESTAMP: + TRACE("Timestamp query.\n"); + if (!gl_info->supported[ARB_TIMER_QUERY]) + { + WARN("Unsupported in local OpenGL implementation: ARB_TIMER_QUERY.\n"); + return WINED3DERR_NOTAVAILABLE; + } + query->query_ops = ×tamp_query_ops; + query->data_size = sizeof(UINT64); + query->extendedData = HeapAlloc(GetProcessHeap(), 0, sizeof(struct wined3d_timestamp_query)); + if (!query->extendedData) + { + ERR("Failed to allocate timestamp query extended data.\n"); + return E_OUTOFMEMORY; + } + ((struct wined3d_timestamp_query *)query->extendedData)->context = NULL; + break; + + case WINED3D_QUERY_TYPE_TIMESTAMP_DISJOINT: + case WINED3D_QUERY_TYPE_TIMESTAMP_FREQ: + TRACE("TIMESTAMP_DISJOINT query.\n"); + if (!gl_info->supported[ARB_TIMER_QUERY]) + { + WARN("Unsupported in local OpenGL implementation: ARB_TIMER_QUERY.\n"); + return WINED3DERR_NOTAVAILABLE; + } + query->query_ops = ×tamp_disjoint_query_ops; + query->data_size = type == WINED3D_QUERY_TYPE_TIMESTAMP_DISJOINT + ? sizeof(struct wined3d_query_data_timestamp_disjoint) : sizeof(UINT64); + query->extendedData = NULL; + break; + case WINED3D_QUERY_TYPE_VCACHE: case WINED3D_QUERY_TYPE_RESOURCE_MANAGER: case WINED3D_QUERY_TYPE_VERTEX_STATS: - case WINED3D_QUERY_TYPE_TIMESTAMP: - case WINED3D_QUERY_TYPE_TIMESTAMP_DISJOINT: - case WINED3D_QUERY_TYPE_TIMESTAMP_FREQ: case WINED3D_QUERY_TYPE_PIPELINE_TIMINGS: case WINED3D_QUERY_TYPE_INTERFACE_TIMINGS: case WINED3D_QUERY_TYPE_VERTEX_TIMINGS: diff --git a/dll/directx/wine/wined3d/resource.c b/dll/directx/wine/wined3d/resource.c index 5c7bc8178e9..d65cc2944de 100644 --- a/dll/directx/wine/wined3d/resource.c +++ b/dll/directx/wine/wined3d/resource.c @@ -25,22 +25,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); -struct private_data -{ - struct list entry; - - GUID tag; - DWORD flags; /* DDSPD_* */ - - union - { - void *data; - IUnknown *object; - } ptr; - - DWORD size; -}; - static DWORD resource_access_from_pool(enum wined3d_pool pool) { switch (pool) @@ -114,7 +98,6 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * resource->parent = parent; resource->parent_ops = parent_ops; resource->resource_ops = resource_ops; - list_init(&resource->privateData); if (size) { @@ -149,9 +132,6 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * void resource_cleanup(struct wined3d_resource *resource) { const struct wined3d *d3d = resource->device->wined3d; - struct private_data *data; - struct list *e1, *e2; - HRESULT hr; TRACE("Cleaning up resource %p.\n", resource); @@ -161,14 +141,6 @@ void resource_cleanup(struct wined3d_resource *resource) adapter_adjust_memory(resource->device->adapter, 0 - resource->size); } - LIST_FOR_EACH_SAFE(e1, e2, &resource->privateData) - { - data = LIST_ENTRY(e1, struct private_data, entry); - hr = wined3d_resource_free_private_data(resource, &data->tag); - if (FAILED(hr)) - ERR("Failed to free private data when destroying resource %p, hr = %#x.\n", resource, hr); - } - wined3d_resource_free_sysmem(resource); device_resource_released(resource->device, resource); @@ -183,128 +155,6 @@ void resource_unload(struct wined3d_resource *resource) resource, resource->type); } -static struct private_data *resource_find_private_data(const struct wined3d_resource *resource, REFGUID tag) -{ - struct private_data *data; - struct list *entry; - - TRACE("Searching for private data %s\n", debugstr_guid(tag)); - LIST_FOR_EACH(entry, &resource->privateData) - { - data = LIST_ENTRY(entry, struct private_data, entry); - if (IsEqualGUID(&data->tag, tag)) { - TRACE("Found %p\n", data); - return data; - } - } - TRACE("Not found\n"); - return NULL; -} - -HRESULT CDECL wined3d_resource_set_private_data(struct wined3d_resource *resource, REFGUID guid, - const void *data, DWORD data_size, DWORD flags) -{ - struct private_data *d; - - TRACE("resource %p, riid %s, data %p, data_size %u, flags %#x.\n", - resource, debugstr_guid(guid), data, data_size, flags); - - wined3d_resource_free_private_data(resource, guid); - - d = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*d)); - if (!d) return E_OUTOFMEMORY; - - d->tag = *guid; - d->flags = flags; - - if (flags & WINED3DSPD_IUNKNOWN) - { - if (data_size != sizeof(IUnknown *)) - { - WARN("IUnknown data with size %u, returning WINED3DERR_INVALIDCALL.\n", data_size); - HeapFree(GetProcessHeap(), 0, d); - return WINED3DERR_INVALIDCALL; - } - d->ptr.object = (IUnknown *)data; - d->size = sizeof(IUnknown *); - IUnknown_AddRef(d->ptr.object); - } - else - { - d->ptr.data = HeapAlloc(GetProcessHeap(), 0, data_size); - if (!d->ptr.data) - { - HeapFree(GetProcessHeap(), 0, d); - return E_OUTOFMEMORY; - } - d->size = data_size; - memcpy(d->ptr.data, data, data_size); - } - list_add_tail(&resource->privateData, &d->entry); - - return WINED3D_OK; -} - -HRESULT CDECL wined3d_resource_get_private_data(const struct wined3d_resource *resource, REFGUID guid, - void *data, DWORD *data_size) -{ - const struct private_data *d; - - TRACE("resource %p, guid %s, data %p, data_size %p.\n", - resource, debugstr_guid(guid), data, data_size); - - d = resource_find_private_data(resource, guid); - if (!d) return WINED3DERR_NOTFOUND; - - if (*data_size < d->size) - { - *data_size = d->size; - return WINED3DERR_MOREDATA; - } - - if (d->flags & WINED3DSPD_IUNKNOWN) - { - *(IUnknown **)data = d->ptr.object; - if (resource->device->wined3d->dxVersion != 7) - { - /* D3D8 and D3D9 addref the private data, DDraw does not. This - * can't be handled in ddraw because it doesn't know if the - * pointer returned is an IUnknown * or just a blob. */ - IUnknown_AddRef(d->ptr.object); - } - } - else - { - memcpy(data, d->ptr.data, d->size); - } - - return WINED3D_OK; -} -HRESULT CDECL wined3d_resource_free_private_data(struct wined3d_resource *resource, REFGUID guid) -{ - struct private_data *data; - - TRACE("resource %p, guid %s.\n", resource, debugstr_guid(guid)); - - data = resource_find_private_data(resource, guid); - if (!data) return WINED3DERR_NOTFOUND; - - if (data->flags & WINED3DSPD_IUNKNOWN) - { - if (data->ptr.object) - IUnknown_Release(data->ptr.object); - } - else - { - HeapFree(GetProcessHeap(), 0, data->ptr.data); - } - list_remove(&data->entry); - - HeapFree(GetProcessHeap(), 0, data); - - return WINED3D_OK; -} - DWORD resource_set_priority(struct wined3d_resource *resource, DWORD priority) { DWORD prev = resource->priority; diff --git a/dll/directx/wine/wined3d/surface.c b/dll/directx/wine/wined3d/surface.c index aea626d7c1c..b995b359478 100644 --- a/dll/directx/wine/wined3d/surface.c +++ b/dll/directx/wine/wined3d/surface.c @@ -672,7 +672,8 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface) surface->texture_target = GL_TEXTURE_2D; /* Non-power2 support */ - if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]) + if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT] + || gl_info->supported[ARB_TEXTURE_RECTANGLE]) { pow2Width = surface->resource.width; pow2Height = surface->resource.height; @@ -692,9 +693,9 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface) if (pow2Width > surface->resource.width || pow2Height > surface->resource.height) { /* TODO: Add support for non power two compressed textures. */ - if (surface->resource.format->flags & WINED3DFMT_FLAG_COMPRESSED) + if (surface->resource.format->flags & (WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_HEIGHT_SCALE)) { - FIXME("(%p) Compressed non-power-two textures are not supported w(%d) h(%d)\n", + FIXME("(%p) Compressed or height scaled non-power-two textures are not supported w(%d) h(%d)\n", surface, surface->resource.width, surface->resource.height); return WINED3DERR_NOTAVAILABLE; } @@ -2602,8 +2603,9 @@ HRESULT CDECL wined3d_surface_update_desc(struct wined3d_surface *surface, HRESULT hr; DWORD valid_location = 0; - TRACE("surface %p, width %u, height %u, format %s, multisample_type %#x, multisample_quality %u.\n", - surface, width, height, debug_d3dformat(format_id), multisample_type, multisample_type); + TRACE("surface %p, width %u, height %u, format %s, multisample_type %#x, multisample_quality %u, " + "mem %p, pitch %u.\n", + surface, width, height, debug_d3dformat(format_id), multisample_type, multisample_type, mem, pitch); if (!resource_size) return WINED3DERR_INVALIDCALL; @@ -5119,7 +5121,8 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location) if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) { - if (location == WINED3D_LOCATION_TEXTURE_RGB && surface->locations & WINED3D_LOCATION_DRAWABLE) + if (location == WINED3D_LOCATION_TEXTURE_RGB + && surface->locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_DISCARDED)) { struct wined3d_context *context = context_acquire(device, NULL); surface_load_ds_location(surface, context, location); diff --git a/dll/directx/wine/wined3d/utils.c b/dll/directx/wine/wined3d/utils.c index 18ee65e7b39..cd55f2e3bd0 100644 --- a/dll/directx/wine/wined3d/utils.c +++ b/dll/directx/wine/wined3d/utils.c @@ -50,6 +50,7 @@ static const struct wined3d_format_channels formats[] = {WINED3DFMT_UYVY, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, {WINED3DFMT_YUY2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, {WINED3DFMT_YV12, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, + {WINED3DFMT_NV12, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, {WINED3DFMT_DXT1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, {WINED3DFMT_DXT2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, {WINED3DFMT_DXT3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, @@ -665,6 +666,10 @@ static const struct wined3d_format_texture_info format_texture_info[] = GL_ALPHA, GL_UNSIGNED_BYTE, 0, WINED3DFMT_FLAG_FILTERING, WINED3D_GL_EXT_NONE, NULL}, + {WINED3DFMT_NV12, GL_ALPHA, GL_ALPHA, 0, + GL_ALPHA, GL_UNSIGNED_BYTE, 0, + WINED3DFMT_FLAG_FILTERING, + WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_DXT1, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING @@ -1832,6 +1837,12 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_ gl_info->formats[idx].height_scale.denominator = 2; gl_info->formats[idx].color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_YV12); + idx = getFmtIdx(WINED3DFMT_NV12); + gl_info->formats[idx].flags |= WINED3DFMT_FLAG_HEIGHT_SCALE; + gl_info->formats[idx].height_scale.numerator = 3; + gl_info->formats[idx].height_scale.denominator = 2; + gl_info->formats[idx].color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_NV12); + if (gl_info->supported[ARB_FRAGMENT_PROGRAM]) { idx = getFmtIdx(WINED3DFMT_P8_UINT); @@ -2068,6 +2079,7 @@ const char *debug_d3dformat(enum wined3d_format_id format_id) FMT_TO_STR(WINED3DFMT_UYVY); FMT_TO_STR(WINED3DFMT_YUY2); FMT_TO_STR(WINED3DFMT_YV12); + FMT_TO_STR(WINED3DFMT_NV12); FMT_TO_STR(WINED3DFMT_DXT1); FMT_TO_STR(WINED3DFMT_DXT2); FMT_TO_STR(WINED3DFMT_DXT3); @@ -2771,6 +2783,7 @@ static const char *debug_complex_fixup(enum complex_fixup fixup) WINED3D_TO_STR(COMPLEX_FIXUP_YUY2); WINED3D_TO_STR(COMPLEX_FIXUP_UYVY); WINED3D_TO_STR(COMPLEX_FIXUP_YV12); + WINED3D_TO_STR(COMPLEX_FIXUP_NV12); WINED3D_TO_STR(COMPLEX_FIXUP_P8); #undef WINED3D_TO_STR default: diff --git a/dll/directx/wine/wined3d/wined3d.spec b/dll/directx/wine/wined3d/wined3d.spec index 3a6dd333081..bdfe017b670 100644 --- a/dll/directx/wine/wined3d/wined3d.spec +++ b/dll/directx/wine/wined3d/wined3d.spec @@ -6,7 +6,7 @@ @ cdecl wined3d_check_device_format_conversion(ptr long long long long) @ cdecl wined3d_check_device_multisample_type(ptr long long long long long ptr) @ cdecl wined3d_check_device_type(ptr long long long long long) -@ cdecl wined3d_create(long long) +@ cdecl wined3d_create(long) @ cdecl wined3d_decref(ptr) @ cdecl wined3d_enum_adapter_modes(ptr long long long long ptr) @ cdecl wined3d_get_adapter_count(ptr) @@ -170,12 +170,9 @@ @ cdecl wined3d_query_incref(ptr) @ cdecl wined3d_query_issue(ptr long) -@ cdecl wined3d_resource_free_private_data(ptr ptr) @ cdecl wined3d_resource_get_desc(ptr ptr) @ cdecl wined3d_resource_get_parent(ptr) -@ cdecl wined3d_resource_get_private_data(ptr ptr ptr ptr) @ cdecl wined3d_resource_set_parent(ptr ptr) -@ cdecl wined3d_resource_set_private_data(ptr ptr ptr long long) @ cdecl wined3d_rendertarget_view_create(ptr ptr ptr) @ cdecl wined3d_rendertarget_view_decref(ptr) diff --git a/dll/directx/wine/wined3d/wined3d_gl.h b/dll/directx/wine/wined3d/wined3d_gl.h index b357bb180db..acfbe3cebfd 100644 --- a/dll/directx/wine/wined3d/wined3d_gl.h +++ b/dll/directx/wine/wined3d/wined3d_gl.h @@ -43,6 +43,7 @@ enum wined3d_gl_extension APPLE_FLUSH_BUFFER_RANGE, APPLE_YCBCR_422, /* ARB */ + ARB_BLEND_FUNC_EXTENDED, ARB_COLOR_BUFFER_FLOAT, ARB_DEBUG_OUTPUT, ARB_DEPTH_BUFFER_FLOAT, @@ -88,6 +89,7 @@ enum wined3d_gl_extension ARB_TEXTURE_NON_POWER_OF_TWO, ARB_TEXTURE_RECTANGLE, ARB_TEXTURE_RG, + ARB_TIMER_QUERY, ARB_VERTEX_ARRAY_BGRA, ARB_VERTEX_BLEND, ARB_VERTEX_BUFFER_OBJECT, @@ -180,6 +182,9 @@ enum wined3d_gl_extension /* GL_APPLE_flush_buffer_range */ \ USE_GL_FUNC(glBufferParameteriAPPLE) \ USE_GL_FUNC(glFlushMappedBufferRangeAPPLE) \ + /* GL_ARB_blend_func_extended */ \ + USE_GL_FUNC(glBindFragDataLocationIndexed) \ + USE_GL_FUNC(glGetFragDataIndex) \ /* GL_ARB_color_buffer_float */ \ USE_GL_FUNC(glClampColorARB) \ /* GL_ARB_debug_output */ \ @@ -317,6 +322,9 @@ enum wined3d_gl_extension USE_GL_FUNC(glCompressedTexSubImage2DARB) \ USE_GL_FUNC(glCompressedTexSubImage3DARB) \ USE_GL_FUNC(glGetCompressedTexImageARB) \ + /* GL_ARB_timer_query */ \ + USE_GL_FUNC(glQueryCounter) \ + USE_GL_FUNC(glGetQueryObjectui64v) \ /* GL_ARB_vertex_blend */ \ USE_GL_FUNC(glVertexBlendARB) \ USE_GL_FUNC(glWeightPointerARB) \ diff --git a/dll/directx/wine/wined3d/wined3d_main.c b/dll/directx/wine/wined3d/wined3d_main.c index d290a6f362a..c62d1f56f3b 100644 --- a/dll/directx/wine/wined3d/wined3d_main.c +++ b/dll/directx/wine/wined3d/wined3d_main.c @@ -85,7 +85,7 @@ struct wined3d_settings wined3d_settings = FALSE, /* 3D support enabled by default. */ }; -struct wined3d * CDECL wined3d_create(UINT version, DWORD flags) +struct wined3d * CDECL wined3d_create(DWORD flags) { struct wined3d *object; HRESULT hr; @@ -97,10 +97,10 @@ struct wined3d * CDECL wined3d_create(UINT version, DWORD flags) return NULL; } - if (version == 7 && wined3d_settings.no_3d) + if (wined3d_settings.no_3d) flags |= WINED3D_NO3D; - hr = wined3d_init(object, version, flags); + hr = wined3d_init(object, flags); if (FAILED(hr)) { WARN("Failed to initialize wined3d object, hr %#x.\n", hr); @@ -108,7 +108,7 @@ struct wined3d * CDECL wined3d_create(UINT version, DWORD flags) return NULL; } - TRACE("Created wined3d object %p for d3d%d support.\n", object, version); + TRACE("Created wined3d object %p.\n", object); return object; } diff --git a/dll/directx/wine/wined3d/wined3d_private.h b/dll/directx/wine/wined3d/wined3d_private.h index abfcb7a1dc9..6863f141ed9 100644 --- a/dll/directx/wine/wined3d/wined3d_private.h +++ b/dll/directx/wine/wined3d/wined3d_private.h @@ -94,6 +94,7 @@ enum complex_fixup COMPLEX_FIXUP_UYVY = 2, COMPLEX_FIXUP_YV12 = 3, COMPLEX_FIXUP_P8 = 4, + COMPLEX_FIXUP_NV12 = 5, }; #include @@ -1053,6 +1054,16 @@ enum wined3d_event_query_result wined3d_event_query_finish(const struct wined3d_ void wined3d_event_query_issue(struct wined3d_event_query *query, const struct wined3d_device *device) DECLSPEC_HIDDEN; BOOL wined3d_event_query_supported(const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; +struct wined3d_timestamp_query +{ + struct list entry; + GLuint id; + struct wined3d_context *context; +}; + +void context_alloc_timestamp_query(struct wined3d_context *context, struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN; +void context_free_timestamp_query(struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN; + struct wined3d_context { const struct wined3d_gl_info *gl_info; @@ -1093,7 +1104,10 @@ struct wined3d_context DWORD fixed_function_usage_map : 8; /* MAX_TEXTURES, 8 */ DWORD lowest_disabled_stage : 4; /* Max MAX_TEXTURES, 8 */ DWORD rebind_fbo : 1; - DWORD padding : 19; + DWORD needs_set : 1; + DWORD hdc_is_private : 1; + DWORD hdc_has_format : 1; /* only meaningful if hdc_is_private */ + DWORD padding : 16; DWORD shader_update_mask; DWORD constant_update_mask; DWORD numbered_array_mask; @@ -1111,6 +1125,7 @@ struct wined3d_context HGLRC restore_ctx; HDC restore_dc; int restore_pf; + HWND restore_pf_win; HGLRC glCtx; HWND win_handle; HDC hdc; @@ -1141,6 +1156,11 @@ struct wined3d_context UINT free_event_query_count; struct list event_queries; + GLuint *free_timestamp_queries; + UINT free_timestamp_query_size; + UINT free_timestamp_query_count; + struct list timestamp_queries; + struct wined3d_stream_info stream_info; /* Fences for GL_APPLE_flush_buffer_range */ @@ -1356,10 +1376,11 @@ struct wined3d_pixel_format enum wined3d_pci_vendor { - HW_VENDOR_SOFTWARE = 0x0000, - HW_VENDOR_AMD = 0x1002, - HW_VENDOR_NVIDIA = 0x10de, - HW_VENDOR_INTEL = 0x8086, + HW_VENDOR_SOFTWARE = 0x0000, + HW_VENDOR_AMD = 0x1002, + HW_VENDOR_NVIDIA = 0x10de, + HW_VENDOR_VMWARE = 0x15ad, + HW_VENDOR_INTEL = 0x8086, }; enum wined3d_pci_device @@ -1477,10 +1498,15 @@ enum wined3d_pci_device CARD_NVIDIA_GEFORCE_GTX670 = 0x1189, CARD_NVIDIA_GEFORCE_GTX670MX = 0x11a1, CARD_NVIDIA_GEFORCE_GTX680 = 0x1180, + CARD_NVIDIA_GEFORCE_GTX750 = 0x1381, + CARD_NVIDIA_GEFORCE_GTX750TI = 0x1380, + CARD_NVIDIA_GEFORCE_GTX760 = 0x1187, CARD_NVIDIA_GEFORCE_GTX765M = 0x11e2, CARD_NVIDIA_GEFORCE_GTX770M = 0x11e0, CARD_NVIDIA_GEFORCE_GTX770 = 0x1184, + CARD_VMWARE_SVGA3D = 0x0405, + CARD_INTEL_830M = 0x3577, CARD_INTEL_855GM = 0x3582, CARD_INTEL_845G = 0x2562, @@ -1788,12 +1814,11 @@ struct wined3d { LONG ref; DWORD flags; - UINT dxVersion; UINT adapter_count; struct wined3d_adapter adapters[1]; }; -HRESULT wined3d_init(struct wined3d *wined3d, UINT version, DWORD flags) DECLSPEC_HIDDEN; +HRESULT wined3d_init(struct wined3d *wined3d, DWORD flags) DECLSPEC_HIDDEN; BOOL wined3d_register_window(HWND window, struct wined3d_device *device) DECLSPEC_HIDDEN; void wined3d_unregister_window(HWND window) DECLSPEC_HIDDEN; @@ -2009,7 +2034,6 @@ struct wined3d_resource UINT size; DWORD priority; void *heap_memory; - struct list privateData; struct list resource_list_entry; void *parent; diff --git a/dll/win32/actxprxy/actxprxy_activscp.idl b/dll/win32/actxprxy/actxprxy_activscp.idl index 3f0fda76cd2..514c4640e88 100644 --- a/dll/win32/actxprxy/actxprxy_activscp.idl +++ b/dll/win32/actxprxy/actxprxy_activscp.idl @@ -18,6 +18,9 @@ /* just a wrapper for activscp.idl */ +#pragma makedep proxy +#pragma makedep register + #include "activscp.idl" [ diff --git a/dll/win32/actxprxy/actxprxy_comcat.idl b/dll/win32/actxprxy/actxprxy_comcat.idl index 548aa0d17a0..7832513e932 100644 --- a/dll/win32/actxprxy/actxprxy_comcat.idl +++ b/dll/win32/actxprxy/actxprxy_comcat.idl @@ -18,6 +18,9 @@ /* just a wrapper for comcat.idl */ +#pragma makedep proxy +#pragma makedep register + #include "comcat.idl" [ diff --git a/dll/win32/actxprxy/actxprxy_docobj.idl b/dll/win32/actxprxy/actxprxy_docobj.idl index 8b2a83f65f2..99b9caa420f 100644 --- a/dll/win32/actxprxy/actxprxy_docobj.idl +++ b/dll/win32/actxprxy/actxprxy_docobj.idl @@ -18,6 +18,9 @@ /* just a wrapper for docobj.idl */ +#pragma makedep proxy +#pragma makedep register + #include "docobj.idl" [ diff --git a/dll/win32/actxprxy/actxprxy_hlink.idl b/dll/win32/actxprxy/actxprxy_hlink.idl index 479e937cbf1..519ac5943e7 100644 --- a/dll/win32/actxprxy/actxprxy_hlink.idl +++ b/dll/win32/actxprxy/actxprxy_hlink.idl @@ -18,6 +18,9 @@ /* just a wrapper for hlink.idl */ +#pragma makedep proxy +#pragma makedep register + #include "hlink.idl" [ diff --git a/dll/win32/actxprxy/actxprxy_htiface.idl b/dll/win32/actxprxy/actxprxy_htiface.idl index 8ecf7e664b9..e2d9ab7dd58 100644 --- a/dll/win32/actxprxy/actxprxy_htiface.idl +++ b/dll/win32/actxprxy/actxprxy_htiface.idl @@ -18,6 +18,9 @@ /* just a wrapper for htiface.idl */ +#pragma makedep proxy +#pragma makedep register + #include "htiface.idl" [ diff --git a/dll/win32/actxprxy/actxprxy_htiframe.idl b/dll/win32/actxprxy/actxprxy_htiframe.idl index e3d5f723c91..d0ece4a0281 100644 --- a/dll/win32/actxprxy/actxprxy_htiframe.idl +++ b/dll/win32/actxprxy/actxprxy_htiframe.idl @@ -18,6 +18,9 @@ /* just a wrapper for htiframe.idl */ +#pragma makedep proxy +#pragma makedep register + #include "htiframe.idl" [ diff --git a/dll/win32/actxprxy/actxprxy_objsafe.idl b/dll/win32/actxprxy/actxprxy_objsafe.idl index 771a4d9ccb0..01d39ac3a63 100644 --- a/dll/win32/actxprxy/actxprxy_objsafe.idl +++ b/dll/win32/actxprxy/actxprxy_objsafe.idl @@ -18,6 +18,9 @@ /* just a wrapper for objsafe.idl */ +#pragma makedep proxy +#pragma makedep register + #include "objsafe.idl" [ diff --git a/dll/win32/actxprxy/actxprxy_ocmm.idl b/dll/win32/actxprxy/actxprxy_ocmm.idl index 75e4788aa54..b1ac316ba78 100644 --- a/dll/win32/actxprxy/actxprxy_ocmm.idl +++ b/dll/win32/actxprxy/actxprxy_ocmm.idl @@ -18,6 +18,9 @@ /* just a wrapper for ocmm.idl */ +#pragma makedep proxy +#pragma makedep register + #include "ocmm.idl" [ diff --git a/dll/win32/actxprxy/actxprxy_servprov.idl b/dll/win32/actxprxy/actxprxy_servprov.idl index 1388f23e43b..98ac626530f 100644 --- a/dll/win32/actxprxy/actxprxy_servprov.idl +++ b/dll/win32/actxprxy/actxprxy_servprov.idl @@ -1,3 +1,6 @@ +#pragma makedep proxy +#pragma makedep register + #include "servprov.idl" [ diff --git a/dll/win32/actxprxy/actxprxy_shldisp.idl b/dll/win32/actxprxy/actxprxy_shldisp.idl index e5ddb18cfc4..041c675ef5b 100644 --- a/dll/win32/actxprxy/actxprxy_shldisp.idl +++ b/dll/win32/actxprxy/actxprxy_shldisp.idl @@ -18,6 +18,9 @@ /* just a wrapper for shldisp.idl */ +#pragma makedep proxy +#pragma makedep register + #include "shldisp.idl" [ diff --git a/dll/win32/actxprxy/actxprxy_shobjidl.idl b/dll/win32/actxprxy/actxprxy_shobjidl.idl index ccff236dca3..2a6dac117f4 100644 --- a/dll/win32/actxprxy/actxprxy_shobjidl.idl +++ b/dll/win32/actxprxy/actxprxy_shobjidl.idl @@ -18,6 +18,9 @@ /* just a wrapper for shobjidl.idl */ +#pragma makedep proxy +#pragma makedep register + #include "shobjidl.idl" [ diff --git a/dll/win32/actxprxy/actxprxy_urlhist.idl b/dll/win32/actxprxy/actxprxy_urlhist.idl index f9877527e88..7e933a999f6 100644 --- a/dll/win32/actxprxy/actxprxy_urlhist.idl +++ b/dll/win32/actxprxy/actxprxy_urlhist.idl @@ -18,6 +18,9 @@ /* just a wrapper for urlhist.idl */ +#pragma makedep proxy +#pragma makedep register + #include "urlhist.idl" [ diff --git a/dll/win32/avifil32/api.c b/dll/win32/avifil32/api.c index c5c4dcf3cd6..9ae26b94311 100644 --- a/dll/win32/avifil32/api.c +++ b/dll/win32/avifil32/api.c @@ -1493,7 +1493,7 @@ HRESULT WINAPI AVISaveVA(LPCSTR szFile, CLSID *pclsidHandler, HRESULT hr; int len; - TRACE("%s,%p,%p,%d,%p,%p)\n", debugstr_a(szFile), pclsidHandler, + TRACE("(%s,%p,%p,%d,%p,%p)\n", debugstr_a(szFile), pclsidHandler, lpfnCallback, nStream, ppavi, plpOptions); if (szFile == NULL || ppavi == NULL || plpOptions == NULL) diff --git a/dll/win32/avifil32/avifil32.idl b/dll/win32/avifil32/avifil32.idl index b4c563f4d71..1f50f154ae1 100644 --- a/dll/win32/avifil32/avifil32.idl +++ b/dll/win32/avifil32/avifil32.idl @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ helpstring("Microsoft AVI Files"), threading(apartment), diff --git a/dll/win32/avifil32/avifile.c b/dll/win32/avifil32/avifile.c index 28766e97062..fa71eb11d9e 100644 --- a/dll/win32/avifil32/avifile.c +++ b/dll/win32/avifil32/avifile.c @@ -36,46 +36,12 @@ #define IDX_PER_BLOCK 2730 #endif -static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream*iface,REFIID refiid,LPVOID *obj); -static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream*iface); -static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface); -static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream*iface,LPARAM lParam1,LPARAM lParam2); -static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream*iface,AVISTREAMINFOW *psi,LONG size); -static LONG WINAPI IAVIStream_fnFindSample(IAVIStream*iface,LONG pos,LONG flags); -static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG *formatsize); -static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG formatsize); -static HRESULT WINAPI IAVIStream_fnRead(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread); -static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten); -static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream*iface,LONG start,LONG samples); -static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG *lpread); -static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG size); -static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream*iface,AVISTREAMINFOW*info,LONG infolen); - -static const struct IAVIStreamVtbl iavist = { - IAVIStream_fnQueryInterface, - IAVIStream_fnAddRef, - IAVIStream_fnRelease, - IAVIStream_fnCreate, - IAVIStream_fnInfo, - IAVIStream_fnFindSample, - IAVIStream_fnReadFormat, - IAVIStream_fnSetFormat, - IAVIStream_fnRead, - IAVIStream_fnWrite, - IAVIStream_fnDelete, - IAVIStream_fnReadData, - IAVIStream_fnWriteData, - IAVIStream_fnSetInfo -}; - typedef struct _IAVIFileImpl IAVIFileImpl; typedef struct _IAVIStreamImpl { - /* IUnknown stuff */ - const IAVIStreamVtbl *lpVtbl; - LONG ref; + IAVIStream IAVIStream_iface; + LONG ref; - /* IAVIStream stuff */ IAVIFileImpl *paf; DWORD nStream; /* the n-th stream in file */ AVISTREAMINFOW sInfo; @@ -99,6 +65,11 @@ typedef struct _IAVIStreamImpl { DWORD nIdxFmtChanges; /* upper index limit of idxFmtChanges */ } IAVIStreamImpl; +static inline IAVIStreamImpl *impl_from_IAVIStream(IAVIStream *iface) +{ + return CONTAINING_RECORD(iface, IAVIStreamImpl, IAVIStream_iface); +} + struct _IAVIFileImpl { IUnknown IUnknown_inner; IAVIFile IAVIFile_iface; @@ -319,7 +290,7 @@ static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile *iface, IAVIStream **avis, D /* Does the requested stream exist? */ if (nStream < This->fInfo.dwStreams && This->ppStreams[nStream] != NULL) { - *avis = (PAVISTREAM)This->ppStreams[nStream]; + *avis = &This->ppStreams[nStream]->IAVIStream_iface; IAVIStream_AddRef(*avis); return AVIERR_OK; @@ -376,7 +347,7 @@ static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile *iface, IAVIStream **avis AVIFILE_UpdateInfo(This); /* return it */ - *avis = (PAVISTREAM)This->ppStreams[n]; + *avis = &This->ppStreams[n]->IAVIStream_iface; IAVIStream_AddRef(*avis); return AVIERR_OK; @@ -679,31 +650,35 @@ HRESULT AVIFILE_CreateAVIFile(IUnknown *pUnkOuter, REFIID riid, void **ppv) } -static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream *iface, - REFIID refiid, LPVOID *obj) +static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream *iface, REFIID riid, void **ppv) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + IAVIStreamImpl *This = impl_from_IAVIStream(iface); - TRACE("(%p,%s,%p)\n", iface, debugstr_guid(refiid), obj); + TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppv); - if (IsEqualGUID(&IID_IUnknown, refiid) || - IsEqualGUID(&IID_IAVIStream, refiid)) { - *obj = This; + if (!ppv) { + WARN("invalid parameter\n"); + return E_INVALIDARG; + } + *ppv = NULL; + + if (IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IAVIStream, riid)) { + *ppv = iface; IAVIStream_AddRef(iface); return S_OK; } /* FIXME: IAVIStreaming interface */ - return OLE_E_ENUM_NOMORE; + return E_NOINTERFACE; } static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream *iface) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + IAVIStreamImpl *This = impl_from_IAVIStream(iface); ULONG ref = InterlockedIncrement(&This->ref); - TRACE("(%p) -> %d\n", iface, ref); + TRACE("(%p) ref=%d\n", This, ref); /* also add ref to parent, so that it doesn't kill us */ if (This->paf != NULL) @@ -712,12 +687,12 @@ static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream *iface) return ref; } -static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface) +static ULONG WINAPI IAVIStream_fnRelease(IAVIStream *iface) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + IAVIStreamImpl *This = impl_from_IAVIStream(iface); ULONG ref = InterlockedDecrement(&This->ref); - TRACE("(%p) -> %d\n", iface, ref); + TRACE("(%p) ref=%d\n", This, ref); if (This->paf != NULL) IAVIFile_Release(&This->paf->IAVIFile_iface); @@ -725,8 +700,7 @@ static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface) return ref; } -static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream *iface, LPARAM lParam1, - LPARAM lParam2) +static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream *iface, LPARAM lParam1, LPARAM lParam2) { TRACE("(%p,0x%08lX,0x%08lX)\n", iface, lParam1, lParam2); @@ -734,10 +708,9 @@ static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream *iface, LPARAM lParam1, return AVIERR_UNSUPPORTED; } -static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream *iface,LPAVISTREAMINFOW psi, - LONG size) +static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream *iface, AVISTREAMINFOW *psi, LONG size) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + IAVIStreamImpl *This = impl_from_IAVIStream(iface); TRACE("(%p,%p,%d)\n", iface, psi, size); @@ -753,11 +726,9 @@ static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream *iface,LPAVISTREAMINFOW psi, return AVIERR_OK; } -static LONG WINAPI IAVIStream_fnFindSample(IAVIStream *iface, LONG pos, - LONG flags) +static LONG WINAPI IAVIStream_fnFindSample(IAVIStream *iface, LONG pos, LONG flags) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; - + IAVIStreamImpl *This = impl_from_IAVIStream(iface); LONG offset = 0; TRACE("(%p,%d,0x%08X)\n",iface,pos,flags); @@ -853,10 +824,10 @@ static LONG WINAPI IAVIStream_fnFindSample(IAVIStream *iface, LONG pos, return pos; } -static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream *iface, LONG pos, - LPVOID format, LONG *formatsize) +static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream *iface, LONG pos, void *format, + LONG *formatsize) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + IAVIStreamImpl *This = impl_from_IAVIStream(iface); TRACE("(%p,%d,%p,%p)\n", iface, pos, format, formatsize); @@ -892,12 +863,11 @@ static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream *iface, LONG pos, return AVIERR_OK; } -static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos, - LPVOID format, LONG formatsize) +static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos, void *format, + LONG formatsize) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; - - LPBITMAPINFOHEADER lpbiNew = format; + IAVIStreamImpl *This = impl_from_IAVIStream(iface); + BITMAPINFOHEADER *lpbiNew = format; TRACE("(%p,%d,%p,%d)\n", iface, pos, format, formatsize); @@ -1001,15 +971,12 @@ static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos, } } -static HRESULT WINAPI IAVIStream_fnRead(IAVIStream *iface, LONG start, - LONG samples, LPVOID buffer, - LONG buffersize, LPLONG bytesread, - LPLONG samplesread) +static HRESULT WINAPI IAVIStream_fnRead(IAVIStream *iface, LONG start, LONG samples, void *buffer, + LONG buffersize, LONG *bytesread, LONG *samplesread) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; - - DWORD size; - HRESULT hr; + IAVIStreamImpl *This = impl_from_IAVIStream(iface); + DWORD size; + HRESULT hr; TRACE("(%p,%d,%d,%p,%d,%p,%p)\n", iface, start, samples, buffer, buffersize, bytesread, samplesread); @@ -1123,15 +1090,11 @@ static HRESULT WINAPI IAVIStream_fnRead(IAVIStream *iface, LONG start, } } -static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream *iface, LONG start, - LONG samples, LPVOID buffer, - LONG buffersize, DWORD flags, - LPLONG sampwritten, - LPLONG byteswritten) +static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream *iface, LONG start, LONG samples, void *buffer, + LONG buffersize, DWORD flags, LONG *sampwritten, LONG *byteswritten) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; - - FOURCC ckid; + IAVIStreamImpl *This = impl_from_IAVIStream(iface); + FOURCC ckid; HRESULT hr; TRACE("(%p,%d,%d,%p,%d,0x%08X,%p,%p)\n", iface, start, samples, @@ -1217,10 +1180,9 @@ static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream *iface, LONG start, return hr; } -static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream *iface, LONG start, - LONG samples) +static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream *iface, LONG start, LONG samples) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + IAVIStreamImpl *This = impl_from_IAVIStream(iface); FIXME("(%p,%d,%d): stub\n", iface, start, samples); @@ -1256,10 +1218,9 @@ static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream *iface, LONG start, return AVIERR_UNSUPPORTED; } -static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream *iface, DWORD fcc, - LPVOID lp, LPLONG lpread) +static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream *iface, DWORD fcc, void *lp, LONG *lpread) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + IAVIStreamImpl *This = impl_from_IAVIStream(iface); TRACE("(%p,0x%08X,%p,%p)\n", iface, fcc, lp, lpread); @@ -1280,10 +1241,9 @@ static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream *iface, DWORD fcc, return ReadExtraChunk(&This->extra, fcc, lp, lpread); } -static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream *iface, DWORD fcc, - LPVOID lp, LONG size) +static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream *iface, DWORD fcc, void *lp, LONG size) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + IAVIStreamImpl *This = impl_from_IAVIStream(iface); TRACE("(%p,0x%08x,%p,%d)\n", iface, fcc, lp, size); @@ -1313,7 +1273,7 @@ static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream *iface, DWORD fcc, if (fcc == ckidSTREAMHANDLERDATA) { if (This->lpHandlerData != NULL) { - FIXME(": handler data already set -- overwirte?\n"); + FIXME(": handler data already set -- overwrite?\n"); return AVIERR_UNSUPPORTED; } @@ -1328,15 +1288,30 @@ static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream *iface, DWORD fcc, return WriteExtraChunk(&This->extra, fcc, lp, size); } -static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream *iface, - LPAVISTREAMINFOW info, LONG infolen) +static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream *iface, AVISTREAMINFOW *info, LONG infolen) { FIXME("(%p,%p,%d): stub\n", iface, info, infolen); return E_FAIL; } -/***********************************************************************/ +static const struct IAVIStreamVtbl avist_vt = { + IAVIStream_fnQueryInterface, + IAVIStream_fnAddRef, + IAVIStream_fnRelease, + IAVIStream_fnCreate, + IAVIStream_fnInfo, + IAVIStream_fnFindSample, + IAVIStream_fnReadFormat, + IAVIStream_fnSetFormat, + IAVIStream_fnRead, + IAVIStream_fnWrite, + IAVIStream_fnDelete, + IAVIStream_fnReadData, + IAVIStream_fnWriteData, + IAVIStream_fnSetInfo +}; + static HRESULT AVIFILE_AddFrame(IAVIStreamImpl *This, DWORD ckid, DWORD size, DWORD offset, DWORD flags) { @@ -1495,7 +1470,7 @@ static void AVIFILE_ConstructAVIStream(IAVIFileImpl *paf, DWORD nr, const AVISTR pstream = paf->ppStreams[nr]; - pstream->lpVtbl = &iavist; + pstream->IAVIStream_iface.lpVtbl = &avist_vt; pstream->ref = 0; pstream->paf = paf; pstream->nStream = nr; @@ -2102,7 +2077,7 @@ static HRESULT AVIFILE_SaveFile(IAVIFileImpl *This) if (This->dwMoviChunkPos == 0) AVIFILE_ComputeMoviStart(This); - /* written one record to much? */ + /* written one record too much? */ if (This->ckLastRecord.dwFlags & MMIO_DIRTY) { This->dwNextFramePos -= 3 * sizeof(DWORD); if (This->nIdxRecords > 0) @@ -2334,7 +2309,7 @@ static HRESULT AVIFILE_SaveIndex(const IAVIFileImpl *This) if (This->ppStreams[0]->sInfo.dwSampleSize == 0) stepsize = 1; else - stepsize = AVIStreamTimeToSample((PAVISTREAM)This->ppStreams[0], 1000000); + stepsize = AVIStreamTimeToSample(&This->ppStreams[0]->IAVIStream_iface, 1000000); assert(stepsize > 0); @@ -2504,8 +2479,8 @@ static void AVIFILE_UpdateInfo(IAVIFileImpl *This) This->fInfo.dwRate = psi->dwRate; This->fInfo.dwLength = psi->dwLength; } else { - n = AVIStreamSampleToSample((PAVISTREAM)This->ppStreams[0], - (PAVISTREAM)This->ppStreams[i],psi->dwLength); + n = AVIStreamSampleToSample(&This->ppStreams[0]->IAVIStream_iface, + &This->ppStreams[i]->IAVIStream_iface, psi->dwLength); if (This->fInfo.dwLength < n) This->fInfo.dwLength = n; } diff --git a/dll/win32/avifil32/avifile_private.h b/dll/win32/avifil32/avifile_private.h index 605866edd8e..45fe468fa78 100644 --- a/dll/win32/avifil32/avifile_private.h +++ b/dll/win32/avifil32/avifile_private.h @@ -62,7 +62,7 @@ DEFINE_AVIGUID(CLSID_ACMStream, 0x0002000F, 0, 0); extern HMODULE AVIFILE_hModule DECLSPEC_HIDDEN; extern HRESULT AVIFILE_CreateAVIFile(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN; -extern HRESULT AVIFILE_CreateWAVFile(REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN; +extern HRESULT AVIFILE_CreateWAVFile(IUnknown *outer_unk, REFIID riid, void **ret_iface) DECLSPEC_HIDDEN; extern HRESULT AVIFILE_CreateACMStream(REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN; extern HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN; extern PAVIEDITSTREAM AVIFILE_CreateEditStream(PAVISTREAM pstream) DECLSPEC_HIDDEN; diff --git a/dll/win32/avifil32/factory.c b/dll/win32/avifil32/factory.c index e99359868c3..d0eb1efdb3b 100644 --- a/dll/win32/avifil32/factory.c +++ b/dll/win32/avifil32/factory.c @@ -133,14 +133,14 @@ static HRESULT WINAPI IClassFactory_fnCreateInstance(LPCLASSFACTORY iface, if (IsEqualGUID(&CLSID_AVIFile, &This->clsid)) return AVIFILE_CreateAVIFile(pOuter, riid, ppobj); + if (IsEqualGUID(&CLSID_WAVFile, &This->clsid)) + return AVIFILE_CreateWAVFile(pOuter, riid, ppobj); if (pOuter) return CLASS_E_NOAGGREGATION; if (IsEqualGUID(&CLSID_ICMStream, &This->clsid)) return AVIFILE_CreateICMStream(riid,ppobj); - if (IsEqualGUID(&CLSID_WAVFile, &This->clsid)) - return AVIFILE_CreateWAVFile(riid,ppobj); if (IsEqualGUID(&CLSID_ACMStream, &This->clsid)) return AVIFILE_CreateACMStream(riid,ppobj); diff --git a/dll/win32/avifil32/icmstream.c b/dll/win32/avifil32/icmstream.c index bb4155b0582..94df1d9116f 100644 --- a/dll/win32/avifil32/icmstream.c +++ b/dll/win32/avifil32/icmstream.c @@ -299,7 +299,7 @@ static LONG WINAPI ICMStream_fnFindSample(IAVIStream *iface, LONG pos, return This->lLastKey; } } else if (flags & FIND_ANY) { - return pos; /* We really don't know, reread is to expensive, so guess. */ + return pos; /* We really don't know, reread is too expensive, so guess. */ } else if (flags & FIND_FORMAT) { if (flags & FIND_PREV) return 0; diff --git a/dll/win32/avifil32/wavfile.c b/dll/win32/avifil32/wavfile.c index 42637e3af88..4376ffba679 100644 --- a/dll/win32/avifil32/wavfile.c +++ b/dll/win32/avifil32/wavfile.c @@ -67,111 +67,14 @@ typedef struct { /***********************************************************************/ -static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile* iface,REFIID refiid,LPVOID *obj); -static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile* iface); -static ULONG WINAPI IAVIFile_fnRelease(IAVIFile* iface); -static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile*iface,AVIFILEINFOW*afi,LONG size); -static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam); -static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi); -static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG size); -static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG *size); -static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile*iface); -static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile*iface,DWORD fccType,LONG lParam); - -static const struct IAVIFileVtbl iwavft = { - IAVIFile_fnQueryInterface, - IAVIFile_fnAddRef, - IAVIFile_fnRelease, - IAVIFile_fnInfo, - IAVIFile_fnGetStream, - IAVIFile_fnCreateStream, - IAVIFile_fnWriteData, - IAVIFile_fnReadData, - IAVIFile_fnEndRecord, - IAVIFile_fnDeleteStream -}; - -static HRESULT WINAPI IPersistFile_fnQueryInterface(IPersistFile*iface,REFIID refiid,LPVOID*obj); -static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile*iface); -static ULONG WINAPI IPersistFile_fnRelease(IPersistFile*iface); -static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile*iface,CLSID*pClassID); -static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile*iface); -static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile*iface,LPCOLESTR pszFileName,DWORD dwMode); -static HRESULT WINAPI IPersistFile_fnSave(IPersistFile*iface,LPCOLESTR pszFileName,BOOL fRemember); -static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile*iface,LPCOLESTR pszFileName); -static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile*iface,LPOLESTR*ppszFileName); - -static const struct IPersistFileVtbl iwavpft = { - IPersistFile_fnQueryInterface, - IPersistFile_fnAddRef, - IPersistFile_fnRelease, - IPersistFile_fnGetClassID, - IPersistFile_fnIsDirty, - IPersistFile_fnLoad, - IPersistFile_fnSave, - IPersistFile_fnSaveCompleted, - IPersistFile_fnGetCurFile -}; - -static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream*iface,REFIID refiid,LPVOID *obj); -static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream*iface); -static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface); -static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream*iface,LPARAM lParam1,LPARAM lParam2); -static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream*iface,AVISTREAMINFOW *psi,LONG size); -static LONG WINAPI IAVIStream_fnFindSample(IAVIStream*iface,LONG pos,LONG flags); -static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG *formatsize); -static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG formatsize); -static HRESULT WINAPI IAVIStream_fnRead(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread); -static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten); -static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream*iface,LONG start,LONG samples); -static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG *lpread); -static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG size); -static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream*iface,AVISTREAMINFOW*info,LONG infolen); - -static const struct IAVIStreamVtbl iwavst = { - IAVIStream_fnQueryInterface, - IAVIStream_fnAddRef, - IAVIStream_fnRelease, - IAVIStream_fnCreate, - IAVIStream_fnInfo, - IAVIStream_fnFindSample, - IAVIStream_fnReadFormat, - IAVIStream_fnSetFormat, - IAVIStream_fnRead, - IAVIStream_fnWrite, - IAVIStream_fnDelete, - IAVIStream_fnReadData, - IAVIStream_fnWriteData, - IAVIStream_fnSetInfo -}; - -typedef struct _IAVIFileImpl IAVIFileImpl; - -typedef struct _IPersistFileImpl { - /* IUnknown stuff */ - const IPersistFileVtbl *lpVtbl; - - /* IPersistFile stuff */ - IAVIFileImpl *paf; -} IPersistFileImpl; - -typedef struct _IAVIStreamImpl { - /* IUnknown stuff */ - const IAVIStreamVtbl *lpVtbl; - - /* IAVIStream stuff */ - IAVIFileImpl *paf; -} IAVIStreamImpl; - -struct _IAVIFileImpl { - /* IUnknown stuff */ - const IAVIFileVtbl *lpVtbl; - LONG ref; - +typedef struct _IAVIFileImpl { + IUnknown IUnknown_inner; + IAVIFile IAVIFile_iface; + IPersistFile IPersistFile_iface; + IAVIStream IAVIStream_iface; + IUnknown *outer_unk; + LONG ref; /* IAVIFile, IAVIStream stuff... */ - IPersistFileImpl iPersistFile; - IAVIStreamImpl iAVIStream; - AVIFILEINFOW fInfo; AVISTREAMINFOW sInfo; @@ -187,7 +90,7 @@ struct _IAVIFileImpl { LPWSTR szFileName; UINT uMode; BOOL fDirty; -}; +} IAVIFileImpl; /***********************************************************************/ @@ -195,108 +98,112 @@ static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This); static HRESULT AVIFILE_LoadSunFile(IAVIFileImpl *This); static HRESULT AVIFILE_SaveFile(const IAVIFileImpl *This); -HRESULT AVIFILE_CreateWAVFile(REFIID riid, LPVOID *ppv) +static inline IAVIFileImpl *impl_from_IUnknown(IUnknown *iface) { - IAVIFileImpl *pfile; - HRESULT hr; - - assert(riid != NULL && ppv != NULL); - - *ppv = NULL; - - pfile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAVIFileImpl)); - if (pfile == NULL) - return AVIERR_MEMORY; - - pfile->lpVtbl = &iwavft; - pfile->iPersistFile.lpVtbl = &iwavpft; - pfile->iAVIStream.lpVtbl = &iwavst; - pfile->ref = 0; - pfile->iPersistFile.paf = pfile; - pfile->iAVIStream.paf = pfile; - - hr = IAVIFile_QueryInterface((IAVIFile*)pfile, riid, ppv); - if (FAILED(hr)) - HeapFree(GetProcessHeap(), 0, pfile); - - return hr; + return CONTAINING_RECORD(iface, IAVIFileImpl, IUnknown_inner); } -static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile *iface, REFIID refiid, - LPVOID *obj) +static HRESULT WINAPI IUnknown_fnQueryInterface(IUnknown *iface, REFIID riid, void **ret_iface) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IUnknown(iface); - TRACE("(%p,%s,%p)\n", This, debugstr_guid(refiid), obj); + TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ret_iface); - if (IsEqualGUID(&IID_IUnknown, refiid) || - IsEqualGUID(&IID_IAVIFile, refiid)) { - *obj = iface; - IAVIFile_AddRef(iface); - return S_OK; - } else if (This->fInfo.dwStreams == 1 && - IsEqualGUID(&IID_IAVIStream, refiid)) { - *obj = &This->iAVIStream; - IAVIFile_AddRef(iface); - return S_OK; - } else if (IsEqualGUID(&IID_IPersistFile, refiid)) { - *obj = &This->iPersistFile; - IAVIFile_AddRef(iface); - return S_OK; - } + if (IsEqualGUID(&IID_IUnknown, riid)) + *ret_iface = &This->IUnknown_inner; + else if (IsEqualGUID(&IID_IAVIFile, riid)) + *ret_iface = &This->IAVIFile_iface; + else if (IsEqualGUID(&IID_IAVIStream, riid)) + *ret_iface = &This->IAVIStream_iface; + else if (IsEqualGUID(&IID_IPersistFile, riid)) + *ret_iface = &This->IPersistFile_iface; + else { + WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ret_iface); + *ret_iface = NULL; + return E_NOINTERFACE; + } - return OLE_E_ENUM_NOMORE; + /* Violation of the COM aggregation ref counting rule */ + IUnknown_AddRef(&This->IUnknown_inner); + return S_OK; +} + +static ULONG WINAPI IUnknown_fnAddRef(IUnknown *iface) +{ + IAVIFileImpl *This = impl_from_IUnknown(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; +} + +static ULONG WINAPI IUnknown_fnRelease(IUnknown *iface) +{ + IAVIFileImpl *This = impl_from_IUnknown(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if (!ref) { + /* need to write headers to file */ + if (This->fDirty) + AVIFILE_SaveFile(This); + + HeapFree(GetProcessHeap(), 0, This->lpFormat); + This->lpFormat = NULL; + This->cbFormat = 0; + HeapFree(GetProcessHeap(), 0, This->extra.lp); + This->extra.lp = NULL; + This->extra.cb = 0; + HeapFree(GetProcessHeap(), 0, This->szFileName); + This->szFileName = NULL; + if (This->hmmio) { + mmioClose(This->hmmio, 0); + This->hmmio = NULL; + } + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static const IUnknownVtbl unk_vtbl = +{ + IUnknown_fnQueryInterface, + IUnknown_fnAddRef, + IUnknown_fnRelease +}; + +static inline IAVIFileImpl *impl_from_IAVIFile(IAVIFile *iface) +{ + return CONTAINING_RECORD(iface, IAVIFileImpl, IAVIFile_iface); +} + +static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile *iface, REFIID riid, void **ret_iface) +{ + IAVIFileImpl *This = impl_from_IAVIFile(iface); + + return IUnknown_QueryInterface(This->outer_unk, riid, ret_iface); } static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile *iface) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(iface); - TRACE("(%p)\n",iface); - - return InterlockedIncrement(&This->ref); + return IUnknown_AddRef(This->outer_unk); } static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; - ULONG ref = InterlockedDecrement(&This->ref); + IAVIFileImpl *This = impl_from_IAVIFile(iface); - TRACE("(%p)\n",iface); - - if (!ref) { - if (This->fDirty) { - /* need to write headers to file */ - AVIFILE_SaveFile(This); - } - - if (This->lpFormat != NULL) { - HeapFree(GetProcessHeap(), 0, This->lpFormat); - This->lpFormat = NULL; - This->cbFormat = 0; - } - if (This->extra.lp != NULL) { - HeapFree(GetProcessHeap(), 0, This->extra.lp); - This->extra.lp = NULL; - This->extra.cb = 0; - } - HeapFree(GetProcessHeap(), 0, This->szFileName); - This->szFileName = NULL; - if (This->hmmio != NULL) { - mmioClose(This->hmmio, 0); - This->hmmio = NULL; - } - - HeapFree(GetProcessHeap(), 0, This); - return 0; - } - return ref; + return IUnknown_Release(This->outer_unk); } -static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile *iface, LPAVIFILEINFOW afi, - LONG size) +static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile *iface, AVIFILEINFOW *afi, LONG size) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,%p,%d)\n",iface,afi,size); @@ -327,10 +234,10 @@ static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile *iface, LPAVIFILEINFOW afi, return AVIERR_OK; } -static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile *iface, PAVISTREAM *avis, - DWORD fccType, LONG lParam) +static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile *iface, IAVIStream **avis, DWORD fccType, + LONG lParam) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,%p,0x%08X,%d)\n", iface, avis, fccType, lParam); @@ -346,16 +253,16 @@ static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile *iface, PAVISTREAM *avis, if (fccType != 0 && fccType != streamtypeAUDIO) return AVIERR_NODATA; - *avis = (PAVISTREAM)&This->iAVIStream; - IAVIFile_AddRef(iface); + *avis = &This->IAVIStream_iface; + IAVIStream_AddRef(*avis); return AVIERR_OK; } -static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile *iface,PAVISTREAM *avis, - LPAVISTREAMINFOW asi) +static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile *iface, IAVIStream **avis, + AVISTREAMINFOW *asi) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,%p,%p)\n", iface, avis, asi); @@ -397,16 +304,15 @@ static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile *iface,PAVISTREAM *avis, This->ckData.dwDataOffset = 0; This->ckData.cksize = 0; - *avis = (PAVISTREAM)&This->iAVIStream; - IAVIFile_AddRef(iface); + *avis = &This->IAVIStream_iface; + IAVIStream_AddRef(*avis); return AVIERR_OK; } -static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile *iface, DWORD ckid, - LPVOID lpData, LONG size) +static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile *iface, DWORD ckid, void *lpData, LONG size) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,0x%08X,%p,%d)\n", iface, ckid, lpData, size); @@ -425,10 +331,9 @@ static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile *iface, DWORD ckid, return WriteExtraChunk(&This->extra, ckid, lpData, size); } -static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile *iface, DWORD ckid, - LPVOID lpData, LONG *size) +static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile *iface, DWORD ckid, void *lpData, LONG *size) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,0x%08X,%p,%p)\n", iface, ckid, lpData, size); @@ -445,10 +350,9 @@ static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile *iface) return AVIERR_OK; } -static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType, - LONG lParam) +static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType, LONG lParam) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,0x%08X,%d)\n", iface, fccType, lParam); @@ -486,34 +390,46 @@ static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType, return AVIERR_OK; } +static const struct IAVIFileVtbl iwavft = { + IAVIFile_fnQueryInterface, + IAVIFile_fnAddRef, + IAVIFile_fnRelease, + IAVIFile_fnInfo, + IAVIFile_fnGetStream, + IAVIFile_fnCreateStream, + IAVIFile_fnWriteData, + IAVIFile_fnReadData, + IAVIFile_fnEndRecord, + IAVIFile_fnDeleteStream +}; + /***********************************************************************/ -static HRESULT WINAPI IPersistFile_fnQueryInterface(IPersistFile *iface, - REFIID refiid, LPVOID *obj) +static inline IAVIFileImpl *impl_from_IPersistFile(IPersistFile *iface) { - IPersistFileImpl *This = (IPersistFileImpl *)iface; + return CONTAINING_RECORD(iface, IAVIFileImpl, IPersistFile_iface); +} - assert(This->paf != NULL); +static HRESULT WINAPI IPersistFile_fnQueryInterface(IPersistFile *iface, REFIID riid, + void **ret_iface) +{ + IAVIFileImpl *This = impl_from_IPersistFile(iface); - return IAVIFile_QueryInterface((PAVIFILE)This->paf, refiid, obj); + return IUnknown_QueryInterface(This->outer_unk, riid, ret_iface); } static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile *iface) { - IPersistFileImpl *This = (IPersistFileImpl *)iface; + IAVIFileImpl *This = impl_from_IPersistFile(iface); - assert(This->paf != NULL); - - return IAVIFile_AddRef((PAVIFILE)This->paf); + return IUnknown_AddRef(This->outer_unk); } static ULONG WINAPI IPersistFile_fnRelease(IPersistFile *iface) { - IPersistFileImpl *This = (IPersistFileImpl *)iface; + IAVIFileImpl *This = impl_from_IPersistFile(iface); - assert(This->paf != NULL); - - return IAVIFile_Release((PAVIFILE)This->paf); + return IUnknown_Release(This->outer_unk); } static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile *iface, @@ -531,20 +447,16 @@ static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile *iface, static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile *iface) { - IPersistFileImpl *This = (IPersistFileImpl *)iface; + IAVIFileImpl *This = impl_from_IPersistFile(iface); - TRACE("(%p)\n", iface); + TRACE("(%p)\n", iface); - assert(This->paf != NULL); - - return (This->paf->fDirty ? S_OK : S_FALSE); + return (This->fDirty ? S_OK : S_FALSE); } -static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, - LPCOLESTR pszFileName, DWORD dwMode) +static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, LPCOLESTR pszFileName, DWORD dwMode) { - IAVIFileImpl *This = ((IPersistFileImpl*)iface)->paf; - + IAVIFileImpl *This = impl_from_IPersistFile(iface); WCHAR wszStreamFmt[50]; INT len; @@ -554,7 +466,6 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, if (pszFileName == NULL) return AVIERR_BADPARAM; - assert(This != NULL); if (This->hmmio != NULL) return AVIERR_ERROR; /* No reuse of this object for another file! */ @@ -626,10 +537,9 @@ static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile *iface, return AVIERR_OK; } -static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile *iface, - LPOLESTR *ppszFileName) +static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile *iface, LPOLESTR *ppszFileName) { - IPersistFileImpl *This = (IPersistFileImpl *)iface; + IAVIFileImpl *This = impl_from_IPersistFile(iface); TRACE("(%p,%p)\n", iface, ppszFileName); @@ -638,49 +548,57 @@ static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile *iface, *ppszFileName = NULL; - assert(This->paf != NULL); - - if (This->paf->szFileName != NULL) { - int len = lstrlenW(This->paf->szFileName) + 1; + if (This->szFileName) { + int len = lstrlenW(This->szFileName) + 1; *ppszFileName = CoTaskMemAlloc(len * sizeof(WCHAR)); if (*ppszFileName == NULL) return AVIERR_MEMORY; - strcpyW(*ppszFileName, This->paf->szFileName); + strcpyW(*ppszFileName, This->szFileName); } return AVIERR_OK; } +static const struct IPersistFileVtbl iwavpft = { + IPersistFile_fnQueryInterface, + IPersistFile_fnAddRef, + IPersistFile_fnRelease, + IPersistFile_fnGetClassID, + IPersistFile_fnIsDirty, + IPersistFile_fnLoad, + IPersistFile_fnSave, + IPersistFile_fnSaveCompleted, + IPersistFile_fnGetCurFile +}; + /***********************************************************************/ -static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream *iface, - REFIID refiid, LPVOID *obj) +static inline IAVIFileImpl *impl_from_IAVIStream(IAVIStream *iface) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + return CONTAINING_RECORD(iface, IAVIFileImpl, IAVIStream_iface); +} - assert(This->paf != NULL); +static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream *iface, REFIID riid, void **ret_iface) +{ + IAVIFileImpl *This = impl_from_IAVIStream(iface); - return IAVIFile_QueryInterface((PAVIFILE)This->paf, refiid, obj); + return IUnknown_QueryInterface(This->outer_unk, riid, ret_iface); } static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream *iface) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIStream(iface); - assert(This->paf != NULL); - - return IAVIFile_AddRef((PAVIFILE)This->paf); + return IUnknown_AddRef(This->outer_unk); } static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIStream(iface); - assert(This->paf != NULL); - - return IAVIFile_Release((PAVIFILE)This->paf); + return IUnknown_Release(This->outer_unk); } static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream *iface, LPARAM lParam1, @@ -692,10 +610,9 @@ static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream *iface, LPARAM lParam1, return AVIERR_UNSUPPORTED; } -static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream *iface,LPAVISTREAMINFOW psi, - LONG size) +static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream *iface, AVISTREAMINFOW *psi, LONG size) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIStream(iface); TRACE("(%p,%p,%d)\n", iface, psi, size); @@ -704,17 +621,16 @@ static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream *iface,LPAVISTREAMINFOW psi, if (size < 0) return AVIERR_BADSIZE; - memcpy(psi, &This->paf->sInfo, min((DWORD)size, sizeof(This->paf->sInfo))); + memcpy(psi, &This->sInfo, min((DWORD)size, sizeof(This->sInfo))); - if ((DWORD)size < sizeof(This->paf->sInfo)) + if ((DWORD)size < sizeof(This->sInfo)) return AVIERR_BUFFERTOOSMALL; return AVIERR_OK; } -static LONG WINAPI IAVIStream_fnFindSample(IAVIStream *iface, LONG pos, - LONG flags) +static LONG WINAPI IAVIStream_fnFindSample(IAVIStream *iface, LONG pos, LONG flags) { - IAVIFileImpl *This = ((IAVIStreamImpl*)iface)->paf; + IAVIFileImpl *This = impl_from_IAVIStream(iface); TRACE("(%p,%d,0x%08X)\n",iface,pos,flags); @@ -748,10 +664,10 @@ static LONG WINAPI IAVIStream_fnFindSample(IAVIStream *iface, LONG pos, return pos; } -static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream *iface, LONG pos, - LPVOID format, LONG *formatsize) +static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream *iface, LONG pos, void *format, + LONG *formatsize) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIStream(iface); TRACE("(%p,%d,%p,%p)\n", iface, pos, format, formatsize); @@ -760,26 +676,26 @@ static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream *iface, LONG pos, /* only interested in needed buffersize? */ if (format == NULL || *formatsize <= 0) { - *formatsize = This->paf->cbFormat; + *formatsize = This->cbFormat; return AVIERR_OK; } /* copy initial format (only as much as will fit) */ - memcpy(format, This->paf->lpFormat, min(*formatsize, This->paf->cbFormat)); - if (*formatsize < This->paf->cbFormat) { - *formatsize = This->paf->cbFormat; + memcpy(format, This->lpFormat, min(*formatsize, This->cbFormat)); + if (*formatsize < This->cbFormat) { + *formatsize = This->cbFormat; return AVIERR_BUFFERTOOSMALL; } - *formatsize = This->paf->cbFormat; + *formatsize = This->cbFormat; return AVIERR_OK; } -static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos, - LPVOID format, LONG formatsize) +static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos, void *format, + LONG formatsize) { - IAVIFileImpl *This = ((IAVIStreamImpl*)iface)->paf; + IAVIFileImpl *This = impl_from_IAVIStream(iface); TRACE("(%p,%d,%p,%d)\n", iface, pos, format, formatsize); @@ -831,12 +747,10 @@ static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos, return AVIERR_OK; } -static HRESULT WINAPI IAVIStream_fnRead(IAVIStream *iface, LONG start, - LONG samples, LPVOID buffer, - LONG buffersize, LPLONG bytesread, - LPLONG samplesread) +static HRESULT WINAPI IAVIStream_fnRead(IAVIStream *iface, LONG start, LONG samples, void *buffer, + LONG buffersize, LONG *bytesread, LONG *samplesread) { - IAVIFileImpl *This = ((IAVIStreamImpl*)iface)->paf; + IAVIFileImpl *This = impl_from_IAVIStream(iface); TRACE("(%p,%d,%d,%p,%d,%p,%p)\n", iface, start, samples, buffer, buffersize, bytesread, samplesread); @@ -904,13 +818,10 @@ static HRESULT WINAPI IAVIStream_fnRead(IAVIStream *iface, LONG start, return AVIERR_OK; } -static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream *iface, LONG start, - LONG samples, LPVOID buffer, - LONG buffersize, DWORD flags, - LPLONG sampwritten, - LPLONG byteswritten) +static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream *iface, LONG start, LONG samples, void *buffer, + LONG buffersize, DWORD flags, LONG *sampwritten, LONG *byteswritten) { - IAVIFileImpl *This = ((IAVIStreamImpl*)iface)->paf; + IAVIFileImpl *This = impl_from_IAVIStream(iface); TRACE("(%p,%d,%d,%p,%d,0x%08X,%p,%p)\n", iface, start, samples, buffer, buffersize, flags, sampwritten, byteswritten); @@ -939,7 +850,7 @@ static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream *iface, LONG start, /* do we have anything to write? */ if (buffer != NULL && buffersize > 0) { - This->fDirty = 1; + This->fDirty = TRUE; if (mmioSeek(This->hmmio, This->ckData.dwDataOffset + start * This->sInfo.dwSampleSize, SEEK_SET) == -1) @@ -961,10 +872,9 @@ static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream *iface, LONG start, return AVIERR_OK; } -static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream *iface, LONG start, - LONG samples) +static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream *iface, LONG start, LONG samples) { - IAVIFileImpl *This = ((IAVIStreamImpl*)iface)->paf; + IAVIFileImpl *This = impl_from_IAVIStream(iface); TRACE("(%p,%d,%d)\n", iface, start, samples); @@ -1002,27 +912,23 @@ static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream *iface, LONG start, return AVIERR_UNSUPPORTED; } - This->fDirty = 1; + This->fDirty = TRUE; return AVIERR_OK; } -static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream *iface, DWORD fcc, - LPVOID lp, LPLONG lpread) +static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream *iface, DWORD fcc, void *lp, LONG *lpread) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIStream(iface); - assert(This->paf != NULL); - - return IAVIFile_ReadData((PAVIFILE)This->paf, fcc, lp, lpread); + return IAVIFile_ReadData(&This->IAVIFile_iface, fcc, lp, lpread); } -static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream *iface, DWORD fcc, - LPVOID lp, LONG size) +static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream *iface, DWORD fcc, void *lp, LONG size) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIStream(iface); - return IAVIFile_WriteData((PAVIFILE)This->paf, fcc, lp, size); + return IAVIFile_WriteData(&This->IAVIFile_iface, fcc, lp, size); } static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream *iface, @@ -1033,6 +939,50 @@ static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream *iface, return E_FAIL; } +static const struct IAVIStreamVtbl iwavst = { + IAVIStream_fnQueryInterface, + IAVIStream_fnAddRef, + IAVIStream_fnRelease, + IAVIStream_fnCreate, + IAVIStream_fnInfo, + IAVIStream_fnFindSample, + IAVIStream_fnReadFormat, + IAVIStream_fnSetFormat, + IAVIStream_fnRead, + IAVIStream_fnWrite, + IAVIStream_fnDelete, + IAVIStream_fnReadData, + IAVIStream_fnWriteData, + IAVIStream_fnSetInfo +}; + +HRESULT AVIFILE_CreateWAVFile(IUnknown *outer_unk, REFIID riid, void **ret_iface) +{ + IAVIFileImpl *pfile; + HRESULT hr; + + *ret_iface = NULL; + + pfile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pfile)); + if (!pfile) + return AVIERR_MEMORY; + + pfile->IUnknown_inner.lpVtbl = &unk_vtbl; + pfile->IAVIFile_iface.lpVtbl = &iwavft; + pfile->IPersistFile_iface.lpVtbl = &iwavpft; + pfile->IAVIStream_iface.lpVtbl = &iwavst; + pfile->ref = 1; + if (outer_unk) + pfile->outer_unk = outer_unk; + else + pfile->outer_unk = &pfile->IUnknown_inner; + + hr = IUnknown_QueryInterface(&pfile->IUnknown_inner, riid, ret_iface); + IUnknown_Release(&pfile->IUnknown_inner); + + return hr; +} + /***********************************************************************/ static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This) @@ -1206,7 +1156,7 @@ static HRESULT AVIFILE_LoadSunFile(IAVIFileImpl *This) This->lpFormat->nAvgBytesPerSec = This->lpFormat->nBlockAlign * This->lpFormat->nSamplesPerSec; - This->fDirty = 0; + This->fDirty = FALSE; This->sInfo.fccType = streamtypeAUDIO; This->sInfo.fccHandler = 0; diff --git a/dll/win32/bcrypt/CMakeLists.txt b/dll/win32/bcrypt/CMakeLists.txt index a3aa1d82cf2..46525b4f2af 100644 --- a/dll/win32/bcrypt/CMakeLists.txt +++ b/dll/win32/bcrypt/CMakeLists.txt @@ -12,5 +12,5 @@ list(APPEND SOURCE add_library(bcrypt SHARED ${SOURCE}) set_module_type(bcrypt win32dll) target_link_libraries(bcrypt wine) -add_importlibs(bcrypt msvcrt kernel32 ntdll) +add_importlibs(bcrypt advapi32 msvcrt kernel32 ntdll) add_cd_file(TARGET bcrypt DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/bcrypt/bcrypt.spec b/dll/win32/bcrypt/bcrypt.spec index e1ffb8a96d2..87623f8a480 100644 --- a/dll/win32/bcrypt/bcrypt.spec +++ b/dll/win32/bcrypt/bcrypt.spec @@ -24,7 +24,7 @@ @ stub BCryptFinalizeKeyPair @ stub BCryptFinishHash @ stub BCryptFreeBuffer -@ stub BCryptGenRandom +@ stdcall BCryptGenRandom(ptr ptr long long) @ stub BCryptGenerateKeyPair @ stub BCryptGenerateSymmetricKey @ stub BCryptGetFipsAlgorithmMode diff --git a/dll/win32/bcrypt/bcrypt_main.c b/dll/win32/bcrypt/bcrypt_main.c index 9336cd58fe5..4f4e162d7d5 100644 --- a/dll/win32/bcrypt/bcrypt_main.c +++ b/dll/win32/bcrypt/bcrypt_main.c @@ -17,17 +17,17 @@ * */ +#include + +#include #define WIN32_NO_STATUS -#include -//#include "wine/port.h" #include #include +#include #include -typedef LONG NTSTATUS; - WINE_DEFAULT_DEBUG_CHANNEL(bcrypt); BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) @@ -52,5 +52,41 @@ NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG dwAlgOperations, ULONG *pAlgCount, *ppAlgList=NULL; *pAlgCount=0; - return ERROR_CALL_NOT_IMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS WINAPI BCryptGenRandom(BCRYPT_ALG_HANDLE algorithm, UCHAR *buffer, ULONG count, ULONG flags) +{ + const DWORD supported_flags = BCRYPT_USE_SYSTEM_PREFERRED_RNG; + TRACE("%p, %p, %u, %08x - semi-stub\n", algorithm, buffer, count, flags); + + if (!algorithm) + { + /* It's valid to call without an algorithm if BCRYPT_USE_SYSTEM_PREFERRED_RNG + * is set. In this case the preferred system RNG is used. + */ + if (!(flags & BCRYPT_USE_SYSTEM_PREFERRED_RNG)) + return STATUS_INVALID_HANDLE; + } + if (!buffer) + return STATUS_INVALID_PARAMETER; + + if (flags & ~supported_flags) + FIXME("unsupported flags %08x\n", flags & ~supported_flags); + + if (algorithm) + FIXME("ignoring selected algorithm\n"); + + /* When zero bytes are requested the function returns success too. */ + if (!count) + return STATUS_SUCCESS; + + if (flags & BCRYPT_USE_SYSTEM_PREFERRED_RNG) + { + if (RtlGenRandom(buffer, count)) + return STATUS_SUCCESS; + } + + FIXME("called with unsupported parameters, returning error\n"); + return STATUS_NOT_IMPLEMENTED; } diff --git a/dll/win32/cabinet/CMakeLists.txt b/dll/win32/cabinet/CMakeLists.txt index 3d27e919da8..b3369bd760d 100644 --- a/dll/win32/cabinet/CMakeLists.txt +++ b/dll/win32/cabinet/CMakeLists.txt @@ -24,7 +24,5 @@ add_library(cabinet SHARED set_module_type(cabinet win32dll) target_link_libraries(cabinet wine zlib) add_importlibs(cabinet msvcrt kernel32 ntdll) - add_pch(cabinet cabinet.h SOURCE) -add_dependencies(cabinet psdk) add_cd_file(TARGET cabinet DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/cabinet/fdi.c b/dll/win32/cabinet/fdi.c index 78e7cae5495..b60f9db65f3 100644 --- a/dll/win32/cabinet/fdi.c +++ b/dll/win32/cabinet/fdi.c @@ -525,71 +525,28 @@ static BOOL FDI_read_entries( PMORE_ISCAB_INFO pmii) { int num_folders, num_files, header_resv, folder_resv = 0; - LONG base_offset, cabsize; + LONG cabsize; USHORT setid, cabidx, flags; cab_UBYTE buf[64], block_resv; char *prevname = NULL, *previnfo = NULL, *nextname = NULL, *nextinfo = NULL; TRACE("(fdi == ^%p, hf == %ld, pfdici == ^%p)\n", fdi, hf, pfdici); - /* - * FIXME: I just noticed that I am memorizing the initial file pointer - * offset and restoring it before reading in the rest of the header - * information in the cabinet. Perhaps that's correct -- that is, perhaps - * this API is supposed to support "streaming" cabinets which are embedded - * in other files, or cabinets which begin at file offsets other than zero. - * Otherwise, I should instead go to the absolute beginning of the file. - * (Either way, the semantics of wine's FDICopy require me to leave the - * file pointer where it is afterwards -- If Windows does not do so, we - * ought to duplicate the native behavior in the FDIIsCabinet API, not here. - * - * So, the answer lies in Windows; will native cabinet.dll recognize a - * cabinet "file" embedded in another file? Note that cabextract.c does - * support this, which implies that Microsoft's might. I haven't tried it - * yet so I don't know. ATM, most of wine's FDI cabinet routines (except - * this one) would not work in this way. To fix it, we could just make the - * various references to absolute file positions in the code relative to an - * initial "beginning" offset. Because the FDICopy API doesn't take a - * file-handle like this one, we would therein need to search through the - * file for the beginning of the cabinet (as we also do in cabextract.c). - * Note that this limits us to a maximum of one cabinet per. file: the first. - * - * So, in summary: either the code below is wrong, or the rest of fdi.c is - * wrong... I cannot imagine that both are correct ;) One of these flaws - * should be fixed after determining the behavior on Windows. We ought - * to check both FDIIsCabinet and FDICopy for the right behavior. - * - * -gmt - */ - - /* get basic offset & size info */ - base_offset = FDI_getoffset(fdi, hf); - - if (fdi->seek(hf, 0, SEEK_END) == -1) { - if (pmii) set_error( fdi, FDIERROR_NOT_A_CABINET, 0 ); - return FALSE; - } - - cabsize = FDI_getoffset(fdi, hf); - - if ((cabsize == -1) || (base_offset == -1) || - ( fdi->seek(hf, base_offset, SEEK_SET) == -1 )) { - if (pmii) set_error( fdi, FDIERROR_NOT_A_CABINET, 0 ); - return FALSE; - } - /* read in the CFHEADER */ if (fdi->read(hf, buf, cfhead_SIZEOF) != cfhead_SIZEOF) { if (pmii) set_error( fdi, FDIERROR_NOT_A_CABINET, 0 ); return FALSE; } - + /* check basic MSCF signature */ if (EndGetI32(buf+cfhead_Signature) != 0x4643534d) { if (pmii) set_error( fdi, FDIERROR_NOT_A_CABINET, 0 ); return FALSE; } + /* get the cabinet size */ + cabsize = EndGetI32(buf+cfhead_CabinetSize); + /* get the number of folders */ num_folders = EndGetI16(buf+cfhead_NumFolders); @@ -2037,7 +1994,7 @@ static int fdi_decomp(const struct fdi_file *fi, int savemode, fdi_decomp_state FDICABINETINFO fdici; char emptystring = '\0'; cab_UBYTE buf2[64]; - int success = FALSE; + BOOL success = FALSE; struct fdi_folder *fol = NULL, *linkfol = NULL; struct fdi_file *file = NULL, *linkfile = NULL; diff --git a/dll/win32/comctl32/comboex.c b/dll/win32/comctl32/comboex.c index 0d6e41fa6a3..2bf970da73e 100644 --- a/dll/win32/comctl32/comboex.c +++ b/dll/win32/comctl32/comboex.c @@ -986,7 +986,7 @@ static LRESULT COMBOEX_Create (HWND hwnd, CREATESTRUCTA const *cs) } /* Native version of ComboEx creates the ComboBox with DROPDOWNLIST */ - /* specified. It then creates it's own version of the EDIT control */ + /* specified. It then creates its own version of the EDIT control */ /* and makes the ComboBox the parent. This is because a normal */ /* DROPDOWNLIST does not have an EDIT control, but we need one. */ /* We also need to place the edit control at the proper location */ @@ -1580,7 +1580,7 @@ static LRESULT COMBOEX_NotifyFormat (COMBOEX_INFO *infoPtr, LPARAM lParam) if (lParam == NF_REQUERY) { INT i = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY); - infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0; + infoPtr->NtfUnicode = (i == NFR_UNICODE); } return infoPtr->NtfUnicode ? NFR_UNICODE : NFR_ANSI; } diff --git a/dll/win32/comctl32/comctl32_ros.diff b/dll/win32/comctl32/comctl32_ros.diff index 788d94a0103..4e888ef073a 100644 --- a/dll/win32/comctl32/comctl32_ros.diff +++ b/dll/win32/comctl32/comctl32_ros.diff @@ -1,6 +1,6 @@ diff -prudN e:\Wine\dlls\comctl32/comctl32.spec e:\reactos\dll\win32\comctl32/comctl32.spec ---- e:\Wine\dlls\comctl32/comctl32.spec 2011-09-16 23:22:35.964767000 +0100 -+++ e:\reactos\dll\win32\comctl32/comctl32.spec 2012-06-04 11:26:55.545450700 +0100 +--- e:\Wine\dlls\comctl32/comctl32.spec 2014-04-04 14:12:39.665980800 +0100 ++++ e:\reactos\dll\win32\comctl32/comctl32.spec 2014-03-27 14:27:25.808903400 +0100 @@ -15,7 +15,7 @@ 11 stdcall -noname DPA_Merge(ptr ptr long ptr ptr long) #12 stub Cctl1632_ThunkData32 @@ -21,9 +21,9 @@ diff -prudN e:\Wine\dlls\comctl32/comctl32.spec e:\reactos\dll\win32\comctl32/co 167 stdcall -noname AddMRUData(long ptr long) 169 stdcall -noname FindMRUData(long ptr long ptr) 233 stdcall -noname Str_GetPtrA(str str long) -@@ -88,13 +88,13 @@ - 376 stdcall -noname IntlStrEqWorkerA(long str str long) - 377 stdcall -noname IntlStrEqWorkerW(long wstr wstr long) +@@ -89,13 +89,13 @@ + 376 stdcall -noname -private IntlStrEqWorkerA(long str str long) + 377 stdcall -noname -private IntlStrEqWorkerW(long wstr wstr long) 382 stdcall -noname SmoothScrollWindow(ptr) -383 stub -noname DoReaderMode +383 stdcall -noname DoReaderMode(ptr) @@ -37,31 +37,25 @@ diff -prudN e:\Wine\dlls\comctl32/comctl32.spec e:\reactos\dll\win32\comctl32/co 390 stdcall -noname ImageList_SetColorTable(ptr long long ptr) 400 stdcall -ordinal CreateMRUListW(ptr) 401 stdcall -ordinal AddMRUStringW(long wstr) -@@ -188,6 +188,7 @@ +@@ -189,5 +189,6 @@ @ stdcall PropertySheet(ptr) PropertySheetA @ stdcall PropertySheetA(ptr) @ stdcall PropertySheetW(ptr) +@ stdcall RegisterClassNameW(wstr) - @ stdcall TaskDialogIndirect(ptr ptr ptr ptr) @ stdcall UninitializeFlatSB(long) @ stdcall _TrackMouseEvent(ptr) diff -prudN e:\Wine\dlls\comctl32/commctrl.c e:\reactos\dll\win32\comctl32/commctrl.c ---- e:\Wine\dlls\comctl32/commctrl.c 2011-11-24 17:55:01.900415100 +0100 -+++ e:\reactos\dll\win32\comctl32/commctrl.c 2013-01-25 14:12:39.829654200 +0100 -@@ -52,25 +52,42 @@ +--- e:\Wine\dlls\comctl32/commctrl.c 2014-04-04 14:12:39.666981500 +0100 ++++ e:\reactos\dll\win32\comctl32/commctrl.c 2014-04-06 12:07:15.451048000 +0100 +@@ -52,25 +52,26 @@ * -- ICC_WIN95_CLASSES */ -+#define WIN32_NO_STATUS -+#define _INC_WINDOWS -+#define COM_NO_WINDOWS_H -+ - #include +-#include -#include -#include -+//#include -+//#include ++#include "comctl32.h" -#include "windef.h" -#include "winbase.h" @@ -71,20 +65,11 @@ diff -prudN e:\Wine\dlls\comctl32/commctrl.c e:\reactos\dll\win32\comctl32/commc -#include "commctrl.h" -#include "winerror.h" -#include "winreg.h" -+#include -+#include -+//#include "wingdi.h" -+//#include "winuser.h" -+#include -+//#include "commctrl.h" -+//#include "winerror.h" -+#include #define NO_SHLWAPI_STREAM -#include "shlwapi.h" -+#include - #include "comctl32.h" +-#include "comctl32.h" -#include "wine/debug.h" -+#include ++#include WINE_DEFAULT_DEBUG_CHANNEL(commctrl); @@ -104,7 +89,7 @@ diff -prudN e:\Wine\dlls\comctl32/commctrl.c e:\reactos\dll\win32\comctl32/commc static LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); -@@ -92,6 +109,67 @@ static const WCHAR strCC32SubclassInfo[] +@@ -92,6 +93,67 @@ static const WCHAR strCC32SubclassInfo[] 'C','C','3','2','S','u','b','c','l','a','s','s','I','n','f','o',0 }; @@ -118,7 +103,7 @@ diff -prudN e:\Wine\dlls\comctl32/commctrl.c e:\reactos\dll\win32\comctl32/commc + HANDLE hFile; + BOOL bRet = FALSE; + -+ hResInfo = FindResourceW(COMCTL32_hModule, L"WINE_MANIFEST", RT_MANIFEST); ++ hResInfo = FindResourceW(COMCTL32_hModule, L"WINE_MANIFEST", (LPWSTR)RT_MANIFEST); + if (!hResInfo) + return FALSE; + @@ -172,7 +157,7 @@ diff -prudN e:\Wine\dlls\comctl32/commctrl.c e:\reactos\dll\win32\comctl32/commc /*********************************************************************** * DllMain [Internal] -@@ -930,6 +1008,12 @@ HRESULT WINAPI DllGetVersion (DLLVERSION +@@ -928,6 +990,12 @@ HRESULT WINAPI DllGetVersion (DLLVERSION HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline) { TRACE("(%u, %s): stub\n", bInstall, debugstr_w(cmdline)); @@ -181,11 +166,11 @@ diff -prudN e:\Wine\dlls\comctl32/commctrl.c e:\reactos\dll\win32\comctl32/commc + ERR("create_manifest failed!\n"); + return HRESULT_FROM_WIN32(GetLastError()); + } -+ ++ return S_OK; } -@@ -1593,12 +1677,114 @@ LRESULT WINAPI SetPathWordBreakProc(HWND +@@ -1591,12 +1659,114 @@ LRESULT WINAPI SetPathWordBreakProc(HWND * * Draw text with shadow. */ @@ -304,7 +289,7 @@ diff -prudN e:\Wine\dlls\comctl32/commctrl.c e:\reactos\dll\win32\comctl32/commc } /*********************************************************************** -@@ -1639,3 +1825,15 @@ HRESULT WINAPI TaskDialogIndirect(const +@@ -1637,3 +1807,15 @@ HRESULT WINAPI TaskDialogIndirect(const if (pfVerificationFlagChecked) *pfVerificationFlagChecked = TRUE; return S_OK; } @@ -322,9 +307,9 @@ diff -prudN e:\Wine\dlls\comctl32/commctrl.c e:\reactos\dll\win32\comctl32/commc +} diff -prudN e:\Wine\dlls\comctl32/listview.c e:\reactos\dll\win32\comctl32/listview.c ---- e:\Wine\dlls\comctl32/listview.c 2013-03-16 11:54:52.374454400 +0100 -+++ e:\reactos\dll\win32\comctl32/listview.c 2013-03-17 19:12:46.522399200 +0100 -@@ -314,6 +314,7 @@ typedef struct tagLISTVIEW_INFO +--- e:\Wine\dlls\comctl32/listview.c 2014-04-18 20:39:25.506861000 +0100 ++++ e:\reactos\dll\win32\comctl32/listview.c 2014-04-22 13:09:20.504496900 +0100 +@@ -307,6 +288,7 @@ typedef struct tagLISTVIEW_INFO COLORREF clrBk; COLORREF clrText; COLORREF clrTextBk; @@ -332,7 +317,7 @@ diff -prudN e:\Wine\dlls\comctl32/listview.c e:\reactos\dll\win32\comctl32/listv /* font */ HFONT hDefaultFont; -@@ -1700,8 +1701,19 @@ static inline BOOL LISTVIEW_GetItemW(con +@@ -1693,8 +1675,19 @@ static inline BOOL LISTVIEW_GetItemW(con /* used to handle collapse main item column case */ static inline BOOL LISTVIEW_DrawFocusRect(const LISTVIEW_INFO *infoPtr, HDC hdc) { @@ -354,19 +339,21 @@ diff -prudN e:\Wine\dlls\comctl32/listview.c e:\reactos\dll\win32\comctl32/listv } /* Listview invalidation functions: use _only_ these functions to invalidate */ -@@ -4734,7 +4746,10 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_I +@@ -4727,7 +4720,12 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_I if (infoPtr->uView == LV_VIEW_DETAILS && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES) rcLabel.bottom--; - DrawTextW(hdc, lvItem.pszText, -1, &rcLabel, uFormat); ++#ifdef __REACTOS__ + if ((!(lvItem.state & LVIS_SELECTED) || !infoPtr->bFocus) && (infoPtr->dwLvExStyle & LVS_EX_TRANSPARENTSHADOWTEXT)) + DrawShadowText(hdc, lvItem.pszText, -1, &rcLabel, uFormat, RGB(255, 255, 255), RGB(0, 0, 0), 2, 2); + else ++#endif + DrawTextW(hdc, lvItem.pszText, -1, &rcLabel, uFormat); postpaint: if (cdsubitemmode & CDRF_NOTIFYPOSTPAINT) -@@ -5143,7 +5158,11 @@ enddraw: +@@ -5136,7 +5134,11 @@ enddraw: /* Draw marquee rectangle if appropriate */ if (infoPtr->bMarqueeSelect) @@ -378,7 +365,7 @@ diff -prudN e:\Wine\dlls\comctl32/listview.c e:\reactos\dll\win32\comctl32/listv if (cdmode & CDRF_NOTIFYPOSTPAINT) notify_postpaint(infoPtr, &nmlvcd); -@@ -7952,6 +7971,7 @@ static BOOL LISTVIEW_SetBkColor(LISTVIEW +@@ -7939,6 +7941,7 @@ static BOOL LISTVIEW_SetBkColor(LISTVIEW { TRACE("(color=%x)\n", color); @@ -386,7 +373,27 @@ diff -prudN e:\Wine\dlls\comctl32/listview.c e:\reactos\dll\win32\comctl32/listv if(infoPtr->clrBk != color) { if (infoPtr->clrBk != CLR_NONE) DeleteObject(infoPtr->hBkBrush); infoPtr->clrBk = color; -@@ -9362,6 +9382,7 @@ static LRESULT LISTVIEW_NCCreate(HWND hw +@@ -8600,7 +8603,7 @@ static DWORD LISTVIEW_SetIconSpacing(LIS + return oldspacing; + } + +-static inline void set_icon_size(SIZE *size, HIMAGELIST himl, BOOL small) ++static inline void set_icon_size(SIZE *size, HIMAGELIST himl, BOOL is_small) + { + INT cx, cy; + +@@ -8611,8 +8614,8 @@ static inline void set_icon_size(SIZE *s + } + else + { +- size->cx = GetSystemMetrics(small ? SM_CXSMICON : SM_CXICON); +- size->cy = GetSystemMetrics(small ? SM_CYSMICON : SM_CYICON); ++ size->cx = GetSystemMetrics(is_small ? SM_CXSMICON : SM_CXICON); ++ size->cy = GetSystemMetrics(is_small ? SM_CYSMICON : SM_CYICON); + } + } + +@@ -9349,6 +9352,7 @@ static LRESULT LISTVIEW_NCCreate(HWND hw infoPtr->clrText = CLR_DEFAULT; infoPtr->clrTextBk = CLR_DEFAULT; LISTVIEW_SetBkColor(infoPtr, comctl32_color.clrWindow); @@ -394,7 +401,7 @@ diff -prudN e:\Wine\dlls\comctl32/listview.c e:\reactos\dll\win32\comctl32/listv /* set default values */ infoPtr->nFocusedItem = -1; -@@ -11644,6 +11665,12 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg +@@ -11631,6 +11635,12 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg case WM_SYSCOLORCHANGE: COMCTL32_RefreshSysColors(); @@ -409,41 +416,42 @@ diff -prudN e:\Wine\dlls\comctl32/listview.c e:\reactos\dll\win32\comctl32/listv /* case WM_TIMER: */ diff -prudN e:\Wine\dlls\comctl32/propsheet.c e:\reactos\dll\win32\comctl32/propsheet.c ---- e:\Wine\dlls\comctl32/propsheet.c 2013-03-02 14:17:59.122793000 +0100 -+++ e:\reactos\dll\win32\comctl32/propsheet.c 2013-03-16 12:21:47.383897000 +0100 -@@ -2430,6 +2430,9 @@ static void PROPSHEET_SetWizButtons(HWND +--- e:\Wine\dlls\comctl32/propsheet.c 2014-04-04 14:12:39.676987100 +0100 ++++ e:\reactos\dll\win32\comctl32/propsheet.c 2014-04-22 13:11:33.830045900 +0100 +@@ -2430,6 +2414,11 @@ static void PROPSHEET_SetWizButtons(HWND HWND hwndBack = GetDlgItem(hwndDlg, IDC_BACK_BUTTON); HWND hwndNext = GetDlgItem(hwndDlg, IDC_NEXT_BUTTON); HWND hwndFinish = GetDlgItem(hwndDlg, IDC_FINISH_BUTTON); ++#ifdef __REACTOS__ + HWND hwndCancel = GetDlgItem(hwndDlg, IDCANCEL); + INT iDefItem = 0; + HWND hwndFocus; ++#endif TRACE("%d\n", dwFlags); -@@ -2437,17 +2440,6 @@ static void PROPSHEET_SetWizButtons(HWND +@@ -2437,6 +2426,7 @@ static void PROPSHEET_SetWizButtons(HWND EnableWindow(hwndNext, FALSE); EnableWindow(hwndFinish, FALSE); -- /* set the default pushbutton to an enabled button */ -- if (((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH)) -- SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0); -- else if (dwFlags & PSWIZB_NEXT) -- SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0); -- else if (dwFlags & PSWIZB_BACK) -- SendMessageW(hwndDlg, DM_SETDEFID, IDC_BACK_BUTTON, 0); -- else -- SendMessageW(hwndDlg, DM_SETDEFID, IDCANCEL, 0); -- -- - if (dwFlags & PSWIZB_BACK) - EnableWindow(hwndBack, TRUE); ++#ifndef __REACTOS__ + /* set the default pushbutton to an enabled button */ + if (((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH)) + SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0); +@@ -2446,6 +2436,7 @@ static void PROPSHEET_SetWizButtons(HWND + SendMessageW(hwndDlg, DM_SETDEFID, IDC_BACK_BUTTON, 0); + else + SendMessageW(hwndDlg, DM_SETDEFID, IDCANCEL, 0); ++#endif -@@ -2477,6 +2469,22 @@ static void PROPSHEET_SetWizButtons(HWND + + if (dwFlags & PSWIZB_BACK) +@@ -2477,6 +2468,25 @@ static void PROPSHEET_SetWizButtons(HWND } else if (!(dwFlags & PSWIZB_DISABLEDFINISH)) EnableWindow(hwndFinish, TRUE); + ++#ifdef __REACTOS__ + /* set the default pushbutton to an enabled button */ + if (((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH)) + iDefItem = IDC_FINISH_BUTTON; @@ -459,13 +467,15 @@ diff -prudN e:\Wine\dlls\comctl32/propsheet.c e:\reactos\dll\win32\comctl32/prop + hwndFocus = GetFocus(); + if (!hwndFocus || hwndFocus == hwndCancel) + SetFocus(GetDlgItem(hwndDlg, iDefItem)); ++#endif ++ } /****************************************************************************** diff -prudN e:\Wine\dlls\comctl32/rebar.c e:\reactos\dll\win32\comctl32/rebar.c ---- e:\Wine\dlls\comctl32/rebar.c 2013-03-02 14:17:59.125795000 +0100 -+++ e:\reactos\dll\win32\comctl32/rebar.c 2013-09-02 13:40:15.983276500 +0100 -@@ -51,7 +51,6 @@ +--- e:\Wine\dlls\comctl32/rebar.c 2014-04-04 14:12:39.678989500 +0100 ++++ e:\reactos\dll\win32\comctl32/rebar.c 2014-04-22 13:17:59.092589800 +0100 +@@ -50,7 +50,6 @@ * - WM_QUERYNEWPALETTE * - WM_RBUTTONDOWN * - WM_RBUTTONUP @@ -473,21 +483,7 @@ diff -prudN e:\Wine\dlls\comctl32/rebar.c e:\reactos\dll\win32\comctl32/rebar.c * - WM_VKEYTOITEM * - WM_WININICHANGE * Notifications: - -@@ -2544,10 +2543,8 @@ REBAR_InsertBandT(REBAR_INFO *infoPtr, I - - /* initialize band */ - memset(lpBand, 0, sizeof(*lpBand)); -- lpBand->clrFore = infoPtr->clrText == CLR_NONE ? infoPtr->clrBtnText : -- infoPtr->clrText; -- lpBand->clrBack = infoPtr->clrBk == CLR_NONE ? infoPtr->clrBtnFace : -- infoPtr->clrBk; -+ lpBand->clrFore = infoPtr->clrText; -+ lpBand->clrBack = infoPtr->clrBk; - lpBand->iImage = -1; - - REBAR_CommonSetupBand(infoPtr->hwndSelf, lprbbi, lpBand); -@@ -2927,12 +2924,20 @@ REBAR_ShowBand (REBAR_INFO *infoPtr, INT +@@ -2912,12 +2896,22 @@ REBAR_ShowBand (REBAR_INFO *infoPtr, INT static LRESULT @@ -499,6 +495,7 @@ diff -prudN e:\Wine\dlls\comctl32/rebar.c e:\reactos\dll\win32\comctl32/rebar.c TRACE("[%s]\n", wine_dbgstr_rect(lpRect)); REBAR_SizeToHeight(infoPtr, get_rect_cy(infoPtr, lpRect)); + ++#ifdef __REACTOS__ + /* Note that this undocumented flag is available on comctl32 v6 or later */ + if ((flags & RBSTR_CHANGERECT) != 0) + { @@ -506,10 +503,11 @@ diff -prudN e:\Wine\dlls\comctl32/rebar.c e:\reactos\dll\win32\comctl32/rebar.c + GetClientRect(infoPtr->hwndSelf, &rcRebar); + lpRect->bottom = lpRect->top + (rcRebar.bottom - rcRebar.top); + } ++#endif return TRUE; } -@@ -3713,7 +3718,7 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, +@@ -3675,7 +3669,7 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, return REBAR_ShowBand (infoPtr, wParam, lParam); case RB_SIZETORECT: @@ -518,165 +516,23 @@ diff -prudN e:\Wine\dlls\comctl32/rebar.c e:\reactos\dll\win32\comctl32/rebar.c /* Messages passed to parent */ -@@ -3797,6 +3802,8 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, +@@ -3758,6 +3752,11 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, case WM_SYSCOLORCHANGE: COMCTL32_RefreshSysColors(); ++#ifdef __REACTOS__ ++ /* r51522 - Properly support WM_SYSCOLORCHANGE */ + infoPtr->clrBtnText = comctl32_color.clrBtnText; + infoPtr->clrBtnFace = comctl32_color.clrBtnFace; ++#endif return 0; /* case WM_VKEYTOITEM: supported according to ControlSpy */ ---- e:\Wine\dlls\comctl32/tests/v6util.h 2011-09-16 23:22:36.002769200 +0100 -+++ e:\reactos\dll\win32\comctl32/tests/v6util.h 1970-01-01 01:00:00.000000000 +0100 -@@ -1,142 +0,0 @@ --/* -- * Utility routines for comctl32 v6 tests -- * -- * Copyright 2006 Mike McCormack for CodeWeavers -- * Copyright 2007 George Gov -- * Copyright 2009 Owen Rudge for CodeWeavers -- * -- * This library is free software; you can redistribute it and/or -- * modify it under the terms of the GNU Lesser General Public -- * License as published by the Free Software Foundation; either -- * version 2.1 of the License, or (at your option) any later version. -- * -- * This library is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * Lesser General Public License for more details. -- * -- * You should have received a copy of the GNU Lesser General Public -- * License along with this library; if not, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA -- */ -- --#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got) -- --#ifdef __i386__ --#define ARCH "x86" --#elif defined __x86_64__ --#define ARCH "amd64" --#else --#define ARCH "none" --#endif -- --static const CHAR manifest_name[] = "cc6.manifest"; -- --static const CHAR manifest[] = -- "\n" -- "\n" -- " \n" -- "Wine comctl32 test suite\n" -- "\n" -- " \n" -- " \n" -- "\n" -- "\n" -- "\n"; -- --static void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx) --{ -- HANDLE hKernel32; -- BOOL (WINAPI *pDeactivateActCtx)(DWORD, ULONG_PTR); -- VOID (WINAPI *pReleaseActCtx)(HANDLE); -- -- hKernel32 = GetModuleHandleA("kernel32.dll"); -- pDeactivateActCtx = (void*)GetProcAddress(hKernel32, "DeactivateActCtx"); -- pReleaseActCtx = (void*)GetProcAddress(hKernel32, "ReleaseActCtx"); -- if (!pDeactivateActCtx || !pReleaseActCtx) -- { -- win_skip("Activation contexts unsupported\n"); -- return; -- } -- -- pDeactivateActCtx(0, cookie); -- pReleaseActCtx(hCtx); -- -- DeleteFileA(manifest_name); --} -- --static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx) --{ -- HANDLE hKernel32; -- HANDLE (WINAPI *pCreateActCtxA)(ACTCTXA*); -- BOOL (WINAPI *pActivateActCtx)(HANDLE, ULONG_PTR*); -- -- ACTCTXA ctx; -- BOOL ret; -- HANDLE file; -- DWORD written; -- -- hKernel32 = GetModuleHandleA("kernel32.dll"); -- pCreateActCtxA = (void*)GetProcAddress(hKernel32, "CreateActCtxA"); -- pActivateActCtx = (void*)GetProcAddress(hKernel32, "ActivateActCtx"); -- if (!(pCreateActCtxA && pActivateActCtx)) -- { -- win_skip("Activation contexts unsupported. No version 6 tests possible.\n"); -- return FALSE; -- } -- -- /* create manifest */ -- file = CreateFileA( manifest_name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL ); -- if (file != INVALID_HANDLE_VALUE) -- { -- ret = (WriteFile( file, manifest, sizeof(manifest)-1, &written, NULL ) && -- written == sizeof(manifest)-1); -- CloseHandle( file ); -- if (!ret) -- { -- DeleteFileA( manifest_name ); -- skip("Failed to fill manifest file. Skipping comctl32 V6 tests.\n"); -- return FALSE; -- } -- else -- trace("created %s\n", manifest_name); -- } -- else -- { -- skip("Failed to create manifest file. Skipping comctl32 V6 tests.\n"); -- return FALSE; -- } -- -- memset(&ctx, 0, sizeof(ctx)); -- ctx.cbSize = sizeof(ctx); -- ctx.lpSource = manifest_name; -- -- *hCtx = pCreateActCtxA(&ctx); -- ok(*hCtx != 0, "Expected context handle\n"); -- -- ret = pActivateActCtx(*hCtx, pcookie); -- expect(TRUE, ret); -- -- if (!ret) -- { -- win_skip("A problem during context activation occurred.\n"); -- DeleteFileA(manifest_name); -- } -- -- return ret; --} -- --#undef expect --#undef ARCH diff -prudN e:\Wine\dlls\comctl32/tooltips.c e:\reactos\dll\win32\comctl32/tooltips.c ---- e:\Wine\dlls\comctl32/tooltips.c 2013-03-02 14:17:59.178196600 +0100 -+++ e:\reactos\dll\win32\comctl32/tooltips.c 2013-03-16 12:24:45.122483600 +0100 -@@ -2002,7 +2002,32 @@ TOOLTIPS_NCHitTest (const TOOLTIPS_INFO +--- e:\Wine\dlls\comctl32/tooltips.c 2014-04-04 14:12:39.707008100 +0100 ++++ e:\reactos\dll\win32\comctl32/tooltips.c 2014-04-06 12:20:33.342535700 +0100 +@@ -2007,7 +1994,32 @@ TOOLTIPS_NCHitTest (const TOOLTIPS_INFO static LRESULT TOOLTIPS_NotifyFormat (TOOLTIPS_INFO *infoPtr, WPARAM wParam, LPARAM lParam) { @@ -710,11 +566,10 @@ diff -prudN e:\Wine\dlls\comctl32/tooltips.c e:\reactos\dll\win32\comctl32/toolt return 0; } - diff -prudN e:\Wine\dlls\comctl32/treeview.c e:\reactos\dll\win32\comctl32/treeview.c ---- e:\Wine\dlls\comctl32/treeview.c 2013-03-02 14:17:59.181198600 +0100 -+++ e:\reactos\dll\win32\comctl32/treeview.c 2013-03-16 12:26:03.285023200 +0100 -@@ -2921,7 +2921,12 @@ TREEVIEW_Refresh(TREEVIEW_INFO *infoPtr, +--- e:\Wine\dlls\comctl32/treeview.c 2014-04-04 14:12:39.709009500 +0100 ++++ e:\reactos\dll\win32\comctl32/treeview.c 2014-04-06 12:22:08.977839700 +0100 +@@ -2921,7 +2899,12 @@ TREEVIEW_Refresh(TREEVIEW_INFO *infoPtr, } } diff --git a/dll/win32/comctl32/commctrl.c b/dll/win32/comctl32/commctrl.c index 3d5cd27f9a7..f8b8ab0fc95 100644 --- a/dll/win32/comctl32/commctrl.c +++ b/dll/win32/comctl32/commctrl.c @@ -929,7 +929,7 @@ CreateMappedBitmap (HINSTANCE hInstance, INT_PTR idBitmap, UINT wFlags, * Failure: 0 * * NOTES - * Do not use this functions anymore. Use CreateToolbarEx instead. + * Do not use this function anymore. Use CreateToolbarEx instead. */ HWND WINAPI @@ -1560,7 +1560,7 @@ void COMCTL32_GetFontMetrics(HFONT hFont, TEXTMETRICW *ptm) * identifies them. * * Some of the codes are in the CCM_FIRST..CCM_LAST range, but there is no - * colision with defined CCM_ codes. + * collision with defined CCM_ codes. */ BOOL COMCTL32_IsReflectedMessage(UINT uMsg) { @@ -1609,7 +1609,7 @@ BOOL WINAPI MirrorIcon(HICON *phicon1, HICON *phicon2) return FALSE; } -static inline int IsDelimiter(WCHAR c) +static inline BOOL IsDelimiter(WCHAR c) { switch(c) { diff --git a/dll/win32/comctl32/datetime.c b/dll/win32/comctl32/datetime.c index 3709b77da2a..e76a74490f0 100644 --- a/dll/win32/comctl32/datetime.c +++ b/dll/win32/comctl32/datetime.c @@ -60,7 +60,7 @@ typedef struct RECT checkbox; /* checkbox allowing the control to be enabled/disabled */ RECT calbutton; /* button that toggles the dropdown of the monthcal control */ BOOL bCalDepressed; /* TRUE = cal button is depressed */ - int bDropdownEnabled; + BOOL bDropdownEnabled; int select; WCHAR charsEntered[4]; int nCharsEntered; @@ -186,7 +186,7 @@ static BOOL DATETIME_IsDateInValidRange(const DATETIME_INFO *infoPtr, const SYST static BOOL DATETIME_SetSystemTime (DATETIME_INFO *infoPtr, DWORD flag, const SYSTEMTIME *systime) { - if (!systime) return 0; + if (!systime) return FALSE; TRACE("%04d/%02d/%02d %02d:%02d:%02d\n", systime->wYear, systime->wMonth, systime->wDay, @@ -205,7 +205,7 @@ DATETIME_SetSystemTime (DATETIME_INFO *infoPtr, DWORD flag, const SYSTEMTIME *sy return FALSE; /* Windows returns true if the date is valid but outside the limits set */ - if (DATETIME_IsDateInValidRange(infoPtr, systime) == FALSE) + if (!DATETIME_IsDateInValidRange(infoPtr, systime)) return TRUE; infoPtr->dateValid = TRUE; @@ -819,8 +819,8 @@ DATETIME_HitTest (const DATETIME_INFO *infoPtr, POINT pt) return DTHT_NONE; } -/* Returns index of a closest date field from given counting to left - or -1 if there's no such fields at left */ +/* Returns index of the nearest preceding date field from given, + or -1 if none was found */ static int DATETIME_GetPrevDateField(const DATETIME_INFO *infoPtr, int i) { for(--i; i >= 0; i--) @@ -834,7 +834,8 @@ static void DATETIME_ApplySelectedField (DATETIME_INFO *infoPtr) { int fieldNum = infoPtr->select & DTHT_DATEFIELD; - int i, val=0, clamp_day=0; + int i, val = 0; + BOOL clamp_day = FALSE; SYSTEMTIME date = infoPtr->date; int oldyear; @@ -858,7 +859,7 @@ DATETIME_ApplySelectedField (DATETIME_INFO *infoPtr) date.wYear = date.wYear - (date.wYear%100) + val; if (DATETIME_IsDateInValidRange(infoPtr, &date)) - clamp_day = 1; + clamp_day = TRUE; else date.wYear = oldyear; @@ -869,7 +870,7 @@ DATETIME_ApplySelectedField (DATETIME_INFO *infoPtr) date.wYear = val; if (DATETIME_IsDateInValidRange(infoPtr, &date)) - clamp_day = 1; + clamp_day = TRUE; else date.wYear = oldyear; @@ -877,7 +878,7 @@ DATETIME_ApplySelectedField (DATETIME_INFO *infoPtr) case ONEDIGITMONTH: case TWODIGITMONTH: date.wMonth = val; - clamp_day = 1; + clamp_day = TRUE; break; case ONEDIGITDAY: case TWODIGITDAY: diff --git a/dll/win32/comctl32/dpa.c b/dll/win32/comctl32/dpa.c index 11b13bd1777..78a66d61988 100644 --- a/dll/win32/comctl32/dpa.c +++ b/dll/win32/comctl32/dpa.c @@ -117,8 +117,10 @@ HRESULT WINAPI DPA_LoadStream (HDPA *phDpa, PFNDPASTREAM loadProc, if (!hDpa) return E_OUTOFMEMORY; - if (!DPA_Grow (hDpa, streamData.dwItems)) + if (!DPA_Grow (hDpa, streamData.dwItems)) { + DPA_Destroy (hDpa); return E_OUTOFMEMORY; + } /* load data from the stream into the dpa */ ptr = hDpa->ptrs; @@ -162,7 +164,7 @@ HRESULT WINAPI DPA_LoadStream (HDPA *phDpa, PFNDPASTREAM loadProc, * NOTES * No more information available yet! */ -HRESULT WINAPI DPA_SaveStream (const HDPA hDpa, PFNDPASTREAM saveProc, +HRESULT WINAPI DPA_SaveStream (HDPA hDpa, PFNDPASTREAM saveProc, IStream *pStream, LPVOID pData) { LARGE_INTEGER position; @@ -257,7 +259,7 @@ BOOL WINAPI DPA_Merge (HDPA hdpa1, HDPA hdpa2, DWORD dwFlags, INT nResult, i; INT nIndex; - TRACE("%p %p %08x %p %p %08lx)\n", + TRACE("(%p %p %08x %p %p %08lx)\n", hdpa1, hdpa2, dwFlags, pfnCompare, pfnMerge, lParam); if (IsBadWritePtr (hdpa1, sizeof(*hdpa1))) @@ -385,7 +387,7 @@ BOOL WINAPI DPA_Merge (HDPA hdpa1, HDPA hdpa2, DWORD dwFlags, * Success: TRUE * Failure: FALSE */ -BOOL WINAPI DPA_Destroy (const HDPA hdpa) +BOOL WINAPI DPA_Destroy (HDPA hdpa) { TRACE("(%p)\n", hdpa); @@ -455,11 +457,11 @@ BOOL WINAPI DPA_Grow (HDPA hdpa, INT nGrow) * * NOTES * - If the 'hdpaNew' is a NULL-Pointer, a copy of the source pointer - * array will be created and it's handle (pointer) is returned. + * array will be created and its handle (pointer) is returned. * - If 'hdpa' is a NULL-Pointer, the original implementation crashes, * this implementation just returns NULL. */ -HDPA WINAPI DPA_Clone (const HDPA hdpa, const HDPA hdpaNew) +HDPA WINAPI DPA_Clone (const HDPA hdpa, HDPA hdpaNew) { INT nNewItems, nSize; HDPA hdpaTemp; @@ -516,7 +518,7 @@ HDPA WINAPI DPA_Clone (const HDPA hdpa, const HDPA hdpaNew) * Success: pointer * Failure: NULL */ -LPVOID WINAPI DPA_GetPtr (const HDPA hdpa, INT nIndex) +LPVOID WINAPI DPA_GetPtr (HDPA hdpa, INT nIndex) { TRACE("(%p %d)\n", hdpa, nIndex); @@ -580,7 +582,7 @@ INT WINAPI DPA_GetPtrIndex (HDPA hdpa, LPCVOID p) * Success: index of the inserted pointer * Failure: -1 */ -INT WINAPI DPA_InsertPtr (const HDPA hdpa, INT i, LPVOID p) +INT WINAPI DPA_InsertPtr (HDPA hdpa, INT i, LPVOID p) { TRACE("(%p %d %p)\n", hdpa, i, p); @@ -615,7 +617,7 @@ INT WINAPI DPA_InsertPtr (const HDPA hdpa, INT i, LPVOID p) * Success: TRUE * Failure: FALSE */ -BOOL WINAPI DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p) +BOOL WINAPI DPA_SetPtr (HDPA hdpa, INT i, LPVOID p) { LPVOID *lpTemp; @@ -666,7 +668,7 @@ BOOL WINAPI DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p) * Success: deleted pointer * Failure: NULL */ -LPVOID WINAPI DPA_DeletePtr (const HDPA hdpa, INT i) +LPVOID WINAPI DPA_DeletePtr (HDPA hdpa, INT i) { LPVOID *lpDest, *lpSrc, lpTemp = NULL; INT nSize; @@ -719,7 +721,7 @@ LPVOID WINAPI DPA_DeletePtr (const HDPA hdpa, INT i) * Success: TRUE * Failure: FALSE */ -BOOL WINAPI DPA_DeleteAllPtrs (const HDPA hdpa) +BOOL WINAPI DPA_DeleteAllPtrs (HDPA hdpa) { TRACE("(%p)\n", hdpa); @@ -802,7 +804,7 @@ static VOID DPA_QuickSort (LPVOID *lpPtrs, INT l, INT r, * Success: TRUE * Failure: FALSE */ -BOOL WINAPI DPA_Sort (const HDPA hdpa, PFNDPACOMPARE pfnCompare, LPARAM lParam) +BOOL WINAPI DPA_Sort (HDPA hdpa, PFNDPACOMPARE pfnCompare, LPARAM lParam) { if (!hdpa || !pfnCompare) return FALSE; @@ -834,7 +836,7 @@ BOOL WINAPI DPA_Sort (const HDPA hdpa, PFNDPACOMPARE pfnCompare, LPARAM lParam) * Success: index of the pointer in the array. * Failure: -1 */ -INT WINAPI DPA_Search (const HDPA hdpa, LPVOID pFind, INT nStart, +INT WINAPI DPA_Search (HDPA hdpa, LPVOID pFind, INT nStart, PFNDPACOMPARE pfnCompare, LPARAM lParam, UINT uOptions) { if (!hdpa || !pfnCompare || !pFind) diff --git a/dll/win32/comctl32/dsa.c b/dll/win32/comctl32/dsa.c index ce4ca8120b0..dc0d170773e 100644 --- a/dll/win32/comctl32/dsa.c +++ b/dll/win32/comctl32/dsa.c @@ -92,7 +92,7 @@ HDSA WINAPI DSA_Create (INT nSize, INT nGrow) * Success: TRUE * Failure: FALSE */ -BOOL WINAPI DSA_Destroy (const HDSA hdsa) +BOOL WINAPI DSA_Destroy (HDSA hdsa) { TRACE("(%p)\n", hdsa); @@ -120,7 +120,7 @@ BOOL WINAPI DSA_Destroy (const HDSA hdsa) * Success: TRUE * Failure: FALSE */ -BOOL WINAPI DSA_GetItem (const HDSA hdsa, INT nIndex, LPVOID pDest) +BOOL WINAPI DSA_GetItem (HDSA hdsa, INT nIndex, LPVOID pDest) { LPVOID pSrc; @@ -151,7 +151,7 @@ BOOL WINAPI DSA_GetItem (const HDSA hdsa, INT nIndex, LPVOID pDest) * Success: pointer to an item * Failure: NULL */ -LPVOID WINAPI DSA_GetItemPtr (const HDSA hdsa, INT nIndex) +LPVOID WINAPI DSA_GetItemPtr (HDSA hdsa, INT nIndex) { LPVOID pSrc; @@ -184,7 +184,7 @@ LPVOID WINAPI DSA_GetItemPtr (const HDSA hdsa, INT nIndex) * Success: TRUE * Failure: FALSE */ -BOOL WINAPI DSA_SetItem (const HDSA hdsa, INT nIndex, LPVOID pSrc) +BOOL WINAPI DSA_SetItem (HDSA hdsa, INT nIndex, LPVOID pSrc) { INT nSize, nNewItems; LPVOID pDest, lpTemp; @@ -240,7 +240,7 @@ BOOL WINAPI DSA_SetItem (const HDSA hdsa, INT nIndex, LPVOID pSrc) * Success: position of the new item * Failure: -1 */ -INT WINAPI DSA_InsertItem (const HDSA hdsa, INT nIndex, LPVOID pSrc) +INT WINAPI DSA_InsertItem (HDSA hdsa, INT nIndex, LPVOID pSrc) { INT nNewItems, nSize; LPVOID lpTemp, lpDest; @@ -301,7 +301,7 @@ INT WINAPI DSA_InsertItem (const HDSA hdsa, INT nIndex, LPVOID pSrc) * Success: number of the deleted element * Failure: -1 */ -INT WINAPI DSA_DeleteItem (const HDSA hdsa, INT nIndex) +INT WINAPI DSA_DeleteItem (HDSA hdsa, INT nIndex) { LPVOID lpDest,lpSrc; INT nSize; @@ -353,7 +353,7 @@ INT WINAPI DSA_DeleteItem (const HDSA hdsa, INT nIndex) * Success: TRUE * Failure: FALSE */ -BOOL WINAPI DSA_DeleteAllItems (const HDSA hdsa) +BOOL WINAPI DSA_DeleteAllItems (HDSA hdsa) { TRACE("(%p)\n", hdsa); diff --git a/dll/win32/comctl32/header.c b/dll/win32/comctl32/header.c index 9f8fe84a2ba..ba20b177098 100644 --- a/dll/win32/comctl32/header.c +++ b/dll/win32/comctl32/header.c @@ -872,7 +872,7 @@ HEADER_SendNotifyWithIntFieldT(const HEADER_INFO *infoPtr, UINT code, INT iItem, * Prepare callback items * depends on NMHDDISPINFOW having same structure as NMHDDISPINFOA * (so we handle the two cases only doing a specific cast for pszText). - * Checks if any of the required field are callback. If there are sends a + * Checks if any of the required fields is a callback. If this is the case sends a * NMHDISPINFO notify to retrieve these items. The items are stored in the * HEADER_ITEM pszText and iImage fields. They should be freed with * HEADER_FreeCallbackItems. diff --git a/dll/win32/comctl32/imagelist.c b/dll/win32/comctl32/imagelist.c index 32209910b7b..54b0ff8b7fc 100644 --- a/dll/win32/comctl32/imagelist.c +++ b/dll/win32/comctl32/imagelist.c @@ -196,7 +196,7 @@ static void add_dib_bits( HIMAGELIST himl, int pos, int count, int width, int he for (n = 0; n < count; n++) { - int has_alpha = 0; + BOOL has_alpha = FALSE; imagelist_point_from_index( himl, pos + n, &pt ); @@ -2876,7 +2876,7 @@ ImageList_SetImageCount (HIMAGELIST himl, UINT iImageCount) himl->hbmImage = hbmNewBitmap; } else - ERR("Could not create new image bitmap !\n"); + ERR("Could not create new image bitmap!\n"); if (himl->hbmMask) { @@ -3147,7 +3147,7 @@ static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT count) */ UINT WINAPI -ImageList_SetColorTable (HIMAGELIST himl, UINT uStartIndex, UINT cEntries, CONST RGBQUAD * prgb) +ImageList_SetColorTable(HIMAGELIST himl, UINT uStartIndex, UINT cEntries, const RGBQUAD *prgb) { return SetDIBColorTable(himl->hdcImage, uStartIndex, cEntries, prgb); } diff --git a/dll/win32/comctl32/listview.c b/dll/win32/comctl32/listview.c index 421e74cf693..199626b98d5 100644 --- a/dll/win32/comctl32/listview.c +++ b/dll/win32/comctl32/listview.c @@ -1118,7 +1118,7 @@ static inline BOOL ranges_delitem(RANGES ranges, INT nItem) * ITERATOR DOCUMENTATION * * The iterator functions allow for easy, and convenient iteration - * over items of interest in the list. Typically, you create a + * over items of interest in the list. Typically, you create an * iterator, use it, and destroy it, as such: * ITERATOR i; * @@ -3670,8 +3670,8 @@ static void LISTVIEW_SetSelection(LISTVIEW_INFO *infoPtr, INT nItem) static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *infoPtr, INT nItem, BOOL space) { /* FIXME: pass in the state */ - WORD wShift = HIWORD(GetKeyState(VK_SHIFT)); - WORD wCtrl = HIWORD(GetKeyState(VK_CONTROL)); + WORD wShift = GetKeyState(VK_SHIFT) & 0x8000; + WORD wCtrl = GetKeyState(VK_CONTROL) & 0x8000; BOOL bResult = FALSE; TRACE("nItem=%d, wShift=%d, wCtrl=%d\n", nItem, wShift, wCtrl); @@ -4720,9 +4720,11 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS if (infoPtr->uView == LV_VIEW_DETAILS && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES) rcLabel.bottom--; +#ifdef __REACTOS__ if ((!(lvItem.state & LVIS_SELECTED) || !infoPtr->bFocus) && (infoPtr->dwLvExStyle & LVS_EX_TRANSPARENTSHADOWTEXT)) DrawShadowText(hdc, lvItem.pszText, -1, &rcLabel, uFormat, RGB(255, 255, 255), RGB(0, 0, 0), 2, 2); else +#endif DrawTextW(hdc, lvItem.pszText, -1, &rcLabel, uFormat); postpaint: @@ -5383,9 +5385,8 @@ static HIMAGELIST LISTVIEW_CreateDragImage(LISTVIEW_INFO *infoPtr, INT iItem, LP */ static BOOL LISTVIEW_DeleteAllItems(LISTVIEW_INFO *infoPtr, BOOL destroy) { - NMLISTVIEW nmlv; HDPA hdpaSubItems = NULL; - BOOL bSuppress; + BOOL suppress = FALSE; ITEMHDR *hdrItem; ITEM_INFO *lpItem; ITEM_ID *lpID; @@ -5400,11 +5401,15 @@ static BOOL LISTVIEW_DeleteAllItems(LISTVIEW_INFO *infoPtr, BOOL destroy) SetRectEmpty(&infoPtr->rcFocus); /* But we are supposed to leave nHotItem as is! */ - /* send LVN_DELETEALLITEMS notification */ - ZeroMemory(&nmlv, sizeof(NMLISTVIEW)); - nmlv.iItem = -1; - bSuppress = notify_listview(infoPtr, LVN_DELETEALLITEMS, &nmlv); + if (!(infoPtr->dwStyle & LVS_OWNERDATA) || !destroy) + { + NMLISTVIEW nmlv; + + memset(&nmlv, 0, sizeof(NMLISTVIEW)); + nmlv.iItem = -1; + suppress = notify_listview(infoPtr, LVN_DELETEALLITEMS, &nmlv); + } for (i = infoPtr->nItemCount - 1; i >= 0; i--) { @@ -5412,7 +5417,7 @@ static BOOL LISTVIEW_DeleteAllItems(LISTVIEW_INFO *infoPtr, BOOL destroy) { /* send LVN_DELETEITEM notification, if not suppressed and if it is not a virtual listview */ - if (!bSuppress) notify_deleteitem(infoPtr, i); + if (!suppress) notify_deleteitem(infoPtr, i); hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, i); lpItem = DPA_GetPtr(hdpaSubItems, 0); /* free id struct */ @@ -7500,6 +7505,7 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' }; RECT rcBox, rcBounds, rcState, rcIcon, rcLabel, rcSearch; POINT Origin, Position, opt; + BOOL is_fullrow; LVITEMW lvItem; ITERATOR i; INT iItem; @@ -7623,15 +7629,17 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, TRACE("rcBounds=%s\n", wine_dbgstr_rect(&rcBounds)); if (!PtInRect(&rcBounds, opt)) return -1; + /* That's a special case - row rectangle is used as item rectangle and + returned flags contain all item parts. */ + is_fullrow = (infoPtr->uView == LV_VIEW_DETAILS) && ((infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) || (infoPtr->dwStyle & LVS_OWNERDRAWFIXED)); + if (PtInRect(&rcIcon, opt)) lpht->flags |= LVHT_ONITEMICON; else if (PtInRect(&rcLabel, opt)) lpht->flags |= LVHT_ONITEMLABEL; else if (infoPtr->himlState && PtInRect(&rcState, opt)) lpht->flags |= LVHT_ONITEMSTATEICON; - /* special case for LVS_EX_FULLROWSELECT */ - if (infoPtr->uView == LV_VIEW_DETAILS && infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT && - !(lpht->flags & LVHT_ONITEM)) + if (is_fullrow && !(lpht->flags & LVHT_ONITEM)) { lpht->flags = LVHT_ONITEM | LVHT_ABOVE; } @@ -7639,9 +7647,7 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, lpht->flags &= ~LVHT_NOWHERE; TRACE("lpht->flags=0x%x\n", lpht->flags); - if (select && !(infoPtr->uView == LV_VIEW_DETAILS && - ((infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) || - (infoPtr->dwStyle & LVS_OWNERDRAWFIXED)))) + if (select && !is_fullrow) { if (infoPtr->uView == LV_VIEW_DETAILS) { @@ -8247,7 +8253,7 @@ static BOOL LISTVIEW_SetColumnWidth(LISTVIEW_INFO *infoPtr, INT nColumn, INT cx) INT max_cx = 0; HDITEMW hdi; - TRACE("(nColumn=%d, cx=%d\n", nColumn, cx); + TRACE("(nColumn=%d, cx=%d)\n", nColumn, cx); /* set column width only if in report or list mode */ if (infoPtr->uView != LV_VIEW_DETAILS && infoPtr->uView != LV_VIEW_LIST) return FALSE; @@ -8631,7 +8637,7 @@ static HIMAGELIST LISTVIEW_SetImageList(LISTVIEW_INFO *infoPtr, INT nType, HIMAG INT oldHeight = infoPtr->nItemHeight; HIMAGELIST himlOld = 0; - TRACE("(nType=%d, himl=%p\n", nType, himl); + TRACE("(nType=%d, himl=%p)\n", nType, himl); switch (nType) { @@ -8786,7 +8792,7 @@ static BOOL LISTVIEW_SetItemPosition(LISTVIEW_INFO *infoPtr, INT nItem, const PO { POINT Origin, Pt; - TRACE("(nItem=%d, pt=%s\n", nItem, wine_dbgstr_point(pt)); + TRACE("(nItem=%d, pt=%s)\n", nItem, wine_dbgstr_point(pt)); if (!pt || nItem < 0 || nItem >= infoPtr->nItemCount || !(infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON)) return FALSE; diff --git a/dll/win32/comctl32/propsheet.c b/dll/win32/comctl32/propsheet.c index 0744b1d2f82..23a5e91f5b4 100644 --- a/dll/win32/comctl32/propsheet.c +++ b/dll/win32/comctl32/propsheet.c @@ -1872,7 +1872,7 @@ static void PROPSHEET_UnChanged(HWND hwndDlg, HWND hwndCleanPage) if (psInfo->proppage[i].hwndPage == hwndCleanPage) psInfo->proppage[i].isDirty = FALSE; - /* look to see if there's any dirty pages */ + /* look to see if there are any dirty pages */ if (psInfo->proppage[i].isDirty) noPageDirty = FALSE; } @@ -2414,9 +2414,11 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags) HWND hwndBack = GetDlgItem(hwndDlg, IDC_BACK_BUTTON); HWND hwndNext = GetDlgItem(hwndDlg, IDC_NEXT_BUTTON); HWND hwndFinish = GetDlgItem(hwndDlg, IDC_FINISH_BUTTON); +#ifdef __REACTOS__ HWND hwndCancel = GetDlgItem(hwndDlg, IDCANCEL); INT iDefItem = 0; HWND hwndFocus; +#endif TRACE("%d\n", dwFlags); @@ -2424,6 +2426,19 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags) EnableWindow(hwndNext, FALSE); EnableWindow(hwndFinish, FALSE); +#ifndef __REACTOS__ + /* set the default pushbutton to an enabled button */ + if (((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH)) + SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0); + else if (dwFlags & PSWIZB_NEXT) + SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0); + else if (dwFlags & PSWIZB_BACK) + SendMessageW(hwndDlg, DM_SETDEFID, IDC_BACK_BUTTON, 0); + else + SendMessageW(hwndDlg, DM_SETDEFID, IDCANCEL, 0); +#endif + + if (dwFlags & PSWIZB_BACK) EnableWindow(hwndBack, TRUE); @@ -2454,6 +2469,7 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags) else if (!(dwFlags & PSWIZB_DISABLEDFINISH)) EnableWindow(hwndFinish, TRUE); +#ifdef __REACTOS__ /* set the default pushbutton to an enabled button */ if (((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH)) iDefItem = IDC_FINISH_BUTTON; @@ -2469,6 +2485,8 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags) hwndFocus = GetFocus(); if (!hwndFocus || hwndFocus == hwndCancel) SetFocus(GetDlgItem(hwndDlg, iDefItem)); +#endif + } /****************************************************************************** diff --git a/dll/win32/comctl32/rebar.c b/dll/win32/comctl32/rebar.c index dad715d74d1..58c459b34da 100644 --- a/dll/win32/comctl32/rebar.c +++ b/dll/win32/comctl32/rebar.c @@ -50,7 +50,6 @@ * - WM_QUERYNEWPALETTE * - WM_RBUTTONDOWN * - WM_RBUTTONUP - * - WM_SYSCOLORCHANGE * - WM_VKEYTOITEM * - WM_WININICHANGE * Notifications: @@ -2904,6 +2903,7 @@ REBAR_SizeToRect (REBAR_INFO *infoPtr, WPARAM flags, RECT *lpRect) TRACE("[%s]\n", wine_dbgstr_rect(lpRect)); REBAR_SizeToHeight(infoPtr, get_rect_cy(infoPtr, lpRect)); +#ifdef __REACTOS__ /* Note that this undocumented flag is available on comctl32 v6 or later */ if ((flags & RBSTR_CHANGERECT) != 0) { @@ -2911,6 +2911,7 @@ REBAR_SizeToRect (REBAR_INFO *infoPtr, WPARAM flags, RECT *lpRect) GetClientRect(infoPtr->hwndSelf, &rcRebar); lpRect->bottom = lpRect->top + (rcRebar.bottom - rcRebar.top); } +#endif return TRUE; } @@ -3378,7 +3379,7 @@ REBAR_NotifyFormat (REBAR_INFO *infoPtr, LPARAM cmd) ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", i); i = NFR_ANSI; } - infoPtr->bUnicode = (i == NFR_UNICODE) ? 1 : 0; + infoPtr->bUnicode = (i == NFR_UNICODE); return (LRESULT)i; } return (LRESULT)((infoPtr->bUnicode) ? NFR_UNICODE : NFR_ANSI); @@ -3751,8 +3752,11 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_SYSCOLORCHANGE: COMCTL32_RefreshSysColors(); +#ifdef __REACTOS__ + /* r51522 - Properly support WM_SYSCOLORCHANGE */ infoPtr->clrBtnText = comctl32_color.clrBtnText; infoPtr->clrBtnFace = comctl32_color.clrBtnFace; +#endif return 0; /* case WM_VKEYTOITEM: supported according to ControlSpy */ diff --git a/dll/win32/comctl32/status.c b/dll/win32/comctl32/status.c index f2e8adb3a21..69c6aa731f4 100644 --- a/dll/win32/comctl32/status.c +++ b/dll/win32/comctl32/status.c @@ -687,10 +687,12 @@ STATUSBAR_SetParts (STATUS_INFO *infoPtr, INT count, LPINT parts) if (infoPtr->hwndToolTip) { INT nTipCount; TTTOOLINFOW ti; + WCHAR wEmpty = 0; ZeroMemory (&ti, sizeof(TTTOOLINFOW)); ti.cbSize = sizeof(TTTOOLINFOW); ti.hwnd = infoPtr->Self; + ti.lpszText = &wEmpty; nTipCount = SendMessageW (infoPtr->hwndToolTip, TTM_GETTOOLCOUNT, 0, 0); if (nTipCount < infoPtr->numParts) { diff --git a/dll/win32/comctl32/tab.c b/dll/win32/comctl32/tab.c index 046d59151a7..d7da2bedf82 100644 --- a/dll/win32/comctl32/tab.c +++ b/dll/win32/comctl32/tab.c @@ -238,22 +238,29 @@ static inline LRESULT TAB_SetCurSel (TAB_INFO *infoPtr, INT iItem) TRACE("(%p %d)\n", infoPtr, iItem); - if (iItem < 0) - infoPtr->iSelected = -1; - else if (iItem >= infoPtr->uNumItem) + if (iItem >= (INT)infoPtr->uNumItem) return -1; - else { - if (prevItem != iItem) { - if (prevItem != -1) - TAB_GetItem(infoPtr, prevItem)->dwState &= ~TCIS_BUTTONPRESSED; - TAB_GetItem(infoPtr, iItem)->dwState |= TCIS_BUTTONPRESSED; + if (prevItem != iItem) { + if (prevItem != -1) + TAB_GetItem(infoPtr, prevItem)->dwState &= ~TCIS_BUTTONPRESSED; + + if (iItem >= 0) + { + TAB_GetItem(infoPtr, iItem)->dwState |= TCIS_BUTTONPRESSED; infoPtr->iSelected = iItem; infoPtr->uFocus = iItem; - TAB_EnsureSelectionVisible(infoPtr); - TAB_InvalidateTabArea(infoPtr); } + else + { + infoPtr->iSelected = -1; + infoPtr->uFocus = -1; + } + + TAB_EnsureSelectionVisible(infoPtr); + TAB_InvalidateTabArea(infoPtr); } + return prevItem; } diff --git a/dll/win32/comctl32/toolbar.c b/dll/win32/comctl32/toolbar.c index 62f7c388a17..b4671882478 100644 --- a/dll/win32/comctl32/toolbar.c +++ b/dll/win32/comctl32/toolbar.c @@ -80,8 +80,8 @@ typedef struct INT idCommand; BYTE fsState; BYTE fsStyle; - BYTE bHot; - BYTE bDropDownPressed; + BOOL bHot; + BOOL bDropDownPressed; DWORD_PTR dwData; INT_PTR iString; INT nRow; diff --git a/dll/win32/comctl32/tooltips.c b/dll/win32/comctl32/tooltips.c index c1c9415c682..3589e2839cf 100644 --- a/dll/win32/comctl32/tooltips.c +++ b/dll/win32/comctl32/tooltips.c @@ -613,7 +613,7 @@ TOOLTIPS_Show (TOOLTIPS_INFO *infoPtr, BOOL track_activate) TOOLTIPS_CalcTipSize (infoPtr, &size); TRACE("size %d x %d\n", size.cx, size.cy); - if (track_activate) + if (track_activate && (toolPtr->uFlags & TTF_TRACK)) { rect.left = infoPtr->xTrackPos; rect.top = infoPtr->yTrackPos; @@ -1024,6 +1024,9 @@ TOOLTIPS_AddToolT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW) infoPtr->hwndSelf, ti->hwnd, ti->uId, (ti->uFlags & TTF_IDISHWND) ? " TTF_IDISHWND" : ""); + if (ti->cbSize >= TTTOOLINFOW_V2_SIZE && !ti->lpszText && isW) + return FALSE; + if (infoPtr->uNumTools == 0) { infoPtr->tools = Alloc (sizeof(TTTOOL_INFO)); toolPtr = infoPtr->tools; @@ -1047,27 +1050,29 @@ TOOLTIPS_AddToolT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW) toolPtr->rect = ti->rect; toolPtr->hinst = ti->hinst; - if (IS_INTRESOURCE(ti->lpszText)) { - TRACE("add string id %x\n", LOWORD(ti->lpszText)); - toolPtr->lpszText = ti->lpszText; - } - else if (ti->lpszText) { - if (TOOLTIPS_IsCallbackString(ti->lpszText, isW)) { - TRACE("add CALLBACK!\n"); - toolPtr->lpszText = LPSTR_TEXTCALLBACKW; - } - else if (isW) { - INT len = lstrlenW (ti->lpszText); - TRACE("add text %s!\n", debugstr_w(ti->lpszText)); - toolPtr->lpszText = Alloc ((len + 1)*sizeof(WCHAR)); - strcpyW (toolPtr->lpszText, ti->lpszText); - } - else { - INT len = MultiByteToWideChar(CP_ACP, 0, (LPSTR)ti->lpszText, -1, NULL, 0); - TRACE("add text \"%s\"!\n", (LPSTR)ti->lpszText); - toolPtr->lpszText = Alloc (len * sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP, 0, (LPSTR)ti->lpszText, -1, toolPtr->lpszText, len); - } + if (ti->cbSize >= TTTOOLINFOW_V1_SIZE) { + if (IS_INTRESOURCE(ti->lpszText)) { + TRACE("add string id %x\n", LOWORD(ti->lpszText)); + toolPtr->lpszText = ti->lpszText; + } + else if (ti->lpszText) { + if (TOOLTIPS_IsCallbackString(ti->lpszText, isW)) { + TRACE("add CALLBACK!\n"); + toolPtr->lpszText = LPSTR_TEXTCALLBACKW; + } + else if (isW) { + INT len = lstrlenW (ti->lpszText); + TRACE("add text %s!\n", debugstr_w(ti->lpszText)); + toolPtr->lpszText = Alloc ((len + 1)*sizeof(WCHAR)); + strcpyW (toolPtr->lpszText, ti->lpszText); + } + else { + INT len = MultiByteToWideChar(CP_ACP, 0, (LPSTR)ti->lpszText, -1, NULL, 0); + TRACE("add text \"%s\"!\n", (LPSTR)ti->lpszText); + toolPtr->lpszText = Alloc (len * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, (LPSTR)ti->lpszText, -1, toolPtr->lpszText, len); + } + } } if (ti->cbSize >= TTTOOLINFOW_V2_SIZE) diff --git a/dll/win32/comctl32/trackbar.c b/dll/win32/comctl32/trackbar.c index c6aecd62ebb..01c33468dca 100644 --- a/dll/win32/comctl32/trackbar.c +++ b/dll/win32/comctl32/trackbar.c @@ -597,7 +597,6 @@ TRACKBAR_DrawTics (const TRACKBAR_INFO *infoPtr, HDC hdc) } } -#define POINT_COUNT 6 static int TRACKBAR_FillThumb (const TRACKBAR_INFO *infoPtr, HDC hdc, HBRUSH hbrush) { @@ -1511,11 +1510,13 @@ TRACKBAR_Create (HWND hwnd, const CREATESTRUCTW *lpcs) hwnd, 0, 0, 0); if (infoPtr->hwndToolTip) { - TTTOOLINFOW ti; + TTTOOLINFOW ti; + WCHAR wEmpty = 0; ZeroMemory (&ti, sizeof(ti)); ti.cbSize = sizeof(ti); ti.uFlags = TTF_IDISHWND | TTF_TRACK | TTF_ABSOLUTE; ti.hwnd = hwnd; + ti.lpszText = &wEmpty; SendMessageW (infoPtr->hwndToolTip, TTM_ADDTOOLW, 0, (LPARAM)&ti); } diff --git a/dll/win32/comctl32/treeview.c b/dll/win32/comctl32/treeview.c index 28a884b62da..ec60708de55 100644 --- a/dll/win32/comctl32/treeview.c +++ b/dll/win32/comctl32/treeview.c @@ -2926,6 +2926,62 @@ TREEVIEW_Invalidate(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item) InvalidateRect(infoPtr->hwnd, NULL, TRUE); } +static void +TREEVIEW_InitCheckboxes(TREEVIEW_INFO *infoPtr) +{ + RECT rc; + HBITMAP hbm, hbmOld; + HDC hdc, hdcScreen; + int nIndex; + + infoPtr->himlState = ImageList_Create(16, 16, ILC_COLOR | ILC_MASK, 3, 0); + + hdcScreen = GetDC(0); + + hdc = CreateCompatibleDC(hdcScreen); + hbm = CreateCompatibleBitmap(hdcScreen, 48, 16); + hbmOld = SelectObject(hdc, hbm); + + SetRect(&rc, 0, 0, 48, 16); + FillRect(hdc, &rc, (HBRUSH)(COLOR_WINDOW+1)); + + SetRect(&rc, 18, 2, 30, 14); + DrawFrameControl(hdc, &rc, DFC_BUTTON, + DFCS_BUTTONCHECK|DFCS_FLAT); + + SetRect(&rc, 34, 2, 46, 14); + DrawFrameControl(hdc, &rc, DFC_BUTTON, + DFCS_BUTTONCHECK|DFCS_FLAT|DFCS_CHECKED); + + SelectObject(hdc, hbmOld); + nIndex = ImageList_AddMasked(infoPtr->himlState, hbm, + comctl32_color.clrWindow); + TRACE("checkbox index %d\n", nIndex); + + DeleteObject(hbm); + DeleteDC(hdc); + ReleaseDC(0, hdcScreen); + + infoPtr->stateImageWidth = 16; + infoPtr->stateImageHeight = 16; +} + +static void +TREEVIEW_ResetImageStateIndex(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item) +{ + TREEVIEW_ITEM *child = item->firstChild; + + item->state &= ~TVIS_STATEIMAGEMASK; + item->state |= INDEXTOSTATEIMAGEMASK(1); + + while (child) + { + TREEVIEW_ITEM *next = child->nextSibling; + TREEVIEW_ResetImageStateIndex(infoPtr, child); + child = next; + } +} + static LRESULT TREEVIEW_Paint(TREEVIEW_INFO *infoPtr, HDC hdc_ref) { @@ -2935,6 +2991,17 @@ TREEVIEW_Paint(TREEVIEW_INFO *infoPtr, HDC hdc_ref) TRACE("(%p %p)\n", infoPtr, hdc_ref); + if ((infoPtr->dwStyle & TVS_CHECKBOXES) && !infoPtr->himlState) + { + TREEVIEW_InitCheckboxes(infoPtr); + TREEVIEW_ResetImageStateIndex(infoPtr, infoPtr->root); + + TREEVIEW_EndEditLabelNow(infoPtr, TRUE); + TREEVIEW_UpdateSubTree(infoPtr, infoPtr->root); + TREEVIEW_UpdateScrollBars(infoPtr); + TREEVIEW_Invalidate(infoPtr, NULL); + } + if (hdc_ref) { hdc = hdc_ref; @@ -3344,7 +3411,7 @@ TREEVIEW_Expand(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, TREEVIEW_ITEM *nextItem, *tmpItem; BOOL sendsNotifications; - TRACE("(%p, %p, partial=%d, %d\n", infoPtr, item, partial, user); + TRACE("(%p, %p, partial=%d, %d)\n", infoPtr, item, partial, user); if (!TREEVIEW_HasChildren(infoPtr, item)) return FALSE; @@ -4955,46 +5022,6 @@ TREEVIEW_MouseWheel(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam) /* Create/Destroy *******************************************************/ -static void -TREEVIEW_InitCheckboxes(TREEVIEW_INFO *infoPtr) -{ - RECT rc; - HBITMAP hbm, hbmOld; - HDC hdc, hdcScreen; - int nIndex; - - infoPtr->himlState = ImageList_Create(16, 16, ILC_COLOR | ILC_MASK, 3, 0); - - hdcScreen = GetDC(0); - - hdc = CreateCompatibleDC(hdcScreen); - hbm = CreateCompatibleBitmap(hdcScreen, 48, 16); - hbmOld = SelectObject(hdc, hbm); - - SetRect(&rc, 0, 0, 48, 16); - FillRect(hdc, &rc, (HBRUSH)(COLOR_WINDOW+1)); - - SetRect(&rc, 18, 2, 30, 14); - DrawFrameControl(hdc, &rc, DFC_BUTTON, - DFCS_BUTTONCHECK|DFCS_FLAT); - - SetRect(&rc, 34, 2, 46, 14); - DrawFrameControl(hdc, &rc, DFC_BUTTON, - DFCS_BUTTONCHECK|DFCS_FLAT|DFCS_CHECKED); - - SelectObject(hdc, hbmOld); - nIndex = ImageList_AddMasked(infoPtr->himlState, hbm, - comctl32_color.clrWindow); - TRACE("checkbox index %d\n", nIndex); - - DeleteObject(hbm); - DeleteDC(hdc); - ReleaseDC(0, hdcScreen); - - infoPtr->stateImageWidth = 16; - infoPtr->stateImageHeight = 16; -} - static LRESULT TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) { @@ -5093,9 +5120,6 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, 0, 0, 0); - if (infoPtr->dwStyle & TVS_CHECKBOXES) - TREEVIEW_InitCheckboxes(infoPtr); - /* Make sure actual scrollbar state is consistent with uInternalStatus */ ShowScrollBar(hwnd, SB_VERT, FALSE); ShowScrollBar(hwnd, SB_HORZ, FALSE); @@ -5434,21 +5458,6 @@ TREEVIEW_Size(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam) return 0; } -static void TREEVIEW_ResetImageStateIndex(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item) -{ - TREEVIEW_ITEM *child = item->firstChild; - - item->state &= ~TVIS_STATEIMAGEMASK; - item->state |= INDEXTOSTATEIMAGEMASK(1); - - while (child) - { - TREEVIEW_ITEM *next = child->nextSibling; - TREEVIEW_ResetImageStateIndex(infoPtr, child); - child = next; - } -} - static LRESULT TREEVIEW_StyleChanged(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam) { @@ -5492,6 +5501,7 @@ TREEVIEW_StyleChanged(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam) infoPtr->dwStyle = dwNewStyle; } + TREEVIEW_EndEditLabelNow(infoPtr, TRUE); TREEVIEW_UpdateSubTree(infoPtr, infoPtr->root); TREEVIEW_UpdateScrollBars(infoPtr); TREEVIEW_Invalidate(infoPtr, NULL); diff --git a/dll/win32/comctl32/updown.c b/dll/win32/comctl32/updown.c index 425b0fc152a..af41129ea07 100644 --- a/dll/win32/comctl32/updown.c +++ b/dll/win32/comctl32/updown.c @@ -135,11 +135,16 @@ static BOOL UPDOWN_OffsetVal(UPDOWN_INFO *infoPtr, int delta) (infoPtr->MaxVal < infoPtr->MinVal ? -1 : 1) * (infoPtr->MinVal - infoPtr->MaxVal) + (delta < 0 ? 1 : -1); - } else return FALSE; + } else if ((infoPtr->MaxVal > infoPtr->MinVal && infoPtr->CurVal+delta > infoPtr->MaxVal) + || (infoPtr->MaxVal < infoPtr->MinVal && infoPtr->CurVal+delta < infoPtr->MaxVal)) { + delta = infoPtr->MaxVal - infoPtr->CurVal; + } else { + delta = infoPtr->MinVal - infoPtr->CurVal; + } } infoPtr->CurVal += delta; - return TRUE; + return delta != 0; } /*********************************************************************** @@ -334,7 +339,7 @@ static BOOL UPDOWN_SetBuddyInt (const UPDOWN_INFO *infoPtr) /* if nothing changed exit earlier */ GetWindowTextW(infoPtr->Buddy, txt_old, sizeof(txt_old)/sizeof(WCHAR)); - if (lstrcmpiW(txt_old, txt) == 0) return 0; + if (lstrcmpiW(txt_old, txt) == 0) return FALSE; return SetWindowTextW(infoPtr->Buddy, txt); } @@ -462,6 +467,51 @@ static LRESULT UPDOWN_KeyPressed(UPDOWN_INFO *infoPtr, int key) return 0; } +static int UPDOWN_GetPos(UPDOWN_INFO *infoPtr, BOOL *err) +{ + BOOL succ = UPDOWN_GetBuddyInt(infoPtr); + int val = infoPtr->CurVal; + + if(!UPDOWN_InBounds(infoPtr, val)) { + if((infoPtr->MinVal < infoPtr->MaxVal && val < infoPtr->MinVal) + || (infoPtr->MinVal > infoPtr->MaxVal && val > infoPtr->MinVal)) + val = infoPtr->MinVal; + else + val = infoPtr->MaxVal; + + succ = FALSE; + } + + if(err) *err = !succ; + return val; +} + +static int UPDOWN_SetPos(UPDOWN_INFO *infoPtr, int pos) +{ + int ret = infoPtr->CurVal; + + if(!UPDOWN_InBounds(infoPtr, pos)) { + if((infoPtr->MinVal < infoPtr->MaxVal && pos < infoPtr->MinVal) + || (infoPtr->MinVal > infoPtr->MaxVal && pos > infoPtr->MinVal)) + pos = infoPtr->MinVal; + else + pos = infoPtr->MaxVal; + } + + infoPtr->CurVal = pos; + UPDOWN_SetBuddyInt(infoPtr); + + if(!UPDOWN_InBounds(infoPtr, ret)) { + if((infoPtr->MinVal < infoPtr->MaxVal && ret < infoPtr->MinVal) + || (infoPtr->MinVal > infoPtr->MaxVal && ret > infoPtr->MinVal)) + ret = infoPtr->MinVal; + else + ret = infoPtr->MaxVal; + } + return ret; +} + + /*********************************************************************** * UPDOWN_SetRange * @@ -1044,22 +1094,15 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L case UDM_GETPOS: { - BOOL ret = UPDOWN_GetBuddyInt (infoPtr); - return MAKELONG(infoPtr->CurVal, ret ? 0 : 1); + BOOL err; + int pos; + + pos = UPDOWN_GetPos(infoPtr, &err); + return MAKELONG(pos, err); } case UDM_SETPOS: { - int temp = (short)LOWORD(lParam); - - TRACE("UpDown Ctrl new value(%d), hwnd=%p\n", temp, hwnd); - if(!UPDOWN_InBounds(infoPtr, temp)) { - if(temp < infoPtr->MinVal) temp = infoPtr->MinVal; - if(temp > infoPtr->MaxVal) temp = infoPtr->MaxVal; - } - wParam = infoPtr->CurVal; - infoPtr->CurVal = temp; - UPDOWN_SetBuddyInt (infoPtr); - return wParam; /* return prev value */ + return UPDOWN_SetPos(infoPtr, (short)LOWORD(lParam)); } case UDM_GETRANGE: return MAKELONG(infoPtr->MaxVal, infoPtr->MinVal); @@ -1083,22 +1126,11 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L case UDM_GETPOS32: { - BOOL ret = UPDOWN_GetBuddyInt (infoPtr); - if ((LPBOOL)lParam) *((LPBOOL)lParam) = !ret; - return infoPtr->CurVal; + return UPDOWN_GetPos(infoPtr, (BOOL*)lParam); } case UDM_SETPOS32: { - int temp; - - if(!UPDOWN_InBounds(infoPtr, (int)lParam)) { - if((int)lParam < infoPtr->MinVal) lParam = infoPtr->MinVal; - if((int)lParam > infoPtr->MaxVal) lParam = infoPtr->MaxVal; - } - temp = infoPtr->CurVal; /* save prev value */ - infoPtr->CurVal = (int)lParam; /* set the new value */ - UPDOWN_SetBuddyInt (infoPtr); - return temp; /* return prev value */ + return UPDOWN_SetPos(infoPtr, (int)lParam); } case UDM_GETUNICODEFORMAT: /* we lie a bit here, we're always using Unicode internally */ diff --git a/dll/win32/comdlg32/colordlg.c b/dll/win32/comdlg32/colordlg.c index ff9067da9f1..88e8f9206a0 100644 --- a/dll/win32/comdlg32/colordlg.c +++ b/dll/win32/comdlg32/colordlg.c @@ -244,9 +244,9 @@ static void CC_DrawFocusRect(CCPRIV *lpp, HWND hwnd, int x, int y, int rows, int /*********************************************************************** * CC_MouseCheckPredefColorArray [internal] - * returns 1 if one of the predefined colors is clicked + * returns TRUE if one of the predefined colors is clicked */ -static int CC_MouseCheckPredefColorArray(CCPRIV *lpp, int rows, int cols, LPARAM lParam) +static BOOL CC_MouseCheckPredefColorArray(CCPRIV *lpp, int rows, int cols, LPARAM lParam) { HWND hwnd; POINT point; @@ -269,17 +269,17 @@ static int CC_MouseCheckPredefColorArray(CCPRIV *lpp, int rows, int cols, LPARAM y = point.y / dy; lpp->lpcc->rgbResult = predefcolors[y][x]; CC_DrawFocusRect(lpp, hwnd, x, y, rows, cols); - return 1; + return TRUE; } } - return 0; + return FALSE; } /*********************************************************************** * CC_MouseCheckUserColorArray [internal] - * return 1 if the user clicked a color + * return TRUE if the user clicked a color */ -static int CC_MouseCheckUserColorArray(CCPRIV *lpp, int rows, int cols, LPARAM lParam) +static BOOL CC_MouseCheckUserColorArray(CCPRIV *lpp, int rows, int cols, LPARAM lParam) { HWND hwnd; POINT point; @@ -303,10 +303,10 @@ static int CC_MouseCheckUserColorArray(CCPRIV *lpp, int rows, int cols, LPARAM l y = point.y / dy; lpp->lpcc->rgbResult = crarr[x + (cols * y) ]; CC_DrawFocusRect(lpp, hwnd, x, y, rows, cols); - return 1; + return TRUE; } } - return 0; + return FALSE; } #define MAXVERT 240 @@ -322,7 +322,7 @@ static int CC_MouseCheckUserColorArray(CCPRIV *lpp, int rows, int cols, LPARAM l /*********************************************************************** * CC_MouseCheckColorGraph [internal] */ -static int CC_MouseCheckColorGraph( HWND hDlg, int dlgitem, int *hori, int *vert, LPARAM lParam ) +static BOOL CC_MouseCheckColorGraph( HWND hDlg, int dlgitem, int *hori, int *vert, LPARAM lParam ) { HWND hwnd; POINT point; @@ -335,7 +335,7 @@ static int CC_MouseCheckColorGraph( HWND hDlg, int dlgitem, int *hori, int *vert GetWindowRect(hwnd, &rect); if (!PtInRect(&rect, point)) - return 0; + return FALSE; GetClientRect(hwnd, &rect); ScreenToClient(hwnd, &point); @@ -355,13 +355,13 @@ static int CC_MouseCheckColorGraph( HWND hDlg, int dlgitem, int *hori, int *vert if (vert) *vert = y; - return 1; + return TRUE; } /*********************************************************************** * CC_MouseCheckResultWindow [internal] * test if double click one of the result colors */ -static int CC_MouseCheckResultWindow( HWND hDlg, LPARAM lParam ) +static BOOL CC_MouseCheckResultWindow( HWND hDlg, LPARAM lParam ) { HWND hwnd; POINT point; @@ -374,9 +374,9 @@ static int CC_MouseCheckResultWindow( HWND hDlg, LPARAM lParam ) if (PtInRect(&rect, point)) { PostMessageA(hDlg, WM_COMMAND, IDC_COLOR_RES, 0); - return 1; + return TRUE; } - return 0; + return FALSE; } /*********************************************************************** diff --git a/dll/win32/comdlg32/comdlg32_classes.idl b/dll/win32/comdlg32/comdlg32_classes.idl index b45eeb55cd9..1cd2f3d90ff 100644 --- a/dll/win32/comdlg32/comdlg32_classes.idl +++ b/dll/win32/comdlg32/comdlg32_classes.idl @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ helpstring("File Open Dialog"), threading(apartment), diff --git a/dll/win32/comdlg32/comdlg32_ros.diff b/dll/win32/comdlg32/comdlg32_ros.diff index 7a310d01db6..dceaf5b2fdb 100644 --- a/dll/win32/comdlg32/comdlg32_ros.diff +++ b/dll/win32/comdlg32/comdlg32_ros.diff @@ -1,71 +1,66 @@ -Index: filedlg.c -=================================================================== ---- filedlg.c (Revision 56893) -+++ filedlg.c (Arbeitskopie) -@@ -260,6 +260,8 @@ - HRSRC hRes; - HANDLE hDlgTmpl = 0; - HRESULT hr; -+ DWORD dwSize; -+ LPDLGTEMPLATE hDialogTemplate; - - /* test for missing functionality */ - if (fodInfos->ofnInfos->Flags & UNIMPLEMENTED_FLAGS) -@@ -276,12 +278,17 @@ - return FALSE; - } - if (!(hDlgTmpl = LoadResource(COMDLG32_hInstance, hRes )) || -+ !(dwSize = SizeofResource(COMDLG32_hInstance, hRes )) || -+ !(hDialogTemplate = malloc(dwSize)) || - !(template = LockResource( hDlgTmpl ))) - { - COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); - return FALSE; - } - -+ /* Copy the read only resource */ -+ memcpy(hDialogTemplate, template, dwSize); -+ - /* msdn: explorer style dialogs permit sizing by default. - * The OFN_ENABLESIZING flag is only needed when a hook or - * custom tmeplate is provided */ -@@ -291,12 +298,12 @@ - - if (fodInfos->ofnInfos->Flags & OFN_ENABLESIZING) - { -- ((LPDLGTEMPLATEW)template)->style |= WS_SIZEBOX; -+ hDialogTemplate->style |= WS_SIZEBOX; - fodInfos->sizedlg.cx = fodInfos->sizedlg.cy = 0; - fodInfos->initial_size.x = fodInfos->initial_size.y = 0; - } - else -- ((LPDLGTEMPLATEW)template)->style &= ~WS_SIZEBOX; -+ hDialogTemplate->style &= ~WS_SIZEBOX; - - - /* old style hook messages */ -@@ -313,19 +320,21 @@ - - if (fodInfos->unicode) - lRes = DialogBoxIndirectParamW(COMDLG32_hInstance, -- template, -+ hDialogTemplate, - fodInfos->ofnInfos->hwndOwner, - FileOpenDlgProc95, - (LPARAM) fodInfos); - else - lRes = DialogBoxIndirectParamA(COMDLG32_hInstance, -- template, -+ hDialogTemplate, - fodInfos->ofnInfos->hwndOwner, - FileOpenDlgProc95, - (LPARAM) fodInfos); -- if (SUCCEEDED(hr)) -+ if (SUCCEEDED(hr)) - OleUninitialize(); - -+ free(hDialogTemplate); -+ - /* Unable to create the dialog */ - if( lRes == -1) - return FALSE; +diff -prudN e:\Wine\dlls\comdlg32/cdlg32.c e:\reactos\dll\win32\comdlg32/cdlg32.c +--- e:\Wine\dlls\comdlg32/cdlg32.c 2013-10-26 22:24:27.508648000 +0100 ++++ e:\reactos\dll\win32\comdlg32/cdlg32.c 2014-03-05 11:46:06.260510700 +0100 +@@ -174,6 +157,8 @@ DWORD WINAPI CommDlgExtendedError(void) + return 0; /* we never set an error, so there isn't one */ + } + ++#ifndef __REACTOS__ /* Win 7 */ ++ + /************************************************************************* + * Implement the CommDlg32 class factory + * +@@ -283,7 +268,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSI + */ + HRESULT WINAPI DllRegisterServer(void) + { +- return __wine_register_resources(COMDLG32_hInstance); ++ return E_FAIL; // FIXME: __wine_register_resources(COMDLG32_hInstance); + } + + /*********************************************************************** +@@ -291,5 +276,7 @@ HRESULT WINAPI DllRegisterServer(void) + */ + HRESULT WINAPI DllUnregisterServer(void) + { +- return __wine_unregister_resources(COMDLG32_hInstance); ++ return E_FAIL; // FIXME: __wine_unregister_resources(COMDLG32_hInstance); + } ++ ++#endif /* Win 7 */ + +diff -prudN e:\Wine\dlls\comdlg32/comdlg32.spec e:\reactos\dll\win32\comdlg32/comdlg32.spec +--- e:\Wine\dlls\comdlg32/comdlg32.spec 2011-09-16 23:22:36.026770600 +0100 ++++ e:\reactos\dll\win32\comdlg32/comdlg32.spec 2012-02-15 22:32:22.456422900 +0100 +@@ -3,9 +3,9 @@ + @ stdcall ChooseFontA(ptr) + @ stdcall ChooseFontW(ptr) + @ stdcall CommDlgExtendedError() +-@ stdcall -private DllGetClassObject(ptr ptr ptr) +-@ stdcall -private DllRegisterServer() +-@ stdcall -private DllUnregisterServer() ++;@ stdcall -private DllGetClassObject(ptr ptr ptr) ; Win 7 ++;@ stdcall -private DllRegisterServer() ; Win 7 ++;@ stdcall -private DllUnregisterServer() ; Win 7 + @ stdcall FindTextA(ptr) + @ stdcall FindTextW(ptr) + @ stdcall GetFileTitleA(str ptr long) + +diff -prudN e:\Wine\dlls\comdlg32/itemdlg.c e:\reactos\dll\win32\comdlg32/itemdlg.c +--- e:\Wine\dlls\comdlg32/itemdlg.c 2013-10-26 22:24:27.515652700 +0100 ++++ e:\reactos\dll\win32\comdlg32/itemdlg.c 2013-10-15 19:32:27.803008200 +0100 +@@ -18,6 +18,8 @@ + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + ++#ifndef __REACTOS__ /* Win 7 */ ++ + #include + + #define COBJMACROS +@@ -3660,3 +3662,5 @@ HRESULT FileSaveDialog_Constructor(IUnkn + { + return FileDialog_constructor(pUnkOuter, riid, ppv, ITEMDLG_TYPE_SAVE); + } ++ ++#endif /* Win 7 */ diff --git a/dll/win32/comdlg32/filedlg.c b/dll/win32/comdlg32/filedlg.c index 631b2a6980a..3fa42552684 100644 --- a/dll/win32/comdlg32/filedlg.c +++ b/dll/win32/comdlg32/filedlg.c @@ -431,7 +431,7 @@ static BOOL GetFileDialog95A(LPOPENFILENAMEA ofn,UINT iDlgType) ret = GetFileName95(&fodInfos); break; default : - ret = 0; + ret = FALSE; } if (lpstrSavDir) @@ -523,7 +523,7 @@ static BOOL GetFileDialog95W(LPOPENFILENAMEW ofn,UINT iDlgType) ret = GetFileName95(&fodInfos); break; default : - ret = 0; + ret = FALSE; } if (lpstrSavDir) @@ -1401,9 +1401,9 @@ static inline BOOL filename_is_edit( const FileOpenDlgInfos *info ) */ static LRESULT FILEDLG95_InitControls(HWND hwnd) { - int win2000plus = 0; - int win98plus = 0; - int handledPath = FALSE; + BOOL win2000plus = FALSE; + BOOL win98plus = FALSE; + BOOL handledPath = FALSE; OSVERSIONINFOW osVi; static const WCHAR szwSlash[] = { '\\', 0 }; static const WCHAR szwStar[] = { '*',0 }; @@ -1554,12 +1554,11 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) } /* 2. (All platforms) If initdir is not null, then use it */ - if ((handledPath == FALSE) && (fodInfos->initdir!=NULL) && - (*fodInfos->initdir!=0x00)) + if (!handledPath && fodInfos->initdir && *fodInfos->initdir) { /* Work out the proper path as supplied one might be relative */ /* (Here because supplying '.' as dir browses to My Computer) */ - if (handledPath==FALSE) { + if (!handledPath) { WCHAR tmpBuf[MAX_PATH]; WCHAR tmpBuf2[MAX_PATH]; WCHAR *nameBit; @@ -1594,8 +1593,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) } } - if ((handledPath == FALSE) && ((fodInfos->initdir==NULL) || - (*fodInfos->initdir==0x00))) + if (!handledPath && (!fodInfos->initdir || !*fodInfos->initdir)) { /* 3. All except w2k+: if filename contains a path use it */ if (!win2000plus && fodInfos->filename && @@ -1627,7 +1625,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) } /* 4. Win2000+: Recently used */ - if (handledPath == FALSE && win2000plus) { + if (!handledPath && win2000plus) { fodInfos->initdir = MemAlloc(MAX_PATH * sizeof(WCHAR)); fodInfos->initdir[0] = '\0'; @@ -1643,8 +1641,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) /* 5. win98+ and win2000+ if any files of specified filter types in current directory, use it */ - if ( win98plus && handledPath == FALSE && - fodInfos->filter && *fodInfos->filter) { + if (win98plus && !handledPath && fodInfos->filter && *fodInfos->filter) { LPCWSTR lpstrPos = fodInfos->filter; WIN32_FIND_DATAW FindFileData; @@ -1683,7 +1680,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) } /* 6. Win98+ and 2000+: Use personal files dir, others use current dir */ - if (handledPath == FALSE && (win2000plus || win98plus)) { + if (!handledPath && (win2000plus || win98plus)) { fodInfos->initdir = MemAlloc(MAX_PATH*sizeof(WCHAR)); if(!COMDLG32_SHGetFolderPathW(hwnd, CSIDL_PERSONAL, 0, 0, fodInfos->initdir)) @@ -1700,7 +1697,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) TRACE("No initial dir specified, using personal files dir of %s\n", debugstr_w(fodInfos->initdir)); } handledPath = TRUE; - } else if (handledPath==FALSE) { + } else if (!handledPath) { fodInfos->initdir = MemAlloc(MAX_PATH*sizeof(WCHAR)); GetCurrentDirectoryW(MAX_PATH, fodInfos->initdir); handledPath = TRUE; diff --git a/dll/win32/comdlg32/filedlg31.c b/dll/win32/comdlg32/filedlg31.c index fca7c592d73..846982441bd 100644 --- a/dll/win32/comdlg32/filedlg31.c +++ b/dll/win32/comdlg32/filedlg31.c @@ -58,7 +58,7 @@ typedef struct tagFD31_DATA */ static BOOL FD31_Init(void) { - static BOOL initialized = 0; + static BOOL initialized = FALSE; if (!initialized) { hFolder = LoadImageA( COMDLG32_hInstance, "FOLDER", IMAGE_ICON, 16, 16, LR_SHARED ); @@ -70,7 +70,7 @@ static BOOL FD31_Init(void) if (hFolder == 0 || hFolder2 == 0 || hFloppy == 0 || hHDisk == 0 || hCDRom == 0 || hNet == 0) { - ERR("Error loading icons !\n"); + ERR("Error loading icons!\n"); return FALSE; } initialized = TRUE; diff --git a/dll/win32/comdlg32/fontdlg.c b/dll/win32/comdlg32/fontdlg.c index 7f12c231c10..2d0cd2e7dae 100644 --- a/dll/win32/comdlg32/fontdlg.c +++ b/dll/win32/comdlg32/fontdlg.c @@ -345,7 +345,7 @@ static INT WINAPI FontFamilyEnumProc(const ENUMLOGFONTEXW *lpElfex, * * Fill font style information into combobox (without using font.c directly) */ -static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTW *lplf) +static BOOL SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTW *lplf) { #define FSTYLES 4 struct FONTSTYLE @@ -384,19 +384,19 @@ static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTW *lplf) WCHAR name[64]; LoadStringW(COMDLG32_hInstance, fontstyles[i].resId, name, 64); j=SendMessageW(hwnd,CB_ADDSTRING,0,(LPARAM)name ); - if (j==CB_ERR) return 1; + if (j==CB_ERR) return TRUE; j=SendMessageW(hwnd, CB_SETITEMDATA, j, MAKELONG(tm.tmWeight,fontstyles[i].italic)); - if (j==CB_ERR) return 1; + if (j==CB_ERR) return TRUE; } } - return 0; + return FALSE; } /************************************************************************* * AddFontSizeToCombo3 [internal] */ -static int AddFontSizeToCombo3(HWND hwnd, UINT h, const CHOOSEFONTW *lpcf) +static BOOL AddFontSizeToCombo3(HWND hwnd, UINT h, const CHOOSEFONTW *lpcf) { int j; WCHAR buffer[20]; @@ -411,23 +411,23 @@ static int AddFontSizeToCombo3(HWND hwnd, UINT h, const CHOOSEFONTW *lpcf) { j=SendMessageW(hwnd, CB_ADDSTRING, 0, (LPARAM)buffer); if (j!=CB_ERR) j = SendMessageW(hwnd, CB_SETITEMDATA, j, h); - if (j==CB_ERR) return 1; + if (j==CB_ERR) return TRUE; } } - return 0; + return FALSE; } /************************************************************************* * SetFontSizesToCombo3 [internal] */ -static int SetFontSizesToCombo3(HWND hwnd, const CHOOSEFONTW *lpcf) +static BOOL SetFontSizesToCombo3(HWND hwnd, const CHOOSEFONTW *lpcf) { static const BYTE sizes[]={6,7,8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72}; unsigned int i; for (i = 0; i < sizeof(sizes)/sizeof(sizes[0]); i++) - if (AddFontSizeToCombo3(hwnd, sizes[i], lpcf)) return 1; - return 0; + if (AddFontSizeToCombo3(hwnd, sizes[i], lpcf)) return TRUE; + return FALSE; } /************************************************************************* @@ -490,16 +490,17 @@ static INT AddFontStyle( const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW * INT points; points = MulDiv( lpNTM->ntmTm.tmHeight - lpNTM->ntmTm.tmInternalLeading, 72, GetScreenDPI()); - i = AddFontSizeToCombo3(hcmb3, points, lpcf); - if(i) return 0; + if (AddFontSizeToCombo3(hcmb3, points, lpcf)) + return 0; } else if (SetFontSizesToCombo3(hcmb3, lpcf)) return 0; if (!SendMessageW(hcmb2, CB_GETCOUNT, 0, 0)) { + BOOL res; if(!(hdc = CFn_GetDC(lpcf))) return 0; - i=SetFontStylesToCombo2(hcmb2,hdc,lplf); + res = SetFontStylesToCombo2(hcmb2,hdc,lplf); CFn_ReleaseDC(lpcf, hdc); - if (i) + if (res) return 0; } if (!( hcmb5 = GetDlgItem(hDlg, cmb5))) return 1; @@ -514,10 +515,10 @@ static INT AddFontStyle( const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW * return 1 ; } -static INT CFn_FitFontSize( HWND hDlg, int points) +static BOOL CFn_FitFontSize( HWND hDlg, int points) { int i,n; - int ret = 0; + BOOL ret = FALSE; /* look for fitting font size in combobox3 */ n=SendDlgItemMessageW(hDlg, cmb3, CB_GETCOUNT, 0, 0); for (i=0;ilStructSize != sizeof(CHOOSEFONTW)) { - ERR("structure size failure !!!\n"); + ERR("structure size failure!!!\n"); EndDialog (hDlg, 0); return FALSE; } @@ -711,7 +714,7 @@ static LRESULT CFn_WMInitDialog(HWND hDlg, LPARAM lParam, LPCHOOSEFONTW lpcf) SendDlgItemMessageW(hDlg, cmb1, CB_SETCURSEL, j, 0); SendMessageW(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE), (LPARAM)GetDlgItem(hDlg,cmb1)); - init=1; + init = TRUE; /* look for fitting font style in combobox2 */ CFn_FitFontStyle(hDlg, pstyle); /* look for fitting font size in combobox3 */ diff --git a/dll/win32/comdlg32/printdlg.c b/dll/win32/comdlg32/printdlg.c index 237bb965fe0..a114d6d13c4 100644 --- a/dll/win32/comdlg32/printdlg.c +++ b/dll/win32/comdlg32/printdlg.c @@ -1473,7 +1473,7 @@ static LRESULT PRINTDLG_WMInitDialog(HWND hDlg, PrintStructures->hNoCollateIcon == 0 || PrintStructures->hPortraitIcon == 0 || PrintStructures->hLandscapeIcon == 0) { - ERR("no icon in resourcefile\n"); + ERR("no icon in resource file\n"); COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); EndDialog(hDlg, FALSE); } @@ -1581,7 +1581,7 @@ static LRESULT PRINTDLG_WMInitDialogW(HWND hDlg, PrintStructures->hNoCollateIcon == 0 || PrintStructures->hPortraitIcon == 0 || PrintStructures->hLandscapeIcon == 0) { - ERR("no icon in resourcefile\n"); + ERR("no icon in resource file\n"); COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); EndDialog(hDlg, FALSE); } @@ -2241,7 +2241,7 @@ BOOL WINAPI PrintDlgA(LPPRINTDLGA lppd) } if(lppd->lStructSize != sizeof(PRINTDLGA)) { - WARN("structure size failure !!!\n"); + WARN("structure size failure!!!\n"); COMDLG32_SetCommDlgExtendedError(CDERR_STRUCTSIZE); return FALSE; } @@ -2392,7 +2392,7 @@ BOOL WINAPI PrintDlgW(LPPRINTDLGW lppd) } if(lppd->lStructSize != sizeof(PRINTDLGW)) { - WARN("structure size failure !!!\n"); + WARN("structure size failure!!!\n"); COMDLG32_SetCommDlgExtendedError(CDERR_STRUCTSIZE); return FALSE; } diff --git a/dll/win32/crypt32/CMakeLists.txt b/dll/win32/crypt32/CMakeLists.txt index aef59eb235f..a4eedfafdcb 100644 --- a/dll/win32/crypt32/CMakeLists.txt +++ b/dll/win32/crypt32/CMakeLists.txt @@ -46,5 +46,6 @@ add_library(crypt32 SHARED set_module_type(crypt32 win32dll) target_link_libraries(crypt32 wine ${PSEH_LIB} oldnames) add_importlibs(crypt32 user32 advapi32 msvcrt kernel32 ntdll) +add_delay_importlibs(crypt32 cryptnet) add_pch(crypt32 crypt32_private.h SOURCE) add_cd_file(TARGET crypt32 DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/crypt32/cert.c b/dll/win32/crypt32/cert.c index 052a024e858..c1728d5fe1c 100644 --- a/dll/win32/crypt32/cert.c +++ b/dll/win32/crypt32/cert.c @@ -29,7 +29,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(crypt); * CertGetCertificateContextProperty, and are particular to the store in which * the property exists (which is separate from the context.) */ -static BOOL CertContext_GetProperty(void *context, DWORD dwPropId, +static BOOL CertContext_GetProperty(cert_t *cert, DWORD dwPropId, void *pvData, DWORD *pcbData); /* Internal version of CertSetCertificateContextProperty that sets properties @@ -37,7 +37,7 @@ static BOOL CertContext_GetProperty(void *context, DWORD dwPropId, * type.) Doesn't handle special cases, since they're handled by * CertSetCertificateContextProperty anyway. */ -static BOOL CertContext_SetProperty(void *context, DWORD dwPropId, +static BOOL CertContext_SetProperty(cert_t *cert, DWORD dwPropId, DWORD dwFlags, const void *pvData); BOOL WINAPI CertAddEncodedCertificateToStore(HCERTSTORE hCertStore, @@ -100,12 +100,190 @@ BOOL WINAPI CertAddEncodedCertificateToSystemStoreW(LPCWSTR pszCertStoreName, return ret; } +static const context_vtbl_t cert_vtbl; + +static void Cert_free(context_t *context) +{ + cert_t *cert = (cert_t*)context; + + CryptMemFree(cert->ctx.pbCertEncoded); + LocalFree(cert->ctx.pCertInfo); +} + +static context_t *Cert_clone(context_t *context, WINECRYPT_CERTSTORE *store, BOOL use_link) +{ + cert_t *cert; + + if(use_link) { + cert = (cert_t*)Context_CreateLinkContext(sizeof(CERT_CONTEXT), context, store); + if(!cert) + return NULL; + }else { + const cert_t *cloned = (const cert_t*)context; + DWORD size = 0; + BOOL res; + + cert = (cert_t*)Context_CreateDataContext(sizeof(CERT_CONTEXT), &cert_vtbl, store); + if(!cert) + return NULL; + + Context_CopyProperties(&cert->ctx, &cloned->ctx); + + cert->ctx.dwCertEncodingType = cloned->ctx.dwCertEncodingType; + cert->ctx.pbCertEncoded = CryptMemAlloc(cloned->ctx.cbCertEncoded); + memcpy(cert->ctx.pbCertEncoded, cloned->ctx.pbCertEncoded, cloned->ctx.cbCertEncoded); + cert->ctx.cbCertEncoded = cloned->ctx.cbCertEncoded; + + /* FIXME: We don't need to decode the object here, we could just clone cert info. */ + res = CryptDecodeObjectEx(cert->ctx.dwCertEncodingType, X509_CERT_TO_BE_SIGNED, + cert->ctx.pbCertEncoded, cert->ctx.cbCertEncoded, CRYPT_DECODE_ALLOC_FLAG, NULL, + &cert->ctx.pCertInfo, &size); + if(!res) { + CertFreeCertificateContext(&cert->ctx); + return NULL; + } + } + + cert->ctx.hCertStore = store; + return &cert->base; +} + +static const context_vtbl_t cert_vtbl = { + Cert_free, + Cert_clone +}; + +static BOOL add_cert_to_store(WINECRYPT_CERTSTORE *store, const CERT_CONTEXT *cert, + DWORD add_disposition, BOOL use_link, PCCERT_CONTEXT *ret_context) +{ + const CERT_CONTEXT *existing = NULL; + BOOL ret = TRUE, inherit_props = FALSE; + context_t *new_context = NULL; + + switch (add_disposition) + { + case CERT_STORE_ADD_ALWAYS: + break; + case CERT_STORE_ADD_NEW: + case CERT_STORE_ADD_REPLACE_EXISTING: + case CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES: + case CERT_STORE_ADD_USE_EXISTING: + case CERT_STORE_ADD_NEWER: + case CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES: + { + BYTE hashToAdd[20]; + DWORD size = sizeof(hashToAdd); + + ret = CertGetCertificateContextProperty(cert, CERT_HASH_PROP_ID, + hashToAdd, &size); + if (ret) + { + CRYPT_HASH_BLOB blob = { sizeof(hashToAdd), hashToAdd }; + + existing = CertFindCertificateInStore(store, cert->dwCertEncodingType, 0, + CERT_FIND_SHA1_HASH, &blob, NULL); + } + break; + } + default: + FIXME("Unimplemented add disposition %d\n", add_disposition); + SetLastError(E_INVALIDARG); + return FALSE; + } + + switch (add_disposition) + { + case CERT_STORE_ADD_ALWAYS: + break; + case CERT_STORE_ADD_NEW: + if (existing) + { + TRACE("found matching certificate, not adding\n"); + SetLastError(CRYPT_E_EXISTS); + return FALSE; + } + break; + case CERT_STORE_ADD_REPLACE_EXISTING: + break; + case CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES: + if (use_link) + FIXME("CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES: semi-stub for links\n"); + if (existing) + inherit_props = TRUE; + break; + case CERT_STORE_ADD_USE_EXISTING: + if(use_link) + FIXME("CERT_STORE_ADD_USE_EXISTING: semi-stub for links\n"); + if (existing) + { + Context_CopyProperties(existing, cert); + if (ret_context) + *ret_context = CertDuplicateCertificateContext(existing); + return TRUE; + } + break; + case CERT_STORE_ADD_NEWER: + if (existing && CompareFileTime(&existing->pCertInfo->NotBefore, &cert->pCertInfo->NotBefore) >= 0) + { + TRACE("existing certificate is newer, not adding\n"); + SetLastError(CRYPT_E_EXISTS); + return FALSE; + } + break; + case CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES: + if (existing) + { + if (CompareFileTime(&existing->pCertInfo->NotBefore, &cert->pCertInfo->NotBefore) >= 0) + { + TRACE("existing certificate is newer, not adding\n"); + SetLastError(CRYPT_E_EXISTS); + return FALSE; + } + inherit_props = TRUE; + } + break; + } + + /* FIXME: We have tests that this works, but what should we really do in this case? */ + if(!store) { + if(ret_context) + *ret_context = CertDuplicateCertificateContext(cert); + return TRUE; + } + + ret = store->vtbl->certs.addContext(store, context_from_ptr(cert), existing ? context_from_ptr(existing) : NULL, + (ret_context || inherit_props) ? &new_context : NULL, use_link); + if(!ret) + return FALSE; + + if(inherit_props) + Context_CopyProperties(context_ptr(new_context), existing); + + if(ret_context) + *ret_context = context_ptr(new_context); + else if(new_context) + Context_Release(new_context); + + TRACE("returning %d\n", ret); + return ret; +} + +BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pCertContext, + DWORD dwAddDisposition, PCCERT_CONTEXT *ppStoreContext) +{ + WINECRYPT_CERTSTORE *store = hCertStore; + + TRACE("(%p, %p, %08x, %p)\n", hCertStore, pCertContext, dwAddDisposition, ppStoreContext); + + return add_cert_to_store(store, pCertContext, dwAddDisposition, FALSE, ppStoreContext); +} + BOOL WINAPI CertAddCertificateLinkToStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pCertContext, DWORD dwAddDisposition, PCCERT_CONTEXT *ppCertContext) { static int calls; - PWINECRYPT_CERTSTORE store = (PWINECRYPT_CERTSTORE)hCertStore; + WINECRYPT_CERTSTORE *store = (WINECRYPT_CERTSTORE*)hCertStore; if (!(calls++)) FIXME("(%p, %p, %08x, %p): semi-stub\n", hCertStore, pCertContext, @@ -117,14 +295,14 @@ BOOL WINAPI CertAddCertificateLinkToStore(HCERTSTORE hCertStore, SetLastError(E_INVALIDARG); return FALSE; } - return CertAddCertificateContextToStore(hCertStore, pCertContext, - dwAddDisposition, ppCertContext); + return add_cert_to_store(hCertStore, pCertContext, dwAddDisposition, TRUE, ppCertContext); } PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded) { - PCERT_CONTEXT cert = NULL; + cert_t *cert = NULL; + BYTE *data = NULL; BOOL ret; PCERT_INFO certInfo = NULL; DWORD size = 0; @@ -141,81 +319,65 @@ PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD dwCertEncodingType, ret = CryptDecodeObjectEx(dwCertEncodingType, X509_CERT_TO_BE_SIGNED, pbCertEncoded, cbCertEncoded, CRYPT_DECODE_ALLOC_FLAG, NULL, &certInfo, &size); - if (ret) - { - BYTE *data = NULL; + if (!ret) + return NULL; - cert = Context_CreateDataContext(sizeof(CERT_CONTEXT)); - if (!cert) - goto end; - data = CryptMemAlloc(cbCertEncoded); - if (!data) - { - CertFreeCertificateContext(cert); - cert = NULL; - goto end; - } - memcpy(data, pbCertEncoded, cbCertEncoded); - cert->dwCertEncodingType = dwCertEncodingType; - cert->pbCertEncoded = data; - cert->cbCertEncoded = cbCertEncoded; - cert->pCertInfo = certInfo; - cert->hCertStore = 0; + cert = (cert_t*)Context_CreateDataContext(sizeof(CERT_CONTEXT), &cert_vtbl, &empty_store); + if (!cert) + return NULL; + data = CryptMemAlloc(cbCertEncoded); + if (!data) + { + Context_Release(&cert->base); + return NULL; } -end: - return cert; + memcpy(data, pbCertEncoded, cbCertEncoded); + cert->ctx.dwCertEncodingType = dwCertEncodingType; + cert->ctx.pbCertEncoded = data; + cert->ctx.cbCertEncoded = cbCertEncoded; + cert->ctx.pCertInfo = certInfo; + cert->ctx.hCertStore = &empty_store; + + return &cert->ctx; } -PCCERT_CONTEXT WINAPI CertDuplicateCertificateContext( - PCCERT_CONTEXT pCertContext) +PCCERT_CONTEXT WINAPI CertDuplicateCertificateContext(PCCERT_CONTEXT pCertContext) { TRACE("(%p)\n", pCertContext); if (!pCertContext) return NULL; - Context_AddRef((void *)pCertContext, sizeof(CERT_CONTEXT)); + Context_AddRef(&cert_from_ptr(pCertContext)->base); return pCertContext; } -static void CertDataContext_Free(void *context) -{ - PCERT_CONTEXT certContext = context; - - CryptMemFree(certContext->pbCertEncoded); - LocalFree(certContext->pCertInfo); -} - BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext) { - BOOL ret = TRUE; - TRACE("(%p)\n", pCertContext); if (pCertContext) - ret = Context_Release((void *)pCertContext, sizeof(CERT_CONTEXT), - CertDataContext_Free); - return ret; + Context_Release(&cert_from_ptr(pCertContext)->base); + return TRUE; } DWORD WINAPI CertEnumCertificateContextProperties(PCCERT_CONTEXT pCertContext, DWORD dwPropId) { - PCONTEXT_PROPERTY_LIST properties = Context_GetProperties( - pCertContext, sizeof(CERT_CONTEXT)); + cert_t *cert = cert_from_ptr(pCertContext); DWORD ret; TRACE("(%p, %d)\n", pCertContext, dwPropId); - if (properties) - ret = ContextPropertyList_EnumPropIDs(properties, dwPropId); + if (cert->base.properties) + ret = ContextPropertyList_EnumPropIDs(cert->base.properties, dwPropId); else ret = 0; return ret; } -static BOOL CertContext_GetHashProp(void *context, DWORD dwPropId, +static BOOL CertContext_GetHashProp(cert_t *cert, DWORD dwPropId, ALG_ID algID, const BYTE *toHash, DWORD toHashLen, void *pvData, DWORD *pcbData) { @@ -225,7 +387,7 @@ static BOOL CertContext_GetHashProp(void *context, DWORD dwPropId, { CRYPT_DATA_BLOB blob = { *pcbData, pvData }; - ret = CertContext_SetProperty(context, dwPropId, 0, &blob); + ret = CertContext_SetProperty(cert, dwPropId, 0, &blob); } return ret; } @@ -251,19 +413,16 @@ static BOOL CertContext_CopyParam(void *pvData, DWORD *pcbData, const void *pb, return ret; } -static BOOL CertContext_GetProperty(void *context, DWORD dwPropId, +static BOOL CertContext_GetProperty(cert_t *cert, DWORD dwPropId, void *pvData, DWORD *pcbData) { - PCCERT_CONTEXT pCertContext = context; - PCONTEXT_PROPERTY_LIST properties = - Context_GetProperties(context, sizeof(CERT_CONTEXT)); BOOL ret; CRYPT_DATA_BLOB blob; - TRACE("(%p, %d, %p, %p)\n", context, dwPropId, pvData, pcbData); + TRACE("(%p, %d, %p, %p)\n", cert, dwPropId, pvData, pcbData); - if (properties) - ret = ContextPropertyList_FindProperty(properties, dwPropId, &blob); + if (cert->base.properties) + ret = ContextPropertyList_FindProperty(cert->base.properties, dwPropId, &blob); else ret = FALSE; if (ret) @@ -274,49 +433,49 @@ static BOOL CertContext_GetProperty(void *context, DWORD dwPropId, switch (dwPropId) { case CERT_SHA1_HASH_PROP_ID: - ret = CertContext_GetHashProp(context, dwPropId, CALG_SHA1, - pCertContext->pbCertEncoded, pCertContext->cbCertEncoded, pvData, + ret = CertContext_GetHashProp(cert, dwPropId, CALG_SHA1, + cert->ctx.pbCertEncoded, cert->ctx.cbCertEncoded, pvData, pcbData); break; case CERT_MD5_HASH_PROP_ID: - ret = CertContext_GetHashProp(context, dwPropId, CALG_MD5, - pCertContext->pbCertEncoded, pCertContext->cbCertEncoded, pvData, + ret = CertContext_GetHashProp(cert, dwPropId, CALG_MD5, + cert->ctx.pbCertEncoded, cert->ctx.cbCertEncoded, pvData, pcbData); break; case CERT_SUBJECT_NAME_MD5_HASH_PROP_ID: - ret = CertContext_GetHashProp(context, dwPropId, CALG_MD5, - pCertContext->pCertInfo->Subject.pbData, - pCertContext->pCertInfo->Subject.cbData, + ret = CertContext_GetHashProp(cert, dwPropId, CALG_MD5, + cert->ctx.pCertInfo->Subject.pbData, + cert->ctx.pCertInfo->Subject.cbData, pvData, pcbData); break; case CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID: - ret = CertContext_GetHashProp(context, dwPropId, CALG_MD5, - pCertContext->pCertInfo->SubjectPublicKeyInfo.PublicKey.pbData, - pCertContext->pCertInfo->SubjectPublicKeyInfo.PublicKey.cbData, + ret = CertContext_GetHashProp(cert, dwPropId, CALG_MD5, + cert->ctx.pCertInfo->SubjectPublicKeyInfo.PublicKey.pbData, + cert->ctx.pCertInfo->SubjectPublicKeyInfo.PublicKey.cbData, pvData, pcbData); break; case CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID: - ret = CertContext_GetHashProp(context, dwPropId, CALG_MD5, - pCertContext->pCertInfo->SerialNumber.pbData, - pCertContext->pCertInfo->SerialNumber.cbData, + ret = CertContext_GetHashProp(cert, dwPropId, CALG_MD5, + cert->ctx.pCertInfo->SerialNumber.pbData, + cert->ctx.pCertInfo->SerialNumber.cbData, pvData, pcbData); break; case CERT_SIGNATURE_HASH_PROP_ID: - ret = CryptHashToBeSigned(0, pCertContext->dwCertEncodingType, - pCertContext->pbCertEncoded, pCertContext->cbCertEncoded, pvData, + ret = CryptHashToBeSigned(0, cert->ctx.dwCertEncodingType, + cert->ctx.pbCertEncoded, cert->ctx.cbCertEncoded, pvData, pcbData); if (ret && pvData) { CRYPT_DATA_BLOB blob = { *pcbData, pvData }; - ret = CertContext_SetProperty(context, dwPropId, 0, &blob); + ret = CertContext_SetProperty(cert, dwPropId, 0, &blob); } break; case CERT_KEY_IDENTIFIER_PROP_ID: { PCERT_EXTENSION ext = CertFindExtension( - szOID_SUBJECT_KEY_IDENTIFIER, pCertContext->pCertInfo->cExtension, - pCertContext->pCertInfo->rgExtension); + szOID_SUBJECT_KEY_IDENTIFIER, cert->ctx.pCertInfo->cExtension, + cert->ctx.pCertInfo->rgExtension); if (ext) { @@ -331,7 +490,7 @@ static BOOL CertContext_GetProperty(void *context, DWORD dwPropId, { ret = CertContext_CopyParam(pvData, pcbData, value.pbData, value.cbData); - CertContext_SetProperty(context, dwPropId, 0, &value); + CertContext_SetProperty(cert, dwPropId, 0, &value); } } else @@ -372,6 +531,7 @@ void CRYPT_FixKeyProvInfoPointers(PCRYPT_KEY_PROV_INFO info) BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext, DWORD dwPropId, void *pvData, DWORD *pcbData) { + cert_t *cert = cert_from_ptr(pCertContext); BOOL ret; TRACE("(%p, %d, %p, %p)\n", pCertContext, dwPropId, pvData, pcbData); @@ -386,22 +546,14 @@ BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext, ret = FALSE; break; case CERT_ACCESS_STATE_PROP_ID: - if (pCertContext->hCertStore) - ret = CertGetStoreProperty(pCertContext->hCertStore, dwPropId, - pvData, pcbData); - else - { - DWORD state = 0; - - ret = CertContext_CopyParam(pvData, pcbData, &state, sizeof(state)); - } + ret = CertGetStoreProperty(cert->ctx.hCertStore, dwPropId, pvData, pcbData); break; case CERT_KEY_PROV_HANDLE_PROP_ID: { CERT_KEY_CONTEXT keyContext; DWORD size = sizeof(keyContext); - ret = CertContext_GetProperty((void *)pCertContext, + ret = CertContext_GetProperty(cert, CERT_KEY_CONTEXT_PROP_ID, &keyContext, &size); if (ret) ret = CertContext_CopyParam(pvData, pcbData, &keyContext.hCryptProv, @@ -409,13 +561,13 @@ BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext, break; } case CERT_KEY_PROV_INFO_PROP_ID: - ret = CertContext_GetProperty((void *)pCertContext, dwPropId, pvData, + ret = CertContext_GetProperty(cert, dwPropId, pvData, pcbData); if (ret && pvData) CRYPT_FixKeyProvInfoPointers(pvData); break; default: - ret = CertContext_GetProperty((void *)pCertContext, dwPropId, pvData, + ret = CertContext_GetProperty(cert, dwPropId, pvData, pcbData); } @@ -472,7 +624,7 @@ static void CRYPT_CopyKeyProvInfo(PCRYPT_KEY_PROV_INFO to, } } -static BOOL CertContext_SetKeyProvInfoProperty(PCONTEXT_PROPERTY_LIST properties, +static BOOL CertContext_SetKeyProvInfoProperty(CONTEXT_PROPERTY_LIST *properties, const CRYPT_KEY_PROV_INFO *info) { BOOL ret; @@ -503,16 +655,14 @@ static BOOL CertContext_SetKeyProvInfoProperty(PCONTEXT_PROPERTY_LIST properties return ret; } -static BOOL CertContext_SetProperty(void *context, DWORD dwPropId, +static BOOL CertContext_SetProperty(cert_t *cert, DWORD dwPropId, DWORD dwFlags, const void *pvData) { - PCONTEXT_PROPERTY_LIST properties = - Context_GetProperties(context, sizeof(CERT_CONTEXT)); BOOL ret; - TRACE("(%p, %d, %08x, %p)\n", context, dwPropId, dwFlags, pvData); + TRACE("(%p, %d, %08x, %p)\n", cert, dwPropId, dwFlags, pvData); - if (!properties) + if (!cert->base.properties) ret = FALSE; else { @@ -541,23 +691,23 @@ static BOOL CertContext_SetProperty(void *context, DWORD dwPropId, { const CRYPT_DATA_BLOB *blob = pvData; - ret = ContextPropertyList_SetProperty(properties, dwPropId, + ret = ContextPropertyList_SetProperty(cert->base.properties, dwPropId, blob->pbData, blob->cbData); } else { - ContextPropertyList_RemoveProperty(properties, dwPropId); + ContextPropertyList_RemoveProperty(cert->base.properties, dwPropId); ret = TRUE; } break; } case CERT_DATE_STAMP_PROP_ID: if (pvData) - ret = ContextPropertyList_SetProperty(properties, dwPropId, + ret = ContextPropertyList_SetProperty(cert->base.properties, dwPropId, pvData, sizeof(FILETIME)); else { - ContextPropertyList_RemoveProperty(properties, dwPropId); + ContextPropertyList_RemoveProperty(cert->base.properties, dwPropId); ret = TRUE; } break; @@ -573,22 +723,22 @@ static BOOL CertContext_SetProperty(void *context, DWORD dwPropId, ret = FALSE; } else - ret = ContextPropertyList_SetProperty(properties, dwPropId, + ret = ContextPropertyList_SetProperty(cert->base.properties, dwPropId, (const BYTE *)keyContext, keyContext->cbSize); } else { - ContextPropertyList_RemoveProperty(properties, dwPropId); + ContextPropertyList_RemoveProperty(cert->base.properties, dwPropId); ret = TRUE; } break; } case CERT_KEY_PROV_INFO_PROP_ID: if (pvData) - ret = CertContext_SetKeyProvInfoProperty(properties, pvData); + ret = CertContext_SetKeyProvInfoProperty(cert->base.properties, pvData); else { - ContextPropertyList_RemoveProperty(properties, dwPropId); + ContextPropertyList_RemoveProperty(cert->base.properties, dwPropId); ret = TRUE; } break; @@ -597,7 +747,7 @@ static BOOL CertContext_SetProperty(void *context, DWORD dwPropId, CERT_KEY_CONTEXT keyContext; DWORD size = sizeof(keyContext); - ret = CertContext_GetProperty(context, CERT_KEY_CONTEXT_PROP_ID, + ret = CertContext_GetProperty(cert, CERT_KEY_CONTEXT_PROP_ID, &keyContext, &size); if (ret) { @@ -612,7 +762,7 @@ static BOOL CertContext_SetProperty(void *context, DWORD dwPropId, keyContext.hCryptProv = 0; keyContext.dwKeySpec = AT_SIGNATURE; } - ret = CertContext_SetProperty(context, CERT_KEY_CONTEXT_PROP_ID, + ret = CertContext_SetProperty(cert, CERT_KEY_CONTEXT_PROP_ID, 0, &keyContext); break; } @@ -645,7 +795,7 @@ BOOL WINAPI CertSetCertificateContextProperty(PCCERT_CONTEXT pCertContext, SetLastError(E_INVALIDARG); return FALSE; } - ret = CertContext_SetProperty((void *)pCertContext, dwPropId, dwFlags, + ret = CertContext_SetProperty(cert_from_ptr(pCertContext), dwPropId, dwFlags, pvData); TRACE("returning %d\n", ret); return ret; @@ -1307,6 +1457,8 @@ static BOOL compare_cert_by_cert_id(PCCERT_CONTEXT pCertContext, DWORD dwType, ret = !memcmp(buf, id->u.KeyId.pbData, size); CryptMemFree(buf); } + else + ret = FALSE; } else ret = FALSE; @@ -1347,6 +1499,8 @@ static BOOL compare_cert_by_signature_hash(PCCERT_CONTEXT pCertContext, DWORD dw ret = !memcmp(buf, hash->pbData, size); CryptMemFree(buf); } + else + ret = FALSE; } else ret = FALSE; @@ -1730,7 +1884,7 @@ typedef struct _OLD_CERT_REVOCATION_STATUS { DWORD dwIndex; DWORD dwError; DWORD dwReason; -} OLD_CERT_REVOCATION_STATUS, *POLD_CERT_REVOCATION_STATUS; +} OLD_CERT_REVOCATION_STATUS; typedef BOOL (WINAPI *CertVerifyRevocationFunc)(DWORD, DWORD, DWORD, void **, DWORD, PCERT_REVOCATION_PARA, PCERT_REVOCATION_STATUS); @@ -2216,10 +2370,14 @@ BOOL WINAPI CryptSignAndEncodeCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCrypt } CryptMemFree(hash); } + else + ret = FALSE; } } CryptMemFree(encoded); } + else + ret = FALSE; } return ret; } diff --git a/dll/win32/crypt32/chain.c b/dll/win32/crypt32/chain.c index 0222b3492cf..0aa359fedbb 100644 --- a/dll/win32/crypt32/chain.c +++ b/dll/win32/crypt32/chain.c @@ -26,8 +26,6 @@ WINE_DECLARE_DEBUG_CHANNEL(chain); #define DEFAULT_CYCLE_MODULUS 7 -static HCERTCHAINENGINE CRYPT_defaultChainEngine; - /* This represents a subset of a certificate chain engine: it doesn't include * the "hOther" store described by MSDN, because I'm not sure how that's used. * It also doesn't include the "hTrust" store, because I don't yet implement @@ -42,7 +40,7 @@ typedef struct _CertificateChainEngine DWORD dwUrlRetrievalTimeout; DWORD MaximumCachedCertificates; DWORD CycleDetectionModulus; -} CertificateChainEngine, *PCertificateChainEngine; +} CertificateChainEngine; static inline void CRYPT_AddStoresToCollection(HCERTSTORE collection, DWORD cStores, HCERTSTORE *stores) @@ -107,45 +105,102 @@ static BOOL CRYPT_CheckRestrictedRoot(HCERTSTORE store) return ret; } -HCERTCHAINENGINE CRYPT_CreateChainEngine(HCERTSTORE root, - PCERT_CHAIN_ENGINE_CONFIG pConfig) +HCERTCHAINENGINE CRYPT_CreateChainEngine(HCERTSTORE root, DWORD system_store, const CERT_CHAIN_ENGINE_CONFIG *config) { + CertificateChainEngine *engine; + HCERTSTORE worldStores[4]; + static const WCHAR caW[] = { 'C','A',0 }; static const WCHAR myW[] = { 'M','y',0 }; static const WCHAR trustW[] = { 'T','r','u','s','t',0 }; - PCertificateChainEngine engine = - CryptMemAlloc(sizeof(CertificateChainEngine)); - if (engine) - { - HCERTSTORE worldStores[4]; - - engine->ref = 1; - engine->hRoot = root; - engine->hWorld = CertOpenStore(CERT_STORE_PROV_COLLECTION, 0, 0, - CERT_STORE_CREATE_NEW_FLAG, NULL); - worldStores[0] = CertDuplicateStore(engine->hRoot); - worldStores[1] = CertOpenSystemStoreW(0, caW); - worldStores[2] = CertOpenSystemStoreW(0, myW); - worldStores[3] = CertOpenSystemStoreW(0, trustW); - CRYPT_AddStoresToCollection(engine->hWorld, - sizeof(worldStores) / sizeof(worldStores[0]), worldStores); - CRYPT_AddStoresToCollection(engine->hWorld, - pConfig->cAdditionalStore, pConfig->rghAdditionalStore); - CRYPT_CloseStores(sizeof(worldStores) / sizeof(worldStores[0]), - worldStores); - engine->dwFlags = pConfig->dwFlags; - engine->dwUrlRetrievalTimeout = pConfig->dwUrlRetrievalTimeout; - engine->MaximumCachedCertificates = - pConfig->MaximumCachedCertificates; - if (pConfig->CycleDetectionModulus) - engine->CycleDetectionModulus = pConfig->CycleDetectionModulus; + if(!root) { + if(config->cbSize >= sizeof(CERT_CHAIN_ENGINE_CONFIG) && config->hExclusiveRoot) + root = CertDuplicateStore(config->hExclusiveRoot); + else if (config->hRestrictedRoot) + root = CertDuplicateStore(config->hRestrictedRoot); else - engine->CycleDetectionModulus = DEFAULT_CYCLE_MODULUS; + root = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, system_store, rootW); + if(!root) + return NULL; } + + engine = CryptMemAlloc(sizeof(CertificateChainEngine)); + if(!engine) { + CertCloseStore(root, 0); + return NULL; + } + + engine->ref = 1; + engine->hRoot = root; + engine->hWorld = CertOpenStore(CERT_STORE_PROV_COLLECTION, 0, 0, CERT_STORE_CREATE_NEW_FLAG, NULL); + worldStores[0] = CertDuplicateStore(engine->hRoot); + worldStores[1] = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, system_store, caW); + worldStores[2] = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, system_store, myW); + worldStores[3] = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, system_store, trustW); + + CRYPT_AddStoresToCollection(engine->hWorld, sizeof(worldStores) / sizeof(worldStores[0]), worldStores); + CRYPT_AddStoresToCollection(engine->hWorld, config->cAdditionalStore, config->rghAdditionalStore); + CRYPT_CloseStores(sizeof(worldStores) / sizeof(worldStores[0]), worldStores); + + engine->dwFlags = config->dwFlags; + engine->dwUrlRetrievalTimeout = config->dwUrlRetrievalTimeout; + engine->MaximumCachedCertificates = config->MaximumCachedCertificates; + if(config->CycleDetectionModulus) + engine->CycleDetectionModulus = config->CycleDetectionModulus; + else + engine->CycleDetectionModulus = DEFAULT_CYCLE_MODULUS; + return engine; } +static CertificateChainEngine *default_cu_engine, *default_lm_engine; + +static CertificateChainEngine *get_chain_engine(HCERTCHAINENGINE handle, BOOL allow_default) +{ + const CERT_CHAIN_ENGINE_CONFIG config = { sizeof(config) }; + + if(handle == HCCE_CURRENT_USER) { + if(!allow_default) + return NULL; + + if(!default_cu_engine) { + handle = CRYPT_CreateChainEngine(NULL, CERT_SYSTEM_STORE_CURRENT_USER, &config); + InterlockedCompareExchangePointer((void**)&default_cu_engine, handle, NULL); + if(default_cu_engine != handle) + CertFreeCertificateChainEngine(handle); + } + + return default_cu_engine; + } + + if(handle == HCCE_LOCAL_MACHINE) { + if(!allow_default) + return NULL; + + if(!default_lm_engine) { + handle = CRYPT_CreateChainEngine(NULL, CERT_SYSTEM_STORE_LOCAL_MACHINE, &config); + InterlockedCompareExchangePointer((void**)&default_lm_engine, handle, NULL); + if(default_lm_engine != handle) + CertFreeCertificateChainEngine(handle); + } + + return default_lm_engine; + } + + return (CertificateChainEngine*)handle; +} + +static void free_chain_engine(CertificateChainEngine *engine) +{ + if(!engine || InterlockedDecrement(&engine->ref)) + return; + + CertCloseStore(engine->hWorld, 0); + CertCloseStore(engine->hRoot, 0); + CryptMemFree(engine); +} + typedef struct _CERT_CHAIN_ENGINE_CONFIG_NO_EXCLUSIVE_ROOT { DWORD cbSize; @@ -173,66 +228,27 @@ BOOL WINAPI CertCreateCertificateChainEngine(PCERT_CHAIN_ENGINE_CONFIG pConfig, SetLastError(E_INVALIDARG); return FALSE; } - *phChainEngine = NULL; ret = CRYPT_CheckRestrictedRoot(pConfig->hRestrictedRoot); - if (ret) + if (!ret) { - HCERTSTORE root; - HCERTCHAINENGINE engine; - - if (pConfig->cbSize >= sizeof(CERT_CHAIN_ENGINE_CONFIG) && - pConfig->hExclusiveRoot) - root = CertDuplicateStore(pConfig->hExclusiveRoot); - else if (pConfig->hRestrictedRoot) - root = CertDuplicateStore(pConfig->hRestrictedRoot); - else - root = CertOpenSystemStoreW(0, rootW); - engine = CRYPT_CreateChainEngine(root, pConfig); - if (engine) - { - *phChainEngine = engine; - ret = TRUE; - } - else - ret = FALSE; + *phChainEngine = NULL; + return FALSE; } - return ret; + + *phChainEngine = CRYPT_CreateChainEngine(NULL, CERT_SYSTEM_STORE_CURRENT_USER, pConfig); + return *phChainEngine != NULL; } -VOID WINAPI CertFreeCertificateChainEngine(HCERTCHAINENGINE hChainEngine) +void WINAPI CertFreeCertificateChainEngine(HCERTCHAINENGINE hChainEngine) { - PCertificateChainEngine engine = (PCertificateChainEngine)hChainEngine; - TRACE("(%p)\n", hChainEngine); - - if (engine && InterlockedDecrement(&engine->ref) == 0) - { - CertCloseStore(engine->hWorld, 0); - CertCloseStore(engine->hRoot, 0); - CryptMemFree(engine); - } -} - -static HCERTCHAINENGINE CRYPT_GetDefaultChainEngine(void) -{ - if (!CRYPT_defaultChainEngine) - { - CERT_CHAIN_ENGINE_CONFIG config = { 0 }; - HCERTCHAINENGINE engine; - - config.cbSize = sizeof(config); - CertCreateCertificateChainEngine(&config, &engine); - InterlockedCompareExchangePointer(&CRYPT_defaultChainEngine, engine, - NULL); - if (CRYPT_defaultChainEngine != engine) - CertFreeCertificateChainEngine(engine); - } - return CRYPT_defaultChainEngine; + free_chain_engine(get_chain_engine(hChainEngine, FALSE)); } void default_chain_engine_free(void) { - CertFreeCertificateChainEngine(CRYPT_defaultChainEngine); + free_chain_engine(default_cu_engine); + free_chain_engine(default_lm_engine); } typedef struct _CertificateChain @@ -240,7 +256,7 @@ typedef struct _CertificateChain CERT_CHAIN_CONTEXT context; HCERTSTORE world; LONG ref; -} CertificateChain, *PCertificateChain; +} CertificateChain; static BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert) { @@ -299,6 +315,8 @@ static BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert) ret = !memcmp(buf, info->KeyId.pbData, size); CryptMemFree(buf); } + else + ret = FALSE; } else ret = FALSE; @@ -470,7 +488,7 @@ static void CRYPT_CheckTrustedStatus(HCERTSTORE hRoot, CertFreeCertificateContext(trustedRoot); } -static void CRYPT_CheckRootCert(HCERTCHAINENGINE hRoot, +static void CRYPT_CheckRootCert(HCERTSTORE hRoot, PCERT_CHAIN_ELEMENT rootElement) { PCCERT_CONTEXT root = rootElement->pCertContext; @@ -559,7 +577,7 @@ static BOOL CRYPT_DecodeBasicConstraints(PCCERT_CONTEXT cert, * Returns TRUE if the element can be a CA, and the length of the remaining * chain is valid. */ -static BOOL CRYPT_CheckBasicConstraintsForCA(PCertificateChainEngine engine, +static BOOL CRYPT_CheckBasicConstraintsForCA(CertificateChainEngine *engine, PCCERT_CONTEXT cert, CERT_BASIC_CONSTRAINTS2_INFO *chainConstraints, DWORD remainingCAs, BOOL isRoot, BOOL *pathLengthConstraintViolated) { @@ -1705,7 +1723,7 @@ static void dump_element(PCCERT_CONTEXT cert) dump_extension(&cert->pCertInfo->rgExtension[i]); } -static BOOL CRYPT_KeyUsageValid(PCertificateChainEngine engine, +static BOOL CRYPT_KeyUsageValid(CertificateChainEngine *engine, PCCERT_CONTEXT cert, BOOL isRoot, BOOL isCA, DWORD index) { PCERT_EXTENSION ext; @@ -1861,7 +1879,7 @@ static BOOL CRYPT_IsCertVersionValid(PCCERT_CONTEXT cert) return ret; } -static void CRYPT_CheckSimpleChain(PCertificateChainEngine engine, +static void CRYPT_CheckSimpleChain(CertificateChainEngine *engine, PCERT_SIMPLE_CHAIN chain, LPFILETIME time) { PCERT_CHAIN_ELEMENT rootElement = chain->rgpElement[chain->cElement - 1]; @@ -1964,8 +1982,83 @@ static void CRYPT_CheckSimpleChain(PCertificateChainEngine engine, CRYPT_CombineTrustStatus(&chain->TrustStatus, &rootElement->TrustStatus); } -static PCCERT_CONTEXT CRYPT_GetIssuer(HCERTSTORE store, PCCERT_CONTEXT subject, - PCCERT_CONTEXT prevIssuer, DWORD *infoStatus) +static PCCERT_CONTEXT CRYPT_FindIssuer(const CertificateChainEngine *engine, const CERT_CONTEXT *cert, + HCERTSTORE store, DWORD type, void *para, DWORD flags, PCCERT_CONTEXT prev_issuer) +{ + CRYPT_URL_ARRAY *urls; + PCCERT_CONTEXT issuer; + DWORD size; + BOOL res; + + issuer = CertFindCertificateInStore(store, cert->dwCertEncodingType, 0, type, para, prev_issuer); + if(issuer) { + TRACE("Found in store %p\n", issuer); + return issuer; + } + + /* FIXME: For alternate issuers, we don't search world store nor try to retrieve issuer from URL. + * This needs more tests. + */ + if(prev_issuer) + return NULL; + + if(engine->hWorld) { + issuer = CertFindCertificateInStore(engine->hWorld, cert->dwCertEncodingType, 0, type, para, NULL); + if(issuer) { + TRACE("Found in world %p\n", issuer); + return issuer; + } + } + + res = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, (void*)cert, 0, NULL, &size, NULL, NULL, NULL); + if(!res) + return NULL; + + urls = HeapAlloc(GetProcessHeap(), 0, size); + if(!urls) + return NULL; + + res = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, (void*)cert, 0, urls, &size, NULL, NULL, NULL); + if(res) + { + CERT_CONTEXT *new_cert; + HCERTSTORE new_store; + unsigned i; + + for(i=0; i < urls->cUrl; i++) + { + TRACE("Trying URL %s\n", debugstr_w(urls->rgwszUrl[i])); + + res = CryptRetrieveObjectByUrlW(urls->rgwszUrl[i], CONTEXT_OID_CERTIFICATE, + (flags & CERT_CHAIN_CACHE_ONLY_URL_RETRIEVAL) ? CRYPT_CACHE_ONLY_RETRIEVAL : CRYPT_AIA_RETRIEVAL, + 0, (void**)&new_cert, NULL, NULL, NULL, NULL); + if(!res) + { + TRACE("CryptRetrieveObjectByUrlW failed: %u\n", GetLastError()); + continue; + } + + /* FIXME: Use new_cert->hCertStore once cert ref count bug is fixed. */ + new_store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, CERT_STORE_CREATE_NEW_FLAG, NULL); + CertAddCertificateContextToStore(new_store, new_cert, CERT_STORE_ADD_NEW, NULL); + issuer = CertFindCertificateInStore(new_store, cert->dwCertEncodingType, 0, type, para, NULL); + CertFreeCertificateContext(new_cert); + CertCloseStore(new_store, 0); + if(issuer) + { + TRACE("Found downloaded issuer %p\n", issuer); + break; + } + } + } + + HeapFree(GetProcessHeap(), 0, urls); + return issuer; +} + +static PCCERT_CONTEXT CRYPT_GetIssuer(const CertificateChainEngine *engine, + HCERTSTORE store, PCCERT_CONTEXT subject, PCCERT_CONTEXT prevIssuer, + DWORD flags, DWORD *infoStatus) { PCCERT_CONTEXT issuer = NULL; PCERT_EXTENSION ext; @@ -1993,9 +2086,8 @@ static PCCERT_CONTEXT CRYPT_GetIssuer(HCERTSTORE store, PCCERT_CONTEXT subject, sizeof(CERT_NAME_BLOB)); memcpy(&id.u.IssuerSerialNumber.SerialNumber, &info->CertSerialNumber, sizeof(CRYPT_INTEGER_BLOB)); - issuer = CertFindCertificateInStore(store, - subject->dwCertEncodingType, 0, CERT_FIND_CERT_ID, &id, - prevIssuer); + + issuer = CRYPT_FindIssuer(engine, subject, store, CERT_FIND_CERT_ID, &id, flags, prevIssuer); if (issuer) { TRACE_(chain)("issuer found by issuer/serial number\n"); @@ -2005,10 +2097,9 @@ static PCCERT_CONTEXT CRYPT_GetIssuer(HCERTSTORE store, PCCERT_CONTEXT subject, else if (info->KeyId.cbData) { id.dwIdChoice = CERT_ID_KEY_IDENTIFIER; + memcpy(&id.u.KeyId, &info->KeyId, sizeof(CRYPT_HASH_BLOB)); - issuer = CertFindCertificateInStore(store, - subject->dwCertEncodingType, 0, CERT_FIND_CERT_ID, &id, - prevIssuer); + issuer = CRYPT_FindIssuer(engine, subject, store, CERT_FIND_CERT_ID, &id, flags, prevIssuer); if (issuer) { TRACE_(chain)("issuer found by key id\n"); @@ -2052,9 +2143,8 @@ static PCCERT_CONTEXT CRYPT_GetIssuer(HCERTSTORE store, PCCERT_CONTEXT subject, memcpy(&id.u.IssuerSerialNumber.SerialNumber, &info->AuthorityCertSerialNumber, sizeof(CRYPT_INTEGER_BLOB)); - issuer = CertFindCertificateInStore(store, - subject->dwCertEncodingType, 0, CERT_FIND_CERT_ID, &id, - prevIssuer); + + issuer = CRYPT_FindIssuer(engine, subject, store, CERT_FIND_CERT_ID, &id, flags, prevIssuer); if (issuer) { TRACE_(chain)("issuer found by directory name\n"); @@ -2068,9 +2158,7 @@ static PCCERT_CONTEXT CRYPT_GetIssuer(HCERTSTORE store, PCCERT_CONTEXT subject, { id.dwIdChoice = CERT_ID_KEY_IDENTIFIER; memcpy(&id.u.KeyId, &info->KeyId, sizeof(CRYPT_HASH_BLOB)); - issuer = CertFindCertificateInStore(store, - subject->dwCertEncodingType, 0, CERT_FIND_CERT_ID, &id, - prevIssuer); + issuer = CRYPT_FindIssuer(engine, subject, store, CERT_FIND_CERT_ID, &id, flags, prevIssuer); if (issuer) { TRACE_(chain)("issuer found by key id\n"); @@ -2082,9 +2170,8 @@ static PCCERT_CONTEXT CRYPT_GetIssuer(HCERTSTORE store, PCCERT_CONTEXT subject, } else { - issuer = CertFindCertificateInStore(store, - subject->dwCertEncodingType, 0, CERT_FIND_SUBJECT_NAME, - &subject->pCertInfo->Issuer, prevIssuer); + issuer = CRYPT_FindIssuer(engine, subject, store, CERT_FIND_SUBJECT_NAME, + &subject->pCertInfo->Issuer, flags, prevIssuer); TRACE_(chain)("issuer found by name\n"); *infoStatus = CERT_TRUST_HAS_NAME_MATCH_ISSUER; } @@ -2095,7 +2182,7 @@ static PCCERT_CONTEXT CRYPT_GetIssuer(HCERTSTORE store, PCCERT_CONTEXT subject, * until reaching a self-signed cert, or until no issuer can be found. */ static BOOL CRYPT_BuildSimpleChain(const CertificateChainEngine *engine, - HCERTSTORE world, PCERT_SIMPLE_CHAIN chain) + HCERTSTORE world, DWORD flags, PCERT_SIMPLE_CHAIN chain) { BOOL ret = TRUE; PCCERT_CONTEXT cert = chain->rgpElement[chain->cElement - 1]->pCertContext; @@ -2103,7 +2190,7 @@ static BOOL CRYPT_BuildSimpleChain(const CertificateChainEngine *engine, while (ret && !CRYPT_IsSimpleChainCyclic(chain) && !CRYPT_IsCertificateSelfSigned(cert)) { - PCCERT_CONTEXT issuer = CRYPT_GetIssuer(world, cert, NULL, + PCCERT_CONTEXT issuer = CRYPT_GetIssuer(engine, world, cert, NULL, flags, &chain->rgpElement[chain->cElement - 1]->TrustStatus.dwInfoStatus); if (issuer) @@ -2133,8 +2220,8 @@ static LPCSTR debugstr_filetime(LPFILETIME pTime) return wine_dbg_sprintf("%p (%s)", pTime, filetime_to_str(pTime)); } -static BOOL CRYPT_GetSimpleChainForCert(PCertificateChainEngine engine, - HCERTSTORE world, PCCERT_CONTEXT cert, LPFILETIME pTime, +static BOOL CRYPT_GetSimpleChainForCert(CertificateChainEngine *engine, + HCERTSTORE world, PCCERT_CONTEXT cert, LPFILETIME pTime, DWORD flags, PCERT_SIMPLE_CHAIN *ppChain) { BOOL ret = FALSE; @@ -2150,7 +2237,7 @@ static BOOL CRYPT_GetSimpleChainForCert(PCertificateChainEngine engine, ret = CRYPT_AddCertToSimpleChain(engine, chain, cert, 0); if (ret) { - ret = CRYPT_BuildSimpleChain(engine, world, chain); + ret = CRYPT_BuildSimpleChain(engine, world, flags, chain); if (ret) CRYPT_CheckSimpleChain(engine, chain, pTime); } @@ -2164,11 +2251,10 @@ static BOOL CRYPT_GetSimpleChainForCert(PCertificateChainEngine engine, return ret; } -static BOOL CRYPT_BuildCandidateChainFromCert(HCERTCHAINENGINE hChainEngine, - PCCERT_CONTEXT cert, LPFILETIME pTime, HCERTSTORE hAdditionalStore, - PCertificateChain *ppChain) +static BOOL CRYPT_BuildCandidateChainFromCert(CertificateChainEngine *engine, + PCCERT_CONTEXT cert, LPFILETIME pTime, HCERTSTORE hAdditionalStore, DWORD flags, + CertificateChain **ppChain) { - PCertificateChainEngine engine = (PCertificateChainEngine)hChainEngine; PCERT_SIMPLE_CHAIN simpleChain = NULL; HCERTSTORE world; BOOL ret; @@ -2181,10 +2267,9 @@ static BOOL CRYPT_BuildCandidateChainFromCert(HCERTCHAINENGINE hChainEngine, /* FIXME: only simple chains are supported for now, as CTLs aren't * supported yet. */ - if ((ret = CRYPT_GetSimpleChainForCert(engine, world, cert, pTime, - &simpleChain))) + if ((ret = CRYPT_GetSimpleChainForCert(engine, world, cert, pTime, flags, &simpleChain))) { - PCertificateChain chain = CryptMemAlloc(sizeof(CertificateChain)); + CertificateChain *chain = CryptMemAlloc(sizeof(CertificateChain)); if (chain) { @@ -2263,7 +2348,7 @@ static PCERT_SIMPLE_CHAIN CRYPT_CopySimpleChainToElement( return copy; } -static void CRYPT_FreeLowerQualityChains(PCertificateChain chain) +static void CRYPT_FreeLowerQualityChains(CertificateChain *chain) { DWORD i; @@ -2274,7 +2359,7 @@ static void CRYPT_FreeLowerQualityChains(PCertificateChain chain) chain->context.rgpLowerQualityChainContext = NULL; } -static void CRYPT_FreeChainContext(PCertificateChain chain) +static void CRYPT_FreeChainContext(CertificateChain *chain) { DWORD i; @@ -2289,10 +2374,10 @@ static void CRYPT_FreeChainContext(PCertificateChain chain) /* Makes and returns a copy of chain, up to and including element iElement of * simple chain iChain. */ -static PCertificateChain CRYPT_CopyChainToElement(PCertificateChain chain, +static CertificateChain *CRYPT_CopyChainToElement(CertificateChain *chain, DWORD iChain, DWORD iElement) { - PCertificateChain copy = CryptMemAlloc(sizeof(CertificateChain)); + CertificateChain *copy = CryptMemAlloc(sizeof(CertificateChain)); if (copy) { @@ -2354,21 +2439,20 @@ static PCertificateChain CRYPT_CopyChainToElement(PCertificateChain chain, return copy; } -static PCertificateChain CRYPT_BuildAlternateContextFromChain( - HCERTCHAINENGINE hChainEngine, LPFILETIME pTime, HCERTSTORE hAdditionalStore, - PCertificateChain chain) +static CertificateChain *CRYPT_BuildAlternateContextFromChain( + CertificateChainEngine *engine, LPFILETIME pTime, HCERTSTORE hAdditionalStore, + DWORD flags, CertificateChain *chain) { - PCertificateChainEngine engine = (PCertificateChainEngine)hChainEngine; - PCertificateChain alternate; + CertificateChain *alternate; - TRACE("(%p, %s, %p, %p)\n", hChainEngine, debugstr_filetime(pTime), + TRACE("(%p, %s, %p, %p)\n", engine, debugstr_filetime(pTime), hAdditionalStore, chain); /* Always start with the last "lower quality" chain to ensure a consistent * order of alternate creation: */ if (chain->context.cLowerQualityChainContext) - chain = (PCertificateChain)chain->context.rgpLowerQualityChainContext[ + chain = (CertificateChain*)chain->context.rgpLowerQualityChainContext[ chain->context.cLowerQualityChainContext - 1]; /* A chain with only one element can't have any alternates */ if (chain->context.cChain <= 1 && chain->context.rgpChain[0]->cElement <= 1) @@ -2388,8 +2472,8 @@ static PCertificateChain CRYPT_BuildAlternateContextFromChain( PCCERT_CONTEXT prevIssuer = CertDuplicateCertificateContext( chain->context.rgpChain[i]->rgpElement[j + 1]->pCertContext); - alternateIssuer = CRYPT_GetIssuer(prevIssuer->hCertStore, - subject, prevIssuer, &infoStatus); + alternateIssuer = CRYPT_GetIssuer(engine, prevIssuer->hCertStore, + subject, prevIssuer, flags, &infoStatus); } if (alternateIssuer) { @@ -2408,7 +2492,7 @@ static PCertificateChain CRYPT_BuildAlternateContextFromChain( if (ret) { ret = CRYPT_BuildSimpleChain(engine, alternate->world, - alternate->context.rgpChain[i]); + flags, alternate->context.rgpChain[i]); if (ret) CRYPT_CheckSimpleChain(engine, alternate->context.rgpChain[i], pTime); @@ -2467,8 +2551,8 @@ static DWORD CRYPT_ChainQuality(const CertificateChain *chain) * alternate chains. Returns the highest quality chain, with all other * chains as lower quality chains of it. */ -static PCertificateChain CRYPT_ChooseHighestQualityChain( - PCertificateChain chain) +static CertificateChain *CRYPT_ChooseHighestQualityChain( + CertificateChain *chain) { DWORD i; @@ -2480,8 +2564,8 @@ static PCertificateChain CRYPT_ChooseHighestQualityChain( */ for (i = 0; i < chain->context.cLowerQualityChainContext; i++) { - PCertificateChain alternate = - (PCertificateChain)chain->context.rgpLowerQualityChainContext[i]; + CertificateChain *alternate = + (CertificateChain*)chain->context.rgpLowerQualityChainContext[i]; if (CRYPT_ChainQuality(alternate) > CRYPT_ChainQuality(chain)) { @@ -2499,7 +2583,7 @@ static PCertificateChain CRYPT_ChooseHighestQualityChain( return chain; } -static BOOL CRYPT_AddAlternateChainToChain(PCertificateChain chain, +static BOOL CRYPT_AddAlternateChainToChain(CertificateChain *chain, const CertificateChain *alternate) { BOOL ret; @@ -2543,7 +2627,7 @@ static PCERT_CHAIN_ELEMENT CRYPT_FindIthElementInChain( typedef struct _CERT_CHAIN_PARA_NO_EXTRA_FIELDS { DWORD cbSize; CERT_USAGE_MATCH RequestedUsage; -} CERT_CHAIN_PARA_NO_EXTRA_FIELDS, *PCERT_CHAIN_PARA_NO_EXTRA_FIELDS; +} CERT_CHAIN_PARA_NO_EXTRA_FIELDS; static void CRYPT_VerifyChainRevocation(PCERT_CHAIN_CONTEXT chain, LPFILETIME pTime, HCERTSTORE hAdditionalStore, @@ -2792,13 +2876,18 @@ BOOL WINAPI CertGetCertificateChain(HCERTCHAINENGINE hChainEngine, PCERT_CHAIN_PARA pChainPara, DWORD dwFlags, LPVOID pvReserved, PCCERT_CHAIN_CONTEXT* ppChainContext) { + CertificateChainEngine *engine; BOOL ret; - PCertificateChain chain = NULL; + CertificateChain *chain = NULL; TRACE("(%p, %p, %s, %p, %p, %08x, %p, %p)\n", hChainEngine, pCertContext, debugstr_filetime(pTime), hAdditionalStore, pChainPara, dwFlags, pvReserved, ppChainContext); + engine = get_chain_engine(hChainEngine, TRUE); + if (!engine) + return FALSE; + if (ppChainContext) *ppChainContext = NULL; if (!pChainPara) @@ -2812,21 +2901,19 @@ BOOL WINAPI CertGetCertificateChain(HCERTCHAINENGINE hChainEngine, return FALSE; } - if (!hChainEngine) - hChainEngine = CRYPT_GetDefaultChainEngine(); if (TRACE_ON(chain)) dump_chain_para(pChainPara); /* FIXME: what about HCCE_LOCAL_MACHINE? */ - ret = CRYPT_BuildCandidateChainFromCert(hChainEngine, pCertContext, pTime, - hAdditionalStore, &chain); + ret = CRYPT_BuildCandidateChainFromCert(engine, pCertContext, pTime, + hAdditionalStore, dwFlags, &chain); if (ret) { - PCertificateChain alternate = NULL; + CertificateChain *alternate = NULL; PCERT_CHAIN_CONTEXT pChain; do { - alternate = CRYPT_BuildAlternateContextFromChain(hChainEngine, - pTime, hAdditionalStore, chain); + alternate = CRYPT_BuildAlternateContextFromChain(engine, + pTime, hAdditionalStore, dwFlags, chain); /* Alternate contexts are added as "lower quality" contexts of * chain, to avoid loops in alternate chain creation. @@ -2856,7 +2943,7 @@ BOOL WINAPI CertGetCertificateChain(HCERTCHAINENGINE hChainEngine, PCCERT_CHAIN_CONTEXT WINAPI CertDuplicateCertificateChain( PCCERT_CHAIN_CONTEXT pChainContext) { - PCertificateChain chain = (PCertificateChain)pChainContext; + CertificateChain *chain = (CertificateChain*)pChainContext; TRACE("(%p)\n", pChainContext); @@ -2867,7 +2954,7 @@ PCCERT_CHAIN_CONTEXT WINAPI CertDuplicateCertificateChain( VOID WINAPI CertFreeCertificateChain(PCCERT_CHAIN_CONTEXT pChainContext) { - PCertificateChain chain = (PCertificateChain)pChainContext; + CertificateChain *chain = (CertificateChain*)pChainContext; TRACE("(%p)\n", pChainContext); diff --git a/dll/win32/crypt32/collectionstore.c b/dll/win32/crypt32/collectionstore.c index 192cab6b52e..366bdacc79e 100644 --- a/dll/win32/crypt32/collectionstore.c +++ b/dll/win32/crypt32/collectionstore.c @@ -22,92 +22,106 @@ WINE_DEFAULT_DEBUG_CHANNEL(crypt); typedef struct _WINE_STORE_LIST_ENTRY { - PWINECRYPT_CERTSTORE store; + WINECRYPT_CERTSTORE *store; DWORD dwUpdateFlags; DWORD dwPriority; struct list entry; -} WINE_STORE_LIST_ENTRY, *PWINE_STORE_LIST_ENTRY; +} WINE_STORE_LIST_ENTRY; typedef struct _WINE_COLLECTIONSTORE { WINECRYPT_CERTSTORE hdr; CRITICAL_SECTION cs; struct list stores; -} WINE_COLLECTIONSTORE, *PWINE_COLLECTIONSTORE; +} WINE_COLLECTIONSTORE; -static void WINAPI CRYPT_CollectionCloseStore(HCERTSTORE store, DWORD dwFlags) +static void Collection_addref(WINECRYPT_CERTSTORE *store) { - PWINE_COLLECTIONSTORE cs = store; - PWINE_STORE_LIST_ENTRY entry, next; + LONG ref = InterlockedIncrement(&store->ref); + TRACE("ref = %d\n", ref); +} - TRACE("(%p, %08x)\n", store, dwFlags); +static DWORD Collection_release(WINECRYPT_CERTSTORE *store, DWORD flags) +{ + WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store; + WINE_STORE_LIST_ENTRY *entry, *next; + LONG ref; - LIST_FOR_EACH_ENTRY_SAFE(entry, next, &cs->stores, WINE_STORE_LIST_ENTRY, - entry) + if(flags) + FIXME("Unimplemented flags %x\n", flags); + + ref = InterlockedDecrement(&cs->hdr.ref); + TRACE("(%p) ref=%d\n", store, ref); + if(ref) + return ERROR_SUCCESS; + + LIST_FOR_EACH_ENTRY_SAFE(entry, next, &cs->stores, WINE_STORE_LIST_ENTRY, entry) { TRACE("closing %p\n", entry); - CertCloseStore(entry->store, dwFlags); + entry->store->vtbl->release(entry->store, flags); CryptMemFree(entry); } cs->cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&cs->cs); CRYPT_FreeStore(store); + return ERROR_SUCCESS; } -static void *CRYPT_CollectionCreateContextFromChild(PWINE_COLLECTIONSTORE store, - PWINE_STORE_LIST_ENTRY storeEntry, void *child, size_t contextSize, - BOOL addRef) +static void Collection_releaseContext(WINECRYPT_CERTSTORE *store, context_t *context) { - void *ret = Context_CreateLinkContext(contextSize, child, - sizeof(PWINE_STORE_LIST_ENTRY), addRef); + /* We don't cache context links, so just free them. */ + Context_Free(context); +} - if (ret) - *(PWINE_STORE_LIST_ENTRY *)Context_GetExtra(ret, contextSize) - = storeEntry; +static context_t *CRYPT_CollectionCreateContextFromChild(WINE_COLLECTIONSTORE *store, + WINE_STORE_LIST_ENTRY *storeEntry, context_t *child) +{ + context_t *ret; + ret = child->vtbl->clone(child, &store->hdr, TRUE); + if (!ret) + return NULL; + + ret->u.ptr = storeEntry; return ret; } -static BOOL CRYPT_CollectionAddContext(PWINE_COLLECTIONSTORE store, - unsigned int contextFuncsOffset, void *context, void *toReplace, unsigned int contextSize, - void **pChildContext) +static BOOL CRYPT_CollectionAddContext(WINE_COLLECTIONSTORE *store, + unsigned int contextFuncsOffset, context_t *context, context_t *toReplace, + context_t **pChildContext) { BOOL ret; - void *childContext = NULL; - PWINE_STORE_LIST_ENTRY storeEntry = NULL; + context_t *childContext = NULL; + WINE_STORE_LIST_ENTRY *storeEntry = NULL; - TRACE("(%p, %d, %p, %p, %d)\n", store, contextFuncsOffset, context, - toReplace, contextSize); + TRACE("(%p, %d, %p, %p)\n", store, contextFuncsOffset, context, toReplace); ret = FALSE; if (toReplace) { - void *existingLinked = Context_GetLinkedContext(toReplace, contextSize); - PCONTEXT_FUNCS contextFuncs; + context_t *existingLinked = toReplace->linked; + CONTEXT_FUNCS *contextFuncs; - storeEntry = *(PWINE_STORE_LIST_ENTRY *)Context_GetExtra(toReplace, - contextSize); - contextFuncs = (PCONTEXT_FUNCS)((LPBYTE)storeEntry->store + + storeEntry = toReplace->u.ptr; + contextFuncs = (CONTEXT_FUNCS*)((LPBYTE)storeEntry->store->vtbl + contextFuncsOffset); ret = contextFuncs->addContext(storeEntry->store, context, - existingLinked, (const void **)&childContext); + existingLinked, &childContext, TRUE); } else { - PWINE_STORE_LIST_ENTRY entry, next; + WINE_STORE_LIST_ENTRY *entry, *next; EnterCriticalSection(&store->cs); - LIST_FOR_EACH_ENTRY_SAFE(entry, next, &store->stores, - WINE_STORE_LIST_ENTRY, entry) + LIST_FOR_EACH_ENTRY_SAFE(entry, next, &store->stores, WINE_STORE_LIST_ENTRY, entry) { if (entry->dwUpdateFlags & CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG) { - PCONTEXT_FUNCS contextFuncs = (PCONTEXT_FUNCS)( - (LPBYTE)entry->store + contextFuncsOffset); + CONTEXT_FUNCS *contextFuncs = (CONTEXT_FUNCS*)( + (LPBYTE)entry->store->vtbl + contextFuncsOffset); storeEntry = entry; - ret = contextFuncs->addContext(entry->store, context, NULL, - (const void **)&childContext); + ret = contextFuncs->addContext(entry->store, context, NULL, &childContext, TRUE); break; } } @@ -128,31 +142,34 @@ static BOOL CRYPT_CollectionAddContext(PWINE_COLLECTIONSTORE store, * Returns NULL if the collection contains no more items or on error. * Assumes the collection store's lock is held. */ -static void *CRYPT_CollectionAdvanceEnum(PWINE_COLLECTIONSTORE store, - PWINE_STORE_LIST_ENTRY storeEntry, const CONTEXT_FUNCS *contextFuncs, - PCWINE_CONTEXT_INTERFACE contextInterface, void *pPrev, size_t contextSize) +static context_t *CRYPT_CollectionAdvanceEnum(WINE_COLLECTIONSTORE *store, + WINE_STORE_LIST_ENTRY *storeEntry, const CONTEXT_FUNCS *contextFuncs, + context_t *prev) { - void *ret, *child; + context_t *child, *ret; struct list *storeNext = list_next(&store->stores, &storeEntry->entry); - TRACE("(%p, %p, %p)\n", store, storeEntry, pPrev); + TRACE("(%p, %p, %p)\n", store, storeEntry, prev); - if (pPrev) + if (prev) { /* Ref-counting funny business: "duplicate" (addref) the child, because * the free(pPrev) below can cause the ref count to become negative. */ - child = Context_GetLinkedContext(pPrev, contextSize); - contextInterface->duplicate(child); + child = prev->linked; + Context_AddRef(child); child = contextFuncs->enumContext(storeEntry->store, child); - contextInterface->free(pPrev); - pPrev = NULL; + Context_Release(prev); + prev = NULL; } else + { child = contextFuncs->enumContext(storeEntry->store, NULL); - if (child) - ret = CRYPT_CollectionCreateContextFromChild(store, storeEntry, child, - contextSize, FALSE); + } + if (child) { + ret = CRYPT_CollectionCreateContextFromChild(store, storeEntry, child); + Context_Release(child); + } else { if (storeNext) @@ -160,14 +177,14 @@ static void *CRYPT_CollectionAdvanceEnum(PWINE_COLLECTIONSTORE store, /* We always want the same function pointers (from certs, crls) * in the next store, so use the same offset into the next store. */ - size_t offset = (const BYTE *)contextFuncs - (LPBYTE)storeEntry->store; - PWINE_STORE_LIST_ENTRY storeNextEntry = + size_t offset = (const BYTE *)contextFuncs - (LPBYTE)storeEntry->store->vtbl; + WINE_STORE_LIST_ENTRY *storeNextEntry = LIST_ENTRY(storeNext, WINE_STORE_LIST_ENTRY, entry); - PCONTEXT_FUNCS storeNextContexts = - (PCONTEXT_FUNCS)((LPBYTE)storeNextEntry->store + offset); + CONTEXT_FUNCS *storeNextContexts = + (CONTEXT_FUNCS*)((LPBYTE)storeNextEntry->store->vtbl + offset); ret = CRYPT_CollectionAdvanceEnum(store, storeNextEntry, - storeNextContexts, contextInterface, NULL, contextSize); + storeNextContexts, NULL); } else { @@ -179,59 +196,52 @@ static void *CRYPT_CollectionAdvanceEnum(PWINE_COLLECTIONSTORE store, return ret; } -static BOOL CRYPT_CollectionAddCert(PWINECRYPT_CERTSTORE store, void *cert, - void *toReplace, const void **ppStoreContext) +static BOOL Collection_addCert(WINECRYPT_CERTSTORE *store, context_t *cert, + context_t *toReplace, context_t **ppStoreContext, BOOL use_link) { BOOL ret; - void *childContext = NULL; - PWINE_COLLECTIONSTORE cs = (PWINE_COLLECTIONSTORE)store; + context_t *childContext = NULL; + WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store; - ret = CRYPT_CollectionAddContext(cs, offsetof(WINECRYPT_CERTSTORE, certs), - cert, toReplace, sizeof(CERT_CONTEXT), &childContext); + ret = CRYPT_CollectionAddContext(cs, offsetof(store_vtbl_t, certs), + cert, toReplace, &childContext); if (ppStoreContext && childContext) { - PWINE_STORE_LIST_ENTRY storeEntry = *(PWINE_STORE_LIST_ENTRY *) - Context_GetExtra(childContext, sizeof(CERT_CONTEXT)); - PCERT_CONTEXT context = - CRYPT_CollectionCreateContextFromChild(cs, storeEntry, childContext, - sizeof(CERT_CONTEXT), TRUE); + WINE_STORE_LIST_ENTRY *storeEntry = childContext->u.ptr; + cert_t *context = (cert_t*)CRYPT_CollectionCreateContextFromChild(cs, storeEntry, + childContext); - if (context) - context->hCertStore = store; - *ppStoreContext = context; + *ppStoreContext = &context->base; } - CertFreeCertificateContext(childContext); + if (childContext) + Context_Release(childContext); return ret; } -static void *CRYPT_CollectionEnumCert(PWINECRYPT_CERTSTORE store, void *pPrev) +static context_t *Collection_enumCert(WINECRYPT_CERTSTORE *store, context_t *prev) { - PWINE_COLLECTIONSTORE cs = (PWINE_COLLECTIONSTORE)store; - void *ret; + WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store; + context_t *ret; - TRACE("(%p, %p)\n", store, pPrev); + TRACE("(%p, %p)\n", store, prev); EnterCriticalSection(&cs->cs); - if (pPrev) + if (prev) { - PWINE_STORE_LIST_ENTRY storeEntry = - *(PWINE_STORE_LIST_ENTRY *)Context_GetExtra(pPrev, - sizeof(CERT_CONTEXT)); + WINE_STORE_LIST_ENTRY *storeEntry = prev->u.ptr; ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry, - &storeEntry->store->certs, pCertInterface, pPrev, - sizeof(CERT_CONTEXT)); + &storeEntry->store->vtbl->certs, prev); } else { if (!list_empty(&cs->stores)) { - PWINE_STORE_LIST_ENTRY storeEntry = LIST_ENTRY(cs->stores.next, + WINE_STORE_LIST_ENTRY *storeEntry = LIST_ENTRY(cs->stores.next, WINE_STORE_LIST_ENTRY, entry); ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry, - &storeEntry->store->certs, pCertInterface, NULL, - sizeof(CERT_CONTEXT)); + &storeEntry->store->vtbl->certs, NULL); } else { @@ -240,84 +250,67 @@ static void *CRYPT_CollectionEnumCert(PWINECRYPT_CERTSTORE store, void *pPrev) } } LeaveCriticalSection(&cs->cs); - if (ret) - ((PCERT_CONTEXT)ret)->hCertStore = store; TRACE("returning %p\n", ret); return ret; } -static BOOL CRYPT_CollectionDeleteCert(PWINECRYPT_CERTSTORE store, - void *pCertContext) +static BOOL Collection_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context) { - BOOL ret; - PCCERT_CONTEXT linked; + cert_t *cert = (cert_t*)context; + cert_t *linked; - TRACE("(%p, %p)\n", store, pCertContext); + TRACE("(%p, %p)\n", store, cert); - /* Deleting the linked context results in its ref count getting - * decreased, but the caller of this (CertDeleteCertificateFromStore) also - * decreases pCertContext's ref count, by calling - * CertFreeCertificateContext. Increase ref count of linked context to - * compensate. - */ - linked = Context_GetLinkedContext(pCertContext, sizeof(CERT_CONTEXT)); - CertDuplicateCertificateContext(linked); - ret = CertDeleteCertificateFromStore(linked); - return ret; + linked = (cert_t*)context->linked; + return CertDeleteCertificateFromStore(&linked->ctx); } -static BOOL CRYPT_CollectionAddCRL(PWINECRYPT_CERTSTORE store, void *crl, - void *toReplace, const void **ppStoreContext) +static BOOL Collection_addCRL(WINECRYPT_CERTSTORE *store, context_t *crl, + context_t *toReplace, context_t **ppStoreContext, BOOL use_link) { BOOL ret; - void *childContext = NULL; - PWINE_COLLECTIONSTORE cs = (PWINE_COLLECTIONSTORE)store; + context_t *childContext = NULL; + WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store; - ret = CRYPT_CollectionAddContext(cs, offsetof(WINECRYPT_CERTSTORE, crls), - crl, toReplace, sizeof(CRL_CONTEXT), &childContext); + ret = CRYPT_CollectionAddContext(cs, offsetof(store_vtbl_t, crls), + crl, toReplace, &childContext); if (ppStoreContext && childContext) { - PWINE_STORE_LIST_ENTRY storeEntry = *(PWINE_STORE_LIST_ENTRY *) - Context_GetExtra(childContext, sizeof(CRL_CONTEXT)); - PCRL_CONTEXT context = - CRYPT_CollectionCreateContextFromChild(cs, storeEntry, childContext, - sizeof(CRL_CONTEXT), TRUE); + WINE_STORE_LIST_ENTRY *storeEntry = childContext->u.ptr; + crl_t *context = (crl_t*)CRYPT_CollectionCreateContextFromChild(cs, storeEntry, + childContext); - if (context) - context->hCertStore = store; - *ppStoreContext = context; + *ppStoreContext = &context->base; } - CertFreeCRLContext(childContext); + if (childContext) + Context_Release(childContext); return ret; } -static void *CRYPT_CollectionEnumCRL(PWINECRYPT_CERTSTORE store, void *pPrev) +static context_t *Collection_enumCRL(WINECRYPT_CERTSTORE *store, context_t *prev) { - PWINE_COLLECTIONSTORE cs = (PWINE_COLLECTIONSTORE)store; - void *ret; + WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store; + context_t *ret; - TRACE("(%p, %p)\n", store, pPrev); + TRACE("(%p, %p)\n", store, prev); EnterCriticalSection(&cs->cs); - if (pPrev) + if (prev) { - PWINE_STORE_LIST_ENTRY storeEntry = - *(PWINE_STORE_LIST_ENTRY *)Context_GetExtra(pPrev, - sizeof(CRL_CONTEXT)); + WINE_STORE_LIST_ENTRY *storeEntry = prev->u.ptr; ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry, - &storeEntry->store->crls, pCRLInterface, pPrev, sizeof(CRL_CONTEXT)); + &storeEntry->store->vtbl->crls, prev); } else { if (!list_empty(&cs->stores)) { - PWINE_STORE_LIST_ENTRY storeEntry = LIST_ENTRY(cs->stores.next, + WINE_STORE_LIST_ENTRY *storeEntry = LIST_ENTRY(cs->stores.next, WINE_STORE_LIST_ENTRY, entry); ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry, - &storeEntry->store->crls, pCRLInterface, NULL, - sizeof(CRL_CONTEXT)); + &storeEntry->store->vtbl->crls, NULL); } else { @@ -326,83 +319,66 @@ static void *CRYPT_CollectionEnumCRL(PWINECRYPT_CERTSTORE store, void *pPrev) } } LeaveCriticalSection(&cs->cs); - if (ret) - ((PCRL_CONTEXT)ret)->hCertStore = store; TRACE("returning %p\n", ret); return ret; } -static BOOL CRYPT_CollectionDeleteCRL(PWINECRYPT_CERTSTORE store, - void *pCrlContext) +static BOOL Collection_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *context) { - BOOL ret; - PCCRL_CONTEXT linked; + crl_t *crl = (crl_t*)context, *linked; - TRACE("(%p, %p)\n", store, pCrlContext); + TRACE("(%p, %p)\n", store, crl); - /* Deleting the linked context results in its ref count getting - * decreased, but the caller of this (CertDeleteCRLFromStore) also - * decreases pCrlContext's ref count, by calling CertFreeCRLContext. - * Increase ref count of linked context to compensate. - */ - linked = Context_GetLinkedContext(pCrlContext, sizeof(CRL_CONTEXT)); - CertDuplicateCRLContext(linked); - ret = CertDeleteCRLFromStore(linked); - return ret; + linked = (crl_t*)context->linked; + return CertDeleteCRLFromStore(&linked->ctx); } -static BOOL CRYPT_CollectionAddCTL(PWINECRYPT_CERTSTORE store, void *ctl, - void *toReplace, const void **ppStoreContext) +static BOOL Collection_addCTL(WINECRYPT_CERTSTORE *store, context_t *ctl, + context_t *toReplace, context_t **ppStoreContext, BOOL use_link) { BOOL ret; - void *childContext = NULL; - PWINE_COLLECTIONSTORE cs = (PWINE_COLLECTIONSTORE)store; + context_t *childContext = NULL; + WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store; - ret = CRYPT_CollectionAddContext(cs, offsetof(WINECRYPT_CERTSTORE, ctls), - ctl, toReplace, sizeof(CTL_CONTEXT), &childContext); + ret = CRYPT_CollectionAddContext(cs, offsetof(store_vtbl_t, ctls), + ctl, toReplace, &childContext); if (ppStoreContext && childContext) { - PWINE_STORE_LIST_ENTRY storeEntry = *(PWINE_STORE_LIST_ENTRY *) - Context_GetExtra(childContext, sizeof(CTL_CONTEXT)); - PCTL_CONTEXT context = - CRYPT_CollectionCreateContextFromChild(cs, storeEntry, childContext, - sizeof(CTL_CONTEXT), TRUE); + WINE_STORE_LIST_ENTRY *storeEntry = childContext->u.ptr; + ctl_t *context = (ctl_t*)CRYPT_CollectionCreateContextFromChild(cs, storeEntry, + childContext); - if (context) - context->hCertStore = store; - *ppStoreContext = context; + *ppStoreContext = &context->base; } - CertFreeCTLContext(childContext); + if (childContext) + Context_Release(childContext); return ret; } -static void *CRYPT_CollectionEnumCTL(PWINECRYPT_CERTSTORE store, void *pPrev) +static context_t *Collection_enumCTL(WINECRYPT_CERTSTORE *store, context_t *prev) { - PWINE_COLLECTIONSTORE cs = (PWINE_COLLECTIONSTORE)store; + WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store; void *ret; - TRACE("(%p, %p)\n", store, pPrev); + TRACE("(%p, %p)\n", store, prev); EnterCriticalSection(&cs->cs); - if (pPrev) + if (prev) { - PWINE_STORE_LIST_ENTRY storeEntry = - *(PWINE_STORE_LIST_ENTRY *)Context_GetExtra(pPrev, - sizeof(CTL_CONTEXT)); + WINE_STORE_LIST_ENTRY *storeEntry = prev->u.ptr; ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry, - &storeEntry->store->ctls, pCTLInterface, pPrev, sizeof(CTL_CONTEXT)); + &storeEntry->store->vtbl->ctls, prev); } else { if (!list_empty(&cs->stores)) { - PWINE_STORE_LIST_ENTRY storeEntry = LIST_ENTRY(cs->stores.next, + WINE_STORE_LIST_ENTRY *storeEntry = LIST_ENTRY(cs->stores.next, WINE_STORE_LIST_ENTRY, entry); ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry, - &storeEntry->store->ctls, pCTLInterface, NULL, - sizeof(CTL_CONTEXT)); + &storeEntry->store->vtbl->ctls, NULL); } else { @@ -411,40 +387,28 @@ static void *CRYPT_CollectionEnumCTL(PWINECRYPT_CERTSTORE store, void *pPrev) } } LeaveCriticalSection(&cs->cs); - if (ret) - ((PCTL_CONTEXT)ret)->hCertStore = store; TRACE("returning %p\n", ret); return ret; } -static BOOL CRYPT_CollectionDeleteCTL(PWINECRYPT_CERTSTORE store, - void *pCtlContext) +static BOOL Collection_deleteCTL(WINECRYPT_CERTSTORE *store, context_t *context) { - BOOL ret; - PCCTL_CONTEXT linked; + ctl_t *ctl = (ctl_t*)context, *linked; - TRACE("(%p, %p)\n", store, pCtlContext); + TRACE("(%p, %p)\n", store, ctl); - /* Deleting the linked context results in its ref count getting - * decreased, but the caller of this (CertDeleteCTLFromStore) also - * decreases pCtlContext's ref count, by calling CertFreeCTLContext. - * Increase ref count of linked context to compensate. - */ - linked = Context_GetLinkedContext(pCtlContext, sizeof(CTL_CONTEXT)); - CertDuplicateCTLContext(linked); - ret = CertDeleteCTLFromStore(linked); - return ret; + linked = (ctl_t*)context->linked; + return CertDeleteCTLFromStore(&linked->ctx); } -static BOOL WINAPI CRYPT_CollectionControl(HCERTSTORE hCertStore, DWORD dwFlags, +static BOOL Collection_control(WINECRYPT_CERTSTORE *cert_store, DWORD dwFlags, DWORD dwCtrlType, void const *pvCtrlPara) { BOOL ret; - PWINE_COLLECTIONSTORE store = hCertStore; - PWINE_STORE_LIST_ENTRY entry; + WINE_COLLECTIONSTORE *store = (WINE_COLLECTIONSTORE*)cert_store; + WINE_STORE_LIST_ENTRY *entry; - TRACE("(%p, %08x, %d, %p)\n", hCertStore, dwFlags, dwCtrlType, - pvCtrlPara); + TRACE("(%p, %08x, %d, %p)\n", cert_store, dwFlags, dwCtrlType, pvCtrlPara); if (!store) return TRUE; @@ -463,10 +427,9 @@ static BOOL WINAPI CRYPT_CollectionControl(HCERTSTORE hCertStore, DWORD dwFlags, EnterCriticalSection(&store->cs); LIST_FOR_EACH_ENTRY(entry, &store->stores, WINE_STORE_LIST_ENTRY, entry) { - if (entry->store->control) + if (entry->store->vtbl->control) { - ret = entry->store->control(entry->store, dwFlags, dwCtrlType, - pvCtrlPara); + ret = entry->store->vtbl->control(entry->store, dwFlags, dwCtrlType, pvCtrlPara); if (!ret) break; } @@ -475,10 +438,30 @@ static BOOL WINAPI CRYPT_CollectionControl(HCERTSTORE hCertStore, DWORD dwFlags, return ret; } -PWINECRYPT_CERTSTORE CRYPT_CollectionOpenStore(HCRYPTPROV hCryptProv, +static const store_vtbl_t CollectionStoreVtbl = { + Collection_addref, + Collection_release, + Collection_releaseContext, + Collection_control, + { + Collection_addCert, + Collection_enumCert, + Collection_deleteCert + }, { + Collection_addCRL, + Collection_enumCRL, + Collection_deleteCRL + }, { + Collection_addCTL, + Collection_enumCTL, + Collection_deleteCTL + } +}; + +WINECRYPT_CERTSTORE *CRYPT_CollectionOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) { - PWINE_COLLECTIONSTORE store; + WINE_COLLECTIONSTORE *store; if (dwFlags & CERT_STORE_DELETE_FLAG) { @@ -491,32 +474,21 @@ PWINECRYPT_CERTSTORE CRYPT_CollectionOpenStore(HCRYPTPROV hCryptProv, if (store) { memset(store, 0, sizeof(WINE_COLLECTIONSTORE)); - CRYPT_InitStore(&store->hdr, dwFlags, StoreTypeCollection); - store->hdr.closeStore = CRYPT_CollectionCloseStore; - store->hdr.certs.addContext = CRYPT_CollectionAddCert; - store->hdr.certs.enumContext = CRYPT_CollectionEnumCert; - store->hdr.certs.deleteContext = CRYPT_CollectionDeleteCert; - store->hdr.crls.addContext = CRYPT_CollectionAddCRL; - store->hdr.crls.enumContext = CRYPT_CollectionEnumCRL; - store->hdr.crls.deleteContext = CRYPT_CollectionDeleteCRL; - store->hdr.ctls.addContext = CRYPT_CollectionAddCTL; - store->hdr.ctls.enumContext = CRYPT_CollectionEnumCTL; - store->hdr.ctls.deleteContext = CRYPT_CollectionDeleteCTL; - store->hdr.control = CRYPT_CollectionControl; + CRYPT_InitStore(&store->hdr, dwFlags, StoreTypeCollection, &CollectionStoreVtbl); InitializeCriticalSection(&store->cs); store->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": PWINE_COLLECTIONSTORE->cs"); list_init(&store->stores); } } - return (PWINECRYPT_CERTSTORE)store; + return (WINECRYPT_CERTSTORE*)store; } BOOL WINAPI CertAddStoreToCollection(HCERTSTORE hCollectionStore, HCERTSTORE hSiblingStore, DWORD dwUpdateFlags, DWORD dwPriority) { - PWINE_COLLECTIONSTORE collection = hCollectionStore; + WINE_COLLECTIONSTORE *collection = hCollectionStore; WINECRYPT_CERTSTORE *sibling = hSiblingStore; - PWINE_STORE_LIST_ENTRY entry; + WINE_STORE_LIST_ENTRY *entry; BOOL ret; TRACE("(%p, %p, %08x, %d)\n", hCollectionStore, hSiblingStore, @@ -553,7 +525,7 @@ BOOL WINAPI CertAddStoreToCollection(HCERTSTORE hCollectionStore, EnterCriticalSection(&collection->cs); if (dwPriority) { - PWINE_STORE_LIST_ENTRY cursor; + WINE_STORE_LIST_ENTRY *cursor; BOOL added = FALSE; LIST_FOR_EACH_ENTRY(cursor, &collection->stores, @@ -582,9 +554,9 @@ BOOL WINAPI CertAddStoreToCollection(HCERTSTORE hCollectionStore, void WINAPI CertRemoveStoreFromCollection(HCERTSTORE hCollectionStore, HCERTSTORE hSiblingStore) { - PWINE_COLLECTIONSTORE collection = hCollectionStore; + WINE_COLLECTIONSTORE *collection = hCollectionStore; WINECRYPT_CERTSTORE *sibling = hSiblingStore; - PWINE_STORE_LIST_ENTRY store, next; + WINE_STORE_LIST_ENTRY *store, *next; TRACE("(%p, %p)\n", hCollectionStore, hSiblingStore); diff --git a/dll/win32/crypt32/context.c b/dll/win32/crypt32/context.c index 2fe86421c8f..e0824f5a906 100644 --- a/dll/win32/crypt32/context.c +++ b/dll/win32/crypt32/context.c @@ -20,330 +20,107 @@ WINE_DEFAULT_DEBUG_CHANNEL(context); -typedef enum _ContextType { - ContextTypeData, - ContextTypeLink, -} ContextType; - -typedef struct _BASE_CONTEXT +context_t *Context_CreateDataContext(size_t contextSize, const context_vtbl_t *vtbl, WINECRYPT_CERTSTORE *store) { - LONG ref; - ContextType type; -} BASE_CONTEXT, *PBASE_CONTEXT; + context_t *context; -typedef struct _DATA_CONTEXT -{ - LONG ref; - ContextType type; /* always ContextTypeData */ - PCONTEXT_PROPERTY_LIST properties; -} DATA_CONTEXT, *PDATA_CONTEXT; + context = CryptMemAlloc(sizeof(context_t) + contextSize); + if (!context) + return NULL; -typedef struct _LINK_CONTEXT -{ - LONG ref; - ContextType type; /* always ContextTypeLink */ - PBASE_CONTEXT linked; -} LINK_CONTEXT, *PLINK_CONTEXT; - -#define CONTEXT_FROM_BASE_CONTEXT(p, s) ((LPBYTE)(p) - (s)) -#define BASE_CONTEXT_FROM_CONTEXT(p, s) (PBASE_CONTEXT)((LPBYTE)(p) + (s)) - -void *Context_CreateDataContext(size_t contextSize) -{ - void *ret = CryptMemAlloc(contextSize + sizeof(DATA_CONTEXT)); - - if (ret) + context->properties = ContextPropertyList_Create(); + if (!context->properties) { - PDATA_CONTEXT context = (PDATA_CONTEXT)((LPBYTE)ret + contextSize); - - context->ref = 1; - context->type = ContextTypeData; - context->properties = ContextPropertyList_Create(); - if (!context->properties) - { - CryptMemFree(ret); - ret = NULL; - } + CryptMemFree(context); + return NULL; } - TRACE("returning %p\n", ret); - return ret; -} -void *Context_CreateLinkContext(unsigned int contextSize, void *linked, unsigned int extra, - BOOL addRef) -{ - void *context = CryptMemAlloc(contextSize + sizeof(LINK_CONTEXT) + extra); + context->vtbl = vtbl; + context->ref = 1; + context->linked = NULL; - TRACE("(%d, %p, %d)\n", contextSize, linked, extra); + store->vtbl->addref(store); + context->store = store; - if (context) - { - PLINK_CONTEXT linkContext = (PLINK_CONTEXT)BASE_CONTEXT_FROM_CONTEXT( - context, contextSize); - PBASE_CONTEXT linkedBase = BASE_CONTEXT_FROM_CONTEXT(linked, - contextSize); - - memcpy(context, linked, contextSize); - linkContext->ref = 1; - linkContext->type = ContextTypeLink; - linkContext->linked = linkedBase; - if (addRef) - Context_AddRef(linked, contextSize); - TRACE("%p's ref count is %d\n", context, linkContext->ref); - } TRACE("returning %p\n", context); return context; } -void Context_AddRef(void *context, size_t contextSize) +context_t *Context_CreateLinkContext(unsigned int contextSize, context_t *linked, WINECRYPT_CERTSTORE *store) { - PBASE_CONTEXT baseContext = BASE_CONTEXT_FROM_CONTEXT(context, contextSize); + context_t *context; - InterlockedIncrement(&baseContext->ref); - TRACE("%p's ref count is %d\n", context, baseContext->ref); - if (baseContext->type == ContextTypeLink) - { - void *linkedContext = Context_GetLinkedContext(context, contextSize); - PBASE_CONTEXT linkedBase = BASE_CONTEXT_FROM_CONTEXT(linkedContext, - contextSize); + TRACE("(%d, %p)\n", contextSize, linked); - /* Add-ref the linked contexts too */ - while (linkedContext && linkedBase->type == ContextTypeLink) - { - InterlockedIncrement(&linkedBase->ref); - TRACE("%p's ref count is %d\n", linkedContext, linkedBase->ref); - linkedContext = Context_GetLinkedContext(linkedContext, - contextSize); - if (linkedContext) - linkedBase = BASE_CONTEXT_FROM_CONTEXT(linkedContext, - contextSize); - else - linkedBase = NULL; - } - if (linkedContext) - { - /* It's not a link context, so it wasn't add-ref'ed in the while - * loop, so add-ref it here. - */ - linkedBase = BASE_CONTEXT_FROM_CONTEXT(linkedContext, - contextSize); - InterlockedIncrement(&linkedBase->ref); - TRACE("%p's ref count is %d\n", linkedContext, linkedBase->ref); - } - } -} + context = CryptMemAlloc(sizeof(context_t) + contextSize); + if (!context) + return NULL; -void *Context_GetExtra(const void *context, size_t contextSize) -{ - PBASE_CONTEXT baseContext = BASE_CONTEXT_FROM_CONTEXT(context, contextSize); + memcpy(context_ptr(context), context_ptr(linked), contextSize); + context->vtbl = linked->vtbl; + context->ref = 1; + context->linked = linked; + context->properties = linked->properties; + Context_AddRef(linked); - assert(baseContext->type == ContextTypeLink); - return (LPBYTE)baseContext + sizeof(LINK_CONTEXT); -} + store->vtbl->addref(store); + context->store = store; -void *Context_GetLinkedContext(void *context, size_t contextSize) -{ - PBASE_CONTEXT baseContext = BASE_CONTEXT_FROM_CONTEXT(context, contextSize); - - assert(baseContext->type == ContextTypeLink); - return CONTEXT_FROM_BASE_CONTEXT(((PLINK_CONTEXT)baseContext)->linked, - contextSize); -} - -PCONTEXT_PROPERTY_LIST Context_GetProperties(const void *context, size_t contextSize) -{ - PBASE_CONTEXT ptr = BASE_CONTEXT_FROM_CONTEXT(context, contextSize); - - while (ptr && ptr->type == ContextTypeLink) - ptr = ((PLINK_CONTEXT)ptr)->linked; - return (ptr && ptr->type == ContextTypeData) ? - ((PDATA_CONTEXT)ptr)->properties : NULL; -} - -BOOL Context_Release(void *context, size_t contextSize, - ContextFreeFunc dataContextFree) -{ - PBASE_CONTEXT base = BASE_CONTEXT_FROM_CONTEXT(context, contextSize); - BOOL ret = TRUE; - - if (base->ref <= 0) - { - ERR("%p's ref count is %d\n", context, base->ref); - return FALSE; - } - if (base->type == ContextTypeLink) - { - /* The linked context is of the same type as this, so release - * it as well, using the same offset and data free function. - */ - ret = Context_Release(CONTEXT_FROM_BASE_CONTEXT( - ((PLINK_CONTEXT)base)->linked, contextSize), contextSize, - dataContextFree); - } - if (InterlockedDecrement(&base->ref) == 0) - { - TRACE("freeing %p\n", context); - if (base->type == ContextTypeData) - { - ContextPropertyList_Free(((PDATA_CONTEXT)base)->properties); - dataContextFree(context); - } - CryptMemFree(context); - } - else - TRACE("%p's ref count is %d\n", context, base->ref); - return ret; -} - -void Context_CopyProperties(const void *to, const void *from, - size_t contextSize) -{ - PCONTEXT_PROPERTY_LIST toProperties, fromProperties; - - toProperties = Context_GetProperties(to, contextSize); - fromProperties = Context_GetProperties(from, contextSize); - assert(toProperties && fromProperties); - ContextPropertyList_Copy(toProperties, fromProperties); -} - -struct ContextList -{ - PCWINE_CONTEXT_INTERFACE contextInterface; - size_t contextSize; - CRITICAL_SECTION cs; - struct list contexts; -}; - -struct ContextList *ContextList_Create( - PCWINE_CONTEXT_INTERFACE contextInterface, size_t contextSize) -{ - struct ContextList *list = CryptMemAlloc(sizeof(struct ContextList)); - - if (list) - { - list->contextInterface = contextInterface; - list->contextSize = contextSize; - InitializeCriticalSection(&list->cs); - list->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ContextList.cs"); - list_init(&list->contexts); - } - return list; -} - -static inline struct list *ContextList_ContextToEntry(const struct ContextList *list, - const void *context) -{ - struct list *ret; - - if (context) - ret = Context_GetExtra(context, list->contextSize); - else - ret = NULL; - return ret; -} - -static inline void *ContextList_EntryToContext(const struct ContextList *list, - struct list *entry) -{ - return (LPBYTE)entry - sizeof(LINK_CONTEXT) - list->contextSize; -} - -void *ContextList_Add(struct ContextList *list, void *toLink, void *toReplace) -{ - void *context; - - TRACE("(%p, %p, %p)\n", list, toLink, toReplace); - - context = Context_CreateLinkContext(list->contextSize, toLink, - sizeof(struct list), TRUE); - if (context) - { - struct list *entry = ContextList_ContextToEntry(list, context); - - TRACE("adding %p\n", context); - EnterCriticalSection(&list->cs); - if (toReplace) - { - struct list *existing = ContextList_ContextToEntry(list, toReplace); - - entry->prev = existing->prev; - entry->next = existing->next; - entry->prev->next = entry; - entry->next->prev = entry; - existing->prev = existing->next = existing; - list->contextInterface->free(toReplace); - } - else - list_add_head(&list->contexts, entry); - LeaveCriticalSection(&list->cs); - } + TRACE("returning %p\n", context); return context; } -void *ContextList_Enum(struct ContextList *list, void *pPrev) +void Context_AddRef(context_t *context) { - struct list *listNext; - void *ret; + LONG ref = InterlockedIncrement(&context->ref); - EnterCriticalSection(&list->cs); - if (pPrev) - { - struct list *prevEntry = ContextList_ContextToEntry(list, pPrev); + TRACE("(%p) ref=%d\n", context, context->ref); - listNext = list_next(&list->contexts, prevEntry); - list->contextInterface->free(pPrev); + if(ref == 1) { + /* This is the first external (non-store) reference. Increase store ref cnt. */ + context->store->vtbl->addref(context->store); } - else - listNext = list_next(&list->contexts, &list->contexts); - LeaveCriticalSection(&list->cs); - - if (listNext) - { - ret = ContextList_EntryToContext(list, listNext); - list->contextInterface->duplicate(ret); - } - else - ret = NULL; - return ret; } -BOOL ContextList_Remove(struct ContextList *list, void *context) +void Context_Free(context_t *context) { - struct list *entry = ContextList_ContextToEntry(list, context); - BOOL inList = FALSE; + TRACE("(%p)\n", context); - EnterCriticalSection(&list->cs); - if (!list_empty(entry)) - { - list_remove(entry); - inList = TRUE; + assert(!context->ref); + + if (!context->linked) { + ContextPropertyList_Free(context->properties); + context->vtbl->free(context); + }else { + Context_Release(context->linked); } - LeaveCriticalSection(&list->cs); - if (inList) - list_init(entry); - return inList; + + CryptMemFree(context); } -static void ContextList_Empty(struct ContextList *list) +void Context_Release(context_t *context) { - struct list *entry, *next; + LONG ref = InterlockedDecrement(&context->ref); - EnterCriticalSection(&list->cs); - LIST_FOR_EACH_SAFE(entry, next, &list->contexts) - { - const void *context = ContextList_EntryToContext(list, entry); + TRACE("(%p) ref=%d\n", context, ref); + assert(ref >= 0); - TRACE("removing %p\n", context); - list_remove(entry); - list->contextInterface->free(context); + if (!ref) { + WINECRYPT_CERTSTORE *store = context->store; + + /* This is the last reference, but the context still may be in a store. + * We release our store reference, but leave it up to store to free or keep the context. */ + store->vtbl->releaseContext(store, context); + store->vtbl->release(store, 0); } - LeaveCriticalSection(&list->cs); } -void ContextList_Free(struct ContextList *list) +void Context_CopyProperties(const void *to, const void *from) { - ContextList_Empty(list); - list->cs.DebugInfo->Spare[0] = 0; - DeleteCriticalSection(&list->cs); - CryptMemFree(list); + CONTEXT_PROPERTY_LIST *toProperties, *fromProperties; + + toProperties = context_from_ptr(to)->properties; + fromProperties = context_from_ptr(from)->properties; + assert(toProperties && fromProperties); + ContextPropertyList_Copy(toProperties, fromProperties); } diff --git a/dll/win32/crypt32/crl.c b/dll/win32/crypt32/crl.c index 643267287b2..ada6bea0af5 100644 --- a/dll/win32/crypt32/crl.c +++ b/dll/win32/crypt32/crl.c @@ -21,12 +21,66 @@ WINE_DEFAULT_DEBUG_CHANNEL(crypt); +static void CRL_free(context_t *context) +{ + crl_t *crl = (crl_t*)context; + + CryptMemFree(crl->ctx.pbCrlEncoded); + LocalFree(crl->ctx.pCrlInfo); +} + +static const context_vtbl_t crl_vtbl; + +static context_t *CRL_clone(context_t *context, WINECRYPT_CERTSTORE *store, BOOL use_link) +{ + crl_t *crl; + + if(use_link) { + crl = (crl_t*)Context_CreateLinkContext(sizeof(CRL_CONTEXT), context, store); + if(!crl) + return NULL; + }else { + const crl_t *cloned = (const crl_t*)context; + DWORD size = 0; + BOOL res; + + crl = (crl_t*)Context_CreateDataContext(sizeof(CRL_CONTEXT), &crl_vtbl, store); + if(!crl) + return NULL; + + Context_CopyProperties(&crl->ctx, &cloned->ctx); + + crl->ctx.dwCertEncodingType = cloned->ctx.dwCertEncodingType; + crl->ctx.pbCrlEncoded = CryptMemAlloc(cloned->ctx.cbCrlEncoded); + memcpy(crl->ctx.pbCrlEncoded, cloned->ctx.pbCrlEncoded, cloned->ctx.cbCrlEncoded); + crl->ctx.cbCrlEncoded = cloned->ctx.cbCrlEncoded; + + /* FIXME: We don't need to decode the object here, we could just clone crl info. */ + res = CryptDecodeObjectEx(crl->ctx.dwCertEncodingType, X509_CERT_CRL_TO_BE_SIGNED, + crl->ctx.pbCrlEncoded, crl->ctx.cbCrlEncoded, CRYPT_DECODE_ALLOC_FLAG, NULL, + &crl->ctx.pCrlInfo, &size); + if(!res) { + CertFreeCRLContext(&crl->ctx); + return NULL; + } + } + + crl->ctx.hCertStore = store; + return &crl->base; +} + +static const context_vtbl_t crl_vtbl = { + CRL_free, + CRL_clone +}; + PCCRL_CONTEXT WINAPI CertCreateCRLContext(DWORD dwCertEncodingType, const BYTE* pbCrlEncoded, DWORD cbCrlEncoded) { - PCRL_CONTEXT crl = NULL; + crl_t *crl = NULL; BOOL ret; PCRL_INFO crlInfo = NULL; + BYTE *data = NULL; DWORD size = 0; TRACE("(%08x, %p, %d)\n", dwCertEncodingType, pbCrlEncoded, @@ -40,30 +94,28 @@ PCCRL_CONTEXT WINAPI CertCreateCRLContext(DWORD dwCertEncodingType, ret = CryptDecodeObjectEx(dwCertEncodingType, X509_CERT_CRL_TO_BE_SIGNED, pbCrlEncoded, cbCrlEncoded, CRYPT_DECODE_ALLOC_FLAG, NULL, &crlInfo, &size); - if (ret) - { - BYTE *data = NULL; + if (!ret) + return NULL; - crl = Context_CreateDataContext(sizeof(CRL_CONTEXT)); - if (!crl) - goto end; - data = CryptMemAlloc(cbCrlEncoded); - if (!data) - { - CertFreeCRLContext(crl); - crl = NULL; - goto end; - } - memcpy(data, pbCrlEncoded, cbCrlEncoded); - crl->dwCertEncodingType = dwCertEncodingType; - crl->pbCrlEncoded = data; - crl->cbCrlEncoded = cbCrlEncoded; - crl->pCrlInfo = crlInfo; - crl->hCertStore = 0; + crl = (crl_t*)Context_CreateDataContext(sizeof(CRL_CONTEXT), &crl_vtbl, &empty_store); + if (!crl) + return NULL; + + data = CryptMemAlloc(cbCrlEncoded); + if (!data) + { + Context_Release(&crl->base); + return NULL; } -end: - return crl; + memcpy(data, pbCrlEncoded, cbCrlEncoded); + crl->ctx.dwCertEncodingType = dwCertEncodingType; + crl->ctx.pbCrlEncoded = data; + crl->ctx.cbCrlEncoded = cbCrlEncoded; + crl->ctx.pCrlInfo = crlInfo; + crl->ctx.hCertStore = &empty_store; + + return &crl->ctx; } BOOL WINAPI CertAddEncodedCRLToStore(HCERTSTORE hCertStore, @@ -319,50 +371,31 @@ PCCRL_CONTEXT WINAPI CertDuplicateCRLContext(PCCRL_CONTEXT pCrlContext) { TRACE("(%p)\n", pCrlContext); if (pCrlContext) - Context_AddRef((void *)pCrlContext, sizeof(CRL_CONTEXT)); + Context_AddRef(&crl_from_ptr(pCrlContext)->base); return pCrlContext; } -static void CrlDataContext_Free(void *context) +BOOL WINAPI CertFreeCRLContext(PCCRL_CONTEXT pCrlContext) { - PCRL_CONTEXT crlContext = context; - - CryptMemFree(crlContext->pbCrlEncoded); - LocalFree(crlContext->pCrlInfo); -} - -BOOL WINAPI CertFreeCRLContext( PCCRL_CONTEXT pCrlContext) -{ - BOOL ret = TRUE; - TRACE("(%p)\n", pCrlContext); if (pCrlContext) - ret = Context_Release((void *)pCrlContext, sizeof(CRL_CONTEXT), - CrlDataContext_Free); - return ret; + Context_Release(&crl_from_ptr(pCrlContext)->base); + return TRUE; } DWORD WINAPI CertEnumCRLContextProperties(PCCRL_CONTEXT pCRLContext, DWORD dwPropId) { - PCONTEXT_PROPERTY_LIST properties = Context_GetProperties( - pCRLContext, sizeof(CRL_CONTEXT)); - DWORD ret; - TRACE("(%p, %d)\n", pCRLContext, dwPropId); - if (properties) - ret = ContextPropertyList_EnumPropIDs(properties, dwPropId); - else - ret = 0; - return ret; + return ContextPropertyList_EnumPropIDs(crl_from_ptr(pCRLContext)->base.properties, dwPropId); } -static BOOL CRLContext_SetProperty(PCCRL_CONTEXT context, DWORD dwPropId, +static BOOL CRLContext_SetProperty(crl_t *crl, DWORD dwPropId, DWORD dwFlags, const void *pvData); -static BOOL CRLContext_GetHashProp(PCCRL_CONTEXT context, DWORD dwPropId, +static BOOL CRLContext_GetHashProp(crl_t *crl, DWORD dwPropId, ALG_ID algID, const BYTE *toHash, DWORD toHashLen, void *pvData, DWORD *pcbData) { @@ -372,23 +405,21 @@ static BOOL CRLContext_GetHashProp(PCCRL_CONTEXT context, DWORD dwPropId, { CRYPT_DATA_BLOB blob = { *pcbData, pvData }; - ret = CRLContext_SetProperty(context, dwPropId, 0, &blob); + ret = CRLContext_SetProperty(crl, dwPropId, 0, &blob); } return ret; } -static BOOL CRLContext_GetProperty(PCCRL_CONTEXT context, DWORD dwPropId, +static BOOL CRLContext_GetProperty(crl_t *crl, DWORD dwPropId, void *pvData, DWORD *pcbData) { - PCONTEXT_PROPERTY_LIST properties = - Context_GetProperties(context, sizeof(CRL_CONTEXT)); BOOL ret; CRYPT_DATA_BLOB blob; - TRACE("(%p, %d, %p, %p)\n", context, dwPropId, pvData, pcbData); + TRACE("(%p, %d, %p, %p)\n", crl, dwPropId, pvData, pcbData); - if (properties) - ret = ContextPropertyList_FindProperty(properties, dwPropId, &blob); + if (crl->base.properties) + ret = ContextPropertyList_FindProperty(crl->base.properties, dwPropId, &blob); else ret = FALSE; if (ret) @@ -413,13 +444,13 @@ static BOOL CRLContext_GetProperty(PCCRL_CONTEXT context, DWORD dwPropId, switch (dwPropId) { case CERT_SHA1_HASH_PROP_ID: - ret = CRLContext_GetHashProp(context, dwPropId, CALG_SHA1, - context->pbCrlEncoded, context->cbCrlEncoded, pvData, + ret = CRLContext_GetHashProp(crl, dwPropId, CALG_SHA1, + crl->ctx.pbCrlEncoded, crl->ctx.cbCrlEncoded, pvData, pcbData); break; case CERT_MD5_HASH_PROP_ID: - ret = CRLContext_GetHashProp(context, dwPropId, CALG_MD5, - context->pbCrlEncoded, context->cbCrlEncoded, pvData, + ret = CRLContext_GetHashProp(crl, dwPropId, CALG_MD5, + crl->ctx.pbCrlEncoded, crl->ctx.cbCrlEncoded, pvData, pcbData); break; default: @@ -460,37 +491,27 @@ BOOL WINAPI CertGetCRLContextProperty(PCCRL_CONTEXT pCRLContext, } else { - if (pCRLContext->hCertStore) - ret = CertGetStoreProperty(pCRLContext->hCertStore, dwPropId, - pvData, pcbData); - else - { - *(DWORD *)pvData = 0; - ret = TRUE; - } + ret = CertGetStoreProperty(pCRLContext->hCertStore, dwPropId, pvData, pcbData); } break; default: - ret = CRLContext_GetProperty(pCRLContext, dwPropId, pvData, - pcbData); + ret = CRLContext_GetProperty(crl_from_ptr(pCRLContext), dwPropId, pvData, pcbData); } return ret; } -static BOOL CRLContext_SetProperty(PCCRL_CONTEXT context, DWORD dwPropId, +static BOOL CRLContext_SetProperty(crl_t *crl, DWORD dwPropId, DWORD dwFlags, const void *pvData) { - PCONTEXT_PROPERTY_LIST properties = - Context_GetProperties(context, sizeof(CRL_CONTEXT)); BOOL ret; - TRACE("(%p, %d, %08x, %p)\n", context, dwPropId, dwFlags, pvData); + TRACE("(%p, %d, %08x, %p)\n", crl, dwPropId, dwFlags, pvData); - if (!properties) + if (!crl->base.properties) ret = FALSE; else if (!pvData) { - ContextPropertyList_RemoveProperty(properties, dwPropId); + ContextPropertyList_RemoveProperty(crl->base.properties, dwPropId); ret = TRUE; } else @@ -517,12 +538,12 @@ static BOOL CRLContext_SetProperty(PCCRL_CONTEXT context, DWORD dwPropId, { PCRYPT_DATA_BLOB blob = (PCRYPT_DATA_BLOB)pvData; - ret = ContextPropertyList_SetProperty(properties, dwPropId, + ret = ContextPropertyList_SetProperty(crl->base.properties, dwPropId, blob->pbData, blob->cbData); break; } case CERT_DATE_STAMP_PROP_ID: - ret = ContextPropertyList_SetProperty(properties, dwPropId, + ret = ContextPropertyList_SetProperty(crl->base.properties, dwPropId, pvData, sizeof(FILETIME)); break; default: @@ -554,7 +575,7 @@ BOOL WINAPI CertSetCRLContextProperty(PCCRL_CONTEXT pCRLContext, SetLastError(E_INVALIDARG); return FALSE; } - ret = CRLContext_SetProperty(pCRLContext, dwPropId, dwFlags, pvData); + ret = CRLContext_SetProperty(crl_from_ptr(pCRLContext), dwPropId, dwFlags, pvData); TRACE("returning %d\n", ret); return ret; } diff --git a/dll/win32/crypt32/crypt32_private.h b/dll/win32/crypt32/crypt32_private.h index 3224987e04b..aa20cc8b654 100644 --- a/dll/win32/crypt32/crypt32_private.h +++ b/dll/win32/crypt32/crypt32_private.h @@ -188,6 +188,70 @@ void crypt_sip_free(void) DECLSPEC_HIDDEN; void root_store_free(void) DECLSPEC_HIDDEN; void default_chain_engine_free(void) DECLSPEC_HIDDEN; +/* (Internal) certificate store types and functions */ +struct WINE_CRYPTCERTSTORE; + +typedef struct _CONTEXT_PROPERTY_LIST CONTEXT_PROPERTY_LIST; + +typedef struct _context_t context_t; + +typedef struct { + void (*free)(context_t*); + struct _context_t *(*clone)(context_t*,struct WINE_CRYPTCERTSTORE*,BOOL); +} context_vtbl_t; + +struct _context_t { + const context_vtbl_t *vtbl; + LONG ref; + struct WINE_CRYPTCERTSTORE *store; + struct _context_t *linked; + CONTEXT_PROPERTY_LIST *properties; + union { + struct list entry; + void *ptr; + } u; +}; + +static inline context_t *context_from_ptr(const void *ptr) +{ + return (context_t*)ptr-1; +} + +static inline void *context_ptr(context_t *context) +{ + return context+1; +} + +typedef struct { + context_t base; + CERT_CONTEXT ctx; +} cert_t; + +static inline cert_t *cert_from_ptr(const CERT_CONTEXT *ptr) +{ + return CONTAINING_RECORD(ptr, cert_t, ctx); +} + +typedef struct { + context_t base; + CRL_CONTEXT ctx; +} crl_t; + +static inline crl_t *crl_from_ptr(const CRL_CONTEXT *ptr) +{ + return CONTAINING_RECORD(ptr, crl_t, ctx); +} + +typedef struct { + context_t base; + CTL_CONTEXT ctx; +} ctl_t; + +static inline ctl_t *ctl_from_ptr(const CTL_CONTEXT *ptr) +{ + return CONTAINING_RECORD(ptr, ctl_t, ctx); +} + /* Some typedefs that make it easier to abstract which type of context we're * working with. */ @@ -198,7 +262,6 @@ typedef BOOL (WINAPI *AddContextToStoreFunc)(HCERTSTORE hCertStore, typedef BOOL (WINAPI *AddEncodedContextToStoreFunc)(HCERTSTORE hCertStore, DWORD dwCertEncodingType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwAddDisposition, const void **ppContext); -typedef const void *(WINAPI *DuplicateContextFunc)(const void *context); typedef const void *(WINAPI *EnumContextsInStoreFunc)(HCERTSTORE hCertStore, const void *pPrevContext); typedef DWORD (WINAPI *EnumPropertiesFunc)(const void *context, DWORD dwPropId); @@ -208,7 +271,6 @@ typedef BOOL (WINAPI *SetContextPropertyFunc)(const void *context, DWORD dwPropID, DWORD dwFlags, const void *pvData); typedef BOOL (WINAPI *SerializeElementFunc)(const void *context, DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement); -typedef BOOL (WINAPI *FreeContextFunc)(const void *context); typedef BOOL (WINAPI *DeleteContextFunc)(const void *contex); /* An abstract context (certificate, CRL, or CTL) interface */ @@ -217,57 +279,41 @@ typedef struct _WINE_CONTEXT_INTERFACE CreateContextFunc create; AddContextToStoreFunc addContextToStore; AddEncodedContextToStoreFunc addEncodedToStore; - DuplicateContextFunc duplicate; EnumContextsInStoreFunc enumContextsInStore; EnumPropertiesFunc enumProps; GetContextPropertyFunc getProp; SetContextPropertyFunc setProp; SerializeElementFunc serialize; - FreeContextFunc free; DeleteContextFunc deleteFromStore; -} WINE_CONTEXT_INTERFACE, *PWINE_CONTEXT_INTERFACE; -typedef const WINE_CONTEXT_INTERFACE *PCWINE_CONTEXT_INTERFACE; +} WINE_CONTEXT_INTERFACE; -extern PCWINE_CONTEXT_INTERFACE pCertInterface DECLSPEC_HIDDEN; -extern PCWINE_CONTEXT_INTERFACE pCRLInterface DECLSPEC_HIDDEN; -extern PCWINE_CONTEXT_INTERFACE pCTLInterface DECLSPEC_HIDDEN; - -/* (Internal) certificate store types and functions */ -struct WINE_CRYPTCERTSTORE; +extern const WINE_CONTEXT_INTERFACE *pCertInterface DECLSPEC_HIDDEN; +extern const WINE_CONTEXT_INTERFACE *pCRLInterface DECLSPEC_HIDDEN; +extern const WINE_CONTEXT_INTERFACE *pCTLInterface DECLSPEC_HIDDEN; typedef struct WINE_CRYPTCERTSTORE * (*StoreOpenFunc)(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara); -/* Called to enumerate the next context in a store. */ -typedef void * (*EnumFunc)(struct WINE_CRYPTCERTSTORE *store, void *pPrev); - -/* Called to add a context to a store. If toReplace is not NULL, - * context replaces toReplace in the store, and access checks should not be - * performed. Otherwise context is a new context, and it should only be - * added if the store allows it. If ppStoreContext is not NULL, the added - * context should be returned in *ppStoreContext. - */ -typedef BOOL (*AddFunc)(struct WINE_CRYPTCERTSTORE *store, void *context, - void *toReplace, const void **ppStoreContext); - -typedef BOOL (*DeleteFunc)(struct WINE_CRYPTCERTSTORE *store, void *context); - typedef struct _CONTEXT_FUNCS { - AddFunc addContext; - EnumFunc enumContext; - DeleteFunc deleteContext; -} CONTEXT_FUNCS, *PCONTEXT_FUNCS; + /* Called to add a context to a store. If toReplace is not NULL, + * context replaces toReplace in the store, and access checks should not be + * performed. Otherwise context is a new context, and it should only be + * added if the store allows it. If ppStoreContext is not NULL, the added + * context should be returned in *ppStoreContext. + */ + BOOL (*addContext)(struct WINE_CRYPTCERTSTORE*,context_t*,context_t*,context_t**,BOOL); + context_t *(*enumContext)(struct WINE_CRYPTCERTSTORE *store, context_t *prev); + BOOL (*delete)(struct WINE_CRYPTCERTSTORE*,context_t*); +} CONTEXT_FUNCS; typedef enum _CertStoreType { StoreTypeMem, StoreTypeCollection, StoreTypeProvider, + StoreTypeEmpty } CertStoreType; -struct _CONTEXT_PROPERTY_LIST; -typedef struct _CONTEXT_PROPERTY_LIST *PCONTEXT_PROPERTY_LIST; - #define WINE_CRYPTCERTSTORE_MAGIC 0x74726563 /* A cert store is polymorphic through the use of function pointers. A type @@ -277,49 +323,55 @@ typedef struct _CONTEXT_PROPERTY_LIST *PCONTEXT_PROPERTY_LIST; * - control is optional, but should be implemented by any store that supports * persistence */ + +typedef struct { + void (*addref)(struct WINE_CRYPTCERTSTORE*); + DWORD (*release)(struct WINE_CRYPTCERTSTORE*,DWORD); + void (*releaseContext)(struct WINE_CRYPTCERTSTORE*,context_t*); + BOOL (*control)(struct WINE_CRYPTCERTSTORE*,DWORD,DWORD,void const*); + CONTEXT_FUNCS certs; + CONTEXT_FUNCS crls; + CONTEXT_FUNCS ctls; +} store_vtbl_t; + typedef struct WINE_CRYPTCERTSTORE { DWORD dwMagic; LONG ref; DWORD dwOpenFlags; CertStoreType type; - PFN_CERT_STORE_PROV_CLOSE closeStore; - CONTEXT_FUNCS certs; - CONTEXT_FUNCS crls; - CONTEXT_FUNCS ctls; - PFN_CERT_STORE_PROV_CONTROL control; /* optional */ - PCONTEXT_PROPERTY_LIST properties; -} WINECRYPT_CERTSTORE, *PWINECRYPT_CERTSTORE; + const store_vtbl_t *vtbl; + CONTEXT_PROPERTY_LIST *properties; +} WINECRYPT_CERTSTORE; void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, DWORD dwFlags, - CertStoreType type) DECLSPEC_HIDDEN; -void CRYPT_FreeStore(PWINECRYPT_CERTSTORE store) DECLSPEC_HIDDEN; + CertStoreType type, const store_vtbl_t*) DECLSPEC_HIDDEN; +void CRYPT_FreeStore(WINECRYPT_CERTSTORE *store) DECLSPEC_HIDDEN; BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0, DWORD unk1) DECLSPEC_HIDDEN; -PWINECRYPT_CERTSTORE CRYPT_CollectionOpenStore(HCRYPTPROV hCryptProv, +WINECRYPT_CERTSTORE *CRYPT_CollectionOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN; -PWINECRYPT_CERTSTORE CRYPT_ProvCreateStore(DWORD dwFlags, - PWINECRYPT_CERTSTORE memStore, const CERT_STORE_PROV_INFO *pProvInfo) DECLSPEC_HIDDEN; -PWINECRYPT_CERTSTORE CRYPT_ProvOpenStore(LPCSTR lpszStoreProvider, +WINECRYPT_CERTSTORE *CRYPT_ProvCreateStore(DWORD dwFlags, + WINECRYPT_CERTSTORE *memStore, const CERT_STORE_PROV_INFO *pProvInfo) DECLSPEC_HIDDEN; +WINECRYPT_CERTSTORE *CRYPT_ProvOpenStore(LPCSTR lpszStoreProvider, DWORD dwEncodingType, HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN; -PWINECRYPT_CERTSTORE CRYPT_RegOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, +WINECRYPT_CERTSTORE *CRYPT_RegOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN; -PWINECRYPT_CERTSTORE CRYPT_FileOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, +WINECRYPT_CERTSTORE *CRYPT_FileOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN; -PWINECRYPT_CERTSTORE CRYPT_FileNameOpenStoreA(HCRYPTPROV hCryptProv, +WINECRYPT_CERTSTORE *CRYPT_FileNameOpenStoreA(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN; -PWINECRYPT_CERTSTORE CRYPT_FileNameOpenStoreW(HCRYPTPROV hCryptProv, +WINECRYPT_CERTSTORE *CRYPT_FileNameOpenStoreW(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN; -PWINECRYPT_CERTSTORE CRYPT_RootOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags) DECLSPEC_HIDDEN; +WINECRYPT_CERTSTORE *CRYPT_RootOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags) DECLSPEC_HIDDEN; /* Allocates and initializes a certificate chain engine, but without creating * the root store. Instead, it uses root, and assumes the caller has done any * checking necessary. */ -HCERTCHAINENGINE CRYPT_CreateChainEngine(HCERTSTORE root, - PCERT_CHAIN_ENGINE_CONFIG pConfig) DECLSPEC_HIDDEN; +HCERTCHAINENGINE CRYPT_CreateChainEngine(HCERTSTORE, DWORD, const CERT_CHAIN_ENGINE_CONFIG*) DECLSPEC_HIDDEN; /* Helper function for store reading functions and * CertAddSerializedElementToStore. Returns a context of the appropriate type @@ -365,89 +417,49 @@ DWORD cert_name_to_str_with_indent(DWORD dwCertEncodingType, DWORD indent, * which should be one of CERT_CONTEXT, CRL_CONTEXT, or CTL_CONTEXT. * Free with Context_Release. */ -void *Context_CreateDataContext(size_t contextSize) DECLSPEC_HIDDEN; +context_t *Context_CreateDataContext(size_t contextSize, const context_vtbl_t *vtbl, struct WINE_CRYPTCERTSTORE*) DECLSPEC_HIDDEN; -/* Creates a new link context with extra bytes. The context refers to linked +/* Creates a new link context. The context refers to linked * rather than owning its own properties. If addRef is TRUE (which ordinarily * it should be) linked is addref'd. * Free with Context_Release. */ -void *Context_CreateLinkContext(unsigned int contextSize, void *linked, unsigned int extra, - BOOL addRef) DECLSPEC_HIDDEN; - -/* Returns a pointer to the extra bytes allocated with context, which must be - * a link context. - */ -void *Context_GetExtra(const void *context, size_t contextSize) DECLSPEC_HIDDEN; - -/* Gets the context linked to by context, which must be a link context. */ -void *Context_GetLinkedContext(void *context, size_t contextSize) DECLSPEC_HIDDEN; +context_t *Context_CreateLinkContext(unsigned contextSize, context_t *linked, struct WINE_CRYPTCERTSTORE*) DECLSPEC_HIDDEN; /* Copies properties from fromContext to toContext. */ -void Context_CopyProperties(const void *to, const void *from, - size_t contextSize) DECLSPEC_HIDDEN; +void Context_CopyProperties(const void *to, const void *from) DECLSPEC_HIDDEN; -/* Returns context's properties, or the linked context's properties if context - * is a link context. - */ -PCONTEXT_PROPERTY_LIST Context_GetProperties(const void *context, size_t contextSize) DECLSPEC_HIDDEN; - -void Context_AddRef(void *context, size_t contextSize) DECLSPEC_HIDDEN; - -typedef void (*ContextFreeFunc)(void *context); - -/* Decrements context's ref count. If context is a link context, releases its - * linked context as well. - * If a data context has its ref count reach 0, calls dataContextFree on it. - * Returns FALSE if the reference count is <= 0 when called. - */ -BOOL Context_Release(void *context, size_t contextSize, - ContextFreeFunc dataContextFree) DECLSPEC_HIDDEN; +void Context_AddRef(context_t*) DECLSPEC_HIDDEN; +void Context_Release(context_t *context) DECLSPEC_HIDDEN; +void Context_Free(context_t*) DECLSPEC_HIDDEN; /** * Context property list functions */ -PCONTEXT_PROPERTY_LIST ContextPropertyList_Create(void) DECLSPEC_HIDDEN; +CONTEXT_PROPERTY_LIST *ContextPropertyList_Create(void) DECLSPEC_HIDDEN; /* Searches for the property with ID id in the context. Returns TRUE if found, * and copies the property's length and a pointer to its data to blob. * Otherwise returns FALSE. */ -BOOL ContextPropertyList_FindProperty(PCONTEXT_PROPERTY_LIST list, DWORD id, +BOOL ContextPropertyList_FindProperty(CONTEXT_PROPERTY_LIST *list, DWORD id, PCRYPT_DATA_BLOB blob) DECLSPEC_HIDDEN; -BOOL ContextPropertyList_SetProperty(PCONTEXT_PROPERTY_LIST list, DWORD id, +BOOL ContextPropertyList_SetProperty(CONTEXT_PROPERTY_LIST *list, DWORD id, const BYTE *pbData, size_t cbData) DECLSPEC_HIDDEN; -void ContextPropertyList_RemoveProperty(PCONTEXT_PROPERTY_LIST list, DWORD id) DECLSPEC_HIDDEN; +void ContextPropertyList_RemoveProperty(CONTEXT_PROPERTY_LIST *list, DWORD id) DECLSPEC_HIDDEN; -DWORD ContextPropertyList_EnumPropIDs(PCONTEXT_PROPERTY_LIST list, DWORD id) DECLSPEC_HIDDEN; +DWORD ContextPropertyList_EnumPropIDs(CONTEXT_PROPERTY_LIST *list, DWORD id) DECLSPEC_HIDDEN; -void ContextPropertyList_Copy(PCONTEXT_PROPERTY_LIST to, - PCONTEXT_PROPERTY_LIST from) DECLSPEC_HIDDEN; +void ContextPropertyList_Copy(CONTEXT_PROPERTY_LIST *to, + CONTEXT_PROPERTY_LIST *from) DECLSPEC_HIDDEN; -void ContextPropertyList_Free(PCONTEXT_PROPERTY_LIST list) DECLSPEC_HIDDEN; +void ContextPropertyList_Free(CONTEXT_PROPERTY_LIST *list) DECLSPEC_HIDDEN; -/** - * Context list functions. A context list is a simple list of link contexts. - */ -struct ContextList; - -struct ContextList *ContextList_Create( - PCWINE_CONTEXT_INTERFACE contextInterface, size_t contextSize) DECLSPEC_HIDDEN; - -void *ContextList_Add(struct ContextList *list, void *toLink, void *toReplace) DECLSPEC_HIDDEN; - -void *ContextList_Enum(struct ContextList *list, void *pPrev) DECLSPEC_HIDDEN; - -/* Removes a context from the list. Returns TRUE if the context was removed, - * or FALSE if not. (The context may have been duplicated, so subsequent - * removes have no effect.) - */ -BOOL ContextList_Remove(struct ContextList *list, void *context) DECLSPEC_HIDDEN; - -void ContextList_Free(struct ContextList *list) DECLSPEC_HIDDEN; +extern WINECRYPT_CERTSTORE empty_store; +void init_empty_store(void) DECLSPEC_HIDDEN; /** * Utilities. diff --git a/dll/win32/crypt32/ctl.c b/dll/win32/crypt32/ctl.c index cff0c4bfd57..ec2f0aa885d 100644 --- a/dll/win32/crypt32/ctl.c +++ b/dll/win32/crypt32/ctl.c @@ -21,14 +21,43 @@ WINE_DEFAULT_DEBUG_CHANNEL(crypt); -#define CtlContext_CopyProperties(to, from) \ - Context_CopyProperties((to), (from), sizeof(CTL_CONTEXT)) +static void CTL_free(context_t *context) +{ + ctl_t *ctl = (ctl_t*)context; + + CryptMsgClose(ctl->ctx.hCryptMsg); + CryptMemFree(ctl->ctx.pbCtlEncoded); + CryptMemFree(ctl->ctx.pbCtlContext); + LocalFree(ctl->ctx.pCtlInfo); +} + +static context_t *CTL_clone(context_t *context, WINECRYPT_CERTSTORE *store, BOOL use_link) +{ + ctl_t *ctl; + + if(!use_link) { + FIXME("Only links supported\n"); + return NULL; + } + + ctl = (ctl_t*)Context_CreateLinkContext(sizeof(CTL_CONTEXT), context, store); + if(!ctl) + return NULL; + + ctl->ctx.hCertStore = store; + return &ctl->base; +} + +static const context_vtbl_t ctl_vtbl = { + CTL_free, + CTL_clone +}; BOOL WINAPI CertAddCTLContextToStore(HCERTSTORE hCertStore, PCCTL_CONTEXT pCtlContext, DWORD dwAddDisposition, PCCTL_CONTEXT* ppStoreContext) { - PWINECRYPT_CERTSTORE store = hCertStore; + WINECRYPT_CERTSTORE *store = hCertStore; BOOL ret = TRUE; PCCTL_CONTEXT toAdd = NULL, existing = NULL; @@ -83,7 +112,7 @@ BOOL WINAPI CertAddCTLContextToStore(HCERTSTORE hCertStore, if (newer < 0) { toAdd = CertDuplicateCTLContext(pCtlContext); - CtlContext_CopyProperties(existing, pCtlContext); + Context_CopyProperties(existing, pCtlContext); } else { @@ -101,12 +130,12 @@ BOOL WINAPI CertAddCTLContextToStore(HCERTSTORE hCertStore, case CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES: toAdd = CertDuplicateCTLContext(pCtlContext); if (existing) - CtlContext_CopyProperties(toAdd, existing); + Context_CopyProperties(toAdd, existing); break; case CERT_STORE_ADD_USE_EXISTING: if (existing) { - CtlContext_CopyProperties(existing, pCtlContext); + Context_CopyProperties(existing, pCtlContext); if (ppStoreContext) *ppStoreContext = CertDuplicateCTLContext(existing); } @@ -120,11 +149,16 @@ BOOL WINAPI CertAddCTLContextToStore(HCERTSTORE hCertStore, if (toAdd) { - if (store) - ret = store->ctls.addContext(store, (void *)toAdd, - (void *)existing, (const void **)ppStoreContext); - else if (ppStoreContext) + if (store) { + context_t *ret_ctx; + + ret = store->vtbl->ctls.addContext(store, context_from_ptr(toAdd), + existing ? context_from_ptr(existing) : NULL, ppStoreContext ? &ret_ctx : NULL, TRUE); + if(ret && ppStoreContext) + *ppStoreContext = context_ptr(ret_ctx); + }else if (ppStoreContext) { *ppStoreContext = CertDuplicateCTLContext(toAdd); + } CertFreeCTLContext(toAdd); } CertFreeCTLContext(existing); @@ -156,11 +190,10 @@ BOOL WINAPI CertAddEncodedCTLToStore(HCERTSTORE hCertStore, return ret; } -PCCTL_CONTEXT WINAPI CertEnumCTLsInStore(HCERTSTORE hCertStore, - PCCTL_CONTEXT pPrev) +PCCTL_CONTEXT WINAPI CertEnumCTLsInStore(HCERTSTORE hCertStore, PCCTL_CONTEXT pPrev) { + ctl_t *prev = pPrev ? ctl_from_ptr(pPrev) : NULL, *ret; WINECRYPT_CERTSTORE *hcs = hCertStore; - PCCTL_CONTEXT ret; TRACE("(%p, %p)\n", hCertStore, pPrev); if (!hCertStore) @@ -168,8 +201,8 @@ PCCTL_CONTEXT WINAPI CertEnumCTLsInStore(HCERTSTORE hCertStore, else if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) ret = NULL; else - ret = (PCCTL_CONTEXT)hcs->ctls.enumContext(hcs, (void *)pPrev); - return ret; + ret = (ctl_t*)hcs->vtbl->ctls.enumContext(hcs, prev ? &prev->base : NULL); + return ret ? &ret->ctx : NULL; } typedef BOOL (*CtlCompareFunc)(PCCTL_CONTEXT pCtlContext, DWORD dwType, @@ -300,32 +333,30 @@ PCCTL_CONTEXT WINAPI CertFindCTLInStore(HCERTSTORE hCertStore, BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext) { + WINECRYPT_CERTSTORE *hcs; + ctl_t *ctl = ctl_from_ptr(pCtlContext); BOOL ret; TRACE("(%p)\n", pCtlContext); if (!pCtlContext) - ret = TRUE; - else if (!pCtlContext->hCertStore) - ret = CertFreeCTLContext(pCtlContext); - else - { - PWINECRYPT_CERTSTORE hcs = pCtlContext->hCertStore; + return TRUE; - if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) - ret = FALSE; - else - ret = hcs->ctls.deleteContext(hcs, (void *)pCtlContext); - if (ret) - ret = CertFreeCTLContext(pCtlContext); - } + hcs = pCtlContext->hCertStore; + + if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) + return FALSE; + + ret = hcs->vtbl->ctls.delete(hcs, &ctl->base); + if (ret) + ret = CertFreeCTLContext(pCtlContext); return ret; } PCCTL_CONTEXT WINAPI CertCreateCTLContext(DWORD dwMsgAndCertEncodingType, const BYTE *pbCtlEncoded, DWORD cbCtlEncoded) { - PCTL_CONTEXT ctl = NULL; + ctl_t *ctl = NULL; HCRYPTMSG msg; BOOL ret; BYTE *content = NULL; @@ -398,7 +429,7 @@ PCCTL_CONTEXT WINAPI CertCreateCTLContext(DWORD dwMsgAndCertEncodingType, &ctlInfo, &size); if (ret) { - ctl = Context_CreateDataContext(sizeof(CTL_CONTEXT)); + ctl = (ctl_t*)Context_CreateDataContext(sizeof(CTL_CONTEXT), &ctl_vtbl, &empty_store); if (ctl) { BYTE *data = CryptMemAlloc(cbCtlEncoded); @@ -406,15 +437,15 @@ PCCTL_CONTEXT WINAPI CertCreateCTLContext(DWORD dwMsgAndCertEncodingType, if (data) { memcpy(data, pbCtlEncoded, cbCtlEncoded); - ctl->dwMsgAndCertEncodingType = + ctl->ctx.dwMsgAndCertEncodingType = X509_ASN_ENCODING | PKCS_7_ASN_ENCODING; - ctl->pbCtlEncoded = data; - ctl->cbCtlEncoded = cbCtlEncoded; - ctl->pCtlInfo = ctlInfo; - ctl->hCertStore = NULL; - ctl->hCryptMsg = msg; - ctl->pbCtlContext = content; - ctl->cbCtlContext = contentSize; + ctl->ctx.pbCtlEncoded = data; + ctl->ctx.cbCtlEncoded = cbCtlEncoded; + ctl->ctx.pCtlInfo = ctlInfo; + ctl->ctx.hCertStore = &empty_store; + ctl->ctx.hCryptMsg = msg; + ctl->ctx.pbCtlContext = content; + ctl->ctx.cbCtlContext = contentSize; } else { @@ -439,65 +470,53 @@ PCCTL_CONTEXT WINAPI CertCreateCTLContext(DWORD dwMsgAndCertEncodingType, end: if (!ret) { - CertFreeCTLContext(ctl); + if(ctl) + Context_Release(&ctl->base); ctl = NULL; LocalFree(ctlInfo); CryptMemFree(content); CryptMsgClose(msg); + return NULL; } - return ctl; + return &ctl->ctx; } PCCTL_CONTEXT WINAPI CertDuplicateCTLContext(PCCTL_CONTEXT pCtlContext) { TRACE("(%p)\n", pCtlContext); if (pCtlContext) - Context_AddRef((void *)pCtlContext, sizeof(CTL_CONTEXT)); + Context_AddRef(&ctl_from_ptr(pCtlContext)->base); return pCtlContext; } -static void CTLDataContext_Free(void *context) -{ - PCTL_CONTEXT ctlContext = context; - - CryptMsgClose(ctlContext->hCryptMsg); - CryptMemFree(ctlContext->pbCtlEncoded); - CryptMemFree(ctlContext->pbCtlContext); - LocalFree(ctlContext->pCtlInfo); -} - BOOL WINAPI CertFreeCTLContext(PCCTL_CONTEXT pCTLContext) { - BOOL ret = TRUE; - TRACE("(%p)\n", pCTLContext); if (pCTLContext) - ret = Context_Release((void *)pCTLContext, sizeof(CTL_CONTEXT), - CTLDataContext_Free); - return ret; + Context_Release(&ctl_from_ptr(pCTLContext)->base); + return TRUE; } DWORD WINAPI CertEnumCTLContextProperties(PCCTL_CONTEXT pCTLContext, DWORD dwPropId) { - PCONTEXT_PROPERTY_LIST properties = Context_GetProperties( - pCTLContext, sizeof(CTL_CONTEXT)); + ctl_t *ctl = ctl_from_ptr(pCTLContext); DWORD ret; TRACE("(%p, %d)\n", pCTLContext, dwPropId); - if (properties) - ret = ContextPropertyList_EnumPropIDs(properties, dwPropId); + if (ctl->base.properties) + ret = ContextPropertyList_EnumPropIDs(ctl->base.properties, dwPropId); else ret = 0; return ret; } -static BOOL CTLContext_SetProperty(PCCTL_CONTEXT context, DWORD dwPropId, +static BOOL CTLContext_SetProperty(ctl_t *ctl, DWORD dwPropId, DWORD dwFlags, const void *pvData); -static BOOL CTLContext_GetHashProp(PCCTL_CONTEXT context, DWORD dwPropId, +static BOOL CTLContext_GetHashProp(ctl_t *ctl, DWORD dwPropId, ALG_ID algID, const BYTE *toHash, DWORD toHashLen, void *pvData, DWORD *pcbData) { @@ -507,23 +526,21 @@ static BOOL CTLContext_GetHashProp(PCCTL_CONTEXT context, DWORD dwPropId, { CRYPT_DATA_BLOB blob = { *pcbData, pvData }; - ret = CTLContext_SetProperty(context, dwPropId, 0, &blob); + ret = CTLContext_SetProperty(ctl, dwPropId, 0, &blob); } return ret; } -static BOOL CTLContext_GetProperty(PCCTL_CONTEXT context, DWORD dwPropId, +static BOOL CTLContext_GetProperty(ctl_t *ctl, DWORD dwPropId, void *pvData, DWORD *pcbData) { - PCONTEXT_PROPERTY_LIST properties = - Context_GetProperties(context, sizeof(CTL_CONTEXT)); BOOL ret; CRYPT_DATA_BLOB blob; - TRACE("(%p, %d, %p, %p)\n", context, dwPropId, pvData, pcbData); + TRACE("(%p, %d, %p, %p)\n", ctl, dwPropId, pvData, pcbData); - if (properties) - ret = ContextPropertyList_FindProperty(properties, dwPropId, &blob); + if (ctl->base.properties) + ret = ContextPropertyList_FindProperty(ctl->base.properties, dwPropId, &blob); else ret = FALSE; if (ret) @@ -548,12 +565,12 @@ static BOOL CTLContext_GetProperty(PCCTL_CONTEXT context, DWORD dwPropId, switch (dwPropId) { case CERT_SHA1_HASH_PROP_ID: - ret = CTLContext_GetHashProp(context, dwPropId, CALG_SHA1, - context->pbCtlEncoded, context->cbCtlEncoded, pvData, pcbData); + ret = CTLContext_GetHashProp(ctl, dwPropId, CALG_SHA1, + ctl->ctx.pbCtlEncoded, ctl->ctx.cbCtlEncoded, pvData, pcbData); break; case CERT_MD5_HASH_PROP_ID: - ret = CTLContext_GetHashProp(context, dwPropId, CALG_MD5, - context->pbCtlEncoded, context->cbCtlEncoded, pvData, pcbData); + ret = CTLContext_GetHashProp(ctl, dwPropId, CALG_MD5, + ctl->ctx.pbCtlEncoded, ctl->ctx.cbCtlEncoded, pvData, pcbData); break; default: SetLastError(CRYPT_E_NOT_FOUND); @@ -593,37 +610,28 @@ BOOL WINAPI CertGetCTLContextProperty(PCCTL_CONTEXT pCTLContext, } else { - if (pCTLContext->hCertStore) - ret = CertGetStoreProperty(pCTLContext->hCertStore, dwPropId, - pvData, pcbData); - else - { - *(DWORD *)pvData = 0; - ret = TRUE; - } + ret = CertGetStoreProperty(pCTLContext->hCertStore, dwPropId, pvData, pcbData); } break; default: - ret = CTLContext_GetProperty(pCTLContext, dwPropId, pvData, + ret = CTLContext_GetProperty(ctl_from_ptr(pCTLContext), dwPropId, pvData, pcbData); } return ret; } -static BOOL CTLContext_SetProperty(PCCTL_CONTEXT context, DWORD dwPropId, +static BOOL CTLContext_SetProperty(ctl_t *ctl, DWORD dwPropId, DWORD dwFlags, const void *pvData) { - PCONTEXT_PROPERTY_LIST properties = - Context_GetProperties(context, sizeof(CTL_CONTEXT)); BOOL ret; - TRACE("(%p, %d, %08x, %p)\n", context, dwPropId, dwFlags, pvData); + TRACE("(%p, %d, %08x, %p)\n", ctl, dwPropId, dwFlags, pvData); - if (!properties) + if (!ctl->base.properties) ret = FALSE; else if (!pvData) { - ContextPropertyList_RemoveProperty(properties, dwPropId); + ContextPropertyList_RemoveProperty(ctl->base.properties, dwPropId); ret = TRUE; } else @@ -650,12 +658,12 @@ static BOOL CTLContext_SetProperty(PCCTL_CONTEXT context, DWORD dwPropId, { PCRYPT_DATA_BLOB blob = (PCRYPT_DATA_BLOB)pvData; - ret = ContextPropertyList_SetProperty(properties, dwPropId, + ret = ContextPropertyList_SetProperty(ctl->base.properties, dwPropId, blob->pbData, blob->cbData); break; } case CERT_DATE_STAMP_PROP_ID: - ret = ContextPropertyList_SetProperty(properties, dwPropId, + ret = ContextPropertyList_SetProperty(ctl->base.properties, dwPropId, pvData, sizeof(FILETIME)); break; default: @@ -687,7 +695,7 @@ BOOL WINAPI CertSetCTLContextProperty(PCCTL_CONTEXT pCTLContext, SetLastError(E_INVALIDARG); return FALSE; } - ret = CTLContext_SetProperty(pCTLContext, dwPropId, dwFlags, pvData); + ret = CTLContext_SetProperty(ctl_from_ptr(pCTLContext), dwPropId, dwFlags, pvData); TRACE("returning %d\n", ret); return ret; } diff --git a/dll/win32/crypt32/encode.c b/dll/win32/crypt32/encode.c index 16ff3301185..d6b61a878e4 100644 --- a/dll/win32/crypt32/encode.c +++ b/dll/win32/crypt32/encode.c @@ -2060,7 +2060,7 @@ static BOOL CRYPT_AsnEncodeNumericString(const CERT_NAME_VALUE *value, return ret; } -static inline int isprintableW(WCHAR wc) +static inline BOOL isprintableW(WCHAR wc) { return isalnumW(wc) || isspaceW(wc) || wc == '\'' || wc == '(' || wc == ')' || wc == '+' || wc == ',' || wc == '-' || wc == '.' || diff --git a/dll/win32/crypt32/filestore.c b/dll/win32/crypt32/filestore.c index b05751bab14..f3e618f693f 100644 --- a/dll/win32/crypt32/filestore.c +++ b/dll/win32/crypt32/filestore.c @@ -27,11 +27,11 @@ typedef struct _WINE_FILESTOREINFO HANDLE file; DWORD type; BOOL dirty; -} WINE_FILESTOREINFO, *PWINE_FILESTOREINFO; +} WINE_FILESTOREINFO; static void WINAPI CRYPT_FileCloseStore(HCERTSTORE hCertStore, DWORD dwFlags) { - PWINE_FILESTOREINFO store = hCertStore; + WINE_FILESTOREINFO *store = hCertStore; TRACE("(%p, %08x)\n", store, dwFlags); if (store->dirty) @@ -44,7 +44,7 @@ static void WINAPI CRYPT_FileCloseStore(HCERTSTORE hCertStore, DWORD dwFlags) static BOOL WINAPI CRYPT_FileWriteCert(HCERTSTORE hCertStore, PCCERT_CONTEXT cert, DWORD dwFlags) { - PWINE_FILESTOREINFO store = hCertStore; + WINE_FILESTOREINFO *store = hCertStore; TRACE("(%p, %p, %d)\n", hCertStore, cert, dwFlags); store->dirty = TRUE; @@ -54,7 +54,7 @@ static BOOL WINAPI CRYPT_FileWriteCert(HCERTSTORE hCertStore, static BOOL WINAPI CRYPT_FileDeleteCert(HCERTSTORE hCertStore, PCCERT_CONTEXT pCertContext, DWORD dwFlags) { - PWINE_FILESTOREINFO store = hCertStore; + WINE_FILESTOREINFO *store = hCertStore; TRACE("(%p, %p, %08x)\n", hCertStore, pCertContext, dwFlags); store->dirty = TRUE; @@ -64,7 +64,7 @@ static BOOL WINAPI CRYPT_FileDeleteCert(HCERTSTORE hCertStore, static BOOL WINAPI CRYPT_FileWriteCRL(HCERTSTORE hCertStore, PCCRL_CONTEXT crl, DWORD dwFlags) { - PWINE_FILESTOREINFO store = hCertStore; + WINE_FILESTOREINFO *store = hCertStore; TRACE("(%p, %p, %d)\n", hCertStore, crl, dwFlags); store->dirty = TRUE; @@ -74,7 +74,7 @@ static BOOL WINAPI CRYPT_FileWriteCRL(HCERTSTORE hCertStore, static BOOL WINAPI CRYPT_FileDeleteCRL(HCERTSTORE hCertStore, PCCRL_CONTEXT pCrlContext, DWORD dwFlags) { - PWINE_FILESTOREINFO store = hCertStore; + WINE_FILESTOREINFO *store = hCertStore; TRACE("(%p, %p, %08x)\n", hCertStore, pCrlContext, dwFlags); store->dirty = TRUE; @@ -84,7 +84,7 @@ static BOOL WINAPI CRYPT_FileDeleteCRL(HCERTSTORE hCertStore, static BOOL WINAPI CRYPT_FileWriteCTL(HCERTSTORE hCertStore, PCCTL_CONTEXT ctl, DWORD dwFlags) { - PWINE_FILESTOREINFO store = hCertStore; + WINE_FILESTOREINFO *store = hCertStore; TRACE("(%p, %p, %d)\n", hCertStore, ctl, dwFlags); store->dirty = TRUE; @@ -94,7 +94,7 @@ static BOOL WINAPI CRYPT_FileWriteCTL(HCERTSTORE hCertStore, static BOOL WINAPI CRYPT_FileDeleteCTL(HCERTSTORE hCertStore, PCCTL_CONTEXT pCtlContext, DWORD dwFlags) { - PWINE_FILESTOREINFO store = hCertStore; + WINE_FILESTOREINFO *store = hCertStore; TRACE("(%p, %p, %08x)\n", hCertStore, pCtlContext, dwFlags); store->dirty = TRUE; @@ -113,8 +113,11 @@ static BOOL CRYPT_ReadBlobFromFile(HANDLE file, PCERT_BLOB blob) { DWORD read; - ret = ReadFile(file, blob->pbData, blob->cbData, &read, NULL); + ret = ReadFile(file, blob->pbData, blob->cbData, &read, NULL) && read == blob->cbData; + if (!ret) CryptMemFree(blob->pbData); } + else + ret = FALSE; } return ret; } @@ -122,7 +125,7 @@ static BOOL CRYPT_ReadBlobFromFile(HANDLE file, PCERT_BLOB blob) static BOOL WINAPI CRYPT_FileControl(HCERTSTORE hCertStore, DWORD dwFlags, DWORD dwCtrlType, void const *pvCtrlPara) { - PWINE_FILESTOREINFO store = hCertStore; + WINE_FILESTOREINFO *store = hCertStore; BOOL ret; TRACE("(%p, %08x, %d, %p)\n", hCertStore, dwFlags, dwCtrlType, @@ -206,11 +209,11 @@ static void *fileProvFuncs[] = { CRYPT_FileControl, }; -static PWINECRYPT_CERTSTORE CRYPT_CreateFileStore(DWORD dwFlags, +static WINECRYPT_CERTSTORE *CRYPT_CreateFileStore(DWORD dwFlags, HCERTSTORE memStore, HANDLE file, DWORD type) { - PWINECRYPT_CERTSTORE store = NULL; - PWINE_FILESTOREINFO info = CryptMemAlloc(sizeof(WINE_FILESTOREINFO)); + WINECRYPT_CERTSTORE *store = NULL; + WINE_FILESTOREINFO *info = CryptMemAlloc(sizeof(WINE_FILESTOREINFO)); if (info) { @@ -231,10 +234,10 @@ static PWINECRYPT_CERTSTORE CRYPT_CreateFileStore(DWORD dwFlags, return store; } -PWINECRYPT_CERTSTORE CRYPT_FileOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, +WINECRYPT_CERTSTORE *CRYPT_FileOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) { - PWINECRYPT_CERTSTORE store = NULL; + WINECRYPT_CERTSTORE *store = NULL; HANDLE file = (HANDLE)pvPara; TRACE("(%ld, %08x, %p)\n", hCryptProv, dwFlags, pvPara); @@ -281,7 +284,7 @@ PWINECRYPT_CERTSTORE CRYPT_FileOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, return store; } -PWINECRYPT_CERTSTORE CRYPT_FileNameOpenStoreW(HCRYPTPROV hCryptProv, +WINECRYPT_CERTSTORE *CRYPT_FileNameOpenStoreW(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) { HCERTSTORE store = 0; @@ -372,11 +375,11 @@ PWINECRYPT_CERTSTORE CRYPT_FileNameOpenStoreW(HCRYPTPROV hCryptProv, return store; } -PWINECRYPT_CERTSTORE CRYPT_FileNameOpenStoreA(HCRYPTPROV hCryptProv, +WINECRYPT_CERTSTORE *CRYPT_FileNameOpenStoreA(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) { int len; - PWINECRYPT_CERTSTORE ret = NULL; + WINECRYPT_CERTSTORE *ret = NULL; TRACE("(%ld, %08x, %s)\n", hCryptProv, dwFlags, debugstr_a(pvPara)); diff --git a/dll/win32/crypt32/main.c b/dll/win32/crypt32/main.c index f164aebe779..776396e802d 100644 --- a/dll/win32/crypt32/main.c +++ b/dll/win32/crypt32/main.c @@ -33,6 +33,7 @@ BOOL WINAPI DllMain(HINSTANCE hInst, DWORD fdwReason, PVOID pvReserved) case DLL_PROCESS_ATTACH: hInstance = hInst; DisableThreadLibraryCalls(hInst); + init_empty_store(); crypt_oid_init(); break; case DLL_PROCESS_DETACH: diff --git a/dll/win32/crypt32/msg.c b/dll/win32/crypt32/msg.c index 2b6e938cdbb..35bbb958b40 100644 --- a/dll/win32/crypt32/msg.c +++ b/dll/win32/crypt32/msg.c @@ -591,20 +591,20 @@ typedef struct _CMSG_SIGNER_ENCODE_INFO_WITH_CMS CERT_ID SignerId; CRYPT_ALGORITHM_IDENTIFIER HashEncryptionAlgorithm; void *pvHashEncryptionAuxInfo; -} CMSG_SIGNER_ENCODE_INFO_WITH_CMS, *PCMSG_SIGNER_ENCODE_INFO_WITH_CMS; +} CMSG_SIGNER_ENCODE_INFO_WITH_CMS; typedef struct _CMSG_SIGNED_ENCODE_INFO_WITH_CMS { DWORD cbSize; DWORD cSigners; - PCMSG_SIGNER_ENCODE_INFO_WITH_CMS rgSigners; + CMSG_SIGNER_ENCODE_INFO_WITH_CMS *rgSigners; DWORD cCertEncoded; PCERT_BLOB rgCertEncoded; DWORD cCrlEncoded; PCRL_BLOB rgCrlEncoded; DWORD cAttrCertEncoded; PCERT_BLOB rgAttrCertEncoded; -} CMSG_SIGNED_ENCODE_INFO_WITH_CMS, *PCMSG_SIGNED_ENCODE_INFO_WITH_CMS; +} CMSG_SIGNED_ENCODE_INFO_WITH_CMS; static BOOL CRYPT_IsValidSigner(const CMSG_SIGNER_ENCODE_INFO_WITH_CMS *signer) { @@ -1462,7 +1462,7 @@ typedef struct _CMSG_ENVELOPED_ENCODE_INFO_WITH_CMS PCERT_BLOB rgAttrCertEncoded; DWORD cUnprotectedAttr; PCRYPT_ATTRIBUTE rgUnprotectedAttr; -} CMSG_ENVELOPED_ENCODE_INFO_WITH_CMS, *PCMSG_ENVELOPED_ENCODE_INFO_WITH_CMS; +} CMSG_ENVELOPED_ENCODE_INFO_WITH_CMS; typedef struct _CEnvelopedEncodeMsg { @@ -2059,7 +2059,7 @@ typedef struct _CDecodeMsg } u; CRYPT_DATA_BLOB msg_data; CRYPT_DATA_BLOB detached_data; - PCONTEXT_PROPERTY_LIST properties; + CONTEXT_PROPERTY_LIST *properties; } CDecodeMsg; static void CDecodeMsg_Close(HCRYPTMSG hCryptMsg) diff --git a/dll/win32/crypt32/object.c b/dll/win32/crypt32/object.c index ce0f02c67eb..78dea1991c0 100644 --- a/dll/win32/crypt32/object.c +++ b/dll/win32/crypt32/object.c @@ -44,8 +44,11 @@ static BOOL CRYPT_ReadBlobFromFile(LPCWSTR fileName, PCERT_BLOB blob) { DWORD read; - ret = ReadFile(file, blob->pbData, blob->cbData, &read, NULL); + ret = ReadFile(file, blob->pbData, blob->cbData, &read, NULL) && read == blob->cbData; + if (!ret) CryptMemFree(blob->pbData); } + else + ret = FALSE; } CloseHandle(file); } @@ -263,12 +266,15 @@ static BOOL CRYPT_QuerySerializedContextObject(DWORD dwObjectType, *phCertStore = CertDuplicateStore( *(HCERTSTORE *)((const BYTE *)context + certStoreOffset)); if (ppvContext) - *ppvContext = contextInterface->duplicate(context); + { + *ppvContext = context; + Context_AddRef(context_from_ptr(context)); + } } end: if (contextInterface && context) - contextInterface->free(context); + Context_Release(context_from_ptr(context)); if (blob == &fileBlob) CryptMemFree(blob->pbData); TRACE("returning %d\n", ret); diff --git a/dll/win32/crypt32/oid.c b/dll/win32/crypt32/oid.c index a4174305097..01e05d99fa5 100644 --- a/dll/win32/crypt32/oid.c +++ b/dll/win32/crypt32/oid.c @@ -1093,6 +1093,7 @@ static const WCHAR SpcFinancialCriteria[] = { 'S','p','c','F','i','n','a','n','c static const WCHAR SpcMinimalCriteria[] = { 'S','p','c','M','i','n','i','m','a','l','C','r','i','t','e','r','i','a',0 }; static const WCHAR Email[] = { 'E','m','a','i','l',0 }; static const WCHAR GN[] = { 'G','N',0 }; +static const WCHAR SERIALNUMBER[] = { 'S','E','R','I','A','L','N','U','M','B','E','R',0 }; static const DWORD noNullFlag = CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG; static const DWORD mosaicFlags = CRYPT_OID_INHIBIT_SIGNATURE_FORMAT_FLAG | @@ -1212,6 +1213,7 @@ static const struct OIDInfoConstructor { { 5, szOID_TELEPHONE_NUMBER, 0, Phone, &printableStringBlob }, { 5, szOID_X21_ADDRESS, 0, X21Address, &numericStringBlob }, { 5, szOID_DN_QUALIFIER, 0, dnQualifier, NULL }, + { 5, szOID_DEVICE_SERIAL_NUMBER, 0, SERIALNUMBER, NULL }, { 6, szOID_AUTHORITY_KEY_IDENTIFIER2, 0, (LPCWSTR)IDS_AUTHORITY_KEY_ID, NULL }, { 6, szOID_AUTHORITY_KEY_IDENTIFIER, 0, (LPCWSTR)IDS_AUTHORITY_KEY_ID, NULL }, diff --git a/dll/win32/crypt32/proplist.c b/dll/win32/crypt32/proplist.c index 2d021b228b2..ac84cbe3387 100644 --- a/dll/win32/crypt32/proplist.c +++ b/dll/win32/crypt32/proplist.c @@ -20,11 +20,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(crypt); -typedef struct _CONTEXT_PROPERTY_LIST +struct _CONTEXT_PROPERTY_LIST { CRITICAL_SECTION cs; struct list properties; -} CONTEXT_PROPERTY_LIST; +}; typedef struct _CONTEXT_PROPERTY { @@ -32,11 +32,11 @@ typedef struct _CONTEXT_PROPERTY DWORD cbData; LPBYTE pbData; struct list entry; -} CONTEXT_PROPERTY, *PCONTEXT_PROPERTY; +} CONTEXT_PROPERTY; -PCONTEXT_PROPERTY_LIST ContextPropertyList_Create(void) +CONTEXT_PROPERTY_LIST *ContextPropertyList_Create(void) { - PCONTEXT_PROPERTY_LIST list = CryptMemAlloc(sizeof(CONTEXT_PROPERTY_LIST)); + CONTEXT_PROPERTY_LIST *list = CryptMemAlloc(sizeof(CONTEXT_PROPERTY_LIST)); if (list) { @@ -47,9 +47,9 @@ PCONTEXT_PROPERTY_LIST ContextPropertyList_Create(void) return list; } -void ContextPropertyList_Free(PCONTEXT_PROPERTY_LIST list) +void ContextPropertyList_Free(CONTEXT_PROPERTY_LIST *list) { - PCONTEXT_PROPERTY prop, next; + CONTEXT_PROPERTY *prop, *next; LIST_FOR_EACH_ENTRY_SAFE(prop, next, &list->properties, CONTEXT_PROPERTY, entry) @@ -63,10 +63,10 @@ void ContextPropertyList_Free(PCONTEXT_PROPERTY_LIST list) CryptMemFree(list); } -BOOL ContextPropertyList_FindProperty(PCONTEXT_PROPERTY_LIST list, DWORD id, +BOOL ContextPropertyList_FindProperty(CONTEXT_PROPERTY_LIST *list, DWORD id, PCRYPT_DATA_BLOB blob) { - PCONTEXT_PROPERTY prop; + CONTEXT_PROPERTY *prop; BOOL ret = FALSE; TRACE("(%p, %d, %p)\n", list, id, blob); @@ -86,7 +86,7 @@ BOOL ContextPropertyList_FindProperty(PCONTEXT_PROPERTY_LIST list, DWORD id, return ret; } -BOOL ContextPropertyList_SetProperty(PCONTEXT_PROPERTY_LIST list, DWORD id, +BOOL ContextPropertyList_SetProperty(CONTEXT_PROPERTY_LIST *list, DWORD id, const BYTE *pbData, size_t cbData) { LPBYTE data; @@ -102,7 +102,7 @@ BOOL ContextPropertyList_SetProperty(PCONTEXT_PROPERTY_LIST list, DWORD id, data = NULL; if (!cbData || data) { - PCONTEXT_PROPERTY prop; + CONTEXT_PROPERTY *prop; BOOL found = FALSE; EnterCriticalSection(&list->cs); @@ -140,9 +140,9 @@ BOOL ContextPropertyList_SetProperty(PCONTEXT_PROPERTY_LIST list, DWORD id, return ret; } -void ContextPropertyList_RemoveProperty(PCONTEXT_PROPERTY_LIST list, DWORD id) +void ContextPropertyList_RemoveProperty(CONTEXT_PROPERTY_LIST *list, DWORD id) { - PCONTEXT_PROPERTY prop, next; + CONTEXT_PROPERTY *prop, *next; EnterCriticalSection(&list->cs); LIST_FOR_EACH_ENTRY_SAFE(prop, next, &list->properties, CONTEXT_PROPERTY, @@ -162,19 +162,22 @@ void ContextPropertyList_RemoveProperty(PCONTEXT_PROPERTY_LIST list, DWORD id) /* Since the properties are stored in a list, this is a tad inefficient * (O(n^2)) since I have to find the previous position every time. */ -DWORD ContextPropertyList_EnumPropIDs(PCONTEXT_PROPERTY_LIST list, DWORD id) +DWORD ContextPropertyList_EnumPropIDs(CONTEXT_PROPERTY_LIST *list, DWORD id) { DWORD ret; EnterCriticalSection(&list->cs); if (id) { - PCONTEXT_PROPERTY cursor = NULL; + CONTEXT_PROPERTY *cursor = NULL, *prop; - LIST_FOR_EACH_ENTRY(cursor, &list->properties, CONTEXT_PROPERTY, entry) + LIST_FOR_EACH_ENTRY(prop, &list->properties, CONTEXT_PROPERTY, entry) { - if (cursor->propID == id) + if (prop->propID == id) + { + cursor = prop; break; + } } if (cursor) { @@ -196,10 +199,9 @@ DWORD ContextPropertyList_EnumPropIDs(PCONTEXT_PROPERTY_LIST list, DWORD id) return ret; } -void ContextPropertyList_Copy(PCONTEXT_PROPERTY_LIST to, - PCONTEXT_PROPERTY_LIST from) +void ContextPropertyList_Copy(CONTEXT_PROPERTY_LIST *to, CONTEXT_PROPERTY_LIST *from) { - PCONTEXT_PROPERTY prop; + CONTEXT_PROPERTY *prop; EnterCriticalSection(&from->cs); LIST_FOR_EACH_ENTRY(prop, &from->properties, CONTEXT_PROPERTY, entry) diff --git a/dll/win32/crypt32/provstore.c b/dll/win32/crypt32/provstore.c index 5968ac1c0c9..640ea626053 100644 --- a/dll/win32/crypt32/provstore.c +++ b/dll/win32/crypt32/provstore.c @@ -24,7 +24,7 @@ typedef struct _WINE_PROVIDERSTORE { WINECRYPT_CERTSTORE hdr; DWORD dwStoreProvFlags; - PWINECRYPT_CERTSTORE memStore; + WINECRYPT_CERTSTORE *memStore; HCERTSTOREPROV hStoreProv; PFN_CERT_STORE_PROV_CLOSE provCloseStore; PFN_CERT_STORE_PROV_WRITE_CERT provWriteCert; @@ -34,91 +34,112 @@ typedef struct _WINE_PROVIDERSTORE PFN_CERT_STORE_PROV_WRITE_CTL provWriteCtl; PFN_CERT_STORE_PROV_DELETE_CTL provDeleteCtl; PFN_CERT_STORE_PROV_CONTROL provControl; -} WINE_PROVIDERSTORE, *PWINE_PROVIDERSTORE; +} WINE_PROVIDERSTORE; -static void WINAPI CRYPT_ProvCloseStore(HCERTSTORE hCertStore, DWORD dwFlags) +static void ProvStore_addref(WINECRYPT_CERTSTORE *store) { - PWINE_PROVIDERSTORE store = hCertStore; - - TRACE("(%p, %08x)\n", store, dwFlags); - - if (store->provCloseStore) - store->provCloseStore(store->hStoreProv, dwFlags); - if (!(store->dwStoreProvFlags & CERT_STORE_PROV_EXTERNAL_FLAG)) - CertCloseStore(store->memStore, dwFlags); - CRYPT_FreeStore((PWINECRYPT_CERTSTORE)store); + LONG ref = InterlockedIncrement(&store->ref); + TRACE("ref = %d\n", ref); } -static BOOL CRYPT_ProvAddCert(PWINECRYPT_CERTSTORE store, void *cert, - void *toReplace, const void **ppStoreContext) +static DWORD ProvStore_release(WINECRYPT_CERTSTORE *cert_store, DWORD flags) { - PWINE_PROVIDERSTORE ps = (PWINE_PROVIDERSTORE)store; + WINE_PROVIDERSTORE *store = (WINE_PROVIDERSTORE*)cert_store; + LONG ref; + + if(flags) + FIXME("Unimplemented flags %x\n", flags); + + ref = InterlockedDecrement(&store->hdr.ref); + TRACE("(%p) ref=%d\n", store, ref); + + if(ref) + return ERROR_SUCCESS; + + if (store->provCloseStore) + store->provCloseStore(store->hStoreProv, flags); + if (!(store->dwStoreProvFlags & CERT_STORE_PROV_EXTERNAL_FLAG)) + store->memStore->vtbl->release(store->memStore, flags); + CRYPT_FreeStore(&store->hdr); + return ERROR_SUCCESS; +} + +static void ProvStore_releaseContext(WINECRYPT_CERTSTORE *store, context_t *context) +{ + /* As long as we don't have contexts properly stored (and hack around hCertStore + in add* and enum* functions), this function should never be called. */ + assert(0); +} + +static BOOL ProvStore_addCert(WINECRYPT_CERTSTORE *store, context_t *cert, + context_t *toReplace, context_t **ppStoreContext, BOOL use_link) +{ + WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store; BOOL ret; TRACE("(%p, %p, %p, %p)\n", store, cert, toReplace, ppStoreContext); if (toReplace) - ret = ps->memStore->certs.addContext(ps->memStore, cert, toReplace, - ppStoreContext); + ret = ps->memStore->vtbl->certs.addContext(ps->memStore, cert, toReplace, + ppStoreContext, TRUE); else { ret = TRUE; if (ps->provWriteCert) - ret = ps->provWriteCert(ps->hStoreProv, cert, - CERT_STORE_PROV_WRITE_ADD_FLAG); + ret = ps->provWriteCert(ps->hStoreProv, context_ptr(cert), CERT_STORE_PROV_WRITE_ADD_FLAG); if (ret) - ret = ps->memStore->certs.addContext(ps->memStore, cert, NULL, - ppStoreContext); + ret = ps->memStore->vtbl->certs.addContext(ps->memStore, cert, NULL, + ppStoreContext, TRUE); } /* dirty trick: replace the returned context's hCertStore with * store. */ if (ret && ppStoreContext) - (*(PCERT_CONTEXT *)ppStoreContext)->hCertStore = store; + (*(cert_t**)ppStoreContext)->ctx.hCertStore = store; return ret; } -static void *CRYPT_ProvEnumCert(PWINECRYPT_CERTSTORE store, void *pPrev) +static context_t *ProvStore_enumCert(WINECRYPT_CERTSTORE *store, context_t *prev) { - PWINE_PROVIDERSTORE ps = (PWINE_PROVIDERSTORE)store; - void *ret; + WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store; + cert_t *ret; - ret = ps->memStore->certs.enumContext(ps->memStore, pPrev); - if (ret) - { - /* same dirty trick: replace the returned context's hCertStore with - * store. - */ - ((PCERT_CONTEXT)ret)->hCertStore = store; - } - return ret; + ret = (cert_t*)ps->memStore->vtbl->certs.enumContext(ps->memStore, prev); + if (!ret) + return NULL; + + /* same dirty trick: replace the returned context's hCertStore with + * store. + */ + ret->ctx.hCertStore = store; + return &ret->base; } -static BOOL CRYPT_ProvDeleteCert(PWINECRYPT_CERTSTORE store, void *cert) +static BOOL ProvStore_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context) { - PWINE_PROVIDERSTORE ps = (PWINE_PROVIDERSTORE)store; + WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store; BOOL ret = TRUE; - TRACE("(%p, %p)\n", store, cert); + TRACE("(%p, %p)\n", store, context); if (ps->provDeleteCert) - ret = ps->provDeleteCert(ps->hStoreProv, cert, 0); + ret = ps->provDeleteCert(ps->hStoreProv, context_ptr(context), 0); if (ret) - ret = ps->memStore->certs.deleteContext(ps->memStore, cert); + ret = ps->memStore->vtbl->certs.delete(ps->memStore, context); return ret; } -static BOOL CRYPT_ProvAddCRL(PWINECRYPT_CERTSTORE store, void *crl, - void *toReplace, const void **ppStoreContext) +static BOOL ProvStore_addCRL(WINECRYPT_CERTSTORE *store, context_t *crl, + context_t *toReplace, context_t **ppStoreContext, BOOL use_link) { - PWINE_PROVIDERSTORE ps = (PWINE_PROVIDERSTORE)store; + WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store; BOOL ret; TRACE("(%p, %p, %p, %p)\n", store, crl, toReplace, ppStoreContext); if (toReplace) - ret = ps->memStore->crls.addContext(ps->memStore, crl, toReplace, - ppStoreContext); + ret = ps->memStore->vtbl->crls.addContext(ps->memStore, crl, toReplace, + ppStoreContext, TRUE); else { if (ps->hdr.dwOpenFlags & CERT_STORE_READONLY_FLAG) @@ -130,62 +151,62 @@ static BOOL CRYPT_ProvAddCRL(PWINECRYPT_CERTSTORE store, void *crl, { ret = TRUE; if (ps->provWriteCrl) - ret = ps->provWriteCrl(ps->hStoreProv, crl, + ret = ps->provWriteCrl(ps->hStoreProv, context_ptr(crl), CERT_STORE_PROV_WRITE_ADD_FLAG); if (ret) - ret = ps->memStore->crls.addContext(ps->memStore, crl, NULL, - ppStoreContext); + ret = ps->memStore->vtbl->crls.addContext(ps->memStore, crl, NULL, + ppStoreContext, TRUE); } } /* dirty trick: replace the returned context's hCertStore with * store. */ if (ret && ppStoreContext) - (*(PCRL_CONTEXT *)ppStoreContext)->hCertStore = store; + (*(crl_t**)ppStoreContext)->ctx.hCertStore = store; return ret; } -static void *CRYPT_ProvEnumCRL(PWINECRYPT_CERTSTORE store, void *pPrev) +static context_t *ProvStore_enumCRL(WINECRYPT_CERTSTORE *store, context_t *prev) { - PWINE_PROVIDERSTORE ps = (PWINE_PROVIDERSTORE)store; - void *ret; + WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store; + crl_t *ret; - ret = ps->memStore->crls.enumContext(ps->memStore, pPrev); - if (ret) - { - /* same dirty trick: replace the returned context's hCertStore with - * store. - */ - ((PCRL_CONTEXT)ret)->hCertStore = store; - } - return ret; + ret = (crl_t*)ps->memStore->vtbl->crls.enumContext(ps->memStore, prev); + if (!ret) + return NULL; + + /* same dirty trick: replace the returned context's hCertStore with + * store. + */ + ret->ctx.hCertStore = store; + return &ret->base; } -static BOOL CRYPT_ProvDeleteCRL(PWINECRYPT_CERTSTORE store, void *crl) +static BOOL ProvStore_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *crl) { - PWINE_PROVIDERSTORE ps = (PWINE_PROVIDERSTORE)store; + WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store; BOOL ret = TRUE; TRACE("(%p, %p)\n", store, crl); if (ps->provDeleteCrl) - ret = ps->provDeleteCrl(ps->hStoreProv, crl, 0); + ret = ps->provDeleteCrl(ps->hStoreProv, context_ptr(crl), 0); if (ret) - ret = ps->memStore->crls.deleteContext(ps->memStore, crl); + ret = ps->memStore->vtbl->crls.delete(ps->memStore, crl); return ret; } -static BOOL CRYPT_ProvAddCTL(PWINECRYPT_CERTSTORE store, void *ctl, - void *toReplace, const void **ppStoreContext) +static BOOL ProvStore_addCTL(WINECRYPT_CERTSTORE *store, context_t *ctl, + context_t *toReplace, context_t **ppStoreContext, BOOL use_link) { - PWINE_PROVIDERSTORE ps = (PWINE_PROVIDERSTORE)store; + WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store; BOOL ret; TRACE("(%p, %p, %p, %p)\n", store, ctl, toReplace, ppStoreContext); if (toReplace) - ret = ps->memStore->ctls.addContext(ps->memStore, ctl, toReplace, - ppStoreContext); + ret = ps->memStore->vtbl->ctls.addContext(ps->memStore, ctl, toReplace, + ppStoreContext, TRUE); else { if (ps->hdr.dwOpenFlags & CERT_STORE_READONLY_FLAG) @@ -197,58 +218,57 @@ static BOOL CRYPT_ProvAddCTL(PWINECRYPT_CERTSTORE store, void *ctl, { ret = TRUE; if (ps->provWriteCtl) - ret = ps->provWriteCtl(ps->hStoreProv, ctl, + ret = ps->provWriteCtl(ps->hStoreProv, context_ptr(ctl), CERT_STORE_PROV_WRITE_ADD_FLAG); if (ret) - ret = ps->memStore->ctls.addContext(ps->memStore, ctl, NULL, - ppStoreContext); + ret = ps->memStore->vtbl->ctls.addContext(ps->memStore, ctl, NULL, + ppStoreContext, TRUE); } } /* dirty trick: replace the returned context's hCertStore with * store. */ if (ret && ppStoreContext) - (*(PCTL_CONTEXT *)ppStoreContext)->hCertStore = store; + (*(ctl_t**)ppStoreContext)->ctx.hCertStore = store; return ret; } -static void *CRYPT_ProvEnumCTL(PWINECRYPT_CERTSTORE store, void *pPrev) +static context_t *ProvStore_enumCTL(WINECRYPT_CERTSTORE *store, context_t *prev) { - PWINE_PROVIDERSTORE ps = (PWINE_PROVIDERSTORE)store; - void *ret; + WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store; + ctl_t *ret; - ret = ps->memStore->ctls.enumContext(ps->memStore, pPrev); - if (ret) - { - /* same dirty trick: replace the returned context's hCertStore with - * store. - */ - ((PCTL_CONTEXT)ret)->hCertStore = store; - } - return ret; + ret = (ctl_t*)ps->memStore->vtbl->ctls.enumContext(ps->memStore, prev); + if (!ret) + return NULL; + + /* same dirty trick: replace the returned context's hCertStore with + * store. + */ + ret->ctx.hCertStore = store; + return &ret->base; } -static BOOL CRYPT_ProvDeleteCTL(PWINECRYPT_CERTSTORE store, void *ctl) +static BOOL ProvStore_deleteCTL(WINECRYPT_CERTSTORE *store, context_t *ctl) { - PWINE_PROVIDERSTORE ps = (PWINE_PROVIDERSTORE)store; + WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store; BOOL ret = TRUE; TRACE("(%p, %p)\n", store, ctl); if (ps->provDeleteCtl) - ret = ps->provDeleteCtl(ps->hStoreProv, ctl, 0); + ret = ps->provDeleteCtl(ps->hStoreProv, context_ptr(ctl), 0); if (ret) - ret = ps->memStore->ctls.deleteContext(ps->memStore, ctl); + ret = ps->memStore->vtbl->ctls.delete(ps->memStore, ctl); return ret; } -static BOOL WINAPI CRYPT_ProvControl(HCERTSTORE hCertStore, DWORD dwFlags, - DWORD dwCtrlType, void const *pvCtrlPara) +static BOOL ProvStore_control(WINECRYPT_CERTSTORE *cert_store, DWORD dwFlags, DWORD dwCtrlType, void const *pvCtrlPara) { - PWINE_PROVIDERSTORE store = hCertStore; + WINE_PROVIDERSTORE *store = (WINE_PROVIDERSTORE*)cert_store; BOOL ret = TRUE; - TRACE("(%p, %08x, %d, %p)\n", hCertStore, dwFlags, dwCtrlType, + TRACE("(%p, %08x, %d, %p)\n", store, dwFlags, dwCtrlType, pvCtrlPara); if (store->provControl) @@ -257,14 +277,34 @@ static BOOL WINAPI CRYPT_ProvControl(HCERTSTORE hCertStore, DWORD dwFlags, return ret; } -PWINECRYPT_CERTSTORE CRYPT_ProvCreateStore(DWORD dwFlags, - PWINECRYPT_CERTSTORE memStore, const CERT_STORE_PROV_INFO *pProvInfo) +static const store_vtbl_t ProvStoreVtbl = { + ProvStore_addref, + ProvStore_release, + ProvStore_releaseContext, + ProvStore_control, + { + ProvStore_addCert, + ProvStore_enumCert, + ProvStore_deleteCert + }, { + ProvStore_addCRL, + ProvStore_enumCRL, + ProvStore_deleteCRL + }, { + ProvStore_addCTL, + ProvStore_enumCTL, + ProvStore_deleteCTL + } +}; + +WINECRYPT_CERTSTORE *CRYPT_ProvCreateStore(DWORD dwFlags, + WINECRYPT_CERTSTORE *memStore, const CERT_STORE_PROV_INFO *pProvInfo) { - PWINE_PROVIDERSTORE ret = CryptMemAlloc(sizeof(WINE_PROVIDERSTORE)); + WINE_PROVIDERSTORE *ret = CryptMemAlloc(sizeof(WINE_PROVIDERSTORE)); if (ret) { - CRYPT_InitStore(&ret->hdr, dwFlags, StoreTypeProvider); + CRYPT_InitStore(&ret->hdr, dwFlags, StoreTypeProvider, &ProvStoreVtbl); ret->dwStoreProvFlags = pProvInfo->dwStoreProvFlags; if (ret->dwStoreProvFlags & CERT_STORE_PROV_EXTERNAL_FLAG) { @@ -274,17 +314,6 @@ PWINECRYPT_CERTSTORE CRYPT_ProvCreateStore(DWORD dwFlags, else ret->memStore = memStore; ret->hStoreProv = pProvInfo->hStoreProv; - ret->hdr.closeStore = CRYPT_ProvCloseStore; - ret->hdr.certs.addContext = CRYPT_ProvAddCert; - ret->hdr.certs.enumContext = CRYPT_ProvEnumCert; - ret->hdr.certs.deleteContext = CRYPT_ProvDeleteCert; - ret->hdr.crls.addContext = CRYPT_ProvAddCRL; - ret->hdr.crls.enumContext = CRYPT_ProvEnumCRL; - ret->hdr.crls.deleteContext = CRYPT_ProvDeleteCRL; - ret->hdr.ctls.addContext = CRYPT_ProvAddCTL; - ret->hdr.ctls.enumContext = CRYPT_ProvEnumCTL; - ret->hdr.ctls.deleteContext = CRYPT_ProvDeleteCTL; - ret->hdr.control = CRYPT_ProvControl; if (pProvInfo->cStoreProvFunc > CERT_STORE_PROV_CLOSE_FUNC) ret->provCloseStore = pProvInfo->rgpvStoreProvFunc[CERT_STORE_PROV_CLOSE_FUNC]; @@ -333,16 +362,16 @@ PWINECRYPT_CERTSTORE CRYPT_ProvCreateStore(DWORD dwFlags, else ret->provControl = NULL; } - return (PWINECRYPT_CERTSTORE)ret; + return (WINECRYPT_CERTSTORE*)ret; } -PWINECRYPT_CERTSTORE CRYPT_ProvOpenStore(LPCSTR lpszStoreProvider, +WINECRYPT_CERTSTORE *CRYPT_ProvOpenStore(LPCSTR lpszStoreProvider, DWORD dwEncodingType, HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) { static HCRYPTOIDFUNCSET set = NULL; PFN_CERT_DLL_OPEN_STORE_PROV_FUNC provOpenFunc; HCRYPTOIDFUNCADDR hFunc; - PWINECRYPT_CERTSTORE ret = NULL; + WINECRYPT_CERTSTORE *ret = NULL; if (!set) set = CryptInitOIDFunctionSet(CRYPT_OID_OPEN_STORE_PROV_FUNC, 0); diff --git a/dll/win32/crypt32/regstore.c b/dll/win32/crypt32/regstore.c index e5d352e78b7..f90103da8f9 100644 --- a/dll/win32/crypt32/regstore.c +++ b/dll/win32/crypt32/regstore.c @@ -24,7 +24,7 @@ typedef struct _WINE_HASH_TO_DELETE { BYTE hash[20]; struct list entry; -} WINE_HASH_TO_DELETE, *PWINE_HASH_TO_DELETE; +} WINE_HASH_TO_DELETE; typedef struct _WINE_REGSTOREINFO { @@ -36,7 +36,7 @@ typedef struct _WINE_REGSTOREINFO struct list certsToDelete; struct list crlsToDelete; struct list ctlsToDelete; -} WINE_REGSTOREINFO, *PWINE_REGSTOREINFO; +} WINE_REGSTOREINFO; static void CRYPT_HashToStr(const BYTE *hash, LPWSTR asciiHash) { @@ -135,7 +135,7 @@ static void CRYPT_RegReadSerializedFromReg(HKEY key, DWORD contextType, else TRACE("hash doesn't match, ignoring\n"); } - contextInterface->free(context); + Context_Release(context_from_ptr(context)); } } } @@ -234,11 +234,11 @@ static BOOL CRYPT_SerializeContextsToReg(HKEY key, ret = TRUE; } while (ret && context != NULL); if (context) - contextInterface->free(context); + Context_Release(context_from_ptr(context)); return ret; } -static BOOL CRYPT_RegWriteToReg(PWINE_REGSTOREINFO store) +static BOOL CRYPT_RegWriteToReg(WINE_REGSTOREINFO *store) { static const WCHAR * const subKeys[] = { CertsW, CRLsW, CTLsW }; const WINE_CONTEXT_INTERFACE * const interfaces[] = { pCertInterface, @@ -258,7 +258,7 @@ static BOOL CRYPT_RegWriteToReg(PWINE_REGSTOREINFO store) { if (listToDelete[i]) { - PWINE_HASH_TO_DELETE toDelete, next; + WINE_HASH_TO_DELETE *toDelete, *next; WCHAR asciiHash[20 * 2 + 1]; EnterCriticalSection(&store->cs); @@ -296,7 +296,7 @@ static BOOL CRYPT_RegWriteToReg(PWINE_REGSTOREINFO store) /* If force is true or the registry store is dirty, writes the contents of the * store to the registry. */ -static BOOL CRYPT_RegFlushStore(PWINE_REGSTOREINFO store, BOOL force) +static BOOL CRYPT_RegFlushStore(WINE_REGSTOREINFO *store, BOOL force) { BOOL ret; @@ -311,7 +311,7 @@ static BOOL CRYPT_RegFlushStore(PWINE_REGSTOREINFO store, BOOL force) static void WINAPI CRYPT_RegCloseStore(HCERTSTORE hCertStore, DWORD dwFlags) { - PWINE_REGSTOREINFO store = hCertStore; + WINE_REGSTOREINFO *store = hCertStore; TRACE("(%p, %08x)\n", store, dwFlags); if (dwFlags) @@ -324,7 +324,7 @@ static void WINAPI CRYPT_RegCloseStore(HCERTSTORE hCertStore, DWORD dwFlags) CryptMemFree(store); } -static BOOL CRYPT_RegWriteContext(PWINE_REGSTOREINFO store, +static BOOL CRYPT_RegWriteContext(WINE_REGSTOREINFO *store, const void *context, DWORD dwFlags) { BOOL ret; @@ -339,9 +339,9 @@ static BOOL CRYPT_RegWriteContext(PWINE_REGSTOREINFO store, return ret; } -static BOOL CRYPT_RegDeleteContext(PWINE_REGSTOREINFO store, +static BOOL CRYPT_RegDeleteContext(WINE_REGSTOREINFO *store, struct list *deleteList, const void *context, - PCWINE_CONTEXT_INTERFACE contextInterface) + const WINE_CONTEXT_INTERFACE *contextInterface) { BOOL ret; @@ -352,8 +352,7 @@ static BOOL CRYPT_RegDeleteContext(PWINE_REGSTOREINFO store, } else { - PWINE_HASH_TO_DELETE toDelete = - CryptMemAlloc(sizeof(WINE_HASH_TO_DELETE)); + WINE_HASH_TO_DELETE *toDelete = CryptMemAlloc(sizeof(WINE_HASH_TO_DELETE)); if (toDelete) { @@ -384,7 +383,7 @@ static BOOL CRYPT_RegDeleteContext(PWINE_REGSTOREINFO store, static BOOL WINAPI CRYPT_RegWriteCert(HCERTSTORE hCertStore, PCCERT_CONTEXT cert, DWORD dwFlags) { - PWINE_REGSTOREINFO store = hCertStore; + WINE_REGSTOREINFO *store = hCertStore; TRACE("(%p, %p, %d)\n", hCertStore, cert, dwFlags); @@ -394,7 +393,7 @@ static BOOL WINAPI CRYPT_RegWriteCert(HCERTSTORE hCertStore, static BOOL WINAPI CRYPT_RegDeleteCert(HCERTSTORE hCertStore, PCCERT_CONTEXT pCertContext, DWORD dwFlags) { - PWINE_REGSTOREINFO store = hCertStore; + WINE_REGSTOREINFO *store = hCertStore; TRACE("(%p, %p, %08x)\n", store, pCertContext, dwFlags); @@ -405,7 +404,7 @@ static BOOL WINAPI CRYPT_RegDeleteCert(HCERTSTORE hCertStore, static BOOL WINAPI CRYPT_RegWriteCRL(HCERTSTORE hCertStore, PCCRL_CONTEXT crl, DWORD dwFlags) { - PWINE_REGSTOREINFO store = hCertStore; + WINE_REGSTOREINFO *store = hCertStore; TRACE("(%p, %p, %d)\n", hCertStore, crl, dwFlags); @@ -415,7 +414,7 @@ static BOOL WINAPI CRYPT_RegWriteCRL(HCERTSTORE hCertStore, static BOOL WINAPI CRYPT_RegDeleteCRL(HCERTSTORE hCertStore, PCCRL_CONTEXT pCrlContext, DWORD dwFlags) { - PWINE_REGSTOREINFO store = hCertStore; + WINE_REGSTOREINFO *store = hCertStore; TRACE("(%p, %p, %08x)\n", store, pCrlContext, dwFlags); @@ -426,7 +425,7 @@ static BOOL WINAPI CRYPT_RegDeleteCRL(HCERTSTORE hCertStore, static BOOL WINAPI CRYPT_RegWriteCTL(HCERTSTORE hCertStore, PCCTL_CONTEXT ctl, DWORD dwFlags) { - PWINE_REGSTOREINFO store = hCertStore; + WINE_REGSTOREINFO *store = hCertStore; TRACE("(%p, %p, %d)\n", hCertStore, ctl, dwFlags); @@ -436,7 +435,7 @@ static BOOL WINAPI CRYPT_RegWriteCTL(HCERTSTORE hCertStore, static BOOL WINAPI CRYPT_RegDeleteCTL(HCERTSTORE hCertStore, PCCTL_CONTEXT pCtlContext, DWORD dwFlags) { - PWINE_REGSTOREINFO store = hCertStore; + WINE_REGSTOREINFO *store = hCertStore; TRACE("(%p, %p, %08x)\n", store, pCtlContext, dwFlags); @@ -447,7 +446,7 @@ static BOOL WINAPI CRYPT_RegDeleteCTL(HCERTSTORE hCertStore, static BOOL WINAPI CRYPT_RegControl(HCERTSTORE hCertStore, DWORD dwFlags, DWORD dwCtrlType, void const *pvCtrlPara) { - PWINE_REGSTOREINFO store = hCertStore; + WINE_REGSTOREINFO *store = hCertStore; BOOL ret; TRACE("(%p, %08x, %d, %p)\n", hCertStore, dwFlags, dwCtrlType, @@ -499,10 +498,10 @@ static void *regProvFuncs[] = { CRYPT_RegControl, }; -PWINECRYPT_CERTSTORE CRYPT_RegOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, +WINECRYPT_CERTSTORE *CRYPT_RegOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) { - PWINECRYPT_CERTSTORE store = NULL; + WINECRYPT_CERTSTORE *store = NULL; TRACE("(%ld, %08x, %p)\n", hCryptProv, dwFlags, pvPara); @@ -527,13 +526,13 @@ PWINECRYPT_CERTSTORE CRYPT_RegOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, dwFlags & CERT_STORE_READONLY_FLAG ? KEY_READ : KEY_ALL_ACCESS, TRUE, 0)) { - PWINECRYPT_CERTSTORE memStore; + WINECRYPT_CERTSTORE *memStore; memStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, hCryptProv, CERT_STORE_CREATE_NEW_FLAG, NULL); if (memStore) { - PWINE_REGSTOREINFO regInfo = CryptMemAlloc( + WINE_REGSTOREINFO *regInfo = CryptMemAlloc( sizeof(WINE_REGSTOREINFO)); if (regInfo) diff --git a/dll/win32/crypt32/rootstore.c b/dll/win32/crypt32/rootstore.c index 6f8283210f9..414b0d81d2f 100644 --- a/dll/win32/crypt32/rootstore.c +++ b/dll/win32/crypt32/rootstore.c @@ -236,7 +236,7 @@ static void check_and_store_certs(HCERTSTORE from, HCERTSTORE to) TRACE("\n"); CertDuplicateStore(to); - engine = CRYPT_CreateChainEngine(to, &chainEngineConfig); + engine = CRYPT_CreateChainEngine(to, CERT_SYSTEM_STORE_CURRENT_USER, &chainEngineConfig); if (engine) { PCCERT_CONTEXT cert = NULL; @@ -247,9 +247,10 @@ static void check_and_store_certs(HCERTSTORE from, HCERTSTORE to) { CERT_CHAIN_PARA chainPara = { sizeof(chainPara), { 0 } }; PCCERT_CHAIN_CONTEXT chain; - BOOL ret = CertGetCertificateChain(engine, cert, NULL, from, - &chainPara, 0, NULL, &chain); + BOOL ret; + ret = CertGetCertificateChain(engine, cert, NULL, from, + &chainPara, CERT_CHAIN_CACHE_ONLY_URL_RETRIEVAL, NULL, &chain); if (!ret) TRACE("rejecting %s: %s\n", get_cert_common_name(cert), "chain creation failed"); @@ -478,6 +479,7 @@ static const char * const CRYPT_knownLocations[] = { "/etc/ssl/certs/ca-certificates.crt", "/etc/ssl/certs", "/etc/pki/tls/certs/ca-bundle.crt", + "/usr/share/ca-certificates/ca-bundle.crt", "/usr/local/share/certs/", "/etc/sfw/openssl/certs", }; @@ -803,9 +805,9 @@ static HCERTSTORE create_root_store(void) return root; } -static PWINECRYPT_CERTSTORE CRYPT_rootStore; +static WINECRYPT_CERTSTORE *CRYPT_rootStore; -PWINECRYPT_CERTSTORE CRYPT_RootOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags) +WINECRYPT_CERTSTORE *CRYPT_RootOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags) { TRACE("(%ld, %08x)\n", hCryptProv, dwFlags); @@ -824,7 +826,7 @@ PWINECRYPT_CERTSTORE CRYPT_RootOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags) if (CRYPT_rootStore != root) CertCloseStore(root, 0); } - CertDuplicateStore(CRYPT_rootStore); + CRYPT_rootStore->vtbl->addref(CRYPT_rootStore); return CRYPT_rootStore; } diff --git a/dll/win32/crypt32/serialize.c b/dll/win32/crypt32/serialize.c index 23b0172486c..b722d21de77 100644 --- a/dll/win32/crypt32/serialize.c +++ b/dll/win32/crypt32/serialize.c @@ -28,11 +28,11 @@ typedef struct _WINE_CERT_PROP_HEADER DWORD propID; DWORD unknown; /* always 1 */ DWORD cb; -} WINE_CERT_PROP_HEADER, *PWINE_CERT_PROP_HEADER; +} WINE_CERT_PROP_HEADER; static BOOL CRYPT_SerializeStoreElement(const void *context, const BYTE *encodedContext, DWORD cbEncodedContext, DWORD contextPropID, - PCWINE_CONTEXT_INTERFACE contextInterface, DWORD dwFlags, BOOL omitHashes, + const WINE_CONTEXT_INTERFACE *contextInterface, DWORD dwFlags, BOOL omitHashes, BYTE *pbElement, DWORD *pcbElement) { BOOL ret; @@ -71,7 +71,7 @@ static BOOL CRYPT_SerializeStoreElement(const void *context, } else { - PWINE_CERT_PROP_HEADER hdr; + WINE_CERT_PROP_HEADER *hdr; DWORD bufSize = 0; LPBYTE buf = NULL; @@ -100,7 +100,7 @@ static BOOL CRYPT_SerializeStoreElement(const void *context, &propSize); if (ret) { - hdr = (PWINE_CERT_PROP_HEADER)pbElement; + hdr = (WINE_CERT_PROP_HEADER*)pbElement; hdr->propID = prop; hdr->unknown = 1; hdr->cb = propSize; @@ -119,7 +119,7 @@ static BOOL CRYPT_SerializeStoreElement(const void *context, } while (ret && prop != 0); CryptMemFree(buf); - hdr = (PWINE_CERT_PROP_HEADER)pbElement; + hdr = (WINE_CERT_PROP_HEADER*)pbElement; hdr->propID = contextPropID; hdr->unknown = 1; hdr->cb = cbEncodedContext; @@ -400,7 +400,7 @@ const void *CRYPT_ReadSerializedElement(const BYTE *pbElement, DWORD cbElement, } else { - contextInterface->free(context); + Context_Release(context_from_ptr(context)); context = NULL; } } @@ -452,7 +452,7 @@ static BOOL CRYPT_ReadSerializedStore(void *handle, propHdr.propID == CERT_CTL_PROP_ID)) { /* We have a new context, so free the existing one */ - contextInterface->free(context); + Context_Release(context_from_ptr(context)); } if (propHdr.cb > bufSize) { @@ -513,7 +513,7 @@ static BOOL CRYPT_ReadSerializedStore(void *handle, if (contextInterface && context) { /* Free the last context added */ - contextInterface->free(context); + Context_Release(context_from_ptr(context)); } CryptMemFree(buf); ret = TRUE; @@ -629,7 +629,7 @@ static BOOL CRYPT_SerializeContextsToStream(SerializedOutputFunc output, ret = TRUE; } while (ret && context != NULL); if (context) - contextInterface->free(context); + Context_Release(context_from_ptr(context)); return ret; } @@ -987,7 +987,7 @@ BOOL WINAPI CertAddSerializedElementToStore(HCERTSTORE hCertStore, *pdwContentType = type; ret = contextInterface->addContextToStore(hCertStore, context, dwAddDisposition, ppvContext); - contextInterface->free(context); + Context_Release(context_from_ptr(context)); } else ret = FALSE; diff --git a/dll/win32/crypt32/store.c b/dll/win32/crypt32/store.c index 1d6ccb853fd..b0a77f68bfe 100644 --- a/dll/win32/crypt32/store.c +++ b/dll/win32/crypt32/store.c @@ -31,69 +31,65 @@ static const WINE_CONTEXT_INTERFACE gCertInterface = { (CreateContextFunc)CertCreateCertificateContext, (AddContextToStoreFunc)CertAddCertificateContextToStore, (AddEncodedContextToStoreFunc)CertAddEncodedCertificateToStore, - (DuplicateContextFunc)CertDuplicateCertificateContext, (EnumContextsInStoreFunc)CertEnumCertificatesInStore, (EnumPropertiesFunc)CertEnumCertificateContextProperties, (GetContextPropertyFunc)CertGetCertificateContextProperty, (SetContextPropertyFunc)CertSetCertificateContextProperty, (SerializeElementFunc)CertSerializeCertificateStoreElement, - (FreeContextFunc)CertFreeCertificateContext, (DeleteContextFunc)CertDeleteCertificateFromStore, }; -PCWINE_CONTEXT_INTERFACE pCertInterface = &gCertInterface; +const WINE_CONTEXT_INTERFACE *pCertInterface = &gCertInterface; static const WINE_CONTEXT_INTERFACE gCRLInterface = { (CreateContextFunc)CertCreateCRLContext, (AddContextToStoreFunc)CertAddCRLContextToStore, (AddEncodedContextToStoreFunc)CertAddEncodedCRLToStore, - (DuplicateContextFunc)CertDuplicateCRLContext, (EnumContextsInStoreFunc)CertEnumCRLsInStore, (EnumPropertiesFunc)CertEnumCRLContextProperties, (GetContextPropertyFunc)CertGetCRLContextProperty, (SetContextPropertyFunc)CertSetCRLContextProperty, (SerializeElementFunc)CertSerializeCRLStoreElement, - (FreeContextFunc)CertFreeCRLContext, (DeleteContextFunc)CertDeleteCRLFromStore, }; -PCWINE_CONTEXT_INTERFACE pCRLInterface = &gCRLInterface; +const WINE_CONTEXT_INTERFACE *pCRLInterface = &gCRLInterface; static const WINE_CONTEXT_INTERFACE gCTLInterface = { (CreateContextFunc)CertCreateCTLContext, (AddContextToStoreFunc)CertAddCTLContextToStore, (AddEncodedContextToStoreFunc)CertAddEncodedCTLToStore, - (DuplicateContextFunc)CertDuplicateCTLContext, (EnumContextsInStoreFunc)CertEnumCTLsInStore, (EnumPropertiesFunc)CertEnumCTLContextProperties, (GetContextPropertyFunc)CertGetCTLContextProperty, (SetContextPropertyFunc)CertSetCTLContextProperty, (SerializeElementFunc)CertSerializeCTLStoreElement, - (FreeContextFunc)CertFreeCTLContext, (DeleteContextFunc)CertDeleteCTLFromStore, }; -PCWINE_CONTEXT_INTERFACE pCTLInterface = &gCTLInterface; +const WINE_CONTEXT_INTERFACE *pCTLInterface = &gCTLInterface; typedef struct _WINE_MEMSTORE { WINECRYPT_CERTSTORE hdr; - struct ContextList *certs; - struct ContextList *crls; - struct ContextList *ctls; -} WINE_MEMSTORE, *PWINE_MEMSTORE; + CRITICAL_SECTION cs; + struct list certs; + struct list crls; + struct list ctls; +} WINE_MEMSTORE; -void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, DWORD dwFlags, - CertStoreType type) +void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, DWORD dwFlags, CertStoreType type, const store_vtbl_t *vtbl) { store->ref = 1; store->dwMagic = WINE_CRYPTCERTSTORE_MAGIC; store->type = type; store->dwOpenFlags = dwFlags; + store->vtbl = vtbl; store->properties = NULL; } -void CRYPT_FreeStore(PWINECRYPT_CERTSTORE store) +void CRYPT_FreeStore(WINECRYPT_CERTSTORE *store) { if (store->properties) ContextPropertyList_Free(store->properties); + store->dwMagic = 0; CryptMemFree(store); } @@ -134,166 +130,239 @@ BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0, return TRUE; } -static BOOL CRYPT_MemAddCert(PWINECRYPT_CERTSTORE store, void *cert, - void *toReplace, const void **ppStoreContext) +static BOOL MemStore_addContext(WINE_MEMSTORE *store, struct list *list, context_t *orig_context, + context_t *existing, context_t **ret_context, BOOL use_link) +{ + context_t *context; + + context = orig_context->vtbl->clone(orig_context, &store->hdr, use_link); + if (!context) + return FALSE; + + TRACE("adding %p\n", context); + EnterCriticalSection(&store->cs); + if (existing) { + context->u.entry.prev = existing->u.entry.prev; + context->u.entry.next = existing->u.entry.next; + context->u.entry.prev->next = &context->u.entry; + context->u.entry.next->prev = &context->u.entry; + list_init(&existing->u.entry); + if(!existing->ref) + Context_Release(existing); + }else { + list_add_head(list, &context->u.entry); + } + LeaveCriticalSection(&store->cs); + + if(ret_context) + *ret_context = context; + else + Context_Release(context); + return TRUE; +} + +static context_t *MemStore_enumContext(WINE_MEMSTORE *store, struct list *list, context_t *prev) +{ + struct list *next; + context_t *ret; + + EnterCriticalSection(&store->cs); + if (prev) { + next = list_next(list, &prev->u.entry); + Context_Release(prev); + }else { + next = list_next(list, list); + } + LeaveCriticalSection(&store->cs); + + if (!next) { + SetLastError(CRYPT_E_NOT_FOUND); + return NULL; + } + + ret = LIST_ENTRY(next, context_t, u.entry); + Context_AddRef(ret); + return ret; +} + +static BOOL MemStore_deleteContext(WINE_MEMSTORE *store, context_t *context) +{ + BOOL in_list = FALSE; + + EnterCriticalSection(&store->cs); + if (!list_empty(&context->u.entry)) { + list_remove(&context->u.entry); + list_init(&context->u.entry); + in_list = TRUE; + } + LeaveCriticalSection(&store->cs); + + if(in_list && !context->ref) + Context_Free(context); + return TRUE; +} + +static void free_contexts(struct list *list) +{ + context_t *context, *next; + + LIST_FOR_EACH_ENTRY_SAFE(context, next, list, context_t, u.entry) + { + TRACE("freeing %p\n", context); + list_remove(&context->u.entry); + Context_Free(context); + } +} + +static void MemStore_releaseContext(WINECRYPT_CERTSTORE *store, context_t *context) +{ + /* Free the context only if it's not in a list. Otherwise it may be reused later. */ + if(list_empty(&context->u.entry)) + Context_Free(context); +} + +static BOOL MemStore_addCert(WINECRYPT_CERTSTORE *store, context_t *cert, + context_t *toReplace, context_t **ppStoreContext, BOOL use_link) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - PCERT_CONTEXT context; TRACE("(%p, %p, %p, %p)\n", store, cert, toReplace, ppStoreContext); - - context = ContextList_Add(ms->certs, cert, toReplace); - if (context) - { - context->hCertStore = store; - if (ppStoreContext) - *ppStoreContext = CertDuplicateCertificateContext(context); - } - return context != 0; + return MemStore_addContext(ms, &ms->certs, cert, toReplace, ppStoreContext, use_link); } -static void *CRYPT_MemEnumCert(PWINECRYPT_CERTSTORE store, void *pPrev) +static context_t *MemStore_enumCert(WINECRYPT_CERTSTORE *store, context_t *prev) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - void *ret; - TRACE("(%p, %p)\n", store, pPrev); + TRACE("(%p, %p)\n", store, prev); - ret = ContextList_Enum(ms->certs, pPrev); - if (!ret) - SetLastError(CRYPT_E_NOT_FOUND); - - TRACE("returning %p\n", ret); - return ret; + return MemStore_enumContext(ms, &ms->certs, prev); } -static BOOL CRYPT_MemDeleteCert(PWINECRYPT_CERTSTORE store, void *pCertContext) +static BOOL MemStore_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - BOOL ret; - if (ContextList_Remove(ms->certs, pCertContext)) - ret = CertFreeCertificateContext(pCertContext); - else - ret = TRUE; - return ret; + TRACE("(%p, %p)\n", store, context); + + return MemStore_deleteContext(ms, context); } -static BOOL CRYPT_MemAddCrl(PWINECRYPT_CERTSTORE store, void *crl, - void *toReplace, const void **ppStoreContext) +static BOOL MemStore_addCRL(WINECRYPT_CERTSTORE *store, context_t *crl, + context_t *toReplace, context_t **ppStoreContext, BOOL use_link) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - PCRL_CONTEXT context; TRACE("(%p, %p, %p, %p)\n", store, crl, toReplace, ppStoreContext); - context = ContextList_Add(ms->crls, crl, toReplace); - if (context) - { - context->hCertStore = store; - if (ppStoreContext) - *ppStoreContext = CertDuplicateCRLContext(context); - } - return context != 0; + return MemStore_addContext(ms, &ms->crls, crl, toReplace, ppStoreContext, use_link); } -static void *CRYPT_MemEnumCrl(PWINECRYPT_CERTSTORE store, void *pPrev) +static context_t *MemStore_enumCRL(WINECRYPT_CERTSTORE *store, context_t *prev) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - void *ret; - TRACE("(%p, %p)\n", store, pPrev); + TRACE("(%p, %p)\n", store, prev); - ret = ContextList_Enum(ms->crls, pPrev); - if (!ret) - SetLastError(CRYPT_E_NOT_FOUND); - - TRACE("returning %p\n", ret); - return ret; + return MemStore_enumContext(ms, &ms->crls, prev); } -static BOOL CRYPT_MemDeleteCrl(PWINECRYPT_CERTSTORE store, void *pCrlContext) +static BOOL MemStore_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *context) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - BOOL ret; - if (ContextList_Remove(ms->crls, pCrlContext)) - ret = CertFreeCRLContext(pCrlContext); - else - ret = TRUE; - return ret; + TRACE("(%p, %p)\n", store, context); + + return MemStore_deleteContext(ms, context); } -static BOOL CRYPT_MemAddCtl(PWINECRYPT_CERTSTORE store, void *ctl, - void *toReplace, const void **ppStoreContext) +static BOOL MemStore_addCTL(WINECRYPT_CERTSTORE *store, context_t *ctl, + context_t *toReplace, context_t **ppStoreContext, BOOL use_link) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - PCTL_CONTEXT context; TRACE("(%p, %p, %p, %p)\n", store, ctl, toReplace, ppStoreContext); - context = ContextList_Add(ms->ctls, ctl, toReplace); - if (context) - { - context->hCertStore = store; - if (ppStoreContext) - *ppStoreContext = CertDuplicateCTLContext(context); - } - return context != 0; + return MemStore_addContext(ms, &ms->ctls, ctl, toReplace, ppStoreContext, use_link); } -static void *CRYPT_MemEnumCtl(PWINECRYPT_CERTSTORE store, void *pPrev) +static context_t *MemStore_enumCTL(WINECRYPT_CERTSTORE *store, context_t *prev) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - void *ret; - TRACE("(%p, %p)\n", store, pPrev); + TRACE("(%p, %p)\n", store, prev); - ret = ContextList_Enum(ms->ctls, pPrev); - if (!ret) - SetLastError(CRYPT_E_NOT_FOUND); - - TRACE("returning %p\n", ret); - return ret; + return MemStore_enumContext(ms, &ms->ctls, prev); } -static BOOL CRYPT_MemDeleteCtl(PWINECRYPT_CERTSTORE store, void *pCtlContext) +static BOOL MemStore_deleteCTL(WINECRYPT_CERTSTORE *store, context_t *context) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - BOOL ret; - if (ContextList_Remove(ms->ctls, pCtlContext)) - ret = CertFreeCTLContext(pCtlContext); - else - ret = TRUE; - return ret; + TRACE("(%p, %p)\n", store, context); + + return MemStore_deleteContext(ms, context); } -static BOOL WINAPI CRYPT_MemControl(HCERTSTORE hCertStore, DWORD dwFlags, +static void MemStore_addref(WINECRYPT_CERTSTORE *store) +{ + LONG ref = InterlockedIncrement(&store->ref); + TRACE("ref = %d\n", ref); +} + +static DWORD MemStore_release(WINECRYPT_CERTSTORE *cert_store, DWORD flags) +{ + WINE_MEMSTORE *store = (WINE_MEMSTORE*)cert_store; + LONG ref; + + if(flags & ~CERT_CLOSE_STORE_CHECK_FLAG) + FIXME("Unimplemented flags %x\n", flags); + + ref = InterlockedDecrement(&store->hdr.ref); + TRACE("(%p) ref=%d\n", store, ref); + if(ref) + return (flags & CERT_CLOSE_STORE_CHECK_FLAG) ? CRYPT_E_PENDING_CLOSE : ERROR_SUCCESS; + + free_contexts(&store->certs); + free_contexts(&store->crls); + free_contexts(&store->ctls); + store->cs.DebugInfo->Spare[0] = 0; + DeleteCriticalSection(&store->cs); + CRYPT_FreeStore(&store->hdr); + return ERROR_SUCCESS; +} + +static BOOL MemStore_control(WINECRYPT_CERTSTORE *store, DWORD dwFlags, DWORD dwCtrlType, void const *pvCtrlPara) { SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; } -static void WINAPI CRYPT_MemCloseStore(HCERTSTORE hCertStore, DWORD dwFlags) -{ - WINE_MEMSTORE *store = hCertStore; - - TRACE("(%p, %08x)\n", store, dwFlags); - if (dwFlags) - FIXME("Unimplemented flags: %08x\n", dwFlags); - - ContextList_Free(store->certs); - ContextList_Free(store->crls); - ContextList_Free(store->ctls); - CRYPT_FreeStore((PWINECRYPT_CERTSTORE)store); -} +static const store_vtbl_t MemStoreVtbl = { + MemStore_addref, + MemStore_release, + MemStore_releaseContext, + MemStore_control, + { + MemStore_addCert, + MemStore_enumCert, + MemStore_deleteCert + }, { + MemStore_addCRL, + MemStore_enumCRL, + MemStore_deleteCRL + }, { + MemStore_addCTL, + MemStore_enumCTL, + MemStore_deleteCTL + } +}; static WINECRYPT_CERTSTORE *CRYPT_MemOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) { - PWINE_MEMSTORE store; + WINE_MEMSTORE *store; TRACE("(%ld, %08x, %p)\n", hCryptProv, dwFlags, pvPara); @@ -308,41 +377,29 @@ static WINECRYPT_CERTSTORE *CRYPT_MemOpenStore(HCRYPTPROV hCryptProv, if (store) { memset(store, 0, sizeof(WINE_MEMSTORE)); - CRYPT_InitStore(&store->hdr, dwFlags, StoreTypeMem); - store->hdr.closeStore = CRYPT_MemCloseStore; - store->hdr.certs.addContext = CRYPT_MemAddCert; - store->hdr.certs.enumContext = CRYPT_MemEnumCert; - store->hdr.certs.deleteContext = CRYPT_MemDeleteCert; - store->hdr.crls.addContext = CRYPT_MemAddCrl; - store->hdr.crls.enumContext = CRYPT_MemEnumCrl; - store->hdr.crls.deleteContext = CRYPT_MemDeleteCrl; - store->hdr.ctls.addContext = CRYPT_MemAddCtl; - store->hdr.ctls.enumContext = CRYPT_MemEnumCtl; - store->hdr.ctls.deleteContext = CRYPT_MemDeleteCtl; - store->hdr.control = CRYPT_MemControl; - store->certs = ContextList_Create(pCertInterface, - sizeof(CERT_CONTEXT)); - store->crls = ContextList_Create(pCRLInterface, - sizeof(CRL_CONTEXT)); - store->ctls = ContextList_Create(pCTLInterface, - sizeof(CTL_CONTEXT)); + CRYPT_InitStore(&store->hdr, dwFlags, StoreTypeMem, &MemStoreVtbl); + InitializeCriticalSection(&store->cs); + store->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ContextList.cs"); + list_init(&store->certs); + list_init(&store->crls); + list_init(&store->ctls); /* Mem store doesn't need crypto provider, so close it */ if (hCryptProv && !(dwFlags & CERT_STORE_NO_CRYPT_RELEASE_FLAG)) CryptReleaseContext(hCryptProv, 0); } } - return (PWINECRYPT_CERTSTORE)store; + return (WINECRYPT_CERTSTORE*)store; } static const WCHAR rootW[] = { 'R','o','o','t',0 }; -static PWINECRYPT_CERTSTORE CRYPT_SysRegOpenStoreW(HCRYPTPROV hCryptProv, +static WINECRYPT_CERTSTORE *CRYPT_SysRegOpenStoreW(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) { static const WCHAR fmt[] = { '%','s','\\','%','s',0 }; LPCWSTR storeName = pvPara; LPWSTR storePath; - PWINECRYPT_CERTSTORE store = NULL; + WINECRYPT_CERTSTORE *store = NULL; HKEY root; LPCWSTR base; @@ -448,11 +505,11 @@ static PWINECRYPT_CERTSTORE CRYPT_SysRegOpenStoreW(HCRYPTPROV hCryptProv, return store; } -static PWINECRYPT_CERTSTORE CRYPT_SysRegOpenStoreA(HCRYPTPROV hCryptProv, +static WINECRYPT_CERTSTORE *CRYPT_SysRegOpenStoreA(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) { int len; - PWINECRYPT_CERTSTORE ret = NULL; + WINECRYPT_CERTSTORE *ret = NULL; TRACE("(%ld, %08x, %s)\n", hCryptProv, dwFlags, debugstr_a(pvPara)); @@ -477,7 +534,7 @@ static PWINECRYPT_CERTSTORE CRYPT_SysRegOpenStoreA(HCRYPTPROV hCryptProv, return ret; } -static PWINECRYPT_CERTSTORE CRYPT_SysOpenStoreW(HCRYPTPROV hCryptProv, +static WINECRYPT_CERTSTORE *CRYPT_SysOpenStoreW(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) { HCERTSTORE store = 0; @@ -549,11 +606,11 @@ static PWINECRYPT_CERTSTORE CRYPT_SysOpenStoreW(HCRYPTPROV hCryptProv, return store; } -static PWINECRYPT_CERTSTORE CRYPT_SysOpenStoreA(HCRYPTPROV hCryptProv, +static WINECRYPT_CERTSTORE *CRYPT_SysOpenStoreA(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) { int len; - PWINECRYPT_CERTSTORE ret = NULL; + WINECRYPT_CERTSTORE *ret = NULL; TRACE("(%ld, %08x, %s)\n", hCryptProv, dwFlags, debugstr_a(pvPara)); @@ -590,12 +647,12 @@ static void *msgProvFuncs[] = { CRYPT_MsgCloseStore, }; -static PWINECRYPT_CERTSTORE CRYPT_MsgOpenStore(HCRYPTPROV hCryptProv, +static WINECRYPT_CERTSTORE *CRYPT_MsgOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) { - PWINECRYPT_CERTSTORE store = NULL; + WINECRYPT_CERTSTORE *store = NULL; HCRYPTMSG msg = (HCRYPTMSG)pvPara; - PWINECRYPT_CERTSTORE memStore; + WINECRYPT_CERTSTORE *memStore; TRACE("(%ld, %08x, %p)\n", hCryptProv, dwFlags, pvPara); @@ -669,11 +726,11 @@ static PWINECRYPT_CERTSTORE CRYPT_MsgOpenStore(HCRYPTPROV hCryptProv, return store; } -static PWINECRYPT_CERTSTORE CRYPT_PKCSOpenStore(HCRYPTPROV hCryptProv, +static WINECRYPT_CERTSTORE *CRYPT_PKCSOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) { HCRYPTMSG msg; - PWINECRYPT_CERTSTORE store = NULL; + WINECRYPT_CERTSTORE *store = NULL; const CRYPT_DATA_BLOB *data = pvPara; BOOL ret; DWORD msgOpenFlags = dwFlags & CERT_STORE_NO_CRYPT_RELEASE_FLAG ? 0 : @@ -710,7 +767,7 @@ static PWINECRYPT_CERTSTORE CRYPT_PKCSOpenStore(HCRYPTPROV hCryptProv, return store; } -static PWINECRYPT_CERTSTORE CRYPT_SerializedOpenStore(HCRYPTPROV hCryptProv, +static WINECRYPT_CERTSTORE *CRYPT_SerializedOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) { HCERTSTORE store; @@ -735,10 +792,10 @@ static PWINECRYPT_CERTSTORE CRYPT_SerializedOpenStore(HCRYPTPROV hCryptProv, } } TRACE("returning %p\n", store); - return (PWINECRYPT_CERTSTORE)store; + return (WINECRYPT_CERTSTORE*)store; } -static PWINECRYPT_CERTSTORE CRYPT_PhysOpenStoreW(HCRYPTPROV hCryptProv, +static WINECRYPT_CERTSTORE *CRYPT_PhysOpenStoreW(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) { if (dwFlags & CERT_SYSTEM_STORE_RELOCATE_FLAG) @@ -862,142 +919,10 @@ HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV_LEGACY hProv, CERT_SYSTEM_STORE_CURRENT_USER, szSubSystemProtocol); } -#define CertContext_CopyProperties(to, from) \ - Context_CopyProperties((to), (from), sizeof(CERT_CONTEXT)) - -BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore, - PCCERT_CONTEXT pCertContext, DWORD dwAddDisposition, - PCCERT_CONTEXT *ppStoreContext) -{ - PWINECRYPT_CERTSTORE store = hCertStore; - BOOL ret = TRUE; - PCCERT_CONTEXT toAdd = NULL, existing = NULL; - - TRACE("(%p, %p, %08x, %p)\n", hCertStore, pCertContext, - dwAddDisposition, ppStoreContext); - - switch (dwAddDisposition) - { - case CERT_STORE_ADD_ALWAYS: - break; - case CERT_STORE_ADD_NEW: - case CERT_STORE_ADD_REPLACE_EXISTING: - case CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES: - case CERT_STORE_ADD_USE_EXISTING: - case CERT_STORE_ADD_NEWER: - case CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES: - { - BYTE hashToAdd[20]; - DWORD size = sizeof(hashToAdd); - - ret = CertGetCertificateContextProperty(pCertContext, CERT_HASH_PROP_ID, - hashToAdd, &size); - if (ret) - { - CRYPT_HASH_BLOB blob = { sizeof(hashToAdd), hashToAdd }; - - existing = CertFindCertificateInStore(hCertStore, - pCertContext->dwCertEncodingType, 0, CERT_FIND_SHA1_HASH, &blob, - NULL); - } - break; - } - default: - FIXME("Unimplemented add disposition %d\n", dwAddDisposition); - SetLastError(E_INVALIDARG); - ret = FALSE; - } - - switch (dwAddDisposition) - { - case CERT_STORE_ADD_ALWAYS: - toAdd = CertDuplicateCertificateContext(pCertContext); - break; - case CERT_STORE_ADD_NEW: - if (existing) - { - TRACE("found matching certificate, not adding\n"); - SetLastError(CRYPT_E_EXISTS); - ret = FALSE; - } - else - toAdd = CertDuplicateCertificateContext(pCertContext); - break; - case CERT_STORE_ADD_REPLACE_EXISTING: - toAdd = CertDuplicateCertificateContext(pCertContext); - break; - case CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES: - toAdd = CertDuplicateCertificateContext(pCertContext); - if (existing) - CertContext_CopyProperties(toAdd, existing); - break; - case CERT_STORE_ADD_USE_EXISTING: - if (existing) - { - CertContext_CopyProperties(existing, pCertContext); - if (ppStoreContext) - *ppStoreContext = CertDuplicateCertificateContext(existing); - } - else - toAdd = CertDuplicateCertificateContext(pCertContext); - break; - case CERT_STORE_ADD_NEWER: - if (existing) - { - if (CompareFileTime(&existing->pCertInfo->NotBefore, - &pCertContext->pCertInfo->NotBefore) >= 0) - { - TRACE("existing certificate is newer, not adding\n"); - SetLastError(CRYPT_E_EXISTS); - ret = FALSE; - } - else - toAdd = CertDuplicateCertificateContext(pCertContext); - } - else - toAdd = CertDuplicateCertificateContext(pCertContext); - break; - case CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES: - if (existing) - { - if (CompareFileTime(&existing->pCertInfo->NotBefore, - &pCertContext->pCertInfo->NotBefore) >= 0) - { - TRACE("existing certificate is newer, not adding\n"); - SetLastError(CRYPT_E_EXISTS); - ret = FALSE; - } - else - { - toAdd = CertDuplicateCertificateContext(pCertContext); - CertContext_CopyProperties(toAdd, existing); - } - } - else - toAdd = CertDuplicateCertificateContext(pCertContext); - break; - } - - if (toAdd) - { - if (store) - ret = store->certs.addContext(store, (void *)toAdd, - (void *)existing, (const void **)ppStoreContext); - else if (ppStoreContext) - *ppStoreContext = CertDuplicateCertificateContext(toAdd); - CertFreeCertificateContext(toAdd); - } - CertFreeCertificateContext(existing); - - TRACE("returning %d\n", ret); - return ret; -} - -PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, - PCCERT_CONTEXT pPrev) +PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pPrev) { + cert_t *prev = pPrev ? cert_from_ptr(pPrev) : NULL, *ret; WINECRYPT_CERTSTORE *hcs = hCertStore; - PCCERT_CONTEXT ret; TRACE("(%p, %p)\n", hCertStore, pPrev); if (!hCertStore) @@ -1005,42 +930,32 @@ PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, else if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) ret = NULL; else - ret = (PCCERT_CONTEXT)hcs->certs.enumContext(hcs, (void *)pPrev); - return ret; + ret = (cert_t*)hcs->vtbl->certs.enumContext(hcs, prev ? &prev->base : NULL); + return ret ? &ret->ctx : NULL; } BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext) { - BOOL ret; + WINECRYPT_CERTSTORE *hcs; TRACE("(%p)\n", pCertContext); if (!pCertContext) - ret = TRUE; - else if (!pCertContext->hCertStore) - ret = CertFreeCertificateContext(pCertContext); - else - { - PWINECRYPT_CERTSTORE hcs = pCertContext->hCertStore; + return TRUE; - if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) - ret = FALSE; - else - ret = hcs->certs.deleteContext(hcs, (void *)pCertContext); - if (ret) - ret = CertFreeCertificateContext(pCertContext); - } - return ret; + hcs = pCertContext->hCertStore; + + if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) + return FALSE; + + return hcs->vtbl->certs.delete(hcs, &cert_from_ptr(pCertContext)->base); } -#define CrlContext_CopyProperties(to, from) \ - Context_CopyProperties((to), (from), sizeof(CRL_CONTEXT)) - BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore, PCCRL_CONTEXT pCrlContext, DWORD dwAddDisposition, PCCRL_CONTEXT* ppStoreContext) { - PWINECRYPT_CERTSTORE store = hCertStore; + WINECRYPT_CERTSTORE *store = hCertStore; BOOL ret = TRUE; PCCRL_CONTEXT toAdd = NULL, existing = NULL; @@ -1101,7 +1016,7 @@ BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore, if (newer < 0) { toAdd = CertDuplicateCRLContext(pCrlContext); - CrlContext_CopyProperties(toAdd, existing); + Context_CopyProperties(toAdd, existing); } else { @@ -1119,12 +1034,12 @@ BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore, case CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES: toAdd = CertDuplicateCRLContext(pCrlContext); if (existing) - CrlContext_CopyProperties(toAdd, existing); + Context_CopyProperties(toAdd, existing); break; case CERT_STORE_ADD_USE_EXISTING: if (existing) { - CrlContext_CopyProperties(existing, pCrlContext); + Context_CopyProperties(existing, pCrlContext); if (ppStoreContext) *ppStoreContext = CertDuplicateCRLContext(existing); } @@ -1138,14 +1053,19 @@ BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore, if (toAdd) { - if (store) - ret = store->crls.addContext(store, (void *)toAdd, - (void *)existing, (const void **)ppStoreContext); - else if (ppStoreContext) + if (store) { + context_t *ret_context; + ret = store->vtbl->crls.addContext(store, context_from_ptr(toAdd), + existing ? context_from_ptr(existing) : NULL, ppStoreContext ? &ret_context : NULL, FALSE); + if (ret && ppStoreContext) + *ppStoreContext = context_ptr(ret_context); + }else if (ppStoreContext) { *ppStoreContext = CertDuplicateCRLContext(toAdd); + } CertFreeCRLContext(toAdd); } - CertFreeCRLContext(existing); + if (existing) + CertFreeCRLContext(existing); TRACE("returning %d\n", ret); return ret; @@ -1153,33 +1073,29 @@ BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore, BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext) { + WINECRYPT_CERTSTORE *hcs; BOOL ret; TRACE("(%p)\n", pCrlContext); if (!pCrlContext) - ret = TRUE; - else if (!pCrlContext->hCertStore) - ret = CertFreeCRLContext(pCrlContext); - else - { - PWINECRYPT_CERTSTORE hcs = pCrlContext->hCertStore; + return TRUE; - if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) - ret = FALSE; - else - ret = hcs->crls.deleteContext(hcs, (void *)pCrlContext); - if (ret) - ret = CertFreeCRLContext(pCrlContext); - } + hcs = pCrlContext->hCertStore; + + if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) + return FALSE; + + ret = hcs->vtbl->crls.delete(hcs, &crl_from_ptr(pCrlContext)->base); + if (ret) + ret = CertFreeCRLContext(pCrlContext); return ret; } -PCCRL_CONTEXT WINAPI CertEnumCRLsInStore(HCERTSTORE hCertStore, - PCCRL_CONTEXT pPrev) +PCCRL_CONTEXT WINAPI CertEnumCRLsInStore(HCERTSTORE hCertStore, PCCRL_CONTEXT pPrev) { + crl_t *ret, *prev = pPrev ? crl_from_ptr(pPrev) : NULL; WINECRYPT_CERTSTORE *hcs = hCertStore; - PCCRL_CONTEXT ret; TRACE("(%p, %p)\n", hCertStore, pPrev); if (!hCertStore) @@ -1187,8 +1103,8 @@ PCCRL_CONTEXT WINAPI CertEnumCRLsInStore(HCERTSTORE hCertStore, else if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) ret = NULL; else - ret = (PCCRL_CONTEXT)hcs->crls.enumContext(hcs, (void *)pPrev); - return ret; + ret = (crl_t*)hcs->vtbl->crls.enumContext(hcs, prev ? &prev->base : NULL); + return ret ? &ret->ctx : NULL; } HCERTSTORE WINAPI CertDuplicateStore(HCERTSTORE hCertStore) @@ -1198,13 +1114,14 @@ HCERTSTORE WINAPI CertDuplicateStore(HCERTSTORE hCertStore) TRACE("(%p)\n", hCertStore); if (hcs && hcs->dwMagic == WINE_CRYPTCERTSTORE_MAGIC) - InterlockedIncrement(&hcs->ref); + hcs->vtbl->addref(hcs); return hCertStore; } BOOL WINAPI CertCloseStore(HCERTSTORE hCertStore, DWORD dwFlags) { WINECRYPT_CERTSTORE *hcs = hCertStore; + DWORD res; TRACE("(%p, %08x)\n", hCertStore, dwFlags); @@ -1214,16 +1131,12 @@ BOOL WINAPI CertCloseStore(HCERTSTORE hCertStore, DWORD dwFlags) if ( hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC ) return FALSE; - if (hcs->ref <= 0) - ERR("%p's ref count is %d\n", hcs, hcs->ref); - if (InterlockedDecrement(&hcs->ref) == 0) - { - TRACE("%p's ref count is 0, freeing\n", hcs); - hcs->dwMagic = 0; - hcs->closeStore(hcs, dwFlags); + res = hcs->vtbl->release(hcs, dwFlags); + if (res != ERROR_SUCCESS) { + SetLastError(res); + return FALSE; } - else - TRACE("%p's ref count is %d\n", hcs, hcs->ref); + return TRUE; } @@ -1242,8 +1155,8 @@ BOOL WINAPI CertControlStore(HCERTSTORE hCertStore, DWORD dwFlags, ret = FALSE; else { - if (hcs->control) - ret = hcs->control(hCertStore, dwFlags, dwCtrlType, pvCtrlPara); + if (hcs->vtbl->control) + ret = hcs->vtbl->control(hcs, dwFlags, dwCtrlType, pvCtrlPara); else ret = TRUE; } @@ -1253,7 +1166,7 @@ BOOL WINAPI CertControlStore(HCERTSTORE hCertStore, DWORD dwFlags, BOOL WINAPI CertGetStoreProperty(HCERTSTORE hCertStore, DWORD dwPropId, void *pvData, DWORD *pcbData) { - PWINECRYPT_CERTSTORE store = hCertStore; + WINECRYPT_CERTSTORE *store = hCertStore; BOOL ret = FALSE; TRACE("(%p, %d, %p, %p)\n", hCertStore, dwPropId, pvData, pcbData); @@ -1317,7 +1230,7 @@ BOOL WINAPI CertGetStoreProperty(HCERTSTORE hCertStore, DWORD dwPropId, BOOL WINAPI CertSetStoreProperty(HCERTSTORE hCertStore, DWORD dwPropId, DWORD dwFlags, const void *pvData) { - PWINECRYPT_CERTSTORE store = hCertStore; + WINECRYPT_CERTSTORE *store = hCertStore; BOOL ret = FALSE; TRACE("(%p, %d, %08x, %p)\n", hCertStore, dwPropId, dwFlags, pvData); @@ -1463,3 +1376,81 @@ BOOL WINAPI CertRegisterPhysicalStore(const void *pvSystemStore, DWORD dwFlags, dwFlags, debugstr_w(pwszStoreName), pStoreInfo, pvReserved); return FALSE; } + +static void EmptyStore_addref(WINECRYPT_CERTSTORE *store) +{ + TRACE("(%p)\n", store); +} + +static DWORD EmptyStore_release(WINECRYPT_CERTSTORE *store, DWORD flags) +{ + TRACE("(%p)\n", store); + return E_UNEXPECTED; +} + +static void EmptyStore_releaseContext(WINECRYPT_CERTSTORE *store, context_t *context) +{ + Context_Free(context); +} + +static BOOL EmptyStore_add(WINECRYPT_CERTSTORE *store, context_t *context, + context_t *replace, context_t **ret_context, BOOL use_link) +{ + TRACE("(%p, %p, %p, %p)\n", store, context, replace, ret_context); + + /* FIXME: We should clone the context */ + if(ret_context) { + Context_AddRef(context); + *ret_context = context; + } + + return TRUE; +} + +static context_t *EmptyStore_enum(WINECRYPT_CERTSTORE *store, context_t *prev) +{ + TRACE("(%p, %p)\n", store, prev); + + SetLastError(CRYPT_E_NOT_FOUND); + return NULL; +} + +static BOOL EmptyStore_delete(WINECRYPT_CERTSTORE *store, context_t *context) +{ + return TRUE; +} + +static BOOL EmptyStore_control(WINECRYPT_CERTSTORE *store, DWORD flags, DWORD ctrl_type, void const *ctrl_para) +{ + TRACE("()\n"); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +static const store_vtbl_t EmptyStoreVtbl = { + EmptyStore_addref, + EmptyStore_release, + EmptyStore_releaseContext, + EmptyStore_control, + { + EmptyStore_add, + EmptyStore_enum, + EmptyStore_delete + }, { + EmptyStore_add, + EmptyStore_enum, + EmptyStore_delete + }, { + EmptyStore_add, + EmptyStore_enum, + EmptyStore_delete + } +}; + +WINECRYPT_CERTSTORE empty_store; + +void init_empty_store(void) +{ + CRYPT_InitStore(&empty_store, CERT_STORE_READONLY_FLAG, StoreTypeEmpty, &EmptyStoreVtbl); +} diff --git a/dll/win32/crypt32/str.c b/dll/win32/crypt32/str.c index 5974d4ccc34..f58927aff1a 100644 --- a/dll/win32/crypt32/str.c +++ b/dll/win32/crypt32/str.c @@ -448,7 +448,7 @@ DWORD WINAPI CertNameToStrA(DWORD dwCertEncodingType, PCERT_NAME_BLOB pName, for (j = 0; (!psz || ret < csz) && j < rdn->cRDNAttr; j++) { DWORD chars; - char prefixBuf[10]; /* big enough for GivenName */ + char prefixBuf[13]; /* big enough for SERIALNUMBER */ LPCSTR prefix = NULL; if ((dwStrType & 0x000000ff) == CERT_OID_NAME_STR) diff --git a/dll/win32/cryptnet/cryptnet_main.c b/dll/win32/cryptnet/cryptnet_main.c index 43454e85456..e7d0bd8a85f 100644 --- a/dll/win32/cryptnet/cryptnet_main.c +++ b/dll/win32/cryptnet/cryptnet_main.c @@ -466,7 +466,6 @@ static BOOL CRYPT_GetObjectFromFile(HANDLE hFile, PCRYPT_BLOB_ARRAY pObject) blob.pbData = CryptMemAlloc(size.u.LowPart); if (blob.pbData) { - blob.cbData = size.u.LowPart; ret = ReadFile(hFile, blob.pbData, size.u.LowPart, &blob.cbData, NULL); if (ret) @@ -1427,61 +1426,24 @@ static BOOL CRYPT_GetCreateFunction(LPCSTR pszObjectOid, return ret; } -typedef BOOL (*get_object_expiration_func)(const void *pvContext, - FILETIME *expiration); - -static BOOL CRYPT_GetExpirationFromCert(const void *pvObject, FILETIME *expiration) +static BOOL CRYPT_GetExpiration(const void *object, const char *pszObjectOid, FILETIME *expiration) { - PCCERT_CONTEXT cert = pvObject; + if (!IS_INTOID(pszObjectOid)) + return FALSE; - *expiration = cert->pCertInfo->NotAfter; - return TRUE; -} - -static BOOL CRYPT_GetExpirationFromCRL(const void *pvObject, FILETIME *expiration) -{ - PCCRL_CONTEXT cert = pvObject; - - *expiration = cert->pCrlInfo->NextUpdate; - return TRUE; -} - -static BOOL CRYPT_GetExpirationFromCTL(const void *pvObject, FILETIME *expiration) -{ - PCCTL_CONTEXT cert = pvObject; - - *expiration = cert->pCtlInfo->NextUpdate; - return TRUE; -} - -static BOOL CRYPT_GetExpirationFunction(LPCSTR pszObjectOid, - get_object_expiration_func *getExpiration) -{ - BOOL ret; - - if (IS_INTOID(pszObjectOid)) - { - switch (LOWORD(pszObjectOid)) - { - case LOWORD(CONTEXT_OID_CERTIFICATE): - *getExpiration = CRYPT_GetExpirationFromCert; - ret = TRUE; - break; - case LOWORD(CONTEXT_OID_CRL): - *getExpiration = CRYPT_GetExpirationFromCRL; - ret = TRUE; - break; - case LOWORD(CONTEXT_OID_CTL): - *getExpiration = CRYPT_GetExpirationFromCTL; - ret = TRUE; - break; - default: - ret = FALSE; - } + switch (LOWORD(pszObjectOid)) { + case LOWORD(CONTEXT_OID_CERTIFICATE): + *expiration = ((const CERT_CONTEXT*)object)->pCertInfo->NotAfter; + return TRUE; + case LOWORD(CONTEXT_OID_CRL): + *expiration = ((const CRL_CONTEXT*)object)->pCrlInfo->NextUpdate; + return TRUE; + case LOWORD(CONTEXT_OID_CTL): + *expiration = ((const CTL_CONTEXT*)object)->pCtlInfo->NextUpdate; + return TRUE; } - else - ret = FALSE; - return ret; + + return FALSE; } /*********************************************************************** @@ -1514,22 +1476,18 @@ BOOL WINAPI CryptRetrieveObjectByUrlW(LPCWSTR pszURL, LPCSTR pszObjectOid, CRYPT_BLOB_ARRAY object = { 0, NULL }; PFN_FREE_ENCODED_OBJECT_FUNC freeObject; void *freeContext; + FILETIME expires; ret = retrieve(pszURL, pszObjectOid, dwRetrievalFlags, dwTimeout, &object, &freeObject, &freeContext, hAsyncRetrieve, pCredentials, pAuxInfo); if (ret) { - get_object_expiration_func getExpiration; - ret = create(pszObjectOid, dwRetrievalFlags, &object, ppvObject); if (ret && !(dwRetrievalFlags & CRYPT_DONT_CACHE_RESULT) && - CRYPT_GetExpirationFunction(pszObjectOid, &getExpiration)) + CRYPT_GetExpiration(*ppvObject, pszObjectOid, &expires)) { - FILETIME expires; - - if (getExpiration(*ppvObject, &expires)) - CRYPT_CacheURL(pszURL, &object, dwRetrievalFlags, expires); + CRYPT_CacheURL(pszURL, &object, dwRetrievalFlags, expires); } freeObject(pszObjectOid, &object, freeContext); } @@ -1814,14 +1772,14 @@ typedef struct _CERT_REVOCATION_PARA_NO_EXTRA_FIELDS { HCERTSTORE *rgCertStore; HCERTSTORE hCrlStore; LPFILETIME pftTimeToUse; -} CERT_REVOCATION_PARA_NO_EXTRA_FIELDS, *PCERT_REVOCATION_PARA_NO_EXTRA_FIELDS; +} CERT_REVOCATION_PARA_NO_EXTRA_FIELDS; typedef struct _OLD_CERT_REVOCATION_STATUS { DWORD cbSize; DWORD dwIndex; DWORD dwError; DWORD dwReason; -} OLD_CERT_REVOCATION_STATUS, *POLD_CERT_REVOCATION_STATUS; +} OLD_CERT_REVOCATION_STATUS; /*********************************************************************** * CertDllVerifyRevocation (CRYPTNET.@) diff --git a/dll/win32/dwmapi/dwmapi_main.c b/dll/win32/dwmapi/dwmapi_main.c index bf2b6ff342d..7ffba90d6c0 100644 --- a/dll/win32/dwmapi/dwmapi_main.c +++ b/dll/win32/dwmapi/dwmapi_main.c @@ -116,7 +116,9 @@ HRESULT WINAPI DwmFlush(void) */ HRESULT WINAPI DwmSetWindowAttribute(HWND hwnd, DWORD attributenum, LPCVOID attribute, DWORD size) { - FIXME("(%p, %x, %p, %x) stub\n", hwnd, attributenum, attribute, size); + static BOOL once; + + if (!once++) FIXME("(%p, %x, %p, %x) stub\n", hwnd, attributenum, attribute, size); return E_NOTIMPL; } diff --git a/dll/win32/gdiplus/brush.c b/dll/win32/gdiplus/brush.c index c4f433f522b..3382b6b43bf 100644 --- a/dll/win32/gdiplus/brush.c +++ b/dll/win32/gdiplus/brush.c @@ -756,8 +756,6 @@ GpStatus WINGDIPAPI GdipCreateTexture2(GpImage *image, GpWrapMode wrapmode, /****************************************************************************** * GdipCreateTextureIA [GDIPLUS.@] - * - * FIXME: imageattr ignored */ GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image, GDIPCONST GpImageAttributes *imageattr, REAL x, REAL y, REAL width, @@ -855,6 +853,7 @@ GpStatus WINGDIPAPI GdipCreateTexture2I(GpImage *image, GpWrapMode wrapmode, imageattr->wrap = wrapmode; stat = GdipCreateTextureIA(image, imageattr, x, y, width, height, texture); + GdipDisposeImageAttributes(imageattr); } return stat; diff --git a/dll/win32/gdiplus/font.c b/dll/win32/gdiplus/font.c index 7c055a69e47..c710f5b35ee 100644 --- a/dll/win32/gdiplus/font.c +++ b/dll/win32/gdiplus/font.c @@ -1112,15 +1112,39 @@ GpStatus WINGDIPAPI GdipDeletePrivateFontCollection(GpFontCollection **fontColle /***************************************************************************** * GdipPrivateAddFontFile [GDIPLUS.@] */ -GpStatus WINGDIPAPI GdipPrivateAddFontFile(GpFontCollection* fontCollection, - GDIPCONST WCHAR* filename) +GpStatus WINGDIPAPI GdipPrivateAddFontFile(GpFontCollection *collection, GDIPCONST WCHAR *name) { - FIXME("stub: %p, %s\n", fontCollection, debugstr_w(filename)); + HANDLE file, mapping; + LARGE_INTEGER size; + void *mem; + GpStatus status; - if (!(fontCollection && filename)) + TRACE("%p, %s\n", collection, debugstr_w(name)); + + if (!collection || !name) return InvalidParameter; + + file = CreateFileW(name, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); + if (file == INVALID_HANDLE_VALUE) return InvalidParameter; + + if (!GetFileSizeEx(file, &size) || size.u.HighPart) + { + CloseHandle(file); return InvalidParameter; + } - return NotImplemented; + mapping = CreateFileMappingW(file, NULL, PAGE_READONLY, 0, 0, NULL); + CloseHandle(file); + if (!mapping) return InvalidParameter; + + mem = MapViewOfFile(mapping, FILE_MAP_READ, 0, 0, 0); + CloseHandle(mapping); + if (!mem) return InvalidParameter; + + /* GdipPrivateAddMemoryFont creates a copy of the memory block */ + status = GdipPrivateAddMemoryFont(collection, mem, size.u.LowPart); + UnmapViewOfFile(mem); + + return status; } #define TT_PLATFORM_APPLE_UNICODE 0 diff --git a/dll/win32/gdiplus/gdiplus.c b/dll/win32/gdiplus/gdiplus.c index 7be681a3659..2204e6a3c2e 100644 --- a/dll/win32/gdiplus/gdiplus.c +++ b/dll/win32/gdiplus/gdiplus.c @@ -357,7 +357,7 @@ REAL units_scale(GpUnit from, GpUnit to, REAL dpi) } /* Calculates Bezier points from cardinal spline points. */ -void calc_curve_bezier(CONST GpPointF *pts, REAL tension, REAL *x1, +void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1, REAL *y1, REAL *x2, REAL *y2) { REAL xdiff, ydiff; @@ -442,7 +442,7 @@ void delete_element(region_element* element) case RegionDataRect: break; case RegionDataPath: - GdipDeletePath(element->elementdata.pathdata.path); + GdipDeletePath(element->elementdata.path); break; case RegionDataEmptyRect: case RegionDataInfiniteRect: @@ -456,13 +456,13 @@ void delete_element(region_element* element) } } -const char *debugstr_rectf(CONST RectF* rc) +const char *debugstr_rectf(const RectF* rc) { if (!rc) return "(null)"; return wine_dbg_sprintf("(%0.2f,%0.2f,%0.2f,%0.2f)", rc->X, rc->Y, rc->Width, rc->Height); } -const char *debugstr_pointf(CONST PointF* pt) +const char *debugstr_pointf(const PointF* pt) { if (!pt) return "(null)"; return wine_dbg_sprintf("(%0.2f,%0.2f)", pt->X, pt->Y); diff --git a/dll/win32/gdiplus/gdiplus_private.h b/dll/win32/gdiplus/gdiplus_private.h index 94ec592abd6..b98349257a5 100644 --- a/dll/win32/gdiplus/gdiplus_private.h +++ b/dll/win32/gdiplus/gdiplus_private.h @@ -65,10 +65,12 @@ extern GpStatus graphics_from_image(GpImage *image, GpGraphics **graphics) DECLS extern GpStatus METAFILE_GetGraphicsContext(GpMetafile* metafile, GpGraphics **result) DECLSPEC_HIDDEN; extern GpStatus METAFILE_GetDC(GpMetafile* metafile, HDC *hdc) DECLSPEC_HIDDEN; extern GpStatus METAFILE_ReleaseDC(GpMetafile* metafile, HDC hdc) DECLSPEC_HIDDEN; +extern GpStatus METAFILE_FillRectangles(GpMetafile* metafile, GpBrush* brush, + GDIPCONST GpRectF* rects, INT count) DECLSPEC_HIDDEN; +extern GpStatus METAFILE_SetPageTransform(GpMetafile* metafile, GpUnit unit, REAL scale) DECLSPEC_HIDDEN; extern GpStatus METAFILE_GraphicsDeleted(GpMetafile* metafile) DECLSPEC_HIDDEN; -extern MetafileType METAFILE_GetEmfType(HENHMETAFILE hemf) DECLSPEC_HIDDEN; -extern void calc_curve_bezier(CONST GpPointF *pts, REAL tension, REAL *x1, +extern void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1, REAL *y1, REAL *x2, REAL *y2) DECLSPEC_HIDDEN; extern void calc_curve_bezier_endp(REAL xend, REAL yend, REAL xadj, REAL yadj, REAL tension, REAL *x, REAL *y) DECLSPEC_HIDDEN; @@ -122,9 +124,9 @@ static inline ARGB color_over(ARGB bg, ARGB fg) return (a<<24)|(r<<16)|(g<<8)|b; } -extern const char *debugstr_rectf(CONST RectF* rc) DECLSPEC_HIDDEN; +extern const char *debugstr_rectf(const RectF* rc) DECLSPEC_HIDDEN; -extern const char *debugstr_pointf(CONST PointF* pt) DECLSPEC_HIDDEN; +extern const char *debugstr_pointf(const PointF* pt) DECLSPEC_HIDDEN; extern void convert_32bppARGB_to_32bppPARGB(UINT width, UINT height, BYTE *dst_bits, INT dst_stride, const BYTE *src_bits, INT src_stride) DECLSPEC_HIDDEN; @@ -304,8 +306,12 @@ struct GpMetafile{ GpGraphics *playback_graphics; HDC playback_dc; GpPointF playback_points[3]; + GpRectF src_rect; HANDLETABLE *handle_table; int handle_count; + GpMatrix *world_transform; + GpUnit page_unit; + REAL page_scale; }; struct GpBitmap{ @@ -412,17 +418,7 @@ struct region_element union { GpRectF rect; - struct - { - GpPath* path; - struct - { - DWORD size; - DWORD magic; - DWORD count; - DWORD flags; - } pathheader; - } pathdata; + GpPath *path; struct { struct region_element *left; /* the original region */ @@ -432,13 +428,7 @@ struct region_element }; struct GpRegion{ - struct - { - DWORD size; - DWORD checksum; - DWORD magic; - DWORD num_children; - } header; + DWORD num_children; region_element node; }; diff --git a/dll/win32/gdiplus/graphics.c b/dll/win32/gdiplus/graphics.c index 0a6cdcc70ef..8be792a8831 100644 --- a/dll/win32/gdiplus/graphics.c +++ b/dll/win32/gdiplus/graphics.c @@ -617,7 +617,7 @@ static ARGB transform_color(ARGB color, const ColorMatrix *matrix) return (a << 24) | (r << 16) | (g << 8) | b; } -static int color_is_gray(ARGB color) +static BOOL color_is_gray(ARGB color) { unsigned char r, g, b; @@ -940,12 +940,12 @@ static REAL intersect_line_scanline(const GpPointF *p1, const GpPointF *p2, REAL return (p1->X - p2->X) * (p2->Y - y) / (p2->Y - p1->Y) + p2->X; } -static INT brush_can_fill_path(GpBrush *brush) +static BOOL brush_can_fill_path(GpBrush *brush) { switch (brush->bt) { case BrushTypeSolidColor: - return 1; + return TRUE; case BrushTypeHatchFill: { GpHatch *hatch = (GpHatch*)brush; @@ -956,7 +956,7 @@ static INT brush_can_fill_path(GpBrush *brush) case BrushTypeTextureFill: /* Gdi32 isn't much help with these, so we should use brush_fill_pixels instead. */ default: - return 0; + return FALSE; } } @@ -1008,7 +1008,7 @@ static void brush_fill_path(GpGraphics *graphics, GpBrush* brush) } } -static INT brush_can_fill_pixels(GpBrush *brush) +static BOOL brush_can_fill_pixels(GpBrush *brush) { switch (brush->bt) { @@ -1017,9 +1017,9 @@ static INT brush_can_fill_pixels(GpBrush *brush) case BrushTypeLinearGradient: case BrushTypeTextureFill: case BrushTypePathGradient: - return 1; + return TRUE; default: - return 0; + return FALSE; } } @@ -1239,7 +1239,7 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush, INT min_y, max_y, min_x, max_x; INT x, y; ARGB outer_color; - static int transform_fixme_once; + static BOOL transform_fixme_once; if (fill->focus.X != 0.0 || fill->focus.Y != 0.0) { @@ -1276,7 +1276,7 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush, if (!is_identity) { FIXME("path gradient transform not implemented\n"); - transform_fixme_once = 1; + transform_fixme_once = TRUE; } } @@ -1310,7 +1310,7 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush, for (i=0; ipathdata.Count; i++) { int start_center_line=0, end_center_line=0; - int seen_start=0, seen_end=0, seen_center=0; + BOOL seen_start = FALSE, seen_end = FALSE, seen_center = FALSE; REAL center_distance; ARGB start_color, end_color; REAL dy, dx; @@ -1370,17 +1370,17 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush, if (!seen_start && yf >= start_point.Y) { - seen_start = 1; + seen_start = TRUE; start_center_line ^= 1; } if (!seen_end && yf >= end_point.Y) { - seen_end = 1; + seen_end = TRUE; end_center_line ^= 1; } if (!seen_center && yf >= center_point.Y) { - seen_center = 1; + seen_center = TRUE; start_center_line ^= 1; end_center_line ^= 1; } @@ -2243,120 +2243,6 @@ GpStatus WINGDIPAPI GdipCreateFromHWNDICM(HWND hwnd, GpGraphics **graphics) return GdipCreateFromHWND(hwnd, graphics); } -GpStatus WINGDIPAPI GdipCreateMetafileFromEmf(HENHMETAFILE hemf, BOOL delete, - GpMetafile **metafile) -{ - ENHMETAHEADER header; - MetafileType metafile_type; - - TRACE("(%p,%i,%p)\n", hemf, delete, metafile); - - if(!hemf || !metafile) - return InvalidParameter; - - if (GetEnhMetaFileHeader(hemf, sizeof(header), &header) == 0) - return GenericError; - - metafile_type = METAFILE_GetEmfType(hemf); - - if (metafile_type == MetafileTypeInvalid) - return GenericError; - - *metafile = GdipAlloc(sizeof(GpMetafile)); - if (!*metafile) - return OutOfMemory; - - (*metafile)->image.type = ImageTypeMetafile; - (*metafile)->image.format = ImageFormatEMF; - (*metafile)->image.frame_count = 1; - (*metafile)->image.xres = (REAL)header.szlDevice.cx; - (*metafile)->image.yres = (REAL)header.szlDevice.cy; - (*metafile)->bounds.X = (REAL)header.rclBounds.left; - (*metafile)->bounds.Y = (REAL)header.rclBounds.top; - (*metafile)->bounds.Width = (REAL)(header.rclBounds.right - header.rclBounds.left); - (*metafile)->bounds.Height = (REAL)(header.rclBounds.bottom - header.rclBounds.top); - (*metafile)->unit = UnitPixel; - (*metafile)->metafile_type = metafile_type; - (*metafile)->hemf = hemf; - (*metafile)->preserve_hemf = !delete; - - TRACE("<-- %p\n", *metafile); - - return Ok; -} - -GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete, - GDIPCONST WmfPlaceableFileHeader * placeable, GpMetafile **metafile) -{ - UINT read; - BYTE *copy; - HENHMETAFILE hemf; - GpStatus retval = Ok; - - TRACE("(%p, %d, %p, %p)\n", hwmf, delete, placeable, metafile); - - if(!hwmf || !metafile || !placeable) - return InvalidParameter; - - *metafile = NULL; - read = GetMetaFileBitsEx(hwmf, 0, NULL); - if(!read) - return GenericError; - copy = GdipAlloc(read); - GetMetaFileBitsEx(hwmf, read, copy); - - hemf = SetWinMetaFileBits(read, copy, NULL, NULL); - GdipFree(copy); - - /* FIXME: We should store and use hwmf instead of converting to hemf */ - retval = GdipCreateMetafileFromEmf(hemf, TRUE, metafile); - - if (retval == Ok) - { - (*metafile)->image.xres = (REAL)placeable->Inch; - (*metafile)->image.yres = (REAL)placeable->Inch; - (*metafile)->bounds.X = ((REAL)placeable->BoundingBox.Left) / ((REAL)placeable->Inch); - (*metafile)->bounds.Y = ((REAL)placeable->BoundingBox.Top) / ((REAL)placeable->Inch); - (*metafile)->bounds.Width = (REAL)(placeable->BoundingBox.Right - - placeable->BoundingBox.Left); - (*metafile)->bounds.Height = (REAL)(placeable->BoundingBox.Bottom - - placeable->BoundingBox.Top); - (*metafile)->metafile_type = MetafileTypeWmfPlaceable; - (*metafile)->image.format = ImageFormatWMF; - - if (delete) DeleteMetaFile(hwmf); - } - else - DeleteEnhMetaFile(hemf); - return retval; -} - -GpStatus WINGDIPAPI GdipCreateMetafileFromWmfFile(GDIPCONST WCHAR *file, - GDIPCONST WmfPlaceableFileHeader * placeable, GpMetafile **metafile) -{ - HMETAFILE hmf = GetMetaFileW(file); - - TRACE("(%s, %p, %p)\n", debugstr_w(file), placeable, metafile); - - if(!hmf) return InvalidParameter; - - return GdipCreateMetafileFromWmf(hmf, TRUE, placeable, metafile); -} - -GpStatus WINGDIPAPI GdipCreateMetafileFromFile(GDIPCONST WCHAR *file, - GpMetafile **metafile) -{ - FIXME("(%p, %p): stub\n", file, metafile); - return NotImplemented; -} - -GpStatus WINGDIPAPI GdipCreateMetafileFromStream(IStream *stream, - GpMetafile **metafile) -{ - FIXME("(%p, %p): stub\n", stream, metafile); - return NotImplemented; -} - GpStatus WINGDIPAPI GdipCreateStreamOnFile(GDIPCONST WCHAR * filename, UINT access, IStream **stream) { @@ -2405,6 +2291,12 @@ GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics) } GdipDeleteRegion(graphics->clip); + + /* Native returns ObjectBusy on the second free, instead of crashing as we'd + * do otherwise, but we can't have that in the test suite because it means + * accessing freed memory. */ + graphics->busy = TRUE; + GdipFree(graphics); return Ok; @@ -2885,9 +2777,33 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image debugstr_pointf(&points[2])); memcpy(ptf, points, 3 * sizeof(GpPointF)); + + /* Ensure source width/height is positive */ + if (srcwidth < 0) + { + GpPointF tmp = ptf[1]; + srcx = srcx + srcwidth; + srcwidth = -srcwidth; + ptf[2].X = ptf[2].X + ptf[1].X - ptf[0].X; + ptf[2].Y = ptf[2].Y + ptf[1].Y - ptf[0].Y; + ptf[1] = ptf[0]; + ptf[0] = tmp; + } + + if (srcheight < 0) + { + GpPointF tmp = ptf[2]; + srcy = srcy + srcheight; + srcheight = -srcheight; + ptf[1].X = ptf[1].X + ptf[2].X - ptf[0].X; + ptf[1].Y = ptf[1].Y + ptf[2].Y - ptf[0].Y; + ptf[2] = ptf[0]; + ptf[0] = tmp; + } + ptf[3].X = ptf[2].X + ptf[1].X - ptf[0].X; ptf[3].Y = ptf[2].Y + ptf[1].Y - ptf[0].Y; - if (!srcwidth || !srcheight || ptf[3].X == ptf[0].X || ptf[3].Y == ptf[0].Y) + if (!srcwidth || !srcheight || (ptf[3].X == ptf[0].X && ptf[3].Y == ptf[0].Y)) return Ok; transform_and_round_points(graphics, pti, ptf, 4); @@ -2919,7 +2835,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image else if (image->type == ImageTypeBitmap) { GpBitmap* bitmap = (GpBitmap*)image; - int use_software=0; + BOOL use_software = FALSE; TRACE("graphics: %.2fx%.2f dpi, fmt %#x, scale %f, image: %.2fx%.2f dpi, fmt %#x, color %08x\n", graphics->xres, graphics->yres, @@ -2933,11 +2849,12 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image ptf[1].X - ptf[0].X != srcwidth || ptf[2].Y - ptf[0].Y != srcheight || srcx < 0 || srcy < 0 || srcx + srcwidth > bitmap->width || srcy + srcheight > bitmap->height) - use_software = 1; + use_software = TRUE; if (use_software) { RECT dst_area; + GpRectF graphics_bounds; GpRect src_area; int i, x, y, src_stride, dst_stride; GpMatrix dst_to_src; @@ -2963,8 +2880,18 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image if (dst_area.bottom < pti[i].y) dst_area.bottom = pti[i].y; } + stat = get_graphics_bounds(graphics, &graphics_bounds); + if (stat != Ok) return stat; + + if (graphics_bounds.X > dst_area.left) dst_area.left = floorf(graphics_bounds.X); + if (graphics_bounds.Y > dst_area.top) dst_area.top = floorf(graphics_bounds.Y); + if (graphics_bounds.X + graphics_bounds.Width < dst_area.right) dst_area.right = ceilf(graphics_bounds.X + graphics_bounds.Width); + if (graphics_bounds.Y + graphics_bounds.Height < dst_area.bottom) dst_area.bottom = ceilf(graphics_bounds.Y + graphics_bounds.Height); + TRACE("dst_area: %s\n", wine_dbgstr_rect(&dst_area)); + if (IsRectEmpty(&dst_area)) return Ok; + m11 = (ptf[1].X - ptf[0].X) / srcwidth; m21 = (ptf[2].X - ptf[0].X) / srcheight; mdx = ptf[0].X - m11 * srcx - m21 * srcy; @@ -3010,8 +2937,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image if (stat != Ok) { - if (src_data != dst_data) - GdipFree(src_data); + GdipFree(src_data); GdipFree(dst_data); return stat; } @@ -3060,7 +2986,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image else { HDC hdc; - int temp_hdc=0, temp_bitmap=0; + BOOL temp_hdc = FALSE, temp_bitmap = FALSE; HBITMAP hbitmap, old_hbm=NULL; if (!(bitmap->format == PixelFormat16bppRGB555 || @@ -3074,8 +3000,8 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image /* we can't draw a bitmap of this format directly */ hdc = CreateCompatibleDC(0); - temp_hdc = 1; - temp_bitmap = 1; + temp_hdc = TRUE; + temp_bitmap = TRUE; bih.biSize = sizeof(BITMAPINFOHEADER); bih.biWidth = bitmap->width; @@ -3109,7 +3035,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image else { GdipCreateHBITMAPFromBitmap(bitmap, &hbitmap, 0); - temp_bitmap = 1; + temp_bitmap = TRUE; } hdc = bitmap->hdc; @@ -3338,6 +3264,7 @@ GpStatus WINGDIPAPI GdipDrawPath(GpGraphics *graphics, GpPen *pen, GpPath *path) { INT save_state; GpStatus retval; + HRGN hrgn=NULL; TRACE("(%p, %p, %p)\n", graphics, pen, path); @@ -3355,10 +3282,20 @@ GpStatus WINGDIPAPI GdipDrawPath(GpGraphics *graphics, GpPen *pen, GpPath *path) save_state = prepare_dc(graphics, pen); + retval = get_clip_hrgn(graphics, &hrgn); + + if (retval != Ok) + goto end; + + if (hrgn) + ExtSelectClipRgn(graphics->hdc, hrgn, RGN_AND); + retval = draw_poly(graphics, pen, path->pathdata.Points, path->pathdata.Types, path->pathdata.Count, TRUE); +end: restore_dc(graphics, save_state); + DeleteObject(hrgn); return retval; } @@ -3603,6 +3540,7 @@ static GpStatus GDI32_GdipFillPath(GpGraphics *graphics, GpBrush *brush, GpPath { INT save_state; GpStatus retval; + HRGN hrgn=NULL; if(!graphics->hdc || !brush_can_fill_path(brush)) return NotImplemented; @@ -3612,6 +3550,14 @@ static GpStatus GDI32_GdipFillPath(GpGraphics *graphics, GpBrush *brush, GpPath SetPolyFillMode(graphics->hdc, (path->fill == FillModeAlternate ? ALTERNATE : WINDING)); + retval = get_clip_hrgn(graphics, &hrgn); + + if (retval != Ok) + goto end; + + if (hrgn) + ExtSelectClipRgn(graphics->hdc, hrgn, RGN_AND); + BeginPath(graphics->hdc); retval = draw_poly(graphics, NULL, path->pathdata.Points, path->pathdata.Types, path->pathdata.Count, FALSE); @@ -3626,6 +3572,7 @@ static GpStatus GDI32_GdipFillPath(GpGraphics *graphics, GpBrush *brush, GpPath end: RestoreDC(graphics->hdc, save_state); + DeleteObject(hrgn); return retval; } @@ -3795,38 +3742,31 @@ GpStatus WINGDIPAPI GdipFillPolygon2I(GpGraphics *graphics, GpBrush *brush, GpStatus WINGDIPAPI GdipFillRectangle(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, REAL width, REAL height) { - GpStatus stat; - GpPath *path; + GpRectF rect; TRACE("(%p, %p, %.2f, %.2f, %.2f, %.2f)\n", graphics, brush, x, y, width, height); - if(!graphics || !brush) - return InvalidParameter; + rect.X = x; + rect.Y = y; + rect.Width = width; + rect.Height = height; - if(graphics->busy) - return ObjectBusy; - - stat = GdipCreatePath(FillModeAlternate, &path); - - if (stat == Ok) - { - stat = GdipAddPathRectangle(path, x, y, width, height); - - if (stat == Ok) - stat = GdipFillPath(graphics, brush, path); - - GdipDeletePath(path); - } - - return stat; + return GdipFillRectangles(graphics, brush, &rect, 1); } GpStatus WINGDIPAPI GdipFillRectangleI(GpGraphics *graphics, GpBrush *brush, INT x, INT y, INT width, INT height) { + GpRectF rect; + TRACE("(%p, %p, %d, %d, %d, %d)\n", graphics, brush, x, y, width, height); - return GdipFillRectangle(graphics, brush, x, y, width, height); + rect.X = (REAL)x; + rect.Y = (REAL)y; + rect.Width = (REAL)width; + rect.Height = (REAL)height; + + return GdipFillRectangles(graphics, brush, &rect, 1); } GpStatus WINGDIPAPI GdipFillRectangles(GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRectF *rects, @@ -3837,9 +3777,16 @@ GpStatus WINGDIPAPI GdipFillRectangles(GpGraphics *graphics, GpBrush *brush, GDI TRACE("(%p, %p, %p, %d)\n", graphics, brush, rects, count); - if(!rects) + if(!graphics || !brush || !rects || count <= 0) return InvalidParameter; + if (graphics->image && graphics->image->type == ImageTypeMetafile) + { + status = METAFILE_FillRectangles((GpMetafile*)graphics->image, brush, rects, count); + /* FIXME: Add gdi32 drawing. */ + return status; + } + status = GdipCreatePath(FillModeAlternate, &path); if (status != Ok) return status; @@ -4440,13 +4387,25 @@ GpStatus gdip_format_string(HDC hdc, INT *hotkeyprefix_offsets=NULL; INT hotkeyprefix_count=0; INT hotkeyprefix_pos=0, hotkeyprefix_end_pos=0; - int seen_prefix=0; + BOOL seen_prefix = FALSE; + GpStringFormat *dyn_format=NULL; if(length == -1) length = lstrlenW(string); stringdup = GdipAlloc((length + 1) * sizeof(WCHAR)); if(!stringdup) return OutOfMemory; + if (!format) + { + stat = GdipStringFormatGetGenericDefault(&dyn_format); + if (stat != Ok) + { + GdipFree(stringdup); + return stat; + } + format = dyn_format; + } + nwidth = rect->Width; nheight = rect->Height; if (ignore_empty_clip) @@ -4455,10 +4414,7 @@ GpStatus gdip_format_string(HDC hdc, if (!nheight) nheight = INT_MAX; } - if (format) - hkprefix = format->hkprefix; - else - hkprefix = HotkeyPrefixNone; + hkprefix = format->hkprefix; if (hkprefix == HotkeyPrefixShow) { @@ -4487,11 +4443,11 @@ GpStatus gdip_format_string(HDC hdc, hotkeyprefix_offsets[hotkeyprefix_count++] = j; else if (!seen_prefix && hkprefix != HotkeyPrefixNone && string[i] == '&') { - seen_prefix = 1; + seen_prefix = TRUE; continue; } - seen_prefix = 0; + seen_prefix = FALSE; stringdup[j] = string[i]; j++; @@ -4499,8 +4455,7 @@ GpStatus gdip_format_string(HDC hdc, length = j; - if (format) halign = format->align; - else halign = StringAlignmentNear; + halign = format->align; while(sum < length){ GetTextExtentExPointW(hdc, stringdup + sum, length - sum, @@ -4547,7 +4502,11 @@ GpStatus gdip_format_string(HDC hdc, bounds.Width = size.cx; if(height + size.cy > nheight) + { + if (format->attr & StringFormatFlagsLineLimit) + break; bounds.Height = nheight - (height + size.cy); + } else bounds.Height = size.cy; @@ -4589,13 +4548,13 @@ GpStatus gdip_format_string(HDC hdc, break; /* Stop if this was a linewrap (but not if it was a linebreak). */ - if ((lret == fitcpy) && format && - (format->attr & (StringFormatFlagsNoWrap | StringFormatFlagsLineLimit))) + if ((lret == fitcpy) && (format->attr & StringFormatFlagsNoWrap)) break; } GdipFree(stringdup); GdipFree(hotkeyprefix_offsets); + GdipDeleteStringFormat(dyn_format); return stat; } @@ -5239,6 +5198,8 @@ GpStatus WINGDIPAPI GdipSetInterpolationMode(GpGraphics *graphics, GpStatus WINGDIPAPI GdipSetPageScale(GpGraphics *graphics, REAL scale) { + GpStatus stat; + TRACE("(%p, %.2f)\n", graphics, scale); if(!graphics || (scale <= 0.0)) @@ -5247,6 +5208,13 @@ GpStatus WINGDIPAPI GdipSetPageScale(GpGraphics *graphics, REAL scale) if(graphics->busy) return ObjectBusy; + if (graphics->image && graphics->image->type == ImageTypeMetafile) + { + stat = METAFILE_SetPageTransform((GpMetafile*)graphics->image, graphics->unit, scale); + if (stat != Ok) + return stat; + } + graphics->scale = scale; return Ok; @@ -5254,6 +5222,8 @@ GpStatus WINGDIPAPI GdipSetPageScale(GpGraphics *graphics, REAL scale) GpStatus WINGDIPAPI GdipSetPageUnit(GpGraphics *graphics, GpUnit unit) { + GpStatus stat; + TRACE("(%p, %d)\n", graphics, unit); if(!graphics) @@ -5265,6 +5235,13 @@ GpStatus WINGDIPAPI GdipSetPageUnit(GpGraphics *graphics, GpUnit unit) if(unit == UnitWorld) return InvalidParameter; + if (graphics->image && graphics->image->type == ImageTypeMetafile) + { + stat = METAFILE_SetPageTransform((GpMetafile*)graphics->image, unit, graphics->scale); + if (stat != Ok) + return stat; + } + graphics->unit = unit; return Ok; @@ -5528,19 +5505,6 @@ GpStatus WINGDIPAPI GdipSetClipRegion(GpGraphics *graphics, GpRegion *region, return status; } -GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit(GpMetafile *metafile, - UINT limitDpi) -{ - static int calls; - - TRACE("(%p,%u)\n", metafile, limitDpi); - - if(!(calls++)) - FIXME("not implemented\n"); - - return NotImplemented; -} - GpStatus WINGDIPAPI GdipDrawPolygon(GpGraphics *graphics,GpPen *pen,GDIPCONST GpPointF *points, INT count) { @@ -6204,15 +6168,18 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI if (glyphsize > max_glyphsize) max_glyphsize = glyphsize; - left = pti[i].x + glyphmetrics.gmptGlyphOrigin.x; - top = pti[i].y - glyphmetrics.gmptGlyphOrigin.y; - right = pti[i].x + glyphmetrics.gmptGlyphOrigin.x + glyphmetrics.gmBlackBoxX; - bottom = pti[i].y - glyphmetrics.gmptGlyphOrigin.y + glyphmetrics.gmBlackBoxY; + if (glyphsize != 0) + { + left = pti[i].x + glyphmetrics.gmptGlyphOrigin.x; + top = pti[i].y - glyphmetrics.gmptGlyphOrigin.y; + right = pti[i].x + glyphmetrics.gmptGlyphOrigin.x + glyphmetrics.gmBlackBoxX; + bottom = pti[i].y - glyphmetrics.gmptGlyphOrigin.y + glyphmetrics.gmBlackBoxY; - if (left < min_x) min_x = left; - if (top < min_y) min_y = top; - if (right > max_x) max_x = right; - if (bottom > max_y) max_y = bottom; + if (left < min_x) min_x = left; + if (top < min_y) min_y = top; + if (right > max_x) max_x = right; + if (bottom > max_y) max_y = bottom; + } if (i+1 < length && (flags & DriverStringOptionsRealizedAdvance) == DriverStringOptionsRealizedAdvance) { @@ -6221,6 +6188,10 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI } } + if (max_glyphsize == 0) + /* Nothing to draw. */ + return Ok; + glyph_mask = GdipAlloc(max_glyphsize); text_mask = GdipAlloc((max_x - min_x) * (max_y - min_y)); text_mask_stride = max_x - min_x; @@ -6238,11 +6209,15 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI /* Generate a mask for the text */ for (i=0; iscale; y += gm.gmCellIncY * args->scale; - GdipFree(ph); + GdipFree(origph); if (status != Ok) break; } @@ -1837,8 +1837,9 @@ static void widen_cap(const GpPointF *endpoint, const GpPointF *nextpoint, } } -static void widen_open_figure(GpPath *path, GpPen *pen, int start, int end, - path_list_node_t **last_point) +static void widen_open_figure(const GpPointF *points, GpPen *pen, int start, int end, + GpLineCap start_cap, GpCustomLineCap *start_custom, GpLineCap end_cap, + GpCustomLineCap *end_custom, path_list_node_t **last_point) { int i; path_list_node_t *prev_point; @@ -1848,22 +1849,22 @@ static void widen_open_figure(GpPath *path, GpPen *pen, int start, int end, prev_point = *last_point; - widen_cap(&path->pathdata.Points[start], &path->pathdata.Points[start+1], - pen, pen->startcap, pen->customstart, FALSE, TRUE, last_point); + widen_cap(&points[start], &points[start+1], + pen, start_cap, start_custom, FALSE, TRUE, last_point); for (i=start+1; ipathdata.Points[i-1], &path->pathdata.Points[i], - &path->pathdata.Points[i+1], pen, last_point); + widen_joint(&points[i-1], &points[i], + &points[i+1], pen, last_point); - widen_cap(&path->pathdata.Points[end], &path->pathdata.Points[end-1], - pen, pen->endcap, pen->customend, TRUE, TRUE, last_point); + widen_cap(&points[end], &points[end-1], + pen, end_cap, end_custom, TRUE, TRUE, last_point); for (i=end-1; i>start; i--) - widen_joint(&path->pathdata.Points[i+1], &path->pathdata.Points[i], - &path->pathdata.Points[i-1], pen, last_point); + widen_joint(&points[i+1], &points[i], + &points[i-1], pen, last_point); - widen_cap(&path->pathdata.Points[start], &path->pathdata.Points[start+1], - pen, pen->startcap, pen->customstart, TRUE, FALSE, last_point); + widen_cap(&points[start], &points[start+1], + pen, start_cap, start_custom, TRUE, FALSE, last_point); prev_point->next->type = PathPointTypeStart; (*last_point)->type |= PathPointTypeCloseSubpath; @@ -1911,6 +1912,134 @@ static void widen_closed_figure(GpPath *path, GpPen *pen, int start, int end, (*last_point)->type |= PathPointTypeCloseSubpath; } +static void widen_dashed_figure(GpPath *path, GpPen *pen, int start, int end, + int closed, path_list_node_t **last_point) +{ + int i, j; + REAL dash_pos=0.0; + int dash_index=0; + const REAL *dash_pattern; + int dash_count; + GpPointF *tmp_points; + REAL segment_dy; + REAL segment_dx; + REAL segment_length; + REAL segment_pos; + int num_tmp_points=0; + int draw_start_cap=0; + static const REAL dash_dot_dot[6] = { 3.0, 1.0, 1.0, 1.0, 1.0, 1.0 }; + + if (end <= start) + return; + + switch (pen->dash) + { + case DashStyleDash: + default: + dash_pattern = dash_dot_dot; + dash_count = 2; + break; + case DashStyleDot: + dash_pattern = &dash_dot_dot[2]; + dash_count = 2; + break; + case DashStyleDashDot: + dash_pattern = dash_dot_dot; + dash_count = 4; + break; + case DashStyleDashDotDot: + dash_pattern = dash_dot_dot; + dash_count = 6; + break; + case DashStyleCustom: + dash_pattern = pen->dashes; + dash_count = pen->numdashes; + break; + } + + tmp_points = GdipAlloc((end - start + 2) * sizeof(GpPoint)); + if (!tmp_points) return; /* FIXME */ + + if (!closed) + draw_start_cap = 1; + + for (j=start; j <= end; j++) + { + if (j == start) + { + if (closed) + i = end; + else + continue; + } + else + i = j-1; + + segment_dy = path->pathdata.Points[j].Y - path->pathdata.Points[i].Y; + segment_dx = path->pathdata.Points[j].X - path->pathdata.Points[i].X; + segment_length = sqrtf(segment_dy*segment_dy + segment_dx*segment_dx); + segment_pos = 0.0; + + while (1) + { + if (dash_pos == 0.0) + { + if ((dash_index % 2) == 0) + { + /* start dash */ + num_tmp_points = 1; + tmp_points[0].X = path->pathdata.Points[i].X + segment_dx * segment_pos / segment_length; + tmp_points[0].Y = path->pathdata.Points[i].Y + segment_dy * segment_pos / segment_length; + } + else + { + /* end dash */ + tmp_points[num_tmp_points].X = path->pathdata.Points[i].X + segment_dx * segment_pos / segment_length; + tmp_points[num_tmp_points].Y = path->pathdata.Points[i].Y + segment_dy * segment_pos / segment_length; + + widen_open_figure(tmp_points, pen, 0, num_tmp_points, + draw_start_cap ? pen->startcap : LineCapFlat, pen->customstart, + LineCapFlat, NULL, last_point); + draw_start_cap = 0; + num_tmp_points = 0; + } + } + + if (dash_pattern[dash_index] - dash_pos > segment_length - segment_pos) + { + /* advance to next segment */ + if ((dash_index % 2) == 0) + { + tmp_points[num_tmp_points] = path->pathdata.Points[j]; + num_tmp_points++; + } + dash_pos += segment_length - segment_pos; + break; + } + else + { + /* advance to next dash in pattern */ + segment_pos += dash_pattern[dash_index] - dash_pos; + dash_pos = 0.0; + if (++dash_index == dash_count) + dash_index = 0; + continue; + } + } + } + + if (dash_index % 2 == 0 && num_tmp_points != 0) + { + /* last dash overflows last segment */ + tmp_points[num_tmp_points] = path->pathdata.Points[end]; + widen_open_figure(tmp_points, pen, 0, num_tmp_points, + draw_start_cap ? pen->startcap : LineCapFlat, pen->customstart, + closed ? LineCapFlat : pen->endcap, pen->customend, last_point); + } + + GdipFree(tmp_points); +} + GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix, REAL flatness) { @@ -1952,9 +2081,6 @@ GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix, if (pen->join == LineJoinRound) FIXME("unimplemented line join %d\n", pen->join); - if (pen->dash != DashStyleSolid) - FIXME("unimplemented dash style %d\n", pen->dash); - if (pen->align != PenAlignmentCenter) FIXME("unimplemented pen alignment %d\n", pen->align); @@ -1967,12 +2093,18 @@ GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix, if ((type&PathPointTypeCloseSubpath) == PathPointTypeCloseSubpath) { - widen_closed_figure(flat_path, pen, subpath_start, i, &last_point); + if (pen->dash != DashStyleSolid) + widen_dashed_figure(flat_path, pen, subpath_start, i, 1, &last_point); + else + widen_closed_figure(flat_path, pen, subpath_start, i, &last_point); } else if (i == flat_path->pathdata.Count-1 || (flat_path->pathdata.Types[i+1]&PathPointTypePathTypeMask) == PathPointTypeStart) { - widen_open_figure(flat_path, pen, subpath_start, i, &last_point); + if (pen->dash != DashStyleSolid) + widen_dashed_figure(flat_path, pen, subpath_start, i, 0, &last_point); + else + widen_open_figure(flat_path->pathdata.Points, pen, subpath_start, i, pen->startcap, pen->customstart, pen->endcap, pen->customend, &last_point); } } diff --git a/dll/win32/gdiplus/image.c b/dll/win32/gdiplus/image.c index 84a05453cb7..4801401df1e 100644 --- a/dll/win32/gdiplus/image.c +++ b/dll/win32/gdiplus/image.c @@ -1105,12 +1105,12 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect, if (flags & ImageLockModeRead) { - static int fixme=0; + static BOOL fixme = FALSE; if (!fixme && (PIXELFORMATBPP(bitmap->format) * act_rect.X) % 8 != 0) { FIXME("Cannot copy rows that don't start at a whole byte.\n"); - fixme = 1; + fixme = TRUE; } stat = convert_pixels(act_rect.Width, act_rect.Height, @@ -1152,7 +1152,7 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap, BitmapData* lockeddata) { GpStatus stat; - static int fixme=0; + static BOOL fixme = FALSE; TRACE("(%p,%p)\n", bitmap, lockeddata); @@ -1182,7 +1182,7 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap, if (!fixme && (PIXELFORMATBPP(bitmap->format) * bitmap->lockx) % 8 != 0) { FIXME("Cannot copy rows that don't start at a whole byte.\n"); - fixme = 1; + fixme = TRUE; } stat = convert_pixels(lockeddata->Width, lockeddata->Height, @@ -1207,9 +1207,6 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap, GpStatus WINGDIPAPI GdipCloneBitmapArea(REAL x, REAL y, REAL width, REAL height, PixelFormat format, GpBitmap* srcBitmap, GpBitmap** dstBitmap) { - BitmapData lockeddata_src, lockeddata_dst; - int i; - UINT row_size; Rect area; GpStatus stat; @@ -1231,39 +1228,41 @@ GpStatus WINGDIPAPI GdipCloneBitmapArea(REAL x, REAL y, REAL width, REAL height, area.Width = gdip_round(width); area.Height = gdip_round(height); - stat = GdipBitmapLockBits(srcBitmap, &area, ImageLockModeRead, format, - &lockeddata_src); - if (stat != Ok) return stat; - - stat = GdipCreateBitmapFromScan0(lockeddata_src.Width, lockeddata_src.Height, - 0, lockeddata_src.PixelFormat, NULL, dstBitmap); + stat = GdipCreateBitmapFromScan0(area.Width, area.Height, 0, format, NULL, dstBitmap); if (stat == Ok) { - stat = GdipBitmapLockBits(*dstBitmap, NULL, ImageLockModeWrite, - lockeddata_src.PixelFormat, &lockeddata_dst); + stat = convert_pixels(area.Width, area.Height, (*dstBitmap)->stride, (*dstBitmap)->bits, (*dstBitmap)->format, + srcBitmap->stride, + srcBitmap->bits + srcBitmap->stride * area.Y + PIXELFORMATBPP(srcBitmap->format) * area.X / 8, + srcBitmap->format, srcBitmap->image.palette); - if (stat == Ok) + if (stat == Ok && srcBitmap->image.palette) { - /* copy the image data */ - row_size = (lockeddata_src.Width * PIXELFORMATBPP(lockeddata_src.PixelFormat) +7)/8; - for (i=0; iimage.palette; + + dst_palette = GdipAlloc(sizeof(UINT) * 2 + sizeof(ARGB) * src_palette->Count); + + if (dst_palette) + { + dst_palette->Flags = src_palette->Flags; + dst_palette->Count = src_palette->Count; + memcpy(dst_palette->Entries, src_palette->Entries, sizeof(ARGB) * src_palette->Count); + + GdipFree((*dstBitmap)->image.palette); + (*dstBitmap)->image.palette = dst_palette; + } + else + stat = OutOfMemory; } if (stat != Ok) GdipDisposeImage((GpImage*)*dstBitmap); } - GdipBitmapUnlockBits(srcBitmap, &lockeddata_src); - if (stat != Ok) - { *dstBitmap = NULL; - } return stat; } @@ -1318,47 +1317,10 @@ GpStatus WINGDIPAPI GdipCloneImage(GpImage *image, GpImage **cloneImage) } else if (image->type == ImageTypeBitmap) { - GpBitmap *bitmap = (GpBitmap*)image; - BitmapData lockeddata_src, lockeddata_dst; - int i; - UINT row_size; + GpBitmap *bitmap = (GpBitmap *)image; - stat = GdipBitmapLockBits(bitmap, NULL, ImageLockModeRead, bitmap->format, - &lockeddata_src); - if (stat != Ok) return stat; - - stat = GdipCreateBitmapFromScan0(lockeddata_src.Width, lockeddata_src.Height, - 0, lockeddata_src.PixelFormat, NULL, (GpBitmap**)cloneImage); - if (stat == Ok) - { - stat = GdipBitmapLockBits((GpBitmap*)*cloneImage, NULL, ImageLockModeWrite, - lockeddata_src.PixelFormat, &lockeddata_dst); - - if (stat == Ok) - { - /* copy the image data */ - row_size = (lockeddata_src.Width * PIXELFORMATBPP(lockeddata_src.PixelFormat) +7)/8; - for (i=0; iformat, &image->format, sizeof(GUID)); - - return stat; + return GdipCloneBitmapAreaI(0, 0, bitmap->width, bitmap->height, + bitmap->format, bitmap, (GpBitmap **)cloneImage); } else if (image->type == ImageTypeMetafile && ((GpMetafile*)image)->hemf) { @@ -1557,27 +1519,6 @@ GpStatus WINGDIPAPI GdipCreateHBITMAPFromBitmap(GpBitmap* bitmap, return stat; } -GpStatus WINGDIPAPI GdipConvertToEmfPlus(const GpGraphics* ref, - GpMetafile* metafile, BOOL* succ, EmfType emfType, - const WCHAR* description, GpMetafile** out_metafile) -{ - static int calls; - - TRACE("(%p,%p,%p,%u,%s,%p)\n", ref, metafile, succ, emfType, - debugstr_w(description), out_metafile); - - if(!ref || !metafile || !out_metafile) - return InvalidParameter; - - *succ = FALSE; - *out_metafile = NULL; - - if(!(calls++)) - FIXME("not implemented\n"); - - return NotImplemented; -} - GpStatus WINGDIPAPI GdipCreateBitmapFromGraphics(INT width, INT height, GpGraphics* target, GpBitmap** bitmap) { @@ -1799,7 +1740,6 @@ static GpStatus get_screen_resolution(REAL *xres, REAL *yres) GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE* scan0, GpBitmap** bitmap) { - BITMAPINFO* pbmi; HBITMAP hbitmap=NULL; INT row_size, dib_stride; BYTE *bits=NULL, *own_bits=NULL; @@ -1829,9 +1769,8 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, if (format & PixelFormatGDI && !(format & (PixelFormatAlpha|PixelFormatIndexed)) && !scan0) { - pbmi = GdipAlloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); - if (!pbmi) - return OutOfMemory; + char bmibuf[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)]; + BITMAPINFO *pbmi = (BITMAPINFO *)bmibuf; pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); pbmi->bmiHeader.biWidth = width; @@ -1848,8 +1787,6 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, hbitmap = CreateDIBSection(0, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0); - GdipFree(pbmi); - if (!hbitmap) return GenericError; stride = dib_stride; @@ -2072,13 +2009,6 @@ GpStatus WINGDIPAPI GdipDrawCachedBitmap(GpGraphics *graphics, return GdipDrawImage(graphics, cachedbmp->image, (REAL)x, (REAL)y); } -GpStatus WINGDIPAPI GdipEmfToWmfBits(HENHMETAFILE hemf, UINT cbData16, - LPBYTE pData16, INT iMapMode, INT eFlags) -{ - FIXME("(%p, %d, %p, %d, %d): stub\n", hemf, cbData16, pData16, iMapMode, eFlags); - return NotImplemented; -} - /* Internal utility function: Replace the image data of dst with that of src, * and free src. */ static void move_bitmap(GpBitmap *dst, GpBitmap *src, BOOL clobber_palette) @@ -2423,76 +2353,6 @@ GpStatus WINGDIPAPI GdipGetImageWidth(GpImage *image, UINT *width) return Ok; } -GpStatus WINGDIPAPI GdipGetMetafileHeaderFromMetafile(GpMetafile * metafile, - MetafileHeader * header) -{ - static int calls; - - TRACE("(%p, %p)\n", metafile, header); - - if(!metafile || !header) - return InvalidParameter; - - if(!(calls++)) - FIXME("not implemented\n"); - - memset(header, 0, sizeof(MetafileHeader)); - - return Ok; -} - -GpStatus WINGDIPAPI GdipGetMetafileHeaderFromEmf(HENHMETAFILE hEmf, - MetafileHeader *header) -{ - static int calls; - - if(!hEmf || !header) - return InvalidParameter; - - if(!(calls++)) - FIXME("not implemented\n"); - - memset(header, 0, sizeof(MetafileHeader)); - - return Ok; -} - -GpStatus WINGDIPAPI GdipGetMetafileHeaderFromFile(GDIPCONST WCHAR *filename, - MetafileHeader *header) -{ - static int calls; - - TRACE("(%s,%p)\n", debugstr_w(filename), header); - - if(!filename || !header) - return InvalidParameter; - - if(!(calls++)) - FIXME("not implemented\n"); - - memset(header, 0, sizeof(MetafileHeader)); - - return Ok; -} - -GpStatus WINGDIPAPI GdipGetMetafileHeaderFromStream(IStream *stream, - MetafileHeader *header) -{ - static int calls; - - TRACE("(%p,%p)\n", stream, header); - - if(!stream || !header) - return InvalidParameter; - - if(!(calls++)) - FIXME("not implemented\n"); - - memset(header, 0, sizeof(MetafileHeader)); - - return Ok; -} - GpStatus WINGDIPAPI GdipGetPropertyCount(GpImage *image, UINT *num) { TRACE("(%p, %p)\n", image, num); @@ -3989,6 +3849,7 @@ static GpStatus encode_image_WIC(GpImage *image, IStream* stream, HRESULT hr; UINT width, height; PixelFormat gdipformat=0; + const WICPixelFormatGUID *desired_wicformat; WICPixelFormatGUID wicformat; GpRect rc; BitmapData lockeddata; @@ -4041,20 +3902,40 @@ static GpStatus encode_image_WIC(GpImage *image, IStream* stream, { if (pixel_formats[i].gdip_format == bitmap->format) { - memcpy(&wicformat, pixel_formats[i].wic_format, sizeof(GUID)); + desired_wicformat = pixel_formats[i].wic_format; gdipformat = bitmap->format; break; } } if (!gdipformat) { - memcpy(&wicformat, &GUID_WICPixelFormat32bppBGRA, sizeof(GUID)); + desired_wicformat = &GUID_WICPixelFormat32bppBGRA; gdipformat = PixelFormat32bppARGB; } + memcpy(&wicformat, desired_wicformat, sizeof(GUID)); hr = IWICBitmapFrameEncode_SetPixelFormat(frameencode, &wicformat); } + if (SUCCEEDED(hr) && !IsEqualGUID(desired_wicformat, &wicformat)) + { + /* Encoder doesn't support this bitmap's format. */ + gdipformat = 0; + for (i=0; pixel_formats[i].wic_format; i++) + { + if (IsEqualGUID(&wicformat, pixel_formats[i].wic_format)) + { + gdipformat = pixel_formats[i].gdip_format; + break; + } + } + if (!gdipformat) + { + ERR("Cannot support encoder format %s\n", debugstr_guid(&wicformat)); + hr = E_FAIL; + } + } + if (SUCCEEDED(hr)) { stat = GdipBitmapLockBits(bitmap, &rc, ImageLockModeRead, gdipformat, @@ -4652,28 +4533,21 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi if (retval == Ok) { HDC hdc; - BITMAPINFO *pbmi; + char bmibuf[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)]; + BITMAPINFO *pbmi = (BITMAPINFO *)bmibuf; INT src_height; hdc = CreateCompatibleDC(NULL); - pbmi = GdipAlloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); - if (pbmi) - { - pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - pbmi->bmiHeader.biBitCount = 0; + pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + pbmi->bmiHeader.biBitCount = 0; - GetDIBits(hdc, hbm, 0, 0, NULL, pbmi, DIB_RGB_COLORS); + GetDIBits(hdc, hbm, 0, 0, NULL, pbmi, DIB_RGB_COLORS); - src_height = abs(pbmi->bmiHeader.biHeight); - pbmi->bmiHeader.biHeight = -src_height; + src_height = abs(pbmi->bmiHeader.biHeight); + pbmi->bmiHeader.biHeight = -src_height; - GetDIBits(hdc, hbm, 0, src_height, lockeddata.Scan0, pbmi, DIB_RGB_COLORS); - - GdipFree(pbmi); - } - else - retval = OutOfMemory; + GetDIBits(hdc, hbm, 0, src_height, lockeddata.Scan0, pbmi, DIB_RGB_COLORS); DeleteDC(hdc); @@ -4781,27 +4655,6 @@ GpStatus WINGDIPAPI GdipTestControl(GpTestControlEnum control, void *param) return Ok; } -GpStatus WINGDIPAPI GdipRecordMetafileFileName(GDIPCONST WCHAR* fileName, - HDC hdc, EmfType type, GDIPCONST GpRectF *pFrameRect, - MetafileFrameUnit frameUnit, GDIPCONST WCHAR *desc, - GpMetafile **metafile) -{ - FIXME("%s %p %d %p %d %s %p stub!\n", debugstr_w(fileName), hdc, type, pFrameRect, - frameUnit, debugstr_w(desc), metafile); - - return NotImplemented; -} - -GpStatus WINGDIPAPI GdipRecordMetafileFileNameI(GDIPCONST WCHAR* fileName, HDC hdc, EmfType type, - GDIPCONST GpRect *pFrameRect, MetafileFrameUnit frameUnit, - GDIPCONST WCHAR *desc, GpMetafile **metafile) -{ - FIXME("%s %p %d %p %d %s %p stub!\n", debugstr_w(fileName), hdc, type, pFrameRect, - frameUnit, debugstr_w(desc), metafile); - - return NotImplemented; -} - GpStatus WINGDIPAPI GdipImageForceValidation(GpImage *image) { TRACE("%p\n", image); @@ -4866,7 +4719,7 @@ GpStatus WINGDIPAPI GdipImageRotateFlip(GpImage *image, RotateFlipType type) GpBitmap *new_bitmap; GpBitmap *bitmap; int bpp, bytesperpixel; - int rotate_90, flip_x, flip_y; + BOOL rotate_90, flip_x, flip_y; int src_x_offset, src_y_offset; LPBYTE src_origin; UINT x, y, width, height; @@ -4975,16 +4828,3 @@ GpStatus WINGDIPAPI GdipImageRotateFlip(GpImage *image, RotateFlipType type) return stat; } - -/***************************************************************************** - * GdipConvertToEmfPlusToFile [GDIPLUS.@] - */ - -GpStatus WINGDIPAPI GdipConvertToEmfPlusToFile(const GpGraphics* refGraphics, - GpMetafile* metafile, BOOL* conversionSuccess, - const WCHAR* filename, EmfType emfType, - const WCHAR* description, GpMetafile** out_metafile) -{ - FIXME("stub: %p, %p, %p, %p, %u, %p, %p\n", refGraphics, metafile, conversionSuccess, filename, emfType, description, out_metafile); - return NotImplemented; -} diff --git a/dll/win32/gdiplus/metafile.c b/dll/win32/gdiplus/metafile.c index 1f717d0628a..5d2cf49e3a7 100644 --- a/dll/win32/gdiplus/metafile.c +++ b/dll/win32/gdiplus/metafile.c @@ -35,6 +35,27 @@ typedef struct EmfPlusHeader DWORD LogicalDpiY; } EmfPlusHeader; +typedef struct EmfPlusFillRects +{ + EmfPlusRecordHeader Header; + DWORD BrushID; + DWORD Count; +} EmfPlusFillRects; + +typedef struct EmfPlusSetPageTransform +{ + EmfPlusRecordHeader Header; + REAL PageScale; +} EmfPlusSetPageTransform; + +typedef struct EmfPlusRect +{ + SHORT X; + SHORT Y; + SHORT Width; + SHORT Height; +} EmfPlusRect; + static GpStatus METAFILE_AllocateRecord(GpMetafile *metafile, DWORD size, void **result) { DWORD size_needed; @@ -211,6 +232,8 @@ GpStatus WINGDIPAPI GdipRecordMetafile(HDC hdc, EmfType type, GDIPCONST GpRectF (*metafile)->image.picture = NULL; (*metafile)->image.flags = ImageFlagsNone; (*metafile)->image.palette = NULL; + (*metafile)->image.xres = 72.0; + (*metafile)->image.yres = 72.0; (*metafile)->bounds = *frameRect; (*metafile)->unit = frameUnit; (*metafile)->metafile_type = type; @@ -267,7 +290,11 @@ GpStatus METAFILE_GetGraphicsContext(GpMetafile* metafile, GpGraphics **result) stat = graphics_from_image((GpImage*)metafile, &metafile->record_graphics); if (stat == Ok) + { *result = metafile->record_graphics; + metafile->record_graphics->xres = 96.0; + metafile->record_graphics->yres = 96.0; + } return stat; } @@ -294,6 +321,108 @@ GpStatus METAFILE_GetDC(GpMetafile* metafile, HDC *hdc) return Ok; } +static BOOL is_integer_rect(const GpRectF *rect) +{ + SHORT x, y, width, height; + x = rect->X; + y = rect->Y; + width = rect->Width; + height = rect->Height; + if (rect->X != (REAL)x || rect->Y != (REAL)y || + rect->Width != (REAL)width || rect->Height != (REAL)height) + return FALSE; + return TRUE; +} + +GpStatus METAFILE_FillRectangles(GpMetafile* metafile, GpBrush* brush, + GDIPCONST GpRectF* rects, INT count) +{ + if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual) + { + EmfPlusFillRects *record; + GpStatus stat; + BOOL integer_rects = TRUE; + int i; + DWORD brushid; + int flags = 0; + + if (brush->bt == BrushTypeSolidColor) + { + flags |= 0x8000; + brushid = ((GpSolidFill*)brush)->color; + } + else + { + FIXME("brush serialization not implemented\n"); + return NotImplemented; + } + + for (i=0; iHeader.Type = EmfPlusRecordTypeFillRects; + record->Header.Flags = flags; + record->BrushID = brushid; + record->Count = count; + + if (integer_rects) + { + EmfPlusRect *record_rects = (EmfPlusRect*)(record+1); + for (i=0; imetafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual) + { + EmfPlusSetPageTransform *record; + GpStatus stat; + + stat = METAFILE_AllocateRecord(metafile, + sizeof(EmfPlusSetPageTransform), + (void**)&record); + if (stat != Ok) + return stat; + + record->Header.Type = EmfPlusRecordTypeSetPageTransform; + record->Header.Flags = unit; + record->PageScale = scale; + + METAFILE_WriteRecords(metafile); + } + + return Ok; +} + GpStatus METAFILE_ReleaseDC(GpMetafile* metafile, HDC hdc) { if (hdc != metafile->record_dc) @@ -368,9 +497,40 @@ static void METAFILE_PlaybackReleaseDC(GpMetafile *metafile) } } +static GpStatus METAFILE_PlaybackUpdateWorldTransform(GpMetafile *metafile) +{ + GpMatrix *real_transform; + GpStatus stat; + + stat = GdipCreateMatrix3(&metafile->src_rect, metafile->playback_points, &real_transform); + + if (stat == Ok) + { + REAL scale = units_to_pixels(1.0, metafile->page_unit, 96.0); + + if (metafile->page_unit != UnitDisplay) + scale *= metafile->page_scale; + + stat = GdipScaleMatrix(real_transform, scale, scale, MatrixOrderPrepend); + + if (stat == Ok) + stat = GdipMultiplyMatrix(real_transform, metafile->world_transform, MatrixOrderPrepend); + + if (stat == Ok) + stat = GdipSetWorldTransform(metafile->playback_graphics, real_transform); + + GdipDeleteMatrix(real_transform); + } + + return stat; +} + GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile, EmfPlusRecordType recordType, UINT flags, UINT dataSize, GDIPCONST BYTE *data) { + GpStatus stat; + GpMetafile *real_metafile = (GpMetafile*)metafile; + TRACE("(%p,%x,%x,%d,%p)\n", metafile, recordType, flags, dataSize, data); if (!metafile || (dataSize && !data) || !metafile->playback_graphics) @@ -402,6 +562,8 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile, } else { + EmfPlusRecordHeader *header = (EmfPlusRecordHeader*)(data)-1; + METAFILE_PlaybackReleaseDC((GpMetafile*)metafile); switch(recordType) @@ -412,6 +574,85 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile, case EmfPlusRecordTypeGetDC: METAFILE_PlaybackGetDC((GpMetafile*)metafile); break; + case EmfPlusRecordTypeFillRects: + { + EmfPlusFillRects *record = (EmfPlusFillRects*)header; + GpBrush *brush, *temp_brush=NULL; + GpRectF *rects, *temp_rects=NULL; + + if (dataSize + sizeof(EmfPlusRecordHeader) < sizeof(EmfPlusFillRects)) + return InvalidParameter; + + if (flags & 0x4000) + { + if (dataSize + sizeof(EmfPlusRecordHeader) < sizeof(EmfPlusFillRects) + sizeof(EmfPlusRect) * record->Count) + return InvalidParameter; + } + else + { + if (dataSize + sizeof(EmfPlusRecordHeader) < sizeof(EmfPlusFillRects) + sizeof(GpRectF) * record->Count) + return InvalidParameter; + } + + if (flags & 0x8000) + { + stat = GdipCreateSolidFill((ARGB)record->BrushID, (GpSolidFill**)&temp_brush); + brush = temp_brush; + } + else + { + FIXME("brush deserialization not implemented\n"); + return NotImplemented; + } + + if (stat == Ok) + { + if (flags & 0x4000) + { + EmfPlusRect *int_rects = (EmfPlusRect*)(record+1); + int i; + + rects = temp_rects = GdipAlloc(sizeof(GpRectF) * record->Count); + if (rects) + { + for (i=0; iCount; i++) + { + rects[i].X = int_rects[i].X; + rects[i].Y = int_rects[i].Y; + rects[i].Width = int_rects[i].Width; + rects[i].Height = int_rects[i].Height; + } + } + else + stat = OutOfMemory; + } + else + rects = (GpRectF*)(record+1); + } + + if (stat == Ok) + { + stat = GdipFillRectangles(metafile->playback_graphics, brush, rects, record->Count); + } + + GdipDeleteBrush(temp_brush); + GdipFree(temp_rects); + + return stat; + } + case EmfPlusRecordTypeSetPageTransform: + { + EmfPlusSetPageTransform *record = (EmfPlusSetPageTransform*)header; + GpUnit unit = (GpUnit)flags; + + if (dataSize + sizeof(EmfPlusRecordHeader) < sizeof(EmfPlusSetPageTransform)) + return InvalidParameter; + + real_metafile->page_unit = unit; + real_metafile->page_scale = record->PageScale; + + return METAFILE_PlaybackUpdateWorldTransform(real_metafile); + } default: FIXME("Not implemented for record type %x\n", recordType); return NotImplemented; @@ -486,6 +727,7 @@ GpStatus WINGDIPAPI GdipEnumerateMetafileSrcRectDestPoints(GpGraphics *graphics, struct enum_metafile_data data; GpStatus stat; GpMetafile *real_metafile = (GpMetafile*)metafile; /* whoever made this const was joking */ + GraphicsContainer state; TRACE("(%p,%p,%p,%i,%p,%i,%p,%p,%p)\n", graphics, metafile, destPoints, count, srcRect, srcUnit, callback, callbackData, @@ -510,19 +752,46 @@ GpStatus WINGDIPAPI GdipEnumerateMetafileSrcRectDestPoints(GpGraphics *graphics, real_metafile->playback_graphics = graphics; real_metafile->playback_dc = NULL; + real_metafile->src_rect = *srcRect; memcpy(real_metafile->playback_points, destPoints, sizeof(PointF) * 3); stat = GdipTransformPoints(graphics, CoordinateSpaceDevice, CoordinateSpaceWorld, real_metafile->playback_points, 3); - if (stat == Ok && (metafile->metafile_type == MetafileTypeEmf || - metafile->metafile_type == MetafileTypeWmfPlaceable || - metafile->metafile_type == MetafileTypeWmf)) - stat = METAFILE_PlaybackGetDC((GpMetafile*)metafile); + if (stat == Ok) + stat = GdipBeginContainer2(graphics, &state); if (stat == Ok) - EnumEnhMetaFile(0, metafile->hemf, enum_metafile_proc, &data, NULL); + { + stat = GdipSetPageScale(graphics, 1.0); - METAFILE_PlaybackReleaseDC((GpMetafile*)metafile); + if (stat == Ok) + stat = GdipSetPageUnit(graphics, UnitPixel); + + if (stat == Ok) + stat = GdipCreateMatrix(&real_metafile->world_transform); + + if (stat == Ok) + { + real_metafile->page_unit = UnitDisplay; + real_metafile->page_scale = 1.0; + stat = METAFILE_PlaybackUpdateWorldTransform(real_metafile); + } + + if (stat == Ok && (metafile->metafile_type == MetafileTypeEmf || + metafile->metafile_type == MetafileTypeWmfPlaceable || + metafile->metafile_type == MetafileTypeWmf)) + stat = METAFILE_PlaybackGetDC(real_metafile); + + if (stat == Ok) + EnumEnhMetaFile(0, metafile->hemf, enum_metafile_proc, &data, NULL); + + METAFILE_PlaybackReleaseDC(real_metafile); + + GdipDeleteMatrix(real_metafile->world_transform); + real_metafile->world_transform = NULL; + + GdipEndContainer(graphics, state); + } real_metafile->playback_graphics = NULL; @@ -623,9 +892,268 @@ static int CALLBACK get_metafile_type_proc(HDC hDC, HANDLETABLE *lpHTable, const return FALSE; } -MetafileType METAFILE_GetEmfType(HENHMETAFILE hemf) +static MetafileType METAFILE_GetEmfType(HENHMETAFILE hemf) { MetafileType result = MetafileTypeInvalid; EnumEnhMetaFile(NULL, hemf, get_metafile_type_proc, &result, NULL); return result; } + +GpStatus WINGDIPAPI GdipGetMetafileHeaderFromMetafile(GpMetafile * metafile, + MetafileHeader * header) +{ + static int calls; + + TRACE("(%p, %p)\n", metafile, header); + + if(!metafile || !header) + return InvalidParameter; + + if(!(calls++)) + FIXME("not implemented\n"); + + memset(header, 0, sizeof(MetafileHeader)); + + return Ok; +} + +GpStatus WINGDIPAPI GdipGetMetafileHeaderFromEmf(HENHMETAFILE hEmf, + MetafileHeader *header) +{ + static int calls; + + if(!hEmf || !header) + return InvalidParameter; + + if(!(calls++)) + FIXME("not implemented\n"); + + memset(header, 0, sizeof(MetafileHeader)); + + return Ok; +} + +GpStatus WINGDIPAPI GdipGetMetafileHeaderFromFile(GDIPCONST WCHAR *filename, + MetafileHeader *header) +{ + static int calls; + + TRACE("(%s,%p)\n", debugstr_w(filename), header); + + if(!filename || !header) + return InvalidParameter; + + if(!(calls++)) + FIXME("not implemented\n"); + + memset(header, 0, sizeof(MetafileHeader)); + + return Ok; +} + +GpStatus WINGDIPAPI GdipGetMetafileHeaderFromStream(IStream *stream, + MetafileHeader *header) +{ + static int calls; + + TRACE("(%p,%p)\n", stream, header); + + if(!stream || !header) + return InvalidParameter; + + if(!(calls++)) + FIXME("not implemented\n"); + + memset(header, 0, sizeof(MetafileHeader)); + + return Ok; +} + +GpStatus WINGDIPAPI GdipCreateMetafileFromEmf(HENHMETAFILE hemf, BOOL delete, + GpMetafile **metafile) +{ + ENHMETAHEADER header; + MetafileType metafile_type; + + TRACE("(%p,%i,%p)\n", hemf, delete, metafile); + + if(!hemf || !metafile) + return InvalidParameter; + + if (GetEnhMetaFileHeader(hemf, sizeof(header), &header) == 0) + return GenericError; + + metafile_type = METAFILE_GetEmfType(hemf); + + if (metafile_type == MetafileTypeInvalid) + return GenericError; + + *metafile = GdipAlloc(sizeof(GpMetafile)); + if (!*metafile) + return OutOfMemory; + + (*metafile)->image.type = ImageTypeMetafile; + (*metafile)->image.format = ImageFormatEMF; + (*metafile)->image.frame_count = 1; + (*metafile)->image.xres = (REAL)header.szlDevice.cx; + (*metafile)->image.yres = (REAL)header.szlDevice.cy; + (*metafile)->bounds.X = (REAL)header.rclBounds.left; + (*metafile)->bounds.Y = (REAL)header.rclBounds.top; + (*metafile)->bounds.Width = (REAL)(header.rclBounds.right - header.rclBounds.left); + (*metafile)->bounds.Height = (REAL)(header.rclBounds.bottom - header.rclBounds.top); + (*metafile)->unit = UnitPixel; + (*metafile)->metafile_type = metafile_type; + (*metafile)->hemf = hemf; + (*metafile)->preserve_hemf = !delete; + + TRACE("<-- %p\n", *metafile); + + return Ok; +} + +GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete, + GDIPCONST WmfPlaceableFileHeader * placeable, GpMetafile **metafile) +{ + UINT read; + BYTE *copy; + HENHMETAFILE hemf; + GpStatus retval = Ok; + + TRACE("(%p, %d, %p, %p)\n", hwmf, delete, placeable, metafile); + + if(!hwmf || !metafile || !placeable) + return InvalidParameter; + + *metafile = NULL; + read = GetMetaFileBitsEx(hwmf, 0, NULL); + if(!read) + return GenericError; + copy = GdipAlloc(read); + GetMetaFileBitsEx(hwmf, read, copy); + + hemf = SetWinMetaFileBits(read, copy, NULL, NULL); + GdipFree(copy); + + /* FIXME: We should store and use hwmf instead of converting to hemf */ + retval = GdipCreateMetafileFromEmf(hemf, TRUE, metafile); + + if (retval == Ok) + { + (*metafile)->image.xres = (REAL)placeable->Inch; + (*metafile)->image.yres = (REAL)placeable->Inch; + (*metafile)->bounds.X = ((REAL)placeable->BoundingBox.Left) / ((REAL)placeable->Inch); + (*metafile)->bounds.Y = ((REAL)placeable->BoundingBox.Top) / ((REAL)placeable->Inch); + (*metafile)->bounds.Width = (REAL)(placeable->BoundingBox.Right - + placeable->BoundingBox.Left); + (*metafile)->bounds.Height = (REAL)(placeable->BoundingBox.Bottom - + placeable->BoundingBox.Top); + (*metafile)->metafile_type = MetafileTypeWmfPlaceable; + (*metafile)->image.format = ImageFormatWMF; + + if (delete) DeleteMetaFile(hwmf); + } + else + DeleteEnhMetaFile(hemf); + return retval; +} + +GpStatus WINGDIPAPI GdipCreateMetafileFromWmfFile(GDIPCONST WCHAR *file, + GDIPCONST WmfPlaceableFileHeader * placeable, GpMetafile **metafile) +{ + HMETAFILE hmf = GetMetaFileW(file); + + TRACE("(%s, %p, %p)\n", debugstr_w(file), placeable, metafile); + + if(!hmf) return InvalidParameter; + + return GdipCreateMetafileFromWmf(hmf, TRUE, placeable, metafile); +} + +GpStatus WINGDIPAPI GdipCreateMetafileFromFile(GDIPCONST WCHAR *file, + GpMetafile **metafile) +{ + FIXME("(%p, %p): stub\n", file, metafile); + return NotImplemented; +} + +GpStatus WINGDIPAPI GdipCreateMetafileFromStream(IStream *stream, + GpMetafile **metafile) +{ + FIXME("(%p, %p): stub\n", stream, metafile); + return NotImplemented; +} + +GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit(GpMetafile *metafile, + UINT limitDpi) +{ + static int calls; + + TRACE("(%p,%u)\n", metafile, limitDpi); + + if(!(calls++)) + FIXME("not implemented\n"); + + return NotImplemented; +} + +GpStatus WINGDIPAPI GdipConvertToEmfPlus(const GpGraphics* ref, + GpMetafile* metafile, BOOL* succ, EmfType emfType, + const WCHAR* description, GpMetafile** out_metafile) +{ + static int calls; + + TRACE("(%p,%p,%p,%u,%s,%p)\n", ref, metafile, succ, emfType, + debugstr_w(description), out_metafile); + + if(!ref || !metafile || !out_metafile) + return InvalidParameter; + + *succ = FALSE; + *out_metafile = NULL; + + if(!(calls++)) + FIXME("not implemented\n"); + + return NotImplemented; +} + +GpStatus WINGDIPAPI GdipEmfToWmfBits(HENHMETAFILE hemf, UINT cbData16, + LPBYTE pData16, INT iMapMode, INT eFlags) +{ + FIXME("(%p, %d, %p, %d, %d): stub\n", hemf, cbData16, pData16, iMapMode, eFlags); + return NotImplemented; +} + +GpStatus WINGDIPAPI GdipRecordMetafileFileName(GDIPCONST WCHAR* fileName, + HDC hdc, EmfType type, GDIPCONST GpRectF *pFrameRect, + MetafileFrameUnit frameUnit, GDIPCONST WCHAR *desc, + GpMetafile **metafile) +{ + FIXME("%s %p %d %p %d %s %p stub!\n", debugstr_w(fileName), hdc, type, pFrameRect, + frameUnit, debugstr_w(desc), metafile); + + return NotImplemented; +} + +GpStatus WINGDIPAPI GdipRecordMetafileFileNameI(GDIPCONST WCHAR* fileName, HDC hdc, EmfType type, + GDIPCONST GpRect *pFrameRect, MetafileFrameUnit frameUnit, + GDIPCONST WCHAR *desc, GpMetafile **metafile) +{ + FIXME("%s %p %d %p %d %s %p stub!\n", debugstr_w(fileName), hdc, type, pFrameRect, + frameUnit, debugstr_w(desc), metafile); + + return NotImplemented; +} + +/***************************************************************************** + * GdipConvertToEmfPlusToFile [GDIPLUS.@] + */ + +GpStatus WINGDIPAPI GdipConvertToEmfPlusToFile(const GpGraphics* refGraphics, + GpMetafile* metafile, BOOL* conversionSuccess, + const WCHAR* filename, EmfType emfType, + const WCHAR* description, GpMetafile** out_metafile) +{ + FIXME("stub: %p, %p, %p, %p, %u, %p, %p\n", refGraphics, metafile, conversionSuccess, filename, emfType, description, out_metafile); + return NotImplemented; +} diff --git a/dll/win32/gdiplus/pathiterator.c b/dll/win32/gdiplus/pathiterator.c index 31713526a12..be5e51a0d07 100644 --- a/dll/win32/gdiplus/pathiterator.c +++ b/dll/win32/gdiplus/pathiterator.c @@ -205,7 +205,7 @@ GpStatus WINGDIPAPI GdipPathIterNextSubpath(GpPathIterator* iterator, if(iterator->subpath_pos == count){ *startIndex = *endIndex = *resultCount = 0; - *isClosed = 1; + *isClosed = TRUE; return Ok; } diff --git a/dll/win32/gdiplus/region.c b/dll/win32/gdiplus/region.c index 421fdceb05e..37cb45f860d 100644 --- a/dll/win32/gdiplus/region.c +++ b/dll/win32/gdiplus/region.c @@ -75,6 +75,24 @@ typedef struct packed_point short Y; } packed_point; +/* Test to see if the path could be stored as an array of shorts */ +static BOOL is_integer_path(const GpPath *path) +{ + int i; + + if (!path->pathdata.Count) return FALSE; + + for (i = 0; i < path->pathdata.Count; i++) + { + short x, y; + x = gdip_round(path->pathdata.Points[i].X); + y = gdip_round(path->pathdata.Points[i].Y); + if (path->pathdata.Points[i].X != (REAL)x || path->pathdata.Points[i].Y != (REAL)y) + return FALSE; + } + return TRUE; +} + /* Everything is measured in DWORDS; round up if there's a remainder */ static inline INT get_pathtypes_size(const GpPath* path) { @@ -94,9 +112,20 @@ static inline INT get_element_size(const region_element* element) case RegionDataRect: return needed + sizeof(GpRect); case RegionDataPath: - needed += element->elementdata.pathdata.pathheader.size; - needed += sizeof(DWORD); /* Extra DWORD for pathheader.size */ - return needed; + { + const GpPath *path = element->elementdata.path; + DWORD flags = is_integer_path(path) ? FLAGS_INTPATH : FLAGS_NOFLAGS; + /* 3 for headers, once again size doesn't count itself */ + needed += sizeof(DWORD) * 3; + if (flags & FLAGS_INTPATH) + needed += 2 * sizeof(SHORT) * path->pathdata.Count; + else + needed += 2 * sizeof(FLOAT) * path->pathdata.Count; + + needed += get_pathtypes_size(path); + needed += sizeof(DWORD); /* Extra DWORD for pathheader.size */ + return needed; + } case RegionDataEmptyRect: case RegionDataInfiniteRect: return needed; @@ -112,11 +141,8 @@ static inline INT get_element_size(const region_element* element) /* Does not check parameters, caller must do that */ static inline GpStatus init_region(GpRegion* region, const RegionType type) { - region->node.type = type; - region->header.checksum = 0xdeadbeef; - region->header.magic = VERSION_MAGIC; - region->header.num_children = 0; - region->header.size = sizeheader_size + get_element_size(®ion->node); + region->node.type = type; + region->num_children = 0; return Ok; } @@ -144,9 +170,7 @@ static inline GpStatus clone_element(const region_element* element, case RegionDataInfiniteRect: return Ok; case RegionDataPath: - (*element2)->elementdata.pathdata.pathheader = element->elementdata.pathdata.pathheader; - stat = GdipClonePath(element->elementdata.pathdata.path, - &(*element2)->elementdata.pathdata.path); + stat = GdipClonePath(element->elementdata.path, &(*element2)->elementdata.path); if (stat == Ok) return Ok; break; default: @@ -178,9 +202,7 @@ static inline void fuse_region(GpRegion* region, region_element* left, region->node.type = mode; region->node.elementdata.combine.left = left; region->node.elementdata.combine.right = right; - - region->header.size = sizeheader_size + get_element_size(®ion->node); - region->header.num_children += 2; + region->num_children += 2; } /***************************************************************************** @@ -210,7 +232,7 @@ GpStatus WINGDIPAPI GdipCloneRegion(GpRegion *region, GpRegion **clone) return OutOfMemory; element = &(*clone)->node; - (*clone)->header = region->header; + (*clone)->num_children = region->num_children; return clone_element(®ion->node, &element); } @@ -367,7 +389,7 @@ GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region1, } fuse_region(region1, left, right, mode); - region1->header.num_children += region2->header.num_children; + region1->num_children += region2->num_children; return Ok; } @@ -413,12 +435,7 @@ GpStatus WINGDIPAPI GdipCreateRegion(GpRegion **region) GpStatus WINGDIPAPI GdipCreateRegionPath(GpPath *path, GpRegion **region) { region_element* element; - GpPoint *pointsi; - GpPointF *pointsf; - GpStatus stat; - DWORD flags = FLAGS_INTPATH; - INT count, i; TRACE("%p, %p\n", path, region); @@ -435,77 +452,14 @@ GpStatus WINGDIPAPI GdipCreateRegionPath(GpPath *path, GpRegion **region) return stat; } element = &(*region)->node; - count = path->pathdata.Count; - /* Test to see if the path is an Integer path */ - if (count) - { - pointsi = GdipAlloc(sizeof(GpPoint) * count); - pointsf = GdipAlloc(sizeof(GpPointF) * count); - if (!(pointsi && pointsf)) - { - GdipFree(pointsi); - GdipFree(pointsf); - GdipDeleteRegion(*region); - return OutOfMemory; - } - - stat = GdipGetPathPointsI(path, pointsi, count); - if (stat != Ok) - { - GdipDeleteRegion(*region); - return stat; - } - stat = GdipGetPathPoints(path, pointsf, count); - if (stat != Ok) - { - GdipDeleteRegion(*region); - return stat; - } - - for (i = 0; i < count; i++) - { - if (!(pointsi[i].X == pointsf[i].X && - pointsi[i].Y == pointsf[i].Y )) - { - flags = FLAGS_NOFLAGS; - break; - } - } - GdipFree(pointsi); - GdipFree(pointsf); - } - - stat = GdipClonePath(path, &element->elementdata.pathdata.path); + stat = GdipClonePath(path, &element->elementdata.path); if (stat != Ok) { GdipDeleteRegion(*region); return stat; } - /* 3 for headers, once again size doesn't count itself */ - element->elementdata.pathdata.pathheader.size = ((sizeof(DWORD) * 3)); - switch(flags) - { - /* Floats, sent out as floats */ - case FLAGS_NOFLAGS: - element->elementdata.pathdata.pathheader.size += - (sizeof(DWORD) * count * 2); - break; - /* INTs, sent out as packed shorts */ - case FLAGS_INTPATH: - element->elementdata.pathdata.pathheader.size += - (sizeof(DWORD) * count); - break; - default: - FIXME("Unhandled flags (%08x). Expect wrong results.\n", flags); - } - element->elementdata.pathdata.pathheader.size += get_pathtypes_size(path); - element->elementdata.pathdata.pathheader.magic = VERSION_MAGIC; - element->elementdata.pathdata.pathheader.count = count; - element->elementdata.pathdata.pathheader.flags = flags; - (*region)->header.size = sizeheader_size + get_element_size(element); - return Ok; } @@ -727,25 +681,24 @@ static inline void write_float(DWORD* location, INT* offset, const FLOAT write) static inline void write_packed_point(DWORD* location, INT* offset, const GpPointF* write) { - packed_point point; - - point.X = write->X; - point.Y = write->Y; - memcpy(location + *offset, &point, sizeof(packed_point)); + packed_point *point = (packed_point *)(location + *offset); + point->X = gdip_round(write->X); + point->Y = gdip_round(write->Y); (*offset)++; } static inline void write_path_types(DWORD* location, INT* offset, const GpPath* path) { + INT rounded_size = get_pathtypes_size(path); + memcpy(location + *offset, path->pathdata.Types, path->pathdata.Count); /* The unwritten parts of the DWORD (if any) must be cleared */ - if (path->pathdata.Count % sizeof(DWORD)) + if (rounded_size - path->pathdata.Count) ZeroMemory(((BYTE*)location) + (*offset * sizeof(DWORD)) + - path->pathdata.Count, - sizeof(DWORD) - path->pathdata.Count % sizeof(DWORD)); - *offset += (get_pathtypes_size(path) / sizeof(DWORD)); + path->pathdata.Count, rounded_size - path->pathdata.Count); + *offset += rounded_size / sizeof(DWORD); } static void write_element(const region_element* element, DWORD *buffer, @@ -772,12 +725,31 @@ static void write_element(const region_element* element, DWORD *buffer, case RegionDataPath: { INT i; - const GpPath* path = element->elementdata.pathdata.path; + const GpPath* path = element->elementdata.path; + struct _pathheader + { + DWORD size; + DWORD magic; + DWORD count; + DWORD flags; + } *pathheader; - memcpy(buffer + *filled, &element->elementdata.pathdata.pathheader, - sizeof(element->elementdata.pathdata.pathheader)); - *filled += sizeof(element->elementdata.pathdata.pathheader) / sizeof(DWORD); - switch (element->elementdata.pathdata.pathheader.flags) + pathheader = (struct _pathheader *)(buffer + *filled); + + pathheader->flags = is_integer_path(path) ? FLAGS_INTPATH : FLAGS_NOFLAGS; + /* 3 for headers, once again size doesn't count itself */ + pathheader->size = sizeof(DWORD) * 3; + if (pathheader->flags & FLAGS_INTPATH) + pathheader->size += 2 * sizeof(SHORT) * path->pathdata.Count; + else + pathheader->size += 2 * sizeof(FLOAT) * path->pathdata.Count; + pathheader->size += get_pathtypes_size(path); + pathheader->magic = VERSION_MAGIC; + pathheader->count = path->pathdata.Count; + + *filled += 4; + + switch (pathheader->flags & FLAGS_INTPATH) { case FLAGS_NOFLAGS: for (i = 0; i < path->pathdata.Count; i++) @@ -792,6 +764,7 @@ static void write_element(const region_element* element, DWORD *buffer, write_packed_point(buffer, filled, &path->pathdata.Points[i]); } + break; } write_path_types(buffer, filled, path); break; @@ -838,15 +811,36 @@ static void write_element(const region_element* element, DWORD *buffer, GpStatus WINGDIPAPI GdipGetRegionData(GpRegion *region, BYTE *buffer, UINT size, UINT *needed) { + struct _region_header + { + DWORD size; + DWORD checksum; + DWORD magic; + DWORD num_children; + } *region_header; INT filled = 0; + UINT required; + GpStatus status; TRACE("%p, %p, %d, %p\n", region, buffer, size, needed); - if (!(region && buffer && size)) + if (!region || !buffer || !size) return InvalidParameter; - memcpy(buffer, ®ion->header, sizeof(region->header)); - filled += sizeof(region->header) / sizeof(DWORD); + status = GdipGetRegionDataSize(region, &required); + if (status != Ok) return status; + if (size < required) + { + if (needed) *needed = size; + return InsufficientBuffer; + } + + region_header = (struct _region_header *)buffer; + region_header->size = sizeheader_size + get_element_size(®ion->node); + region_header->checksum = 0; + region_header->magic = VERSION_MAGIC; + region_header->num_children = region->num_children; + filled += 4; /* With few exceptions, everything written is DWORD aligned, * so use that as our base */ write_element(®ion->node, (DWORD*)buffer, &filled); @@ -868,7 +862,7 @@ GpStatus WINGDIPAPI GdipGetRegionDataSize(GpRegion *region, UINT *needed) return InvalidParameter; /* header.size doesn't count header.size and header.checksum */ - *needed = region->header.size + sizeof(DWORD) * 2; + *needed = sizeof(DWORD) * 2 + sizeheader_size + get_element_size(®ion->node); return Ok; } @@ -938,7 +932,7 @@ static GpStatus get_region_hrgn(struct region_element *element, GpGraphics *grap *hrgn = CreateRectRgn(0, 0, 0, 0); return *hrgn ? Ok : OutOfMemory; case RegionDataPath: - return get_path_hrgn(element->elementdata.pathdata.path, graphics, hrgn); + return get_path_hrgn(element->elementdata.path, graphics, hrgn); case RegionDataRect: { GpPath* path; @@ -982,8 +976,8 @@ static GpStatus get_region_hrgn(struct region_element *element, GpGraphics *grap case CombineModeIntersect: return get_region_hrgn(element->elementdata.combine.right, graphics, hrgn); case CombineModeXor: case CombineModeExclude: - FIXME("cannot exclude from an infinite region\n"); - /* fall-through */ + left = CreateRectRgn(-4194304, -4194304, 4194304, 4194304); + break; case CombineModeUnion: case CombineModeComplement: *hrgn = NULL; return Ok; @@ -1007,8 +1001,8 @@ static GpStatus get_region_hrgn(struct region_element *element, GpGraphics *grap *hrgn = left; return Ok; case CombineModeXor: case CombineModeComplement: - FIXME("cannot exclude from an infinite region\n"); - /* fall-through */ + right = CreateRectRgn(-4194304, -4194304, 4194304, 4194304); + break; case CombineModeUnion: case CombineModeExclude: DeleteObject(left); *hrgn = NULL; @@ -1291,16 +1285,19 @@ static GpStatus transform_region_element(region_element* element, GpMatrix *matr { /* Steal the element from the created region. */ memcpy(element, &new_region->node, sizeof(region_element)); - HeapFree(GetProcessHeap(), 0, new_region); + GdipFree(new_region); } else return stat; } /* Fall-through to do the actual conversion. */ case RegionDataPath: + if (!element->elementdata.path->pathdata.Count) + return Ok; + stat = GdipTransformMatrixPoints(matrix, - element->elementdata.pathdata.path->pathdata.Points, - element->elementdata.pathdata.path->pathdata.Count); + element->elementdata.path->pathdata.Points, + element->elementdata.path->pathdata.Count); return stat; default: stat = transform_region_element(element->elementdata.combine.left, matrix); @@ -1335,9 +1332,9 @@ static void translate_region_element(region_element* element, REAL dx, REAL dy) element->elementdata.rect.Y += dy; return; case RegionDataPath: - for(i = 0; i < element->elementdata.pathdata.path->pathdata.Count; i++){ - element->elementdata.pathdata.path->pathdata.Points[i].X += dx; - element->elementdata.pathdata.path->pathdata.Points[i].Y += dy; + for(i = 0; i < element->elementdata.path->pathdata.Count; i++){ + element->elementdata.path->pathdata.Points[i].X += dx; + element->elementdata.path->pathdata.Points[i].Y += dy; } return; default: diff --git a/dll/win32/hhctrl.ocx/hhctrl.c b/dll/win32/hhctrl.ocx/hhctrl.c index a73d0789638..5e97c8cbdd8 100644 --- a/dll/win32/hhctrl.ocx/hhctrl.c +++ b/dll/win32/hhctrl.ocx/hhctrl.c @@ -188,7 +188,20 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat case HH_DISPLAY_TOPIC: case HH_DISPLAY_TOC: if (data) - index = (const WCHAR *)data; + { + static const WCHAR delimW[] = {':',':',0}; + const WCHAR *i = (const WCHAR *)data; + + index = strstrW(i, delimW); + if(index) + { + if(memcmp(info->pCHMInfo->szFile, i, index-i)) + FIXME("Opening a CHM file in the context of another is not supported.\n"); + index += strlenW(delimW); + } + else + index = i; + } break; } @@ -258,6 +271,8 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat url = FindContextAlias(info->pCHMInfo, data); if(!url) { + if(!data) /* there may legitimately be no context alias for id 0 */ + return info->WinType.hwndHelp; ReleaseHelpViewer(info); return NULL; } diff --git a/dll/win32/hhctrl.ocx/hhctrl_tlb.idl b/dll/win32/hhctrl.ocx/hhctrl_tlb.idl index c2f8a242b6b..58a4b1e80d1 100644 --- a/dll/win32/hhctrl.ocx/hhctrl_tlb.idl +++ b/dll/win32/hhctrl.ocx/hhctrl_tlb.idl @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep regtypelib + import "unknwn.idl"; import "objidl.idl"; import "oaidl.idl"; diff --git a/dll/win32/hhctrl.ocx/stream.c b/dll/win32/hhctrl.ocx/stream.c index 828c8d43dc2..cdefef7af84 100644 --- a/dll/win32/hhctrl.ocx/stream.c +++ b/dll/win32/hhctrl.ocx/stream.c @@ -105,12 +105,52 @@ BOOL next_content(stream_t *stream, strbuf_t *buf) return TRUE; } +static BOOL find_node_end(stream_t *stream, strbuf_t *buf) +{ + int tag_count = 0, b = buf->len; + char *p; + + while(1) + { + if(!stream_chr(stream, buf, '>')) + return FALSE; + if(buf->len == 0) + break; + p = &buf->buf[b]; + while((p = memchr(p+1, '"', buf->len-(p-buf->buf))) != NULL) + tag_count++; + b = buf->len; + if(tag_count % 2 != 0) + { + if(!stream_chr(stream, buf, '"')) + return FALSE; + tag_count++; + } + else + break; + } + return TRUE; +} + BOOL next_node(stream_t *stream, strbuf_t *buf) { + strbuf_t tmpbuf; + + /* search through the end of the current node */ + strbuf_init(&tmpbuf); + if(!find_node_end(stream, &tmpbuf)) + { + strbuf_free(&tmpbuf); + return FALSE; + } + strbuf_free(&tmpbuf); + + /* find the beginning of the next node */ if(!stream_chr(stream, NULL, '<')) return FALSE; - if(!stream_chr(stream, buf, '>')) + /* read out the data of the next node */ + if(!find_node_end(stream, buf)) return FALSE; strbuf_append(buf, ">", 2); diff --git a/dll/win32/hlink/hlink_classes.idl b/dll/win32/hlink/hlink_classes.idl index 98b5d328095..120567d37c6 100644 --- a/dll/win32/hlink/hlink_classes.idl +++ b/dll/win32/hlink/hlink_classes.idl @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ threading(apartment), uuid(79eac9d0-baf9-11ce-8c82-00aa004ba90b) diff --git a/dll/win32/hlink/hlink_main.c b/dll/win32/hlink/hlink_main.c index 26849d83f20..3c64c042c78 100644 --- a/dll/win32/hlink/hlink_main.c +++ b/dll/win32/hlink/hlink_main.c @@ -375,6 +375,8 @@ HRESULT WINAPI HlinkUpdateStackItem(IHlinkFrame *frame, IHlinkBrowseContext *bc, HRESULT WINAPI HlinkParseDisplayName(LPBC pibc, LPCWSTR pwzDisplayName, BOOL fNoForceAbs, ULONG *pcchEaten, IMoniker **ppimk) { + static const WCHAR file_colonW[] = {'f','i','l','e',':'}; + ULONG eaten = 0; HRESULT hres; TRACE("(%p %s %x %p %p)\n", pibc, debugstr_w(pwzDisplayName), fNoForceAbs, pcchEaten, ppimk); @@ -382,17 +384,27 @@ HRESULT WINAPI HlinkParseDisplayName(LPBC pibc, LPCWSTR pwzDisplayName, BOOL fNo if(fNoForceAbs) FIXME("Unsupported fNoForceAbs\n"); - hres = MkParseDisplayNameEx(pibc, pwzDisplayName, pcchEaten, ppimk); - if(SUCCEEDED(hres)) - return hres; + if(!strncmpiW(pwzDisplayName, file_colonW, sizeof(file_colonW)/sizeof(WCHAR))) { + pwzDisplayName += sizeof(file_colonW)/sizeof(WCHAR); + eaten += sizeof(file_colonW)/sizeof(WCHAR); - hres = MkParseDisplayName(pibc, pwzDisplayName, pcchEaten, ppimk); - if(SUCCEEDED(hres)) - return hres; + while(*pwzDisplayName == '/') { + pwzDisplayName++; + eaten++; + } + }else { + hres = MkParseDisplayNameEx(pibc, pwzDisplayName, pcchEaten, ppimk); + if(SUCCEEDED(hres)) + return hres; + + hres = MkParseDisplayName(pibc, pwzDisplayName, pcchEaten, ppimk); + if(SUCCEEDED(hres)) + return hres; + } hres = CreateFileMoniker(pwzDisplayName, ppimk); if(SUCCEEDED(hres)) - *pcchEaten = strlenW(pwzDisplayName); + *pcchEaten = eaten + strlenW(pwzDisplayName); return hres; } diff --git a/dll/win32/imagehlp/imagehlp.spec b/dll/win32/imagehlp/imagehlp.spec index 3ba9efae4c1..744b339caf8 100644 --- a/dll/win32/imagehlp/imagehlp.spec +++ b/dll/win32/imagehlp/imagehlp.spec @@ -3,7 +3,7 @@ @ stdcall CheckSumMappedFile(ptr long ptr ptr) @ stdcall EnumerateLoadedModules64(long ptr ptr) dbghelp.EnumerateLoadedModules64 @ stdcall EnumerateLoadedModules(long ptr ptr) dbghelp.EnumerateLoadedModules -@ stdcall FindDebugInfoFile(str str str) dbghelp.FindDebugInfoFile +@ stdcall FindDebugInfoFile(str str ptr) dbghelp.FindDebugInfoFile @ stdcall FindDebugInfoFileEx(str str ptr ptr ptr) dbghelp.FindDebugInfoFileEx @ stdcall FindExecutableImage(str str str) dbghelp.FindExecutableImage @ stdcall FindExecutableImageEx(str str ptr ptr ptr) dbghelp.FindExecutableImageEx @@ -38,16 +38,16 @@ @ stdcall RemovePrivateCvSymbolic(ptr ptr ptr) @ stub RemovePrivateCvSymbolicEx @ stdcall RemoveRelocations(ptr) -@ stdcall SearchTreeForFile(str str str) dbghelp.SearchTreeForFile +@ stdcall SearchTreeForFile(str str ptr) dbghelp.SearchTreeForFile @ stdcall SetImageConfigInformation(ptr ptr) @ stdcall SplitSymbols(str str str long) @ stdcall StackWalk64(long long long ptr ptr ptr ptr ptr ptr) dbghelp.StackWalk64 @ stdcall StackWalk(long long long ptr ptr ptr ptr ptr ptr) dbghelp.StackWalk @ stdcall SymCleanup(long) dbghelp.SymCleanup -@ stdcall SymEnumSourceFiles(long long str ptr ptr) dbghelp.SymEnumSourceFiles +@ stdcall SymEnumSourceFiles(ptr int64 str ptr ptr) dbghelp.SymEnumSourceFiles @ stub SymEnumSym -@ stdcall SymEnumSymbols(long long str ptr ptr) dbghelp.SymEnumSymbols -@ stdcall SymEnumTypes(long long ptr ptr) dbghelp.SymEnumTypes +@ stdcall SymEnumSymbols(ptr int64 str ptr ptr) dbghelp.SymEnumSymbols +@ stdcall SymEnumTypes(ptr int64 ptr ptr) dbghelp.SymEnumTypes @ stdcall SymEnumerateModules64(long ptr ptr) dbghelp.SymEnumerateModules64 @ stdcall SymEnumerateModules(long ptr ptr) dbghelp.SymEnumerateModules @ stdcall SymEnumerateSymbols64(long int64 ptr ptr) dbghelp.SymEnumerateSymbols64 @@ -55,7 +55,7 @@ @ stub SymEnumerateSymbolsW64 @ stub SymEnumerateSymbolsW @ stdcall SymFindFileInPath(long str str ptr long long long ptr ptr ptr) dbghelp.SymFindFileInPath -@ stdcall SymFromAddr(long long ptr ptr) dbghelp.SymFromAddr +@ stdcall SymFromAddr(ptr int64 ptr ptr) dbghelp.SymFromAddr @ stdcall SymFromName(long str ptr) dbghelp.SymFromName @ stdcall SymFunctionTableAccess64(long int64) dbghelp.SymFunctionTableAccess64 @ stdcall SymFunctionTableAccess(long long) dbghelp.SymFunctionTableAccess @@ -74,7 +74,7 @@ @ stdcall SymGetModuleInfoW64(long int64 ptr) dbghelp.SymGetModuleInfoW64 @ stdcall SymGetModuleInfoW(long long ptr) dbghelp.SymGetModuleInfoW @ stdcall SymGetOptions() dbghelp.SymGetOptions -@ stdcall SymGetSearchPath(long str long) dbghelp.SymGetSearchPath +@ stdcall SymGetSearchPath(long ptr long) dbghelp.SymGetSearchPath @ stdcall SymGetSymFromAddr64(long int64 ptr ptr) dbghelp.SymGetSymFromAddr64 @ stdcall SymGetSymFromAddr(long long ptr ptr) dbghelp.SymGetSymFromAddr @ stdcall SymGetSymFromName64(long str ptr) dbghelp.SymGetSymFromName64 @@ -83,8 +83,8 @@ @ stdcall SymGetSymNext(long ptr) dbghelp.SymGetSymNext @ stdcall SymGetSymPrev64(long ptr) dbghelp.SymGetSymPrev64 @ stdcall SymGetSymPrev(long ptr) dbghelp.SymGetSymPrev -@ stdcall SymGetTypeFromName(long long str ptr) dbghelp.SymGetTypeFromName -@ stdcall SymGetTypeInfo(long long long long ptr) dbghelp.SymGetTypeInfo +@ stdcall SymGetTypeFromName(ptr int64 str ptr) dbghelp.SymGetTypeFromName +@ stdcall SymGetTypeInfo(ptr int64 long long ptr) dbghelp.SymGetTypeInfo @ stdcall SymInitialize(long str long) dbghelp.SymInitialize @ stdcall SymLoadModule64(long long str str int64 long) dbghelp.SymLoadModule64 @ stdcall SymLoadModule(long long str str long long) dbghelp.SymLoadModule diff --git a/dll/win32/inetcomm/inetcomm.idl b/dll/win32/inetcomm/inetcomm.idl index 1fba558df5a..03cd20abbac 100644 --- a/dll/win32/inetcomm/inetcomm.idl +++ b/dll/win32/inetcomm/inetcomm.idl @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ helpstring("CLSID_IMimeBody"), threading(both), diff --git a/dll/win32/inetcomm/mimeole.c b/dll/win32/inetcomm/mimeole.c index 101df0eab50..9e25ed5554d 100644 --- a/dll/win32/inetcomm/mimeole.c +++ b/dll/win32/inetcomm/mimeole.c @@ -119,7 +119,7 @@ static HRESULT copy_headers_to_buf(IStream *stm, char **ptr) char *buf = NULL; DWORD size = PARSER_BUF_SIZE, offset = 0, last_end = 0; HRESULT hr; - int done = 0; + BOOL done = FALSE; *ptr = NULL; @@ -147,7 +147,7 @@ static HRESULT copy_headers_to_buf(IStream *stm, char **ptr) offset += read; buf[offset] = '\0'; - if(read == 0) done = 1; + if(read == 0) done = TRUE; while(!done && (end = strstr(buf + last_end, "\r\n"))) { @@ -158,7 +158,7 @@ static HRESULT copy_headers_to_buf(IStream *stm, char **ptr) off.QuadPart = new_end; IStream_Seek(stm, off, STREAM_SEEK_SET, NULL); buf[new_end] = '\0'; - done = 1; + done = TRUE; } else last_end = new_end; @@ -253,14 +253,14 @@ static void unfold_header(char *header, int len) static char *unquote_string(const char *str) { - int quoted = 0; + BOOL quoted = FALSE; char *ret, *cp; while(*str == ' ' || *str == '\t') str++; if(*str == '"') { - quoted = 1; + quoted = TRUE; str++; } ret = strdupA(str); @@ -316,20 +316,19 @@ static void add_param(header_t *header, const char *p) static void split_params(header_t *header, char *value) { char *cp = value, *start = value; - int in_quote = 0; - int done_value = 0; + BOOL in_quotes = FALSE, done_value = FALSE; while(*cp) { - if(!in_quote && *cp == ';') + if(!in_quotes && *cp == ';') { *cp = '\0'; if(done_value) add_param(header, start); - done_value = 1; + done_value = TRUE; start = cp + 1; } else if(*cp == '"') - in_quote = !in_quote; + in_quotes = !in_quotes; cp++; } if(done_value) add_param(header, start); diff --git a/dll/win32/inetcomm/pop3transport.c b/dll/win32/inetcomm/pop3transport.c index 153d5523777..22f2be60f7c 100644 --- a/dll/win32/inetcomm/pop3transport.c +++ b/dll/win32/inetcomm/pop3transport.c @@ -617,7 +617,7 @@ static void POP3Transport_CallbackRecvPASSResp(IInternetTransport *iface, char * static void POP3Transport_CallbackProcessUSERResp(IInternetTransport *iface, char *pBuffer, int cbBuffer) { - static char pass[] = "PASS "; + static const char pass[] = "PASS "; POP3Transport *This = (POP3Transport *)iface; POP3RESPONSE response; char *command; @@ -658,7 +658,7 @@ static void POP3Transport_CallbackRecvUSERResp(IInternetTransport *iface, char * static void POP3Transport_CallbackSendUSERCmd(IInternetTransport *iface, char *pBuffer, int cbBuffer) { - static char user[] = "USER "; + static const char user[] = "USER "; POP3Transport *This = (POP3Transport *)iface; char *command; int len; @@ -854,7 +854,7 @@ static HRESULT WINAPI POP3Transport_CommandAUTH(IPOP3Transport *iface, LPSTR psz static HRESULT WINAPI POP3Transport_CommandUSER(IPOP3Transport *iface, LPSTR username) { - static char user[] = "USER "; + static const char user[] = "USER "; POP3Transport *This = (POP3Transport *)iface; char *command; int len; @@ -877,7 +877,7 @@ static HRESULT WINAPI POP3Transport_CommandUSER(IPOP3Transport *iface, LPSTR use static HRESULT WINAPI POP3Transport_CommandPASS(IPOP3Transport *iface, LPSTR password) { - static char pass[] = "PASS "; + static const char pass[] = "PASS "; POP3Transport *This = (POP3Transport *)iface; char *command; int len; @@ -901,7 +901,7 @@ static HRESULT WINAPI POP3Transport_CommandPASS(IPOP3Transport *iface, LPSTR pas static HRESULT WINAPI POP3Transport_CommandLIST( IPOP3Transport *iface, POP3CMDTYPE cmdtype, DWORD dwPopId) { - static char list[] = "LIST %u\r\n"; + static const char list[] = "LIST %u\r\n"; static char list_all[] = "LIST\r\n"; POP3Transport *This = (POP3Transport *)iface; char *command; @@ -928,7 +928,7 @@ static HRESULT WINAPI POP3Transport_CommandLIST( static HRESULT WINAPI POP3Transport_CommandTOP( IPOP3Transport *iface, POP3CMDTYPE cmdtype, DWORD dwPopId, DWORD cPreviewLines) { - static char top[] = "TOP %u %u\r\n"; + static const char top[] = "TOP %u %u\r\n"; POP3Transport *This = (POP3Transport *)iface; char *command; int len; @@ -950,7 +950,7 @@ static HRESULT WINAPI POP3Transport_CommandTOP( static HRESULT WINAPI POP3Transport_CommandQUIT(IPOP3Transport *iface) { - static char command[] = "QUIT\r\n"; + static const char command[] = "QUIT\r\n"; POP3Transport *This = (POP3Transport *)iface; TRACE("()\n"); @@ -963,7 +963,7 @@ static HRESULT WINAPI POP3Transport_CommandQUIT(IPOP3Transport *iface) static HRESULT WINAPI POP3Transport_CommandSTAT(IPOP3Transport *iface) { - static char stat[] = "STAT\r\n"; + static const char stat[] = "STAT\r\n"; POP3Transport *This = (POP3Transport *)iface; TRACE("\n"); @@ -975,7 +975,7 @@ static HRESULT WINAPI POP3Transport_CommandSTAT(IPOP3Transport *iface) static HRESULT WINAPI POP3Transport_CommandNOOP(IPOP3Transport *iface) { - static char noop[] = "NOOP\r\n"; + static const char noop[] = "NOOP\r\n"; POP3Transport *This = (POP3Transport *)iface; TRACE("\n"); @@ -987,7 +987,7 @@ static HRESULT WINAPI POP3Transport_CommandNOOP(IPOP3Transport *iface) static HRESULT WINAPI POP3Transport_CommandRSET(IPOP3Transport *iface) { - static char rset[] = "RSET\r\n"; + static const char rset[] = "RSET\r\n"; POP3Transport *This = (POP3Transport *)iface; TRACE("\n"); @@ -1000,7 +1000,7 @@ static HRESULT WINAPI POP3Transport_CommandRSET(IPOP3Transport *iface) static HRESULT WINAPI POP3Transport_CommandUIDL( IPOP3Transport *iface, POP3CMDTYPE cmdtype, DWORD dwPopId) { - static char uidl[] = "UIDL %u\r\n"; + static const char uidl[] = "UIDL %u\r\n"; static char uidl_all[] = "UIDL\r\n"; POP3Transport *This = (POP3Transport *)iface; char *command; @@ -1027,7 +1027,7 @@ static HRESULT WINAPI POP3Transport_CommandUIDL( static HRESULT WINAPI POP3Transport_CommandDELE( IPOP3Transport *iface, POP3CMDTYPE cmdtype, DWORD dwPopId) { - static char dele[] = "DELE %u\r\n"; + static const char dele[] = "DELE %u\r\n"; POP3Transport *This = (POP3Transport *)iface; char *command; int len; @@ -1049,7 +1049,7 @@ static HRESULT WINAPI POP3Transport_CommandDELE( static HRESULT WINAPI POP3Transport_CommandRETR( IPOP3Transport *iface, POP3CMDTYPE cmdtype, DWORD dwPopId) { - static char retr[] = "RETR %u\r\n"; + static const char retr[] = "RETR %u\r\n"; POP3Transport *This = (POP3Transport *)iface; char *command; int len; diff --git a/dll/win32/iphlpapi/iphlpapi.spec b/dll/win32/iphlpapi/iphlpapi.spec index 4206beafacd..67ec918f129 100644 --- a/dll/win32/iphlpapi/iphlpapi.spec +++ b/dll/win32/iphlpapi/iphlpapi.spec @@ -40,10 +40,8 @@ @ stub GetIcmpStatsFromStack @ stub GetIcmpStatsFromStackEx @ stdcall GetIfEntry( ptr ) -@ stdcall GetIfEntry2( ptr ) @ stub GetIfEntryFromStack @ stdcall GetIfTable( ptr ptr long ) -@ stdcall GetIfTable2(ptr) @ stub GetIfTableFromStack @ stub GetIgmpList @ stdcall GetInterfaceInfo( ptr ptr ) diff --git a/dll/win32/iphlpapi/iphlpapi_main.c b/dll/win32/iphlpapi/iphlpapi_main.c index dff38c05714..bea15a3ba96 100644 --- a/dll/win32/iphlpapi/iphlpapi_main.c +++ b/dll/win32/iphlpapi/iphlpapi_main.c @@ -2517,35 +2517,6 @@ DWORD WINAPI GetIcmpStatisticsEx(PMIB_ICMP_EX pStats,DWORD dwFamily) return 0L; } -/****************************************************************** - * GetIfTable2 (IPHLPAPI.@) - * - * PARAMS - * pIfTable [In/Out] - */ - -NETIOAPI_API WINAPI GetIfTable2(PMIB_IF_TABLE2 *pIfTable) -{ - UNIMPLEMENTED; - return ERROR_NOT_SUPPORTED; -} - -/****************************************************************** - * GetIfEntry2 (IPHLPAPI.@) - * - * PARAMS - * pIfRow [In/Out] - */ -NETIOAPI_API WINAPI GetIfEntry2(IN OUT PMIB_IF_ROW2 pIfRow) -{ - TRACE("pIfRow %p\n", pIfRow); - if (!pIfRow) - return ERROR_INVALID_PARAMETER; - - UNIMPLEMENTED; - return ERROR_NOT_SUPPORTED; -} - DWORD WINAPI SetIpForwardEntryToStack(PMIB_IPFORWARDROW pRoute) { diff --git a/dll/win32/itss/chm_lib.c b/dll/win32/itss/chm_lib.c index d1c71618847..e1d50342c6d 100644 --- a/dll/win32/itss/chm_lib.c +++ b/dll/win32/itss/chm_lib.c @@ -95,64 +95,64 @@ typedef LONGLONG Int64; typedef ULONGLONG UInt64; /* utilities for unmarshalling data */ -static int _unmarshal_char_array(unsigned char **pData, - unsigned int *pLenRemain, - char *dest, - int count) -{ - if (count <= 0 || (unsigned int)count > *pLenRemain) - return 0; - memcpy(dest, (*pData), count); - *pData += count; - *pLenRemain -= count; - return 1; -} - -static int _unmarshal_uchar_array(unsigned char **pData, +static BOOL _unmarshal_char_array(unsigned char **pData, unsigned int *pLenRemain, - unsigned char *dest, + char *dest, int count) { - if (count <= 0 || (unsigned int)count > *pLenRemain) - return 0; + if (count <= 0 || (unsigned int)count > *pLenRemain) + return FALSE; memcpy(dest, (*pData), count); *pData += count; *pLenRemain -= count; - return 1; + return TRUE; } -static int _unmarshal_int32(unsigned char **pData, - unsigned int *pLenRemain, - Int32 *dest) +static BOOL _unmarshal_uchar_array(unsigned char **pData, + unsigned int *pLenRemain, + unsigned char *dest, + int count) { - if (4 > *pLenRemain) - return 0; - *dest = (*pData)[0] | (*pData)[1]<<8 | (*pData)[2]<<16 | (*pData)[3]<<24; - *pData += 4; - *pLenRemain -= 4; - return 1; + if (count <= 0 || (unsigned int)count > *pLenRemain) + return FALSE; + memcpy(dest, (*pData), count); + *pData += count; + *pLenRemain -= count; + return TRUE; } -static int _unmarshal_uint32(unsigned char **pData, +static BOOL _unmarshal_int32(unsigned char **pData, unsigned int *pLenRemain, - UInt32 *dest) + Int32 *dest) { if (4 > *pLenRemain) - return 0; + return FALSE; *dest = (*pData)[0] | (*pData)[1]<<8 | (*pData)[2]<<16 | (*pData)[3]<<24; *pData += 4; *pLenRemain -= 4; - return 1; + return TRUE; } -static int _unmarshal_int64(unsigned char **pData, - unsigned int *pLenRemain, - Int64 *dest) +static BOOL _unmarshal_uint32(unsigned char **pData, + unsigned int *pLenRemain, + UInt32 *dest) +{ + if (4 > *pLenRemain) + return FALSE; + *dest = (*pData)[0] | (*pData)[1]<<8 | (*pData)[2]<<16 | (*pData)[3]<<24; + *pData += 4; + *pLenRemain -= 4; + return TRUE; +} + +static BOOL _unmarshal_int64(unsigned char **pData, + unsigned int *pLenRemain, + Int64 *dest) { Int64 temp; int i; if (8 > *pLenRemain) - return 0; + return FALSE; temp=0; for(i=8; i>0; i--) { @@ -162,17 +162,17 @@ static int _unmarshal_int64(unsigned char **pData, *dest = temp; *pData += 8; *pLenRemain -= 8; - return 1; + return TRUE; } -static int _unmarshal_uint64(unsigned char **pData, - unsigned int *pLenRemain, - UInt64 *dest) +static BOOL _unmarshal_uint64(unsigned char **pData, + unsigned int *pLenRemain, + UInt64 *dest) { UInt64 temp; int i; if (8 > *pLenRemain) - return 0; + return FALSE; temp=0; for(i=8; i>0; i--) { @@ -182,12 +182,12 @@ static int _unmarshal_uint64(unsigned char **pData, *dest = temp; *pData += 8; *pLenRemain -= 8; - return 1; + return TRUE; } -static int _unmarshal_uuid(unsigned char **pData, - unsigned int *pDataLen, - unsigned char *dest) +static BOOL _unmarshal_uuid(unsigned char **pData, + unsigned int *pDataLen, + unsigned char *dest) { return _unmarshal_uchar_array(pData, pDataLen, dest, 16); } @@ -241,13 +241,13 @@ struct chmItsfHeader UInt64 data_offset; /* 58 (Not present before V3) */ }; /* __attribute__ ((aligned (1))); */ -static int _unmarshal_itsf_header(unsigned char **pData, - unsigned int *pDataLen, - struct chmItsfHeader *dest) +static BOOL _unmarshal_itsf_header(unsigned char **pData, + unsigned int *pDataLen, + struct chmItsfHeader *dest) { /* we only know how to deal with the 0x58 and 0x60 byte structures */ if (*pDataLen != _CHM_ITSF_V2_LEN && *pDataLen != _CHM_ITSF_V3_LEN) - return 0; + return FALSE; /* unmarshal common fields */ _unmarshal_char_array(pData, pDataLen, dest->signature, 4); @@ -268,19 +268,19 @@ static int _unmarshal_itsf_header(unsigned char **pData, * current MS tools do not seem to use them. */ if (memcmp(dest->signature, "ITSF", 4) != 0) - return 0; + return FALSE; if (dest->version == 2) { if (dest->header_len < _CHM_ITSF_V2_LEN) - return 0; + return FALSE; } else if (dest->version == 3) { if (dest->header_len < _CHM_ITSF_V3_LEN) - return 0; + return FALSE; } else - return 0; + return FALSE; /* now, if we have a V3 structure, unmarshal the rest. * otherwise, compute it @@ -290,12 +290,12 @@ static int _unmarshal_itsf_header(unsigned char **pData, if (*pDataLen != 0) _unmarshal_uint64(pData, pDataLen, &dest->data_offset); else - return 0; + return FALSE; } else dest->data_offset = dest->dir_offset + dest->dir_len; - return 1; + return TRUE; } /* structure of ITSP headers */ @@ -319,13 +319,13 @@ struct chmItspHeader UChar unknown_0044[16]; /* 44 */ }; /* __attribute__ ((aligned (1))); */ -static int _unmarshal_itsp_header(unsigned char **pData, - unsigned int *pDataLen, - struct chmItspHeader *dest) +static BOOL _unmarshal_itsp_header(unsigned char **pData, + unsigned int *pDataLen, + struct chmItspHeader *dest) { /* we only know how to deal with a 0x54 byte structures */ if (*pDataLen != _CHM_ITSP_V1_LEN) - return 0; + return FALSE; /* unmarshal fields */ _unmarshal_char_array(pData, pDataLen, dest->signature, 4); @@ -346,13 +346,13 @@ static int _unmarshal_itsp_header(unsigned char **pData, /* error check the data */ if (memcmp(dest->signature, "ITSP", 4) != 0) - return 0; + return FALSE; if (dest->version != 1) - return 0; + return FALSE; if (dest->header_len != _CHM_ITSP_V1_LEN) - return 0; + return FALSE; - return 1; + return TRUE; } /* structure of PMGL headers */ @@ -367,13 +367,13 @@ struct chmPmglHeader Int32 block_next; /* 10 */ }; /* __attribute__ ((aligned (1))); */ -static int _unmarshal_pmgl_header(unsigned char **pData, - unsigned int *pDataLen, - struct chmPmglHeader *dest) +static BOOL _unmarshal_pmgl_header(unsigned char **pData, + unsigned int *pDataLen, + struct chmPmglHeader *dest) { /* we only know how to deal with a 0x14 byte structures */ if (*pDataLen != _CHM_PMGL_LEN) - return 0; + return FALSE; /* unmarshal fields */ _unmarshal_char_array(pData, pDataLen, dest->signature, 4); @@ -384,9 +384,9 @@ static int _unmarshal_pmgl_header(unsigned char **pData, /* check structure */ if (memcmp(dest->signature, _chm_pmgl_marker, 4) != 0) - return 0; + return FALSE; - return 1; + return TRUE; } /* structure of PMGI headers */ @@ -398,13 +398,13 @@ struct chmPmgiHeader UInt32 free_space; /* 4 */ }; /* __attribute__ ((aligned (1))); */ -static int _unmarshal_pmgi_header(unsigned char **pData, - unsigned int *pDataLen, - struct chmPmgiHeader *dest) +static BOOL _unmarshal_pmgi_header(unsigned char **pData, + unsigned int *pDataLen, + struct chmPmgiHeader *dest) { /* we only know how to deal with a 0x8 byte structures */ if (*pDataLen != _CHM_PMGI_LEN) - return 0; + return FALSE; /* unmarshal fields */ _unmarshal_char_array(pData, pDataLen, dest->signature, 4); @@ -412,9 +412,9 @@ static int _unmarshal_pmgi_header(unsigned char **pData, /* check structure */ if (memcmp(dest->signature, _chm_pmgi_marker, 4) != 0) - return 0; + return FALSE; - return 1; + return TRUE; } /* structure of LZXC reset table */ @@ -430,13 +430,13 @@ struct chmLzxcResetTable UInt64 block_len; }; /* __attribute__ ((aligned (1))); */ -static int _unmarshal_lzxc_reset_table(unsigned char **pData, - unsigned int *pDataLen, - struct chmLzxcResetTable *dest) +static BOOL _unmarshal_lzxc_reset_table(unsigned char **pData, + unsigned int *pDataLen, + struct chmLzxcResetTable *dest) { /* we only know how to deal with a 0x28 byte structures */ if (*pDataLen != _CHM_LZXC_RESETTABLE_V1_LEN) - return 0; + return FALSE; /* unmarshal fields */ _unmarshal_uint32 (pData, pDataLen, &dest->version); @@ -449,9 +449,9 @@ static int _unmarshal_lzxc_reset_table(unsigned char **pData, /* check structure */ if (dest->version != 2) - return 0; + return FALSE; - return 1; + return TRUE; } /* structure of LZXC control data block */ @@ -468,13 +468,13 @@ struct chmLzxcControlData UInt32 unknown_18; /* 18 */ }; -static int _unmarshal_lzxc_control_data(unsigned char **pData, - unsigned int *pDataLen, - struct chmLzxcControlData *dest) +static BOOL _unmarshal_lzxc_control_data(unsigned char **pData, + unsigned int *pDataLen, + struct chmLzxcControlData *dest) { /* we want at least 0x18 bytes */ if (*pDataLen < _CHM_LZXC_MIN_LEN) - return 0; + return FALSE; /* unmarshal fields */ _unmarshal_uint32 (pData, pDataLen, &dest->size); @@ -495,19 +495,19 @@ static int _unmarshal_lzxc_control_data(unsigned char **pData, dest->windowSize *= 0x8000; } if (dest->windowSize == 0 || dest->resetInterval == 0) - return 0; + return FALSE; /* for now, only support resetInterval a multiple of windowSize/2 */ if (dest->windowSize == 1) - return 0; + return FALSE; if ((dest->resetInterval % (dest->windowSize/2)) != 0) - return 0; + return FALSE; /* check structure */ if (memcmp(dest->signature, "LZXC", 4) != 0) - return 0; + return FALSE; - return 1; + return TRUE; } /* the structure used for chm file handles */ @@ -920,7 +920,7 @@ static UInt64 _chm_parse_cword(UChar **pEntry) } /* parse a utf-8 string into an ASCII char buffer */ -static int _chm_parse_UTF8(UChar **pEntry, UInt64 count, WCHAR *path) +static BOOL _chm_parse_UTF8(UChar **pEntry, UInt64 count, WCHAR *path) { /* MJM - Modified to return real Unicode strings */ while (count != 0) @@ -930,28 +930,28 @@ static int _chm_parse_UTF8(UChar **pEntry, UInt64 count, WCHAR *path) } *path = '\0'; - return 1; + return TRUE; } /* parse a PMGL entry into a chmUnitInfo struct; return 1 on success. */ -static int _chm_parse_PMGL_entry(UChar **pEntry, struct chmUnitInfo *ui) +static BOOL _chm_parse_PMGL_entry(UChar **pEntry, struct chmUnitInfo *ui) { UInt64 strLen; /* parse str len */ strLen = _chm_parse_cword(pEntry); if (strLen > CHM_MAX_PATHLEN) - return 0; + return FALSE; /* parse path */ if (! _chm_parse_UTF8(pEntry, strLen, ui->path)) - return 0; + return FALSE; /* parse info */ ui->space = (int)_chm_parse_cword(pEntry); ui->start = _chm_parse_cword(pEntry); ui->length = _chm_parse_cword(pEntry); - return 1; + return TRUE; } /* find an exact entry in PMGL; return NULL if we fail */ @@ -1108,11 +1108,11 @@ int chm_resolve_object(struct chmFile *h, * utility methods for dealing with compressed data */ -/* get the bounds of a compressed block. return 0 on failure */ -static int _chm_get_cmpblock_bounds(struct chmFile *h, - UInt64 block, - UInt64 *start, - Int64 *len) +/* get the bounds of a compressed block. Returns FALSE on failure */ +static BOOL _chm_get_cmpblock_bounds(struct chmFile *h, + UInt64 block, + UInt64 *start, + Int64 *len) { UChar buffer[8], *dummy; UInt32 remain; @@ -1130,7 +1130,7 @@ static int _chm_get_cmpblock_bounds(struct chmFile *h, + block*8, remain) != remain || !_unmarshal_uint64(&dummy, &remain, start)) - return 0; + return FALSE; /* unpack the end address */ dummy = buffer; @@ -1142,7 +1142,7 @@ static int _chm_get_cmpblock_bounds(struct chmFile *h, + block*8 + 8, remain) != remain || !_unmarshal_int64(&dummy, &remain, len)) - return 0; + return FALSE; } /* for the last block, use the span in addition to the reset table */ @@ -1158,7 +1158,7 @@ static int _chm_get_cmpblock_bounds(struct chmFile *h, + block*8, remain) != remain || !_unmarshal_uint64(&dummy, &remain, start)) - return 0; + return FALSE; *len = h->reset_table.compressed_len; } @@ -1167,7 +1167,7 @@ static int _chm_get_cmpblock_bounds(struct chmFile *h, *len -= *start; *start += h->data_offset + h->cn_unit.start; - return 1; + return TRUE; } /* decompress the block. must have lzx_mutex. */ @@ -1392,11 +1392,11 @@ LONGINT64 chm_retrieve_object(struct chmFile *h, } } -int chm_enumerate_dir(struct chmFile *h, - const WCHAR *prefix, - int what, - CHM_ENUMERATOR e, - void *context) +BOOL chm_enumerate_dir(struct chmFile *h, + const WCHAR *prefix, + int what, + CHM_ENUMERATOR e, + void *context) { /* * XXX: do this efficiently (i.e. using the tree index) @@ -1411,8 +1411,8 @@ int chm_enumerate_dir(struct chmFile *h, UChar *cur; unsigned int lenRemain; - /* set to 1 once we've started */ - int it_has_begun=0; + /* set to TRUE once we've started */ + BOOL it_has_begun = FALSE; /* the current ui */ struct chmUnitInfo ui; @@ -1454,7 +1454,7 @@ int chm_enumerate_dir(struct chmFile *h, h->block_len) != h->block_len) { HeapFree(GetProcessHeap(), 0, page_buf); - return 0; + return FALSE; } /* figure out start and end for this page */ @@ -1463,7 +1463,7 @@ int chm_enumerate_dir(struct chmFile *h, if (! _unmarshal_pmgl_header(&cur, &lenRemain, &header)) { HeapFree(GetProcessHeap(), 0, page_buf); - return 0; + return FALSE; } end = page_buf + h->block_len - (header.free_space); @@ -1473,14 +1473,14 @@ int chm_enumerate_dir(struct chmFile *h, if (! _chm_parse_PMGL_entry(&cur, &ui)) { HeapFree(GetProcessHeap(), 0, page_buf); - return 0; + return FALSE; } /* check if we should start */ if (! it_has_begun) { if (ui.length == 0 && strncmpiW(ui.path, prefixRectified, prefixLen) == 0) - it_has_begun = 1; + it_has_begun = TRUE; else continue; @@ -1494,7 +1494,7 @@ int chm_enumerate_dir(struct chmFile *h, if (strncmpiW(ui.path, prefixRectified, prefixLen) != 0) { HeapFree(GetProcessHeap(), 0, page_buf); - return 1; + return TRUE; } } @@ -1540,12 +1540,12 @@ int chm_enumerate_dir(struct chmFile *h, { case CHM_ENUMERATOR_FAILURE: HeapFree(GetProcessHeap(), 0, page_buf); - return 0; + return FALSE; case CHM_ENUMERATOR_CONTINUE: break; case CHM_ENUMERATOR_SUCCESS: HeapFree(GetProcessHeap(), 0, page_buf); - return 1; + return TRUE; default: break; } @@ -1557,5 +1557,5 @@ int chm_enumerate_dir(struct chmFile *h, } HeapFree(GetProcessHeap(), 0, page_buf); - return 1; + return TRUE; } diff --git a/dll/win32/itss/chm_lib.h b/dll/win32/itss/chm_lib.h index 50264a52cf8..23b51bd6d9d 100644 --- a/dll/win32/itss/chm_lib.h +++ b/dll/win32/itss/chm_lib.h @@ -105,10 +105,10 @@ typedef int (*CHM_ENUMERATOR)(struct chmFile *h, #define CHM_ENUMERATOR_FAILURE (0) #define CHM_ENUMERATOR_CONTINUE (1) #define CHM_ENUMERATOR_SUCCESS (2) -int chm_enumerate_dir(struct chmFile *h, - const WCHAR *prefix, - int what, - CHM_ENUMERATOR e, - void *context) DECLSPEC_HIDDEN; +BOOL chm_enumerate_dir(struct chmFile *h, + const WCHAR *prefix, + int what, + CHM_ENUMERATOR e, + void *context) DECLSPEC_HIDDEN; #endif /* INCLUDED_CHMLIB_H */ diff --git a/dll/win32/itss/itss.idl b/dll/win32/itss/itss.idl index e3fac3a4689..b80f5d42132 100644 --- a/dll/win32/itss/itss.idl +++ b/dll/win32/itss/itss.idl @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ helpstring("Microsoft InfoTech Protocol for IE 3.0"), threading(both), diff --git a/dll/win32/jscript/CMakeLists.txt b/dll/win32/jscript/CMakeLists.txt index f49a2ece614..6cb5c1d7bea 100644 --- a/dll/win32/jscript/CMakeLists.txt +++ b/dll/win32/jscript/CMakeLists.txt @@ -36,6 +36,7 @@ list(APPEND SOURCE list(APPEND jscript_rc_deps ${CMAKE_CURRENT_SOURCE_DIR}/jscript.rgs ${CMAKE_CURRENT_SOURCE_DIR}/jscript_classes.rgs + ${CMAKE_CURRENT_SOURCE_DIR}/jsglobal.rgs ${CMAKE_CURRENT_BINARY_DIR}/jsglobal.tlb) set_source_files_properties(rsrc.rc PROPERTIES OBJECT_DEPENDS "${jscript_rc_deps}") diff --git a/dll/win32/jscript/global.c b/dll/win32/jscript/global.c index fa1b7910c33..bde5f0f3b3f 100644 --- a/dll/win32/jscript/global.c +++ b/dll/win32/jscript/global.c @@ -18,7 +18,6 @@ #include "jscript.h" -#define LONGLONG_MAX (((LONGLONG)0x7fffffff<<32)|0xffffffff) static const WCHAR NaNW[] = {'N','a','N',0}; static const WCHAR InfinityW[] = {'I','n','f','i','n','i','t','y',0}; @@ -543,7 +542,7 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag while(isdigitW(*str)) { hlp = d*10 + *(str++) - '0'; - if(d>LONGLONG_MAX/10 || hlp<0) { + if(d>MAXLONGLONG/10 || hlp<0) { exp++; break; } @@ -562,7 +561,7 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag while(isdigitW(*str)) { hlp = d*10 + *(str++) - '0'; - if(d>LONGLONG_MAX/10 || hlp<0) + if(d>MAXLONGLONG/10 || hlp<0) break; d = hlp; diff --git a/dll/win32/jscript/jscript.rc b/dll/win32/jscript/jscript.rc index ec8e60cf577..3317c4ba41b 100644 --- a/dll/win32/jscript/jscript.rc +++ b/dll/win32/jscript/jscript.rc @@ -66,7 +66,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL /* @makedep: jscript.rgs */ 2 WINE_REGISTRY jscript.rgs -3 WINE_REGISTRY "jscript_classes.rgs" +3 WINE_REGISTRY jscript_classes.rgs +4 WINE_REGISTRY jsglobal.rgs #define WINE_FILEDESCRIPTION_STR "Wine JScript" #define WINE_FILENAME_STR "jscript.dll" diff --git a/dll/win32/jscript/jscript_classes.idl b/dll/win32/jscript/jscript_classes.idl index d9f481e71ed..597d69e9d7d 100644 --- a/dll/win32/jscript/jscript_classes.idl +++ b/dll/win32/jscript/jscript_classes.idl @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ helpstring("JScript Language"), threading(both), diff --git a/dll/win32/jscript/jscript_classes.rgs b/dll/win32/jscript/jscript_classes.rgs index 4a28efcf48f..ae671fcd273 100644 --- a/dll/win32/jscript/jscript_classes.rgs +++ b/dll/win32/jscript/jscript_classes.rgs @@ -33,147 +33,4 @@ HKCR { CLSID = s '{F414C262-6AC0-11CF-B6D1-00AA00BBBB58}' } - NoRemove Typelib - { - NoRemove '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' - { - '1.0' = s 'JSGlobal' - { - '0' { win32 = s '%MODULE%' } - FLAGS = s '0' - } - } - } - NoRemove Interface - { - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B086}' = s 'GlobalObj' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B087}' = s 'DateObj' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B088}' = s 'MathObj' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B089}' = s 'NumberObj' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B090}' = s 'RegExpObj' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B091}' = s 'StringObj' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B092}' = s 'ArrayInstance' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B093}' = s 'FunctionInstance' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B094}' = s 'StringInstance' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B095}' = s 'BoolInstance' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B096}' = s 'NumberInstance' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B097}' = s 'ObjectInstance' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B098}' = s 'DateInstance' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B099}' = s 'RegExpInstance' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B09A}' = s 'ErrorInstance' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B09B}' = s 'EvalErrorInstance' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B09C}' = s 'RangeErrorInstance' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B09D}' = s 'ReferenceErrorInstance' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B09E}' = s 'SyntaxErrorInstance' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B09F}' = s 'TypeErrorInstance' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - '{3EEF9758-35FC-11D1-8CE4-00C04FC2B0A0}' = s 'URIErrorInstance' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } - } - } - NoRemove CLSID - { - } } diff --git a/dll/win32/jscript/jsglobal.idl b/dll/win32/jscript/jsglobal.idl index bd91a6066fa..b8604e99f27 100644 --- a/dll/win32/jscript/jsglobal.idl +++ b/dll/win32/jscript/jsglobal.idl @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep regtypelib + #include "jsglobal_dispid.h" import "oaidl.idl"; diff --git a/dll/win32/jscript/jsglobal.rgs b/dll/win32/jscript/jsglobal.rgs new file mode 100644 index 00000000000..42c1a80164f --- /dev/null +++ b/dll/win32/jscript/jsglobal.rgs @@ -0,0 +1,146 @@ +HKCR +{ + NoRemove Typelib + { + NoRemove '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' + { + '1.0' = s 'JSGlobal' + { + '0' { win32 = s '%MODULE%' } + FLAGS = s '0' + } + } + } + NoRemove Interface + { + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B086}' = s 'GlobalObj' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B087}' = s 'DateObj' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B088}' = s 'MathObj' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B089}' = s 'NumberObj' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B090}' = s 'RegExpObj' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B091}' = s 'StringObj' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B092}' = s 'ArrayInstance' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B093}' = s 'FunctionInstance' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B094}' = s 'StringInstance' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B095}' = s 'BoolInstance' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B096}' = s 'NumberInstance' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B097}' = s 'ObjectInstance' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B098}' = s 'DateInstance' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B099}' = s 'RegExpInstance' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B09A}' = s 'ErrorInstance' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B09B}' = s 'EvalErrorInstance' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B09C}' = s 'RangeErrorInstance' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B09D}' = s 'ReferenceErrorInstance' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B09E}' = s 'SyntaxErrorInstance' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B09F}' = s 'TypeErrorInstance' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + '{3EEF9758-35FC-11D1-8CE4-00C04FC2B0A0}' = s 'URIErrorInstance' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{3EEF9759-35FC-11D1-8CE4-00C04FC2B085}' { val Version = s '1.0' } + } + } + NoRemove CLSID + { + } +} diff --git a/dll/win32/jscript/jsutils.c b/dll/win32/jscript/jsutils.c index 7383370db51..bf94580125d 100644 --- a/dll/win32/jscript/jsutils.c +++ b/dll/win32/jscript/jsutils.c @@ -317,6 +317,9 @@ HRESULT variant_to_jsval(VARIANT *var, jsval_t *r) *r = jsval_disp(disp); return S_OK; } + }else { + *r = jsval_disp(NULL); + return S_OK; } /* fall through */ default: diff --git a/dll/win32/jscript/lex.c b/dll/win32/jscript/lex.c index effdf6456ef..3d55845ad1b 100644 --- a/dll/win32/jscript/lex.c +++ b/dll/win32/jscript/lex.c @@ -384,7 +384,7 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li d = int_part; while(ctx->ptr < ctx->end && isdigitW(*ctx->ptr)) { hlp = d*10 + *(ctx->ptr++) - '0'; - if(d>LONGLONG_MAX/10 || hlp<0) { + if(d>MAXLONGLONG/10 || hlp<0) { exp++; break; } @@ -401,7 +401,7 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li while(ctx->ptr < ctx->end && isdigitW(*ctx->ptr)) { hlp = d*10 + *(ctx->ptr++) - '0'; - if(d>LONGLONG_MAX/10 || hlp<0) + if(d>MAXLONGLONG/10 || hlp<0) break; d = hlp; @@ -443,6 +443,11 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li else exp += e; } + if(is_identifier_char(*ctx->ptr)) { + WARN("wrong char after zero\n"); + return lex_error(ctx, JS_E_MISSING_SEMICOLON); + } + *literal = new_double_literal(ctx, exp>=0 ? d*pow(10, exp) : d/pow(10, -exp)); return tNumericLiteral; } @@ -466,21 +471,42 @@ static int parse_numeric_literal(parser_ctx_t *ctx, literal_t **literal) if(ctx->ptr < ctx->end && is_identifier_char(*ctx->ptr)) { WARN("unexpected identifier char\n"); - return lex_error(ctx, E_FAIL); + return lex_error(ctx, JS_E_MISSING_SEMICOLON); } *literal = new_double_literal(ctx, l); return tNumericLiteral; } - if(is_identifier_char(*ctx->ptr)) { - WARN("wrong char after zero\n"); - return lex_error(ctx, E_FAIL); + if(isdigitW(*ctx->ptr)) { + unsigned base = 8; + const WCHAR *ptr; + double val = 0; + + for(ptr = ctx->ptr; ptr < ctx->end && isdigitW(*ptr); ptr++) { + if(*ptr > '7') { + base = 10; + break; + } + } + + do { + val = val*base + *ctx->ptr-'0'; + }while(++ctx->ptr < ctx->end && isdigitW(*ctx->ptr)); + + /* FIXME: Do we need it here? */ + if(ctx->ptr < ctx->end && (is_identifier_char(*ctx->ptr) || *ctx->ptr == '.')) { + WARN("wrong char after octal literal: '%c'\n", *ctx->ptr); + return lex_error(ctx, JS_E_MISSING_SEMICOLON); + } + + *literal = new_double_literal(ctx, val); + return tNumericLiteral; } - if(isdigitW(*ctx->ptr)) { - FIXME("octal literals not implemented\n"); - return lex_error(ctx, E_NOTIMPL); + if(is_identifier_char(*ctx->ptr)) { + WARN("wrong char after zero\n"); + return lex_error(ctx, JS_E_MISSING_SEMICOLON); } } diff --git a/dll/win32/jscript/parser.y b/dll/win32/jscript/parser.y index b1ce3a64feb..327366a7f8e 100644 --- a/dll/win32/jscript/parser.y +++ b/dll/win32/jscript/parser.y @@ -1385,7 +1385,7 @@ static expression_t *new_call_expression(parser_ctx_t *ctx, expression_t *expres return &ret->expr; } -static int parser_error(const char *str) +static int parser_error(parser_ctx_t *ctx, const char *str) { return 0; } diff --git a/dll/win32/jscript/regexp.c b/dll/win32/jscript/regexp.c index ed384485650..6152ea0f655 100644 --- a/dll/win32/jscript/regexp.c +++ b/dll/win32/jscript/regexp.c @@ -883,7 +883,7 @@ ProcessOp(CompilerState *state, REOpData *opData, RENode **operandStack, /* * Hack two bits in CompilerState.flags, for use within FindParenCount to flag - * its being on the stack, and to propagate errors to its callers. + * it being on the stack, and to propagate errors to its callers. */ #define JSREG_FIND_PAREN_COUNT 0x8000 #define JSREG_FIND_PAREN_ERROR 0x4000 diff --git a/dll/win32/jscript/string.c b/dll/win32/jscript/string.c index 08ef69fc7f1..e2df888faa8 100644 --- a/dll/win32/jscript/string.c +++ b/dll/win32/jscript/string.c @@ -1637,26 +1637,21 @@ static HRESULT StringConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags break; } case DISPATCH_CONSTRUCT: { + jsstr_t *str; jsdisp_t *ret; if(argc) { - jsstr_t *str; - hres = to_string(ctx, argv[0], &str); if(FAILED(hres)) return hres; - - hres = create_string(ctx, str, &ret); - jsstr_release(str); }else { - hres = create_string(ctx, jsstr_empty(), &ret); + str = jsstr_empty(); } - if(FAILED(hres)) - return hres; - - *r = jsval_obj(ret); - break; + hres = create_string(ctx, str, &ret); + if (SUCCEEDED(hres)) *r = jsval_obj(ret); + jsstr_release(str); + return hres; } default: diff --git a/dll/win32/kernel32/client/console/console.c b/dll/win32/kernel32/client/console/console.c index e4a3367bf97..857a30a212c 100644 --- a/dll/win32/kernel32/client/console/console.c +++ b/dll/win32/kernel32/client/console/console.c @@ -30,6 +30,7 @@ PHANDLER_ROUTINE InitialHandler[1]; PHANDLER_ROUTINE* CtrlHandlers; ULONG NrCtrlHandlers; ULONG NrAllocatedHandlers; +BOOL LastCloseNotify = FALSE; HANDLE InputWaitHandle = INVALID_HANDLE_VALUE; @@ -58,6 +59,10 @@ DefaultConsoleCtrlHandler(DWORD Event) DPRINT("Ctrl Close Event\n"); break; + case CTRL_LAST_CLOSE_EVENT: + DPRINT("Ctrl Last Close Event\n"); + break; + case CTRL_LOGOFF_EVENT: DPRINT("Ctrl Logoff Event\n"); break; @@ -129,8 +134,14 @@ ConsoleControlDispatcher(IN LPVOID lpThreadParameter) case CTRL_SHUTDOWN_EVENT: break; - case 3: - ExitThread(0); + case CTRL_LAST_CLOSE_EVENT: + /* + * In case the console app hasn't register for last close notification, + * just kill this console handler thread. We don't want that such apps + * get killed for unexpected reasons. On the contrary apps that registered + * can be killed because they expect to be. + */ + if (!LastCloseNotify) ExitThread(0); break; case 4: @@ -164,9 +175,9 @@ ConsoleControlDispatcher(IN LPVOID lpThreadParameter) switch(nCode) { case CTRL_CLOSE_EVENT: + case CTRL_LAST_CLOSE_EVENT: case CTRL_LOGOFF_EVENT: case CTRL_SHUTDOWN_EVENT: - case 3: nExitCode = CodeAndFlag; break; } @@ -277,7 +288,6 @@ DuplicateConsoleHandle(HANDLE hConsole, BOOL bInheritHandle, DWORD dwOptions) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_DUPLICATEHANDLE DuplicateHandleRequest = &ApiMessage.Data.DuplicateHandleRequest; @@ -285,26 +295,88 @@ DuplicateConsoleHandle(HANDLE hConsole, (!(dwOptions & DUPLICATE_SAME_ACCESS) && (dwDesiredAccess & ~(GENERIC_READ | GENERIC_WRITE))) ) { - SetLastError (ERROR_INVALID_PARAMETER); + SetLastError(ERROR_INVALID_PARAMETER); return INVALID_HANDLE_VALUE; } - DuplicateHandleRequest->ConsoleHandle = hConsole; - DuplicateHandleRequest->Access = dwDesiredAccess; - DuplicateHandleRequest->Inheritable = bInheritHandle; - DuplicateHandleRequest->Options = dwOptions; + DuplicateHandleRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + DuplicateHandleRequest->SourceHandle = hConsole; + DuplicateHandleRequest->DesiredAccess = dwDesiredAccess; + DuplicateHandleRequest->InheritHandle = bInheritHandle; + DuplicateHandleRequest->Options = dwOptions; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepDuplicateHandle), - sizeof(CONSOLE_DUPLICATEHANDLE)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepDuplicateHandle), + sizeof(*DuplicateHandleRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return INVALID_HANDLE_VALUE; } - return DuplicateHandleRequest->ConsoleHandle; + return DuplicateHandleRequest->TargetHandle; +} + + +/* + * @implemented + */ +BOOL +WINAPI +GetConsoleHandleInformation(IN HANDLE hHandle, + OUT LPDWORD lpdwFlags) +{ + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETHANDLEINFO GetHandleInfoRequest = &ApiMessage.Data.GetHandleInfoRequest; + + GetHandleInfoRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + GetHandleInfoRequest->Handle = hHandle; + + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetHandleInformation), + sizeof(*GetHandleInfoRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) + { + BaseSetLastNTError(ApiMessage.Status); + return FALSE; + } + + *lpdwFlags = GetHandleInfoRequest->Flags; + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +SetConsoleHandleInformation(IN HANDLE hHandle, + IN DWORD dwMask, + IN DWORD dwFlags) +{ + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_SETHANDLEINFO SetHandleInfoRequest = &ApiMessage.Data.SetHandleInfoRequest; + + SetHandleInfoRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + SetHandleInfoRequest->Handle = hHandle; + SetHandleInfoRequest->Mask = dwMask; + SetHandleInfoRequest->Flags = dwFlags; + + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetHandleInformation), + sizeof(*SetHandleInfoRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) + { + BaseSetLastNTError(ApiMessage.Status); + return FALSE; + } + + return TRUE; } @@ -337,6 +409,7 @@ GetConsoleDisplayMode(LPDWORD lpModeFlags) } *lpModeFlags = GetDisplayModeRequest->DisplayMode; // ModeFlags + return TRUE; } @@ -407,6 +480,7 @@ GetConsoleHardwareState(HANDLE hConsoleOutput, *Flags = HardwareStateRequest->Flags; *State = HardwareStateRequest->State; + return TRUE; } @@ -496,16 +570,15 @@ OpenConsoleW(LPCWSTR wsName, BOOL bInheritHandle, DWORD dwShareMode) { - NTSTATUS Status = STATUS_SUCCESS; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_OPENCONSOLE OpenConsoleRequest = &ApiMessage.Data.OpenConsoleRequest; CONSOLE_HANDLE_TYPE HandleType; - if (wsName && 0 == _wcsicmp(wsName, BaseConInputFileName)) + if (wsName && (_wcsicmp(wsName, BaseConInputFileName) == 0)) { HandleType = HANDLE_INPUT; } - else if (wsName && 0 == _wcsicmp(wsName, BaseConOutputFileName)) + else if (wsName && (_wcsicmp(wsName, BaseConOutputFileName) == 0)) { HandleType = HANDLE_OUTPUT; } @@ -522,22 +595,23 @@ OpenConsoleW(LPCWSTR wsName, return INVALID_HANDLE_VALUE; } - OpenConsoleRequest->HandleType = HandleType; - OpenConsoleRequest->Access = dwDesiredAccess; - OpenConsoleRequest->Inheritable = bInheritHandle; - OpenConsoleRequest->ShareMode = dwShareMode; + OpenConsoleRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + OpenConsoleRequest->HandleType = HandleType; + OpenConsoleRequest->DesiredAccess = dwDesiredAccess; + OpenConsoleRequest->InheritHandle = bInheritHandle; + OpenConsoleRequest->ShareMode = dwShareMode; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepOpenConsole), - sizeof(CONSOLE_OPENCONSOLE)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepOpenConsole), + sizeof(*OpenConsoleRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return INVALID_HANDLE_VALUE; } - return OpenConsoleRequest->ConsoleHandle; + return OpenConsoleRequest->Handle; } @@ -1082,19 +1156,20 @@ WINAPI SetConsoleCursorPosition(HANDLE hConsoleOutput, COORD dwCursorPosition) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_SETCURSORPOSITION SetCursorPositionRequest = &ApiMessage.Data.SetCursorPositionRequest; - ApiMessage.Data.SetCursorPositionRequest.OutputHandle = hConsoleOutput; - ApiMessage.Data.SetCursorPositionRequest.Position = dwCursorPosition; + SetCursorPositionRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + SetCursorPositionRequest->OutputHandle = hConsoleOutput; + SetCursorPositionRequest->Position = dwCursorPosition; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetCursorPosition), - sizeof(CONSOLE_SETCURSORPOSITION)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetCursorPosition), + sizeof(*SetCursorPositionRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } @@ -1112,7 +1187,6 @@ WINAPI GetConsoleMode(HANDLE hConsoleHandle, LPDWORD lpMode) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &ApiMessage.Data.ConsoleModeRequest; @@ -1122,19 +1196,51 @@ GetConsoleMode(HANDLE hConsoleHandle, return FALSE; } - ConsoleModeRequest->ConsoleHandle = hConsoleHandle; + ConsoleModeRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + ConsoleModeRequest->Handle = hConsoleHandle; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetMode), - sizeof(CONSOLE_GETSETCONSOLEMODE)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetMode), + sizeof(*ConsoleModeRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } - *lpMode = ConsoleModeRequest->ConsoleMode; + *lpMode = ConsoleModeRequest->Mode; + + return TRUE; +} + + +/*-------------------------------------------------------------- + * SetConsoleMode + * + * @implemented + */ +BOOL +WINAPI +SetConsoleMode(HANDLE hConsoleHandle, + DWORD dwMode) +{ + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &ApiMessage.Data.ConsoleModeRequest; + + ConsoleModeRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + ConsoleModeRequest->Handle = hConsoleHandle; + ConsoleModeRequest->Mode = dwMode; + + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetMode), + sizeof(*ConsoleModeRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) + { + BaseSetLastNTError(ApiMessage.Status); + return FALSE; + } return TRUE; } @@ -1150,20 +1256,20 @@ WINAPI GetNumberOfConsoleInputEvents(HANDLE hConsoleInput, LPDWORD lpNumberOfEvents) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_GETNUMINPUTEVENTS GetNumInputEventsRequest = &ApiMessage.Data.GetNumInputEventsRequest; - GetNumInputEventsRequest->InputHandle = hConsoleInput; - GetNumInputEventsRequest->NumInputEvents = 0; + GetNumInputEventsRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + GetNumInputEventsRequest->InputHandle = hConsoleInput; + GetNumInputEventsRequest->NumberOfEvents = 0; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetNumberOfInputEvents), - sizeof(CONSOLE_GETNUMINPUTEVENTS)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetNumberOfInputEvents), + sizeof(*GetNumInputEventsRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } @@ -1173,7 +1279,7 @@ GetNumberOfConsoleInputEvents(HANDLE hConsoleInput, return FALSE; } - *lpNumberOfEvents = GetNumInputEventsRequest->NumInputEvents; + *lpNumberOfEvents = GetNumInputEventsRequest->NumberOfEvents; return TRUE; } @@ -1188,21 +1294,21 @@ COORD WINAPI GetLargestConsoleWindowSize(HANDLE hConsoleOutput) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_GETLARGESTWINDOWSIZE GetLargestWindowSizeRequest = &ApiMessage.Data.GetLargestWindowSizeRequest; - GetLargestWindowSizeRequest->OutputHandle = hConsoleOutput; + GetLargestWindowSizeRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + GetLargestWindowSizeRequest->OutputHandle = hConsoleOutput; GetLargestWindowSizeRequest->Size.X = 0; GetLargestWindowSizeRequest->Size.Y = 0; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetLargestWindowSize), - sizeof(CONSOLE_GETLARGESTWINDOWSIZE)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetLargestWindowSize), + sizeof(*GetLargestWindowSizeRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); } DPRINT1("GetLargestConsoleWindowSize, X = %d, Y = %d\n", GetLargestWindowSizeRequest->Size.X, GetLargestWindowSizeRequest->Size.Y); @@ -1220,8 +1326,8 @@ WINAPI GetConsoleCursorInfo(HANDLE hConsoleOutput, PCONSOLE_CURSOR_INFO lpConsoleCursorInfo) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETSETCURSORINFO CursorInfoRequest = &ApiMessage.Data.CursorInfoRequest; if (!lpConsoleCursorInfo) { @@ -1233,19 +1339,51 @@ GetConsoleCursorInfo(HANDLE hConsoleOutput, return FALSE; } - ApiMessage.Data.CursorInfoRequest.OutputHandle = hConsoleOutput; + CursorInfoRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + CursorInfoRequest->OutputHandle = hConsoleOutput; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetCursorInfo), - sizeof(CONSOLE_GETSETCURSORINFO)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetCursorInfo), + sizeof(*CursorInfoRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } - *lpConsoleCursorInfo = ApiMessage.Data.CursorInfoRequest.Info; + *lpConsoleCursorInfo = CursorInfoRequest->Info; + + return TRUE; +} + + +/*-------------------------------------------------------------- + * SetConsoleCursorInfo + * + * @implemented + */ +BOOL +WINAPI +SetConsoleCursorInfo(HANDLE hConsoleOutput, + CONST CONSOLE_CURSOR_INFO *lpConsoleCursorInfo) +{ + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GETSETCURSORINFO CursorInfoRequest = &ApiMessage.Data.CursorInfoRequest; + + CursorInfoRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + CursorInfoRequest->OutputHandle = hConsoleOutput; + CursorInfoRequest->Info = *lpConsoleCursorInfo; + + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetCursorInfo), + sizeof(*CursorInfoRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) + { + BaseSetLastNTError(ApiMessage.Status); + return FALSE; + } return TRUE; } @@ -1266,37 +1404,6 @@ GetNumberOfConsoleMouseButtons(LPDWORD lpNumberOfMouseButtons) } -/*-------------------------------------------------------------- - * SetConsoleMode - * - * @implemented - */ -BOOL -WINAPI -SetConsoleMode(HANDLE hConsoleHandle, - DWORD dwMode) -{ - NTSTATUS Status; - CONSOLE_API_MESSAGE ApiMessage; - PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &ApiMessage.Data.ConsoleModeRequest; - - ConsoleModeRequest->ConsoleHandle = hConsoleHandle; - ConsoleModeRequest->ConsoleMode = dwMode; - - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetMode), - sizeof(CONSOLE_GETSETCONSOLEMODE)); - if (!NT_SUCCESS(Status)) - { - BaseSetLastNTError(Status); - return FALSE; - } - - return TRUE; -} - - /*-------------------------------------------------------------- * SetConsoleActiveScreenBuffer * @@ -1306,18 +1413,19 @@ BOOL WINAPI SetConsoleActiveScreenBuffer(HANDLE hConsoleOutput) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_SETACTIVESCREENBUFFER SetScreenBufferRequest = &ApiMessage.Data.SetScreenBufferRequest; - ApiMessage.Data.SetScreenBufferRequest.OutputHandle = hConsoleOutput; + SetScreenBufferRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + SetScreenBufferRequest->OutputHandle = hConsoleOutput; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetActiveScreenBuffer), - sizeof(CONSOLE_SETACTIVESCREENBUFFER)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetActiveScreenBuffer), + sizeof(*SetScreenBufferRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } @@ -1334,18 +1442,19 @@ BOOL WINAPI FlushConsoleInputBuffer(HANDLE hConsoleInput) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_FLUSHINPUTBUFFER FlushInputBufferRequest = &ApiMessage.Data.FlushInputBufferRequest; - ApiMessage.Data.FlushInputBufferRequest.InputHandle = hConsoleInput; + FlushInputBufferRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + FlushInputBufferRequest->InputHandle = hConsoleInput; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepFlushInputBuffer), - sizeof(CONSOLE_FLUSHINPUTBUFFER)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepFlushInputBuffer), + sizeof(*FlushInputBufferRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } @@ -1363,49 +1472,20 @@ WINAPI SetConsoleScreenBufferSize(HANDLE hConsoleOutput, COORD dwSize) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_SETSCREENBUFFERSIZE SetScreenBufferSizeRequest = &ApiMessage.Data.SetScreenBufferSizeRequest; - ApiMessage.Data.SetScreenBufferSizeRequest.OutputHandle = hConsoleOutput; - ApiMessage.Data.SetScreenBufferSizeRequest.Size = dwSize; + SetScreenBufferSizeRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + SetScreenBufferSizeRequest->OutputHandle = hConsoleOutput; + SetScreenBufferSizeRequest->Size = dwSize; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetScreenBufferSize), - sizeof(CONSOLE_SETSCREENBUFFERSIZE)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetScreenBufferSize), + sizeof(*SetScreenBufferSizeRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); - return FALSE; - } - - return TRUE; -} - - -/*-------------------------------------------------------------- - * SetConsoleCursorInfo - * - * @implemented - */ -BOOL -WINAPI -SetConsoleCursorInfo(HANDLE hConsoleOutput, - CONST CONSOLE_CURSOR_INFO *lpConsoleCursorInfo) -{ - NTSTATUS Status; - CONSOLE_API_MESSAGE ApiMessage; - - ApiMessage.Data.CursorInfoRequest.OutputHandle = hConsoleOutput; - ApiMessage.Data.CursorInfoRequest.Info = *lpConsoleCursorInfo; - - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetCursorInfo), - sizeof(CONSOLE_GETSETCURSORINFO)); - if (!NT_SUCCESS(Status)) - { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } @@ -1513,7 +1593,6 @@ SetConsoleWindowInfo(HANDLE hConsoleOutput, BOOL bAbsolute, CONST SMALL_RECT *lpConsoleWindow) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_SETWINDOWINFO SetWindowInfoRequest = &ApiMessage.Data.SetWindowInfoRequest; @@ -1523,17 +1602,18 @@ SetConsoleWindowInfo(HANDLE hConsoleOutput, return FALSE; } - SetWindowInfoRequest->OutputHandle = hConsoleOutput; - SetWindowInfoRequest->Absolute = bAbsolute; - SetWindowInfoRequest->WindowRect = *lpConsoleWindow; + SetWindowInfoRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + SetWindowInfoRequest->OutputHandle = hConsoleOutput; + SetWindowInfoRequest->Absolute = bAbsolute; + SetWindowInfoRequest->WindowRect = *lpConsoleWindow; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetWindowInfo), - sizeof(CONSOLE_SETWINDOWINFO)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetWindowInfo), + sizeof(*SetWindowInfoRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } @@ -1551,19 +1631,20 @@ WINAPI SetConsoleTextAttribute(HANDLE hConsoleOutput, WORD wAttributes) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_SETTEXTATTRIB SetTextAttribRequest = &ApiMessage.Data.SetTextAttribRequest; - ApiMessage.Data.SetTextAttribRequest.OutputHandle = hConsoleOutput; - ApiMessage.Data.SetTextAttribRequest.Attrib = wAttributes; + SetTextAttribRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + SetTextAttribRequest->OutputHandle = hConsoleOutput; + SetTextAttribRequest->Attributes = wAttributes; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetTextAttribute), - sizeof(CONSOLE_SETTEXTATTRIB)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetTextAttribute), + sizeof(*SetTextAttribRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } @@ -1677,8 +1758,8 @@ WINAPI GenerateConsoleCtrlEvent(DWORD dwCtrlEvent, DWORD dwProcessGroupId) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_GENERATECTRLEVENT GenerateCtrlEventRequest = &ApiMessage.Data.GenerateCtrlEventRequest; if (dwCtrlEvent != CTRL_C_EVENT && dwCtrlEvent != CTRL_BREAK_EVENT) { @@ -1686,16 +1767,17 @@ GenerateConsoleCtrlEvent(DWORD dwCtrlEvent, return FALSE; } - ApiMessage.Data.GenerateCtrlEventRequest.Event = dwCtrlEvent; - ApiMessage.Data.GenerateCtrlEventRequest.ProcessGroup = dwProcessGroupId; + GenerateCtrlEventRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + GenerateCtrlEventRequest->CtrlEvent = dwCtrlEvent; + GenerateCtrlEventRequest->ProcessGroupId = dwProcessGroupId; - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - NULL, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGenerateCtrlEvent), - sizeof(CONSOLE_GENERATECTRLEVENT)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGenerateCtrlEvent), + sizeof(*GenerateCtrlEventRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } @@ -1704,16 +1786,18 @@ GenerateConsoleCtrlEvent(DWORD dwCtrlEvent, static DWORD -IntGetConsoleTitle(LPVOID lpConsoleTitle, DWORD nSize, BOOL bUnicode) +IntGetConsoleTitle(LPVOID lpConsoleTitle, DWORD dwNumChars, BOOLEAN bUnicode) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_GETSETCONSOLETITLE TitleRequest = &ApiMessage.Data.TitleRequest; PCSR_CAPTURE_BUFFER CaptureBuffer; - if (nSize == 0) return 0; + if (dwNumChars == 0) return 0; + + TitleRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + TitleRequest->Length = dwNumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); + TitleRequest->Unicode = bUnicode; - TitleRequest->Length = nSize * (bUnicode ? 1 : sizeof(WCHAR)); CaptureBuffer = CsrAllocateCaptureBuffer(1, TitleRequest->Length); if (CaptureBuffer == NULL) { @@ -1726,42 +1810,32 @@ IntGetConsoleTitle(LPVOID lpConsoleTitle, DWORD nSize, BOOL bUnicode) TitleRequest->Length, (PVOID*)&TitleRequest->Title); - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - CaptureBuffer, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetTitle), - sizeof(CONSOLE_GETSETCONSOLETITLE)); - if (!NT_SUCCESS(Status)) + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetTitle), + sizeof(*TitleRequest)); + if (!NT_SUCCESS(ApiMessage.Status)) { CsrFreeCaptureBuffer(CaptureBuffer); - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return 0; } - if (bUnicode) + dwNumChars = TitleRequest->Length / (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); + + if (dwNumChars > 0) { - if (nSize >= sizeof(WCHAR)) - wcscpy((LPWSTR)lpConsoleTitle, TitleRequest->Title); - } - else - { - if (nSize < TitleRequest->Length / sizeof(WCHAR) || - !WideCharToMultiByte(CP_ACP, // ANSI code page - 0, // performance and mapping flags - TitleRequest->Title, // address of wide-character string - -1, // number of characters in string - (LPSTR)lpConsoleTitle, // address of buffer for new string - nSize, // size of buffer - NULL, // FAST - NULL)) - { - /* Yes, if the buffer isn't big enough, it returns 0... Bad API */ - *(LPSTR)lpConsoleTitle = '\0'; - TitleRequest->Length = 0; - } + memcpy(lpConsoleTitle, TitleRequest->Title, TitleRequest->Length); + + if (bUnicode) + ((LPWSTR)lpConsoleTitle)[dwNumChars] = L'\0'; + else + ((LPSTR)lpConsoleTitle)[dwNumChars] = '\0'; } + CsrFreeCaptureBuffer(CaptureBuffer); - return TitleRequest->Length / sizeof(WCHAR); + return dwNumChars; } @@ -1793,21 +1867,16 @@ GetConsoleTitleA(LPSTR lpConsoleTitle, } -/*-------------------------------------------------------------- - * SetConsoleTitleW - * - * @implemented - */ -BOOL -WINAPI -SetConsoleTitleW(LPCWSTR lpConsoleTitle) +static BOOL +IntSetConsoleTitle(CONST VOID *lpConsoleTitle, DWORD dwNumChars, BOOLEAN bUnicode) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_GETSETCONSOLETITLE TitleRequest = &ApiMessage.Data.TitleRequest; PCSR_CAPTURE_BUFFER CaptureBuffer; - TitleRequest->Length = wcslen(lpConsoleTitle) * sizeof(WCHAR); + TitleRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + TitleRequest->Length = dwNumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); + TitleRequest->Unicode = bUnicode; CaptureBuffer = CsrAllocateCaptureBuffer(1, TitleRequest->Length); if (CaptureBuffer == NULL) @@ -1822,22 +1891,34 @@ SetConsoleTitleW(LPCWSTR lpConsoleTitle) TitleRequest->Length, (PVOID*)&TitleRequest->Title); - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - CaptureBuffer, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetTitle), - sizeof(CONSOLE_GETSETCONSOLETITLE)); + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetTitle), + sizeof(*TitleRequest)); CsrFreeCaptureBuffer(CaptureBuffer); - if (!NT_SUCCESS(Status)) + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return FALSE; } return TRUE; } +/*-------------------------------------------------------------- + * SetConsoleTitleW + * + * @implemented + */ +BOOL +WINAPI +SetConsoleTitleW(LPCWSTR lpConsoleTitle) +{ + return IntSetConsoleTitle(lpConsoleTitle, wcslen(lpConsoleTitle), TRUE); +} + /*-------------------------------------------------------------- * SetConsoleTitleA @@ -1848,22 +1929,7 @@ BOOL WINAPI SetConsoleTitleA(LPCSTR lpConsoleTitle) { - BOOL Ret; - ULONG Length = strlen(lpConsoleTitle) + 1; - LPWSTR WideTitle = HeapAlloc(GetProcessHeap(), 0, Length * sizeof(WCHAR)); - - if (!WideTitle) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - - MultiByteToWideChar(CP_ACP, 0, lpConsoleTitle, -1, WideTitle, Length); - - Ret = SetConsoleTitleW(WideTitle); - - HeapFree(GetProcessHeap(), 0, WideTitle); - return Ret; + return IntSetConsoleTitle(lpConsoleTitle, strlen(lpConsoleTitle), FALSE); } @@ -1880,11 +1946,10 @@ CreateConsoleScreenBuffer(DWORD dwDesiredAccess, DWORD dwFlags, LPVOID lpScreenBufferData) { - NTSTATUS Status; CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_CREATESCREENBUFFER CreateScreenBufferRequest = &ApiMessage.Data.CreateScreenBufferRequest; PCSR_CAPTURE_BUFFER CaptureBuffer = NULL; - PCONSOLE_GRAPHICS_BUFFER_INFO GraphicsBufferInfo = /*(PCONSOLE_GRAPHICS_BUFFER_INFO)*/lpScreenBufferData; + PCONSOLE_GRAPHICS_BUFFER_INFO GraphicsBufferInfo = lpScreenBufferData; if ( (dwDesiredAccess & ~(GENERIC_READ | GENERIC_WRITE)) || (dwShareMode & ~(FILE_SHARE_READ | FILE_SHARE_WRITE)) || @@ -1894,15 +1959,16 @@ CreateConsoleScreenBuffer(DWORD dwDesiredAccess, return INVALID_HANDLE_VALUE; } - CreateScreenBufferRequest->ScreenBufferType = dwFlags; - CreateScreenBufferRequest->Access = dwDesiredAccess; - CreateScreenBufferRequest->ShareMode = dwShareMode; - CreateScreenBufferRequest->Inheritable = + CreateScreenBufferRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + CreateScreenBufferRequest->DesiredAccess = dwDesiredAccess; + CreateScreenBufferRequest->InheritHandle = (lpSecurityAttributes ? lpSecurityAttributes->bInheritHandle : FALSE); + CreateScreenBufferRequest->ShareMode = dwShareMode; + CreateScreenBufferRequest->ScreenBufferType = dwFlags; if (dwFlags == CONSOLE_GRAPHICS_BUFFER) { - if (CreateScreenBufferRequest->Inheritable || GraphicsBufferInfo == NULL) + if (CreateScreenBufferRequest->InheritHandle || GraphicsBufferInfo == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return INVALID_HANDLE_VALUE; @@ -1914,7 +1980,7 @@ CreateConsoleScreenBuffer(DWORD dwDesiredAccess, if (CaptureBuffer == NULL) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; + return INVALID_HANDLE_VALUE; } CsrCaptureMessageBuffer(CaptureBuffer, @@ -1923,24 +1989,23 @@ CreateConsoleScreenBuffer(DWORD dwDesiredAccess, (PVOID*)&CreateScreenBufferRequest->GraphicsBufferInfo.lpBitMapInfo); } - Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, - CaptureBuffer, - CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepCreateScreenBuffer), - sizeof(CONSOLE_CREATESCREENBUFFER)); + CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + CaptureBuffer, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepCreateScreenBuffer), + sizeof(*CreateScreenBufferRequest)); - if (CaptureBuffer) - CsrFreeCaptureBuffer(CaptureBuffer); + if (CaptureBuffer) CsrFreeCaptureBuffer(CaptureBuffer); - if (!NT_SUCCESS(Status)) + if (!NT_SUCCESS(ApiMessage.Status)) { - BaseSetLastNTError(Status); + BaseSetLastNTError(ApiMessage.Status); return INVALID_HANDLE_VALUE; } if (dwFlags == CONSOLE_GRAPHICS_BUFFER && GraphicsBufferInfo) { - GraphicsBufferInfo->hMutex = CreateScreenBufferRequest->GraphicsBufferInfo.hMutex ; - GraphicsBufferInfo->lpBitMap = CreateScreenBufferRequest->GraphicsBufferInfo.lpBitMap; + GraphicsBufferInfo->hMutex = CreateScreenBufferRequest->hMutex ; // CreateScreenBufferRequest->GraphicsBufferInfo.hMutex ; + GraphicsBufferInfo->lpBitMap = CreateScreenBufferRequest->lpBitMap; // CreateScreenBufferRequest->GraphicsBufferInfo.lpBitMap; } return CreateScreenBufferRequest->OutputHandle; @@ -2160,6 +2225,7 @@ GetConsoleSelectionInfo(PCONSOLE_SELECTION_INFO lpConsoleSelectionInfo) } *lpConsoleSelectionInfo = GetSelectionInfoRequest->Info; + return TRUE; } @@ -2540,14 +2606,26 @@ BOOL WINAPI GetConsoleKeyboardLayoutNameW(LPWSTR name) } /* - * @unimplemented + * @implemented */ -BOOL +DWORD WINAPI SetLastConsoleEventActive(VOID) { - STUB; - return FALSE; + CONSOLE_API_MESSAGE ApiMessage; + PCONSOLE_NOTIFYLASTCLOSE NotifyLastCloseRequest = &ApiMessage.Data.NotifyLastCloseRequest; + + /* Set the flag used by the console control dispatcher */ + LastCloseNotify = TRUE; + + /* Set up the input arguments */ + NotifyLastCloseRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; + + /* Call CSRSS; just return the NTSTATUS cast to DWORD */ + return CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, + NULL, + CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepNotifyLastClose), + sizeof(*NotifyLastCloseRequest)); } /* EOF */ diff --git a/dll/win32/kernel32/client/console/init.c b/dll/win32/kernel32/client/console/init.c index 5c90ddf9c61..1313b77a232 100644 --- a/dll/win32/kernel32/client/console/init.c +++ b/dll/win32/kernel32/client/console/init.c @@ -70,7 +70,7 @@ PropDialogHandler(IN LPVOID lpThreadParameter) if (ConsoleLibrary == NULL) { - DPRINT1("Failed to load console.dll"); + DPRINT1("Failed to load console.dll\n"); AlreadyDisplayingProps = FALSE; return STATUS_UNSUCCESSFUL; } diff --git a/dll/win32/kernel32/client/handle.c b/dll/win32/kernel32/client/handle.c index 885ea8808cc..5024f5fef94 100644 --- a/dll/win32/kernel32/client/handle.c +++ b/dll/win32/kernel32/client/handle.c @@ -50,10 +50,7 @@ GetHandleInformation(IN HANDLE hObject, if (IsConsoleHandle(hObject)) { - /* FIXME: GetConsoleHandleInformation required */ - UNIMPLEMENTED; - BaseSetLastNTError(STATUS_NOT_IMPLEMENTED); - return FALSE; + return GetConsoleHandleInformation(hObject, lpdwFlags); } Status = NtQueryObject(hObject, @@ -91,10 +88,7 @@ SetHandleInformation(IN HANDLE hObject, if (IsConsoleHandle(hObject)) { - /* FIXME: SetConsoleHandleInformation required */ - UNIMPLEMENTED; - BaseSetLastNTError(STATUS_NOT_IMPLEMENTED); - return FALSE; + return SetConsoleHandleInformation(hObject, dwMask, dwFlags); } Status = NtQueryObject(hObject, diff --git a/dll/win32/kernel32/include/console.h b/dll/win32/kernel32/include/console.h index a7e69e727f3..8edb3493964 100644 --- a/dll/win32/kernel32/include/console.h +++ b/dll/win32/kernel32/include/console.h @@ -38,6 +38,15 @@ DuplicateConsoleHandle(HANDLE hConsole, BOOL bInheritHandle, DWORD dwOptions); +BOOL WINAPI +GetConsoleHandleInformation(IN HANDLE hHandle, + OUT LPDWORD lpdwFlags); + +BOOL WINAPI +SetConsoleHandleInformation(IN HANDLE hHandle, + IN DWORD dwMask, + IN DWORD dwFlags); + BOOL WINAPI VerifyConsoleIoHandle(HANDLE Handle); diff --git a/dll/win32/localspl/provider.c b/dll/win32/localspl/provider.c index 06ac03ff94a..fb4686101e0 100644 --- a/dll/win32/localspl/provider.c +++ b/dll/win32/localspl/provider.c @@ -199,7 +199,7 @@ static LPWSTR strdupW(LPCWSTR p) static BOOL apd_copyfile( WCHAR *pathname, WCHAR *file_part, apd_data_t *apd ) { WCHAR *srcname; - DWORD res; + BOOL res; apd->src[apd->srclen] = '\0'; apd->dst[apd->dstlen] = '\0'; @@ -222,9 +222,9 @@ static BOOL apd_copyfile( WCHAR *pathname, WCHAR *file_part, apd_data_t *apd ) /* FIXME: handle APD_COPY_NEW_FILES */ res = CopyFileW(srcname, apd->dst, FALSE); - TRACE("got %u with %u\n", res, GetLastError()); + TRACE("got %d with %u\n", res, GetLastError()); - return (apd->lazy) ? TRUE : res; + return apd->lazy || res; } /****************************************************************** @@ -234,7 +234,7 @@ static BOOL apd_copyfile( WCHAR *pathname, WCHAR *file_part, apd_data_t *apd ) * * RETURNS * the length (in WCHAR) of the serverpart (0 for the local computer) - * (-length), when the name is to long + * (-length), when the name is too long * */ static LONG copy_servername_from_name(LPCWSTR name, LPWSTR target) @@ -1115,7 +1115,7 @@ static HMODULE driver_load(const printenv_t * env, LPWSTR dllname) if (!fpGetPrinterDriverDirectory(NULL, (LPWSTR) env->envname, 1, (LPBYTE) fullname, len, &len)) { - /* Should never Fail */ + /* Should never fail */ SetLastError(ERROR_BUFFER_OVERFLOW); return NULL; } @@ -1319,7 +1319,7 @@ static BOOL myAddPrinterDriverEx(DWORD level, LPBYTE pDriverInfo, DWORD dwFileCo len = sizeof(apd.src) - sizeof(version3_subdirW) - sizeof(WCHAR); if (!fpGetPrinterDriverDirectory(NULL, (LPWSTR) env->envname, 1, (LPBYTE) apd.src, len, &len)) { - /* Should never Fail */ + /* Should never fail */ return FALSE; } memcpy(apd.dst, apd.src, len); diff --git a/dll/win32/mapi32/mapi32.spec b/dll/win32/mapi32/mapi32.spec index d8771cef2b6..05c2e8277f7 100644 --- a/dll/win32/mapi32/mapi32.spec +++ b/dll/win32/mapi32/mapi32.spec @@ -62,12 +62,12 @@ 80 stdcall LPropCompareProp@8(ptr ptr) LPropCompareProp 81 stub HrAddColumns@16 82 stub HrAddColumnsEx@20 -121 stdcall -ret64 FtAddFt@16(double double) MAPI32_FtAddFt +121 stdcall -ret64 FtAddFt@16(int64 int64) MAPI32_FtAddFt 122 stub FtAdcFt@20 -123 stdcall -ret64 FtSubFt@16(double double) MAPI32_FtSubFt -124 stdcall -ret64 FtMulDw@12(long double) MAPI32_FtMulDw +123 stdcall -ret64 FtSubFt@16(int64 int64) MAPI32_FtSubFt +124 stdcall -ret64 FtMulDw@12(long int64) MAPI32_FtMulDw 125 stdcall -ret64 FtMulDwDw@8(long long) MAPI32_FtMulDwDw -126 stdcall -ret64 FtNegFt@8(double) MAPI32_FtNegFt +126 stdcall -ret64 FtNegFt@8(int64) MAPI32_FtNegFt 127 stub FtDivFtBogus@20 128 stdcall UlAddRef@4(ptr) UlAddRef 129 stdcall UlRelease@4(ptr) UlRelease diff --git a/dll/win32/mciqtz32/mciqtz.c b/dll/win32/mciqtz32/mciqtz.c index 7dcdf9c8113..312aaf23eae 100644 --- a/dll/win32/mciqtz32/mciqtz.c +++ b/dll/win32/mciqtz32/mciqtz.c @@ -264,7 +264,7 @@ err: if (wma->uninit) CoUninitialize(); - wma->uninit = 0; + wma->uninit = FALSE; return MCIERR_INTERNAL; } @@ -736,13 +736,13 @@ static DWORD MCIQTZ_mciWhere(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lp if (dwFlags & MCI_DGV_WHERE_SOURCE) { if (dwFlags & MCI_DGV_WHERE_MAX) - FIXME("MCI_DGV_WHERE_SOURCE_MAX stub %s\n", wine_dbgstr_rect(&rc)); + FIXME("MCI_DGV_WHERE_SOURCE_MAX stub\n"); IBasicVideo_GetSourcePosition(wma->vidbasic, &rc.left, &rc.top, &rc.right, &rc.bottom); TRACE("MCI_DGV_WHERE_SOURCE %s\n", wine_dbgstr_rect(&rc)); } if (dwFlags & MCI_DGV_WHERE_DESTINATION) { if (dwFlags & MCI_DGV_WHERE_MAX) - FIXME("MCI_DGV_WHERE_DESTINATION_MAX stub %s\n", wine_dbgstr_rect(&rc)); + FIXME("MCI_DGV_WHERE_DESTINATION_MAX stub\n"); IBasicVideo_GetDestinationPosition(wma->vidbasic, &rc.left, &rc.top, &rc.right, &rc.bottom); TRACE("MCI_DGV_WHERE_DESTINATION %s\n", wine_dbgstr_rect(&rc)); } diff --git a/dll/win32/mlang/mlang.c b/dll/win32/mlang/mlang.c index 0df3c278419..0b6e7412484 100644 --- a/dll/win32/mlang/mlang.c +++ b/dll/win32/mlang/mlang.c @@ -39,6 +39,7 @@ //#include "objbase.h" #include #include +#include #include #include @@ -47,8 +48,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(mlang); //#include "initguid.h" -#define CP_UNICODE 1200 - static HRESULT MultiLanguage_create(IUnknown *pUnkOuter, LPVOID *ppObj); static HRESULT MLangConvertCharset_create(IUnknown *outer, void **obj); static HRESULT EnumRfc1766_create(LANGID LangId, IEnumRfc1766 **ppEnum); @@ -577,8 +576,8 @@ static inline void sjis2jis(unsigned char *p1, unsigned char *p2) static int han2zen(unsigned char *p1, unsigned char *p2) { - int maru = FALSE; - int nigori = FALSE; + BOOL maru = FALSE; + BOOL nigori = FALSE; static const unsigned char char1[] = {129,129,129,129,129,131,131,131,131, 131,131,131,131,131,131,129,131,131,131,131,131,131,131,131,131,131, 131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131, @@ -625,7 +624,7 @@ static UINT ConvertJIS2SJIS(LPCSTR input, DWORD count, LPSTR output) DWORD i = 0; int j = 0; unsigned char p2,p; - int shifted = FALSE; + BOOL shifted = FALSE; while (i < count) { @@ -693,7 +692,7 @@ static UINT ConvertSJIS2JIS(LPCSTR input, DWORD count, LPSTR output) DWORD i = 0; int j = 0; unsigned char p2,p; - int shifted = FALSE; + BOOL shifted = FALSE; while (i < count) { @@ -3487,10 +3486,28 @@ static HRESULT WINAPI fnIMLangLineBreakConsole_BreakLineA( LONG* pcchLine, LONG* pcchSkip) { + LONG i, line = cchSrc, skip = 0; + FIXME("(%p)->%i %i %s %i %i %p %p\n", iface, locale, uCodePage, debugstr_an(pszSrc,cchSrc), cchSrc, cMaxColumns, pcchLine, pcchSkip); - *pcchLine = cchSrc; - *pcchSkip = 0; + if (uCodePage == CP_USASCII && cchSrc > cMaxColumns) + { + for (line = cMaxColumns, i = cMaxColumns - 1; i >= 0; i--) + { + if (pszSrc[i] == ' ') + { + while (i >= 0 && pszSrc[i] == ' ') + { + i--; + line--; + skip++; + } + break; + } + } + } + *pcchLine = line; + *pcchSkip = skip; return S_OK; } diff --git a/dll/win32/mlang/mlang_classes.idl b/dll/win32/mlang/mlang_classes.idl index 1832e2b0527..645ff004395 100644 --- a/dll/win32/mlang/mlang_classes.idl +++ b/dll/win32/mlang/mlang_classes.idl @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ helpstring("Multi Language Support"), threading(both), diff --git a/dll/win32/msacm32/msacm32.drv/CMakeLists.txt b/dll/win32/msacm32/msacm32.drv/CMakeLists.txt index 407d47dde53..34891e21cce 100644 --- a/dll/win32/msacm32/msacm32.drv/CMakeLists.txt +++ b/dll/win32/msacm32/msacm32.drv/CMakeLists.txt @@ -1,18 +1,14 @@ - include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) - spec2def(msacm32.drv msacm32.drv.spec) -add_library(msacm32.drv SHARED wavemap.c wavemap.rc +add_library(msacm32.drv SHARED + wavemap.c + wavemap.rc ${CMAKE_CURRENT_BINARY_DIR}/msacm32.def) set_module_type(msacm32.drv win32dll UNICODE) - set_target_properties(msacm32.drv PROPERTIES SUFFIX "") - target_link_libraries(msacm32.drv wine) - -add_importlibs(msacm32.drv msvcrt msacm32 user32 winmm advapi32 kernel32 ntdll) -add_dependencies(msacm32.drv psdk) +add_importlibs(msacm32.drv msacm32 user32 winmm advapi32 msvcrt kernel32 ntdll) add_cd_file(TARGET msacm32.drv DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/msacm32/msacm32.drv/wavemap.c b/dll/win32/msacm32/msacm32.drv/wavemap.c index c2b2a06b579..883982191c9 100644 --- a/dll/win32/msacm32/msacm32.drv/wavemap.c +++ b/dll/win32/msacm32/msacm32.drv/wavemap.c @@ -337,7 +337,7 @@ static DWORD wodWrite(WAVEMAPDATA* wom, LPWAVEHDR lpWaveHdrSrc, DWORD dwParam2) if (ash->cbSrcLength > ash->cbSrcLengthUsed) FIXME("Not all src buffer has been written, expect bogus sound\n"); else if (ash->cbSrcLength < ash->cbSrcLengthUsed) - ERR("CoDec has read more data than it is allowed to\n"); + ERR("Codec has read more data than it is allowed to\n"); if (ash->cbDstLengthUsed == 0) { /* something went wrong in decoding */ @@ -675,7 +675,7 @@ static void CALLBACK widCallback(HWAVEIN hWave, UINT uMsg, DWORD_PTR dwInstance, return; } - if (hWave != wim->u.in.hInnerWave && uMsg != WIM_OPEN) + if (uMsg != WIM_OPEN && hWave != wim->u.in.hInnerWave) ERR("Shouldn't happen (%p %p)\n", hWave, wim->u.in.hInnerWave); switch (uMsg) { diff --git a/dll/win32/msacm32/stream.c b/dll/win32/msacm32/stream.c index 74ad5ae0ce6..44b972950e8 100644 --- a/dll/win32/msacm32/stream.c +++ b/dll/win32/msacm32/stream.c @@ -298,9 +298,6 @@ MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, if (fdwPrepare) ret = MMSYSERR_INVALFLAG; - if (pash->fdwStatus & ACMSTREAMHEADER_STATUSF_DONE) - return MMSYSERR_NOERROR; - /* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same * size. some fields are private to msacm internals, and are exposed * in ACMSTREAMHEADER in the dwReservedDriver array @@ -321,7 +318,7 @@ MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, ret = MSACM_Message((HACMDRIVER)was->pDrv, ACMDM_STREAM_PREPARE, (LPARAM)&was->drvInst, (LPARAM)padsh); if (ret == MMSYSERR_NOERROR || ret == MMSYSERR_NOTSUPPORTED) { ret = MMSYSERR_NOERROR; - padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE); + padsh->fdwStatus &= ~ACMSTREAMHEADER_STATUSF_INQUEUE; padsh->fdwStatus |= ACMSTREAMHEADER_STATUSF_PREPARED; padsh->fdwPrepared = padsh->fdwStatus; padsh->dwPrepared = 0; @@ -464,7 +461,7 @@ MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, ret = MSACM_Message((HACMDRIVER)was->pDrv, ACMDM_STREAM_UNPREPARE, (LPARAM)&was->drvInst, (LPARAM)padsh); if (ret == MMSYSERR_NOERROR || ret == MMSYSERR_NOTSUPPORTED) { ret = MMSYSERR_NOERROR; - padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE|ACMSTREAMHEADER_STATUSF_PREPARED); + padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_INQUEUE|ACMSTREAMHEADER_STATUSF_PREPARED); } TRACE("=> (%d)\n", ret); return ret; diff --git a/dll/win32/msadp32.acm/msadp32.c b/dll/win32/msadp32.acm/msadp32.c index dcf36523a87..435b34f5fe6 100644 --- a/dll/win32/msadp32.acm/msadp32.c +++ b/dll/win32/msadp32.acm/msadp32.c @@ -225,6 +225,11 @@ static inline void process_nibble(unsigned nibble, int* idelta, if (*idelta < 16) *idelta = 16; } +static inline unsigned char C168(short s) +{ + return HIBYTE(s) ^ (unsigned char)0x80; +} + static void cvtSSms16K(const ACMDRVSTREAMINSTANCE *adsi, const unsigned char* src, LPDWORD nsrc, unsigned char* dst, LPDWORD ndst) @@ -236,10 +241,10 @@ static void cvtSSms16K(const ACMDRVSTREAMINSTANCE *adsi, int nsamp; int nsamp_blk = ((ADPCMWAVEFORMAT*)adsi->pwfxSrc)->wSamplesPerBlock; DWORD nblock = min(*nsrc / adsi->pwfxSrc->nBlockAlign, - *ndst / (nsamp_blk * 2 * 2)); + *ndst / (nsamp_blk * adsi->pwfxDst->nBlockAlign)); *nsrc = nblock * adsi->pwfxSrc->nBlockAlign; - *ndst = nblock * nsamp_blk * 2 * 2; + *ndst = nblock * nsamp_blk * adsi->pwfxDst->nBlockAlign; nsamp_blk -= 2; /* see below for samples from block head */ for (; nblock > 0; nblock--) @@ -258,18 +263,34 @@ static void cvtSSms16K(const ACMDRVSTREAMINSTANCE *adsi, sample2L = R16(src); src += 2; sample2R = R16(src); src += 2; - /* store samples from block head */ - W16(dst, sample2L); dst += 2; - W16(dst, sample2R); dst += 2; - W16(dst, sample1L); dst += 2; - W16(dst, sample1R); dst += 2; + if(adsi->pwfxDst->wBitsPerSample == 8){ + /* store samples from block head */ + *dst = C168(sample2L); ++dst; + *dst = C168(sample2R); ++dst; + *dst = C168(sample1L); ++dst; + *dst = C168(sample1R); ++dst; - for (nsamp = nsamp_blk; nsamp > 0; nsamp--) - { - process_nibble(*src >> 4, &ideltaL, &sample1L, &sample2L, &coeffL); - W16(dst, sample1L); dst += 2; - process_nibble(*src++ & 0x0F, &ideltaR, &sample1R, &sample2R, &coeffR); - W16(dst, sample1R); dst += 2; + for (nsamp = nsamp_blk; nsamp > 0; nsamp--) + { + process_nibble(*src >> 4, &ideltaL, &sample1L, &sample2L, &coeffL); + *dst = C168(sample1L); ++dst; + process_nibble(*src++ & 0x0F, &ideltaR, &sample1R, &sample2R, &coeffR); + *dst = C168(sample1R); ++dst; + } + }else if(adsi->pwfxDst->wBitsPerSample == 16){ + /* store samples from block head */ + W16(dst, sample2L); dst += 2; + W16(dst, sample2R); dst += 2; + W16(dst, sample1L); dst += 2; + W16(dst, sample1R); dst += 2; + + for (nsamp = nsamp_blk; nsamp > 0; nsamp--) + { + process_nibble(*src >> 4, &ideltaL, &sample1L, &sample2L, &coeffL); + W16(dst, sample1L); dst += 2; + process_nibble(*src++ & 0x0F, &ideltaR, &sample1R, &sample2R, &coeffR); + W16(dst, sample1R); dst += 2; + } } src = in_src + adsi->pwfxSrc->nBlockAlign; } @@ -285,10 +306,10 @@ static void cvtMMms16K(const ACMDRVSTREAMINSTANCE *adsi, int nsamp; int nsamp_blk = ((ADPCMWAVEFORMAT*)adsi->pwfxSrc)->wSamplesPerBlock; DWORD nblock = min(*nsrc / adsi->pwfxSrc->nBlockAlign, - *ndst / (nsamp_blk * 2)); + *ndst / (nsamp_blk * adsi->pwfxDst->nBlockAlign)); *nsrc = nblock * adsi->pwfxSrc->nBlockAlign; - *ndst = nblock * nsamp_blk * 2; + *ndst = nblock * nsamp_blk * adsi->pwfxDst->nBlockAlign; nsamp_blk -= 2; /* see below for samples from block head */ for (; nblock > 0; nblock--) @@ -303,16 +324,30 @@ static void cvtMMms16K(const ACMDRVSTREAMINSTANCE *adsi, sample2 = R16(src); src += 2; /* store samples from block head */ - W16(dst, sample2); dst += 2; - W16(dst, sample1); dst += 2; + if(adsi->pwfxDst->wBitsPerSample == 8){ + *dst = C168(sample2); ++dst; + *dst = C168(sample1); ++dst; - for (nsamp = nsamp_blk; nsamp > 0; nsamp -= 2) - { - process_nibble(*src >> 4, &idelta, &sample1, &sample2, &coeff); - W16(dst, sample1); dst += 2; - process_nibble(*src++ & 0x0F, &idelta, &sample1, &sample2, &coeff); - W16(dst, sample1); dst += 2; + for (nsamp = nsamp_blk; nsamp > 0; nsamp -= 2) + { + process_nibble(*src >> 4, &idelta, &sample1, &sample2, &coeff); + *dst = C168(sample1); ++dst; + process_nibble(*src++ & 0x0F, &idelta, &sample1, &sample2, &coeff); + *dst = C168(sample1); ++dst; + } + }else if(adsi->pwfxDst->wBitsPerSample == 16){ + W16(dst, sample2); dst += 2; + W16(dst, sample1); dst += 2; + + for (nsamp = nsamp_blk; nsamp > 0; nsamp -= 2) + { + process_nibble(*src >> 4, &idelta, &sample1, &sample2, &coeff); + W16(dst, sample1); dst += 2; + process_nibble(*src++ & 0x0F, &idelta, &sample1, &sample2, &coeff); + W16(dst, sample1); dst += 2; + } } + src = in_src + adsi->pwfxSrc->nBlockAlign; } } @@ -555,12 +590,9 @@ static LRESULT ADPCM_StreamOpen(PACMDRVSTREAMINSTANCE adsi) else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_ADPCM && adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM) { - /* resampling or mono <=> stereo not available - * ADPCM algo only define 16 bit per sample output - */ + /* resampling or mono <=> stereo not available */ if (adsi->pwfxSrc->nSamplesPerSec != adsi->pwfxDst->nSamplesPerSec || - adsi->pwfxSrc->nChannels != adsi->pwfxDst->nChannels || - adsi->pwfxDst->wBitsPerSample != 16) + adsi->pwfxSrc->nChannels != adsi->pwfxDst->nChannels) goto theEnd; #if 0 @@ -579,9 +611,9 @@ static LRESULT ADPCM_StreamOpen(PACMDRVSTREAMINSTANCE adsi) #endif /* adpcm decoding... */ - if (adsi->pwfxDst->wBitsPerSample == 16 && adsi->pwfxDst->nChannels == 2) + if (adsi->pwfxDst->nChannels == 2) aad->convert = cvtSSms16K; - if (adsi->pwfxDst->wBitsPerSample == 16 && adsi->pwfxDst->nChannels == 1) + else if (adsi->pwfxDst->nChannels == 1) aad->convert = cvtMMms16K; } else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM && diff --git a/dll/win32/mscms/mscms_main.c b/dll/win32/mscms/mscms_main.c index 6a021752f32..3cffd7ad059 100644 --- a/dll/win32/mscms/mscms_main.c +++ b/dll/win32/mscms/mscms_main.c @@ -53,6 +53,8 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) DisableThreadLibraryCalls( hinst ); #ifdef HAVE_LCMS2 cmsSetLogErrorHandler( lcms_error_handler ); +#else + ERR( "No support for liblcms2, expect problems\n" ); #endif break; case DLL_PROCESS_DETACH: diff --git a/dll/win32/mscms/transform.c b/dll/win32/mscms/transform.c index b4ad55267b3..5f2e588c97f 100644 --- a/dll/win32/mscms/transform.c +++ b/dll/win32/mscms/transform.c @@ -60,7 +60,7 @@ static DWORD from_profile( HPROFILE profile ) static DWORD from_bmformat( BMFORMAT format ) { - static int quietfixme = 0; + static BOOL quietfixme = FALSE; TRACE( "bitmap format: 0x%08x\n", format ); switch (format) @@ -71,10 +71,10 @@ static DWORD from_bmformat( BMFORMAT format ) case BM_xRGBQUADS: return TYPE_ARGB_8; case BM_xBGRQUADS: return TYPE_ABGR_8; default: - if (quietfixme == 0) + if (!quietfixme) { FIXME("unhandled bitmap format 0x%x\n", format); - quietfixme = 1; + quietfixme = TRUE; } return TYPE_RGB_8; } diff --git a/dll/win32/msctf/categorymgr.c b/dll/win32/msctf/categorymgr.c index 01f94201f3a..509494fd0ed 100644 --- a/dll/win32/msctf/categorymgr.c +++ b/dll/win32/msctf/categorymgr.c @@ -43,7 +43,7 @@ static HRESULT WINAPI CategoryMgr_QueryInterface(ITfCategoryMgr *iface, REFIID i if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfCategoryMgr)) { - *ppvOut = This; + *ppvOut = &This->ITfCategoryMgr_iface; } if (*ppvOut) @@ -371,12 +371,11 @@ static HRESULT WINAPI CategoryMgr_IsEqualTfGuidAtom ( ITfCategoryMgr *iface, } -static const ITfCategoryMgrVtbl CategoryMgr_CategoryMgrVtbl = +static const ITfCategoryMgrVtbl CategoryMgrVtbl = { CategoryMgr_QueryInterface, CategoryMgr_AddRef, CategoryMgr_Release, - CategoryMgr_RegisterCategory, CategoryMgr_UnregisterCategory, CategoryMgr_EnumCategoriesInItem, @@ -403,10 +402,10 @@ HRESULT CategoryMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) if (This == NULL) return E_OUTOFMEMORY; - This->ITfCategoryMgr_iface.lpVtbl = &CategoryMgr_CategoryMgrVtbl; + This->ITfCategoryMgr_iface.lpVtbl = &CategoryMgrVtbl; This->refCount = 1; - TRACE("returning %p\n", This); - *ppOut = (IUnknown *)This; + *ppOut = (IUnknown *)&This->ITfCategoryMgr_iface; + TRACE("returning %p\n", *ppOut); return S_OK; } diff --git a/dll/win32/msctf/compartmentmgr.c b/dll/win32/msctf/compartmentmgr.c index e356bb68ee0..17dc2d6f21b 100644 --- a/dll/win32/msctf/compartmentmgr.c +++ b/dll/win32/msctf/compartmentmgr.c @@ -30,7 +30,7 @@ typedef struct tagCompartmentValue { } CompartmentValue; typedef struct tagCompartmentMgr { - const ITfCompartmentMgrVtbl *CompartmentMgrVtbl; + ITfCompartmentMgr ITfCompartmentMgr_iface; LONG refCount; IUnknown *pUnkOuter; @@ -39,7 +39,7 @@ typedef struct tagCompartmentMgr { } CompartmentMgr; typedef struct tagCompartmentEnumGuid { - const IEnumGUIDVtbl *Vtbl; + IEnumGUID IEnumGUID_iface; LONG refCount; struct list *values; @@ -56,8 +56,8 @@ typedef struct tagCompartmentSink { } CompartmentSink; typedef struct tagCompartment { - const ITfCompartmentVtbl *Vtbl; - const ITfSourceVtbl *SourceVtbl; + ITfCompartment ITfCompartment_iface; + ITfSource ITfSource_iface; LONG refCount; /* Only VT_I4, VT_UNKNOWN and VT_BSTR data types are allowed */ @@ -69,14 +69,29 @@ typedef struct tagCompartment { static HRESULT CompartmentEnumGuid_Constructor(struct list* values, IEnumGUID **ppOut); static HRESULT Compartment_Constructor(CompartmentValue *value, ITfCompartment **ppOut); -static inline Compartment *impl_from_ITfSourceVtbl(ITfSource *iface) +static inline CompartmentMgr *impl_from_ITfCompartmentMgr(ITfCompartmentMgr *iface) { - return (Compartment *)((char *)iface - FIELD_OFFSET(Compartment,SourceVtbl)); + return CONTAINING_RECORD(iface, CompartmentMgr, ITfCompartmentMgr_iface); +} + +static inline Compartment *impl_from_ITfCompartment(ITfCompartment *iface) +{ + return CONTAINING_RECORD(iface, Compartment, ITfCompartment_iface); +} + +static inline Compartment *impl_from_ITfSource(ITfSource *iface) +{ + return CONTAINING_RECORD(iface, Compartment, ITfSource_iface); +} + +static inline CompartmentEnumGuid *impl_from_IEnumGUID(IEnumGUID *iface) +{ + return CONTAINING_RECORD(iface, CompartmentEnumGuid, IEnumGUID_iface); } HRESULT CompartmentMgr_Destructor(ITfCompartmentMgr *iface) { - CompartmentMgr *This = (CompartmentMgr *)iface; + CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface); struct list *cursor, *cursor2; LIST_FOR_EACH_SAFE(cursor, cursor2, &This->values) @@ -96,16 +111,16 @@ HRESULT CompartmentMgr_Destructor(ITfCompartmentMgr *iface) *****************************************************/ static HRESULT WINAPI CompartmentMgr_QueryInterface(ITfCompartmentMgr *iface, REFIID iid, LPVOID *ppvOut) { - CompartmentMgr *This = (CompartmentMgr *)iface; + CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface); if (This->pUnkOuter) - return IUnknown_QueryInterface(This->pUnkOuter, iid, *ppvOut); + return IUnknown_QueryInterface(This->pUnkOuter, iid, ppvOut); else { *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfCompartmentMgr)) { - *ppvOut = This; + *ppvOut = &This->ITfCompartmentMgr_iface; } if (*ppvOut) @@ -121,7 +136,7 @@ static HRESULT WINAPI CompartmentMgr_QueryInterface(ITfCompartmentMgr *iface, RE static ULONG WINAPI CompartmentMgr_AddRef(ITfCompartmentMgr *iface) { - CompartmentMgr *This = (CompartmentMgr *)iface; + CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface); if (This->pUnkOuter) return IUnknown_AddRef(This->pUnkOuter); else @@ -130,7 +145,7 @@ static ULONG WINAPI CompartmentMgr_AddRef(ITfCompartmentMgr *iface) static ULONG WINAPI CompartmentMgr_Release(ITfCompartmentMgr *iface) { - CompartmentMgr *This = (CompartmentMgr *)iface; + CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface); if (This->pUnkOuter) return IUnknown_Release(This->pUnkOuter); else @@ -147,7 +162,7 @@ static ULONG WINAPI CompartmentMgr_Release(ITfCompartmentMgr *iface) static HRESULT WINAPI CompartmentMgr_GetCompartment(ITfCompartmentMgr *iface, REFGUID rguid, ITfCompartment **ppcomp) { - CompartmentMgr *This = (CompartmentMgr *)iface; + CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface); CompartmentValue* value; struct list *cursor; HRESULT hr; @@ -186,8 +201,9 @@ static HRESULT WINAPI CompartmentMgr_GetCompartment(ITfCompartmentMgr *iface, static HRESULT WINAPI CompartmentMgr_ClearCompartment(ITfCompartmentMgr *iface, TfClientId tid, REFGUID rguid) { + CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface); struct list *cursor; - CompartmentMgr *This = (CompartmentMgr *)iface; + TRACE("(%p) %i %s\n",This,tid,debugstr_guid(rguid)); LIST_FOR_EACH(cursor, &This->values) @@ -210,19 +226,19 @@ static HRESULT WINAPI CompartmentMgr_ClearCompartment(ITfCompartmentMgr *iface, static HRESULT WINAPI CompartmentMgr_EnumCompartments(ITfCompartmentMgr *iface, IEnumGUID **ppEnum) { - CompartmentMgr *This = (CompartmentMgr *)iface; + CompartmentMgr *This = impl_from_ITfCompartmentMgr(iface); + TRACE("(%p) %p\n",This,ppEnum); if (!ppEnum) return E_INVALIDARG; return CompartmentEnumGuid_Constructor(&This->values, ppEnum); } -static const ITfCompartmentMgrVtbl CompartmentMgr_CompartmentMgrVtbl = +static const ITfCompartmentMgrVtbl CompartmentMgrVtbl = { CompartmentMgr_QueryInterface, CompartmentMgr_AddRef, CompartmentMgr_Release, - CompartmentMgr_GetCompartment, CompartmentMgr_ClearCompartment, CompartmentMgr_EnumCompartments @@ -242,20 +258,20 @@ HRESULT CompartmentMgr_Constructor(IUnknown *pUnkOuter, REFIID riid, IUnknown ** if (This == NULL) return E_OUTOFMEMORY; - This->CompartmentMgrVtbl = &CompartmentMgr_CompartmentMgrVtbl; + This->ITfCompartmentMgr_iface.lpVtbl = &CompartmentMgrVtbl; This->pUnkOuter = pUnkOuter; list_init(&This->values); if (pUnkOuter) { - TRACE("returning %p\n", This); - *ppOut = (IUnknown*)This; + *ppOut = (IUnknown*)&This->ITfCompartmentMgr_iface; + TRACE("returning %p\n", *ppOut); return S_OK; } else { HRESULT hr; - hr = IUnknown_QueryInterface((IUnknown*)This, riid, (LPVOID*)ppOut); + hr = ITfCompartmentMgr_QueryInterface(&This->ITfCompartmentMgr_iface, riid, (void**)ppOut); if (FAILED(hr)) HeapFree(GetProcessHeap(),0,This); return hr; @@ -273,12 +289,12 @@ static void CompartmentEnumGuid_Destructor(CompartmentEnumGuid *This) static HRESULT WINAPI CompartmentEnumGuid_QueryInterface(IEnumGUID *iface, REFIID iid, LPVOID *ppvOut) { - CompartmentEnumGuid *This = (CompartmentEnumGuid *)iface; + CompartmentEnumGuid *This = impl_from_IEnumGUID(iface); *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumGUID)) { - *ppvOut = This; + *ppvOut = &This->IEnumGUID_iface; } if (*ppvOut) @@ -293,13 +309,13 @@ static HRESULT WINAPI CompartmentEnumGuid_QueryInterface(IEnumGUID *iface, REFII static ULONG WINAPI CompartmentEnumGuid_AddRef(IEnumGUID *iface) { - CompartmentEnumGuid *This = (CompartmentEnumGuid*)iface; + CompartmentEnumGuid *This = impl_from_IEnumGUID(iface); return InterlockedIncrement(&This->refCount); } static ULONG WINAPI CompartmentEnumGuid_Release(IEnumGUID *iface) { - CompartmentEnumGuid *This = (CompartmentEnumGuid *)iface; + CompartmentEnumGuid *This = impl_from_IEnumGUID(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -311,10 +327,10 @@ static ULONG WINAPI CompartmentEnumGuid_Release(IEnumGUID *iface) /***************************************************** * IEnumGuid functions *****************************************************/ -static HRESULT WINAPI CompartmentEnumGuid_Next( LPENUMGUID iface, +static HRESULT WINAPI CompartmentEnumGuid_Next(IEnumGUID *iface, ULONG celt, GUID *rgelt, ULONG *pceltFetched) { - CompartmentEnumGuid *This = (CompartmentEnumGuid *)iface; + CompartmentEnumGuid *This = impl_from_IEnumGUID(iface); ULONG fetched = 0; TRACE("(%p)\n",This); @@ -338,27 +354,27 @@ static HRESULT WINAPI CompartmentEnumGuid_Next( LPENUMGUID iface, return fetched == celt ? S_OK : S_FALSE; } -static HRESULT WINAPI CompartmentEnumGuid_Skip( LPENUMGUID iface, ULONG celt) +static HRESULT WINAPI CompartmentEnumGuid_Skip(IEnumGUID *iface, ULONG celt) { - CompartmentEnumGuid *This = (CompartmentEnumGuid *)iface; + CompartmentEnumGuid *This = impl_from_IEnumGUID(iface); TRACE("(%p)\n",This); This->cursor = list_next(This->values,This->cursor); return S_OK; } -static HRESULT WINAPI CompartmentEnumGuid_Reset( LPENUMGUID iface) +static HRESULT WINAPI CompartmentEnumGuid_Reset(IEnumGUID *iface) { - CompartmentEnumGuid *This = (CompartmentEnumGuid *)iface; + CompartmentEnumGuid *This = impl_from_IEnumGUID(iface); TRACE("(%p)\n",This); This->cursor = list_head(This->values); return S_OK; } -static HRESULT WINAPI CompartmentEnumGuid_Clone( LPENUMGUID iface, +static HRESULT WINAPI CompartmentEnumGuid_Clone(IEnumGUID *iface, IEnumGUID **ppenum) { - CompartmentEnumGuid *This = (CompartmentEnumGuid *)iface; + CompartmentEnumGuid *This = impl_from_IEnumGUID(iface); HRESULT res; TRACE("(%p)\n",This); @@ -368,17 +384,17 @@ static HRESULT WINAPI CompartmentEnumGuid_Clone( LPENUMGUID iface, res = CompartmentEnumGuid_Constructor(This->values, ppenum); if (SUCCEEDED(res)) { - CompartmentEnumGuid *new_This = (CompartmentEnumGuid *)*ppenum; + CompartmentEnumGuid *new_This = impl_from_IEnumGUID(*ppenum); new_This->cursor = This->cursor; } return res; } -static const IEnumGUIDVtbl IEnumGUID_Vtbl ={ +static const IEnumGUIDVtbl EnumGUIDVtbl = +{ CompartmentEnumGuid_QueryInterface, CompartmentEnumGuid_AddRef, CompartmentEnumGuid_Release, - CompartmentEnumGuid_Next, CompartmentEnumGuid_Skip, CompartmentEnumGuid_Reset, @@ -393,14 +409,14 @@ static HRESULT CompartmentEnumGuid_Constructor(struct list *values, IEnumGUID ** if (This == NULL) return E_OUTOFMEMORY; - This->Vtbl= &IEnumGUID_Vtbl; + This->IEnumGUID_iface.lpVtbl= &EnumGUIDVtbl; This->refCount = 1; This->values = values; This->cursor = list_head(values); - TRACE("returning %p\n", This); - *ppOut = (IEnumGUID*)This; + *ppOut = &This->IEnumGUID_iface; + TRACE("returning %p\n", *ppOut); return S_OK; } @@ -429,16 +445,17 @@ static void Compartment_Destructor(Compartment *This) static HRESULT WINAPI Compartment_QueryInterface(ITfCompartment *iface, REFIID iid, LPVOID *ppvOut) { - Compartment *This = (Compartment *)iface; + Compartment *This = impl_from_ITfCompartment(iface); + *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfCompartment)) { - *ppvOut = This; + *ppvOut = &This->ITfCompartment_iface; } else if (IsEqualIID(iid, &IID_ITfSource)) { - *ppvOut = &This->SourceVtbl; + *ppvOut = &This->ITfSource_iface; } if (*ppvOut) @@ -453,13 +470,13 @@ static HRESULT WINAPI Compartment_QueryInterface(ITfCompartment *iface, REFIID i static ULONG WINAPI Compartment_AddRef(ITfCompartment *iface) { - Compartment *This = (Compartment*)iface; + Compartment *This = impl_from_ITfCompartment(iface); return InterlockedIncrement(&This->refCount); } static ULONG WINAPI Compartment_Release(ITfCompartment *iface) { - Compartment *This = (Compartment *)iface; + Compartment *This = impl_from_ITfCompartment(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -471,7 +488,7 @@ static ULONG WINAPI Compartment_Release(ITfCompartment *iface) static HRESULT WINAPI Compartment_SetValue(ITfCompartment *iface, TfClientId tid, const VARIANT *pvarValue) { - Compartment *This = (Compartment *)iface; + Compartment *This = impl_from_ITfCompartment(iface); struct list *cursor; TRACE("(%p) %i %p\n",This,tid,pvarValue); @@ -509,7 +526,7 @@ static HRESULT WINAPI Compartment_SetValue(ITfCompartment *iface, static HRESULT WINAPI Compartment_GetValue(ITfCompartment *iface, VARIANT *pvarValue) { - Compartment *This = (Compartment *)iface; + Compartment *This = impl_from_ITfCompartment(iface); TRACE("(%p) %p\n",This, pvarValue); if (!pvarValue) @@ -520,11 +537,11 @@ static HRESULT WINAPI Compartment_GetValue(ITfCompartment *iface, return VariantCopy(pvarValue,&This->variant); } -static const ITfCompartmentVtbl ITfCompartment_Vtbl ={ +static const ITfCompartmentVtbl CompartmentVtbl = +{ Compartment_QueryInterface, Compartment_AddRef, Compartment_Release, - Compartment_SetValue, Compartment_GetValue }; @@ -533,29 +550,29 @@ static const ITfCompartmentVtbl ITfCompartment_Vtbl ={ * ITfSource functions *****************************************************/ -static HRESULT WINAPI Source_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) +static HRESULT WINAPI CompartmentSource_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) { - Compartment *This = impl_from_ITfSourceVtbl(iface); - return Compartment_QueryInterface((ITfCompartment *)This, iid, *ppvOut); + Compartment *This = impl_from_ITfSource(iface); + return ITfCompartment_QueryInterface(&This->ITfCompartment_iface, iid, ppvOut); } -static ULONG WINAPI Source_AddRef(ITfSource *iface) +static ULONG WINAPI CompartmentSource_AddRef(ITfSource *iface) { - Compartment *This = impl_from_ITfSourceVtbl(iface); - return Compartment_AddRef((ITfCompartment*)This); + Compartment *This = impl_from_ITfSource(iface); + return ITfCompartment_AddRef(&This->ITfCompartment_iface); } -static ULONG WINAPI Source_Release(ITfSource *iface) +static ULONG WINAPI CompartmentSource_Release(ITfSource *iface) { - Compartment *This = impl_from_ITfSourceVtbl(iface); - return Compartment_Release((ITfCompartment *)This); + Compartment *This = impl_from_ITfSource(iface); + return ITfCompartment_Release(&This->ITfCompartment_iface); } static HRESULT WINAPI CompartmentSource_AdviseSink(ITfSource *iface, REFIID riid, IUnknown *punk, DWORD *pdwCookie) { + Compartment *This = impl_from_ITfSource(iface); CompartmentSink *cs; - Compartment *This = impl_from_ITfSourceVtbl(iface); TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie); @@ -588,8 +605,8 @@ static HRESULT WINAPI CompartmentSource_AdviseSink(ITfSource *iface, static HRESULT WINAPI CompartmentSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) { + Compartment *This = impl_from_ITfSource(iface); CompartmentSink *sink; - Compartment *This = impl_from_ITfSourceVtbl(iface); TRACE("(%p) %x\n",This,pdwCookie); @@ -606,12 +623,11 @@ static HRESULT WINAPI CompartmentSource_UnadviseSink(ITfSource *iface, DWORD pdw return S_OK; } -static const ITfSourceVtbl Compartment_SourceVtbl = +static const ITfSourceVtbl CompartmentSourceVtbl = { - Source_QueryInterface, - Source_AddRef, - Source_Release, - + CompartmentSource_QueryInterface, + CompartmentSource_AddRef, + CompartmentSource_Release, CompartmentSource_AdviseSink, CompartmentSource_UnadviseSink, }; @@ -624,8 +640,8 @@ static HRESULT Compartment_Constructor(CompartmentValue *valueData, ITfCompartme if (This == NULL) return E_OUTOFMEMORY; - This->Vtbl= &ITfCompartment_Vtbl; - This->SourceVtbl = &Compartment_SourceVtbl; + This->ITfCompartment_iface.lpVtbl= &CompartmentVtbl; + This->ITfSource_iface.lpVtbl = &CompartmentSourceVtbl; This->refCount = 1; This->valueData = valueData; @@ -633,7 +649,7 @@ static HRESULT Compartment_Constructor(CompartmentValue *valueData, ITfCompartme list_init(&This->CompartmentEventSink); - TRACE("returning %p\n", This); - *ppOut = (ITfCompartment*)This; + *ppOut = &This->ITfCompartment_iface; + TRACE("returning %p\n", *ppOut); return S_OK; } diff --git a/dll/win32/msctf/context.c b/dll/win32/msctf/context.c index d9cd1429186..8d037499eda 100644 --- a/dll/win32/msctf/context.c +++ b/dll/win32/msctf/context.c @@ -34,15 +34,15 @@ typedef struct tagContextSink { } ContextSink; typedef struct tagContext { - const ITfContextVtbl *ContextVtbl; - const ITfSourceVtbl *SourceVtbl; + ITfContext ITfContext_iface; + ITfSource ITfSource_iface; /* const ITfContextCompositionVtbl *ContextCompositionVtbl; */ /* const ITfContextOwnerCompositionServicesVtbl *ContextOwnerCompositionServicesVtbl; */ /* const ITfContextOwnerServicesVtbl *ContextOwnerServicesVtbl; */ - const ITfInsertAtSelectionVtbl *InsertAtSelectionVtbl; + ITfInsertAtSelection ITfInsertAtSelection_iface; /* const ITfMouseTrackerVtbl *MouseTrackerVtbl; */ /* const ITfQueryEmbeddedVtbl *QueryEmbeddedVtbl; */ - const ITfSourceSingleVtbl *SourceSingleVtbl; + ITfSourceSingle ITfSourceSingle_iface; LONG refCount; BOOL connected; @@ -75,7 +75,7 @@ typedef struct tagEditCookie { } EditCookie; typedef struct tagTextStoreACPSink { - const ITextStoreACPSinkVtbl *TextStoreACPSinkVtbl; + ITextStoreACPSink ITextStoreACPSink_iface; /* const ITextStoreACPServicesVtbl *TextStoreACPServicesVtbl; */ LONG refCount; @@ -85,19 +85,29 @@ typedef struct tagTextStoreACPSink { static HRESULT TextStoreACPSink_Constructor(ITextStoreACPSink **ppOut, Context *pContext); -static inline Context *impl_from_ITfSourceVtbl(ITfSource *iface) +static inline Context *impl_from_ITfContext(ITfContext *iface) { - return (Context *)((char *)iface - FIELD_OFFSET(Context,SourceVtbl)); + return CONTAINING_RECORD(iface, Context, ITfContext_iface); } -static inline Context *impl_from_ITfInsertAtSelectionVtbl(ITfInsertAtSelection*iface) +static inline Context *impl_from_ITfSource(ITfSource *iface) { - return (Context *)((char *)iface - FIELD_OFFSET(Context,InsertAtSelectionVtbl)); + return CONTAINING_RECORD(iface, Context, ITfSource_iface); } -static inline Context *impl_from_ITfSourceSingleVtbl(ITfSourceSingle* iface) +static inline Context *impl_from_ITfInsertAtSelection(ITfInsertAtSelection *iface) { - return (Context *)((char *)iface - FIELD_OFFSET(Context,SourceSingleVtbl)); + return CONTAINING_RECORD(iface, Context, ITfInsertAtSelection_iface); +} + +static inline Context *impl_from_ITfSourceSingle(ITfSourceSingle* iface) +{ + return CONTAINING_RECORD(iface, Context, ITfSourceSingle_iface); +} + +static inline TextStoreACPSink *impl_from_ITextStoreACPSink(ITextStoreACPSink *iface) +{ + return CONTAINING_RECORD(iface, TextStoreACPSink, ITextStoreACPSink_iface); } static void free_sink(ContextSink *sink) @@ -168,20 +178,20 @@ static void Context_Destructor(Context *This) static HRESULT WINAPI Context_QueryInterface(ITfContext *iface, REFIID iid, LPVOID *ppvOut) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfContext)) { - *ppvOut = This; + *ppvOut = &This->ITfContext_iface; } else if (IsEqualIID(iid, &IID_ITfSource)) { - *ppvOut = &This->SourceVtbl; + *ppvOut = &This->ITfSource_iface; } else if (IsEqualIID(iid, &IID_ITfInsertAtSelection)) { - *ppvOut = &This->InsertAtSelectionVtbl; + *ppvOut = &This->ITfInsertAtSelection_iface; } else if (IsEqualIID(iid, &IID_ITfCompartmentMgr)) { @@ -189,7 +199,7 @@ static HRESULT WINAPI Context_QueryInterface(ITfContext *iface, REFIID iid, LPVO } else if (IsEqualIID(iid, &IID_ITfSourceSingle)) { - *ppvOut = &This->SourceSingleVtbl; + *ppvOut = &This->ITfSourceSingle_iface; } if (*ppvOut) @@ -204,13 +214,13 @@ static HRESULT WINAPI Context_QueryInterface(ITfContext *iface, REFIID iid, LPVO static ULONG WINAPI Context_AddRef(ITfContext *iface) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); return InterlockedIncrement(&This->refCount); } static ULONG WINAPI Context_Release(ITfContext *iface) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -226,8 +236,8 @@ static HRESULT WINAPI Context_RequestEditSession (ITfContext *iface, TfClientId tid, ITfEditSession *pes, DWORD dwFlags, HRESULT *phrSession) { + Context *This = impl_from_ITfContext(iface); HRESULT hr; - Context *This = (Context *)iface; DWORD dwLockFlags = 0x0; TRACE("(%p) %i %p %x %p\n",This, tid, pes, dwFlags, phrSession); @@ -277,7 +287,7 @@ static HRESULT WINAPI Context_InWriteSession (ITfContext *iface, TfClientId tid, BOOL *pfWriteSession) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -286,7 +296,7 @@ static HRESULT WINAPI Context_GetSelection (ITfContext *iface, TfEditCookie ec, ULONG ulIndex, ULONG ulCount, TF_SELECTION *pSelection, ULONG *pcFetched) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); EditCookie *cookie; ULONG count, i; ULONG totalFetched = 0; @@ -345,8 +355,8 @@ static HRESULT WINAPI Context_GetSelection (ITfContext *iface, static HRESULT WINAPI Context_SetSelection (ITfContext *iface, TfEditCookie ec, ULONG ulCount, const TF_SELECTION *pSelection) { + Context *This = impl_from_ITfContext(iface); TS_SELECTION_ACP *acp; - Context *This = (Context *)iface; ULONG i; HRESULT hr; @@ -383,7 +393,7 @@ static HRESULT WINAPI Context_SetSelection (ITfContext *iface, static HRESULT WINAPI Context_GetStart (ITfContext *iface, TfEditCookie ec, ITfRange **ppStart) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); EditCookie *cookie; TRACE("(%p) %i %p\n",This,ec,ppStart); @@ -405,7 +415,7 @@ static HRESULT WINAPI Context_GetStart (ITfContext *iface, static HRESULT WINAPI Context_GetEnd (ITfContext *iface, TfEditCookie ec, ITfRange **ppEnd) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); EditCookie *cookie; LONG end; TRACE("(%p) %i %p\n",This,ec,ppEnd); @@ -436,7 +446,7 @@ static HRESULT WINAPI Context_GetEnd (ITfContext *iface, static HRESULT WINAPI Context_GetActiveView (ITfContext *iface, ITfContextView **ppView) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -444,7 +454,7 @@ static HRESULT WINAPI Context_GetActiveView (ITfContext *iface, static HRESULT WINAPI Context_EnumViews (ITfContext *iface, IEnumTfContextViews **ppEnum) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -452,7 +462,7 @@ static HRESULT WINAPI Context_EnumViews (ITfContext *iface, static HRESULT WINAPI Context_GetStatus (ITfContext *iface, TF_STATUS *pdcs) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); TRACE("(%p) %p\n",This,pdcs); if (!This->connected) @@ -477,7 +487,7 @@ static HRESULT WINAPI Context_GetStatus (ITfContext *iface, static HRESULT WINAPI Context_GetProperty (ITfContext *iface, REFGUID guidProp, ITfProperty **ppProp) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -485,7 +495,7 @@ static HRESULT WINAPI Context_GetProperty (ITfContext *iface, static HRESULT WINAPI Context_GetAppProperty (ITfContext *iface, REFGUID guidProp, ITfReadOnlyProperty **ppProp) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -494,7 +504,7 @@ static HRESULT WINAPI Context_TrackProperties (ITfContext *iface, const GUID **prgProp, ULONG cProp, const GUID **prgAppProp, ULONG cAppProp, ITfReadOnlyProperty **ppProperty) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -502,7 +512,7 @@ static HRESULT WINAPI Context_TrackProperties (ITfContext *iface, static HRESULT WINAPI Context_EnumProperties (ITfContext *iface, IEnumTfProperties **ppEnum) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -510,7 +520,7 @@ static HRESULT WINAPI Context_EnumProperties (ITfContext *iface, static HRESULT WINAPI Context_GetDocumentMgr (ITfContext *iface, ITfDocumentMgr **ppDm) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); TRACE("(%p) %p\n",This,ppDm); if (!ppDm) @@ -528,17 +538,16 @@ static HRESULT WINAPI Context_GetDocumentMgr (ITfContext *iface, static HRESULT WINAPI Context_CreateRangeBackup (ITfContext *iface, TfEditCookie ec, ITfRange *pRange, ITfRangeBackup **ppBackup) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } -static const ITfContextVtbl Context_ContextVtbl = +static const ITfContextVtbl ContextVtbl = { Context_QueryInterface, Context_AddRef, Context_Release, - Context_RequestEditSession, Context_InWriteSession, Context_GetSelection, @@ -556,22 +565,22 @@ static const ITfContextVtbl Context_ContextVtbl = Context_CreateRangeBackup }; -static HRESULT WINAPI Source_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) +static HRESULT WINAPI ContextSource_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) { - Context *This = impl_from_ITfSourceVtbl(iface); - return Context_QueryInterface((ITfContext *)This, iid, *ppvOut); + Context *This = impl_from_ITfSource(iface); + return ITfContext_QueryInterface(&This->ITfContext_iface, iid, ppvOut); } -static ULONG WINAPI Source_AddRef(ITfSource *iface) +static ULONG WINAPI ContextSource_AddRef(ITfSource *iface) { - Context *This = impl_from_ITfSourceVtbl(iface); - return Context_AddRef((ITfContext *)This); + Context *This = impl_from_ITfSource(iface); + return ITfContext_AddRef(&This->ITfContext_iface); } -static ULONG WINAPI Source_Release(ITfSource *iface) +static ULONG WINAPI ContextSource_Release(ITfSource *iface) { - Context *This = impl_from_ITfSourceVtbl(iface); - return Context_Release((ITfContext *)This); + Context *This = impl_from_ITfSource(iface); + return ITfContext_Release(&This->ITfContext_iface); } /***************************************************** @@ -580,8 +589,8 @@ static ULONG WINAPI Source_Release(ITfSource *iface) static HRESULT WINAPI ContextSource_AdviseSink(ITfSource *iface, REFIID riid, IUnknown *punk, DWORD *pdwCookie) { + Context *This = impl_from_ITfSource(iface); ContextSink *es; - Context *This = impl_from_ITfSourceVtbl(iface); TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie); if (!riid || !punk || !pdwCookie) @@ -612,8 +621,8 @@ static HRESULT WINAPI ContextSource_AdviseSink(ITfSource *iface, static HRESULT WINAPI ContextSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) { + Context *This = impl_from_ITfSource(iface); ContextSink *sink; - Context *This = impl_from_ITfSourceVtbl(iface); TRACE("(%p) %x\n",This,pdwCookie); @@ -630,14 +639,13 @@ static HRESULT WINAPI ContextSource_UnadviseSink(ITfSource *iface, DWORD pdwCook return S_OK; } -static const ITfSourceVtbl Context_SourceVtbl = +static const ITfSourceVtbl ContextSourceVtbl = { - Source_QueryInterface, - Source_AddRef, - Source_Release, - + ContextSource_QueryInterface, + ContextSource_AddRef, + ContextSource_Release, ContextSource_AdviseSink, - ContextSource_UnadviseSink, + ContextSource_UnadviseSink }; /***************************************************** @@ -645,27 +653,27 @@ static const ITfSourceVtbl Context_SourceVtbl = *****************************************************/ static HRESULT WINAPI InsertAtSelection_QueryInterface(ITfInsertAtSelection *iface, REFIID iid, LPVOID *ppvOut) { - Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); - return Context_QueryInterface((ITfContext *)This, iid, *ppvOut); + Context *This = impl_from_ITfInsertAtSelection(iface); + return ITfContext_QueryInterface(&This->ITfContext_iface, iid, ppvOut); } static ULONG WINAPI InsertAtSelection_AddRef(ITfInsertAtSelection *iface) { - Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); - return Context_AddRef((ITfContext *)This); + Context *This = impl_from_ITfInsertAtSelection(iface); + return ITfContext_AddRef(&This->ITfContext_iface); } static ULONG WINAPI InsertAtSelection_Release(ITfInsertAtSelection *iface) { - Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); - return Context_Release((ITfContext *)This); + Context *This = impl_from_ITfInsertAtSelection(iface); + return ITfContext_Release(&This->ITfContext_iface); } static HRESULT WINAPI InsertAtSelection_InsertTextAtSelection( ITfInsertAtSelection *iface, TfEditCookie ec, DWORD dwFlags, const WCHAR *pchText, LONG cch, ITfRange **ppRange) { - Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); + Context *This = impl_from_ITfInsertAtSelection(iface); EditCookie *cookie; LONG acpStart, acpEnd; TS_TEXTCHANGE change; @@ -692,7 +700,7 @@ static HRESULT WINAPI InsertAtSelection_InsertTextAtSelection( hr = ITextStoreACP_InsertTextAtSelection(This->pITextStoreACP, dwFlags, pchText, cch, &acpStart, &acpEnd, &change); if (SUCCEEDED(hr)) - Range_Constructor((ITfContext*)This, This->pITextStoreACP, cookie->lockType, change.acpStart, change.acpNewEnd, ppRange); + Range_Constructor(&This->ITfContext_iface, This->pITextStoreACP, cookie->lockType, change.acpStart, change.acpNewEnd, ppRange); return hr; } @@ -701,17 +709,16 @@ static HRESULT WINAPI InsertAtSelection_InsertEmbeddedAtSelection( ITfInsertAtSelection *iface, TfEditCookie ec, DWORD dwFlags, IDataObject *pDataObject, ITfRange **ppRange) { - Context *This = impl_from_ITfInsertAtSelectionVtbl(iface); + Context *This = impl_from_ITfInsertAtSelection(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } -static const ITfInsertAtSelectionVtbl Context_InsertAtSelectionVtbl = +static const ITfInsertAtSelectionVtbl InsertAtSelectionVtbl = { InsertAtSelection_QueryInterface, InsertAtSelection_AddRef, InsertAtSelection_Release, - InsertAtSelection_InsertTextAtSelection, InsertAtSelection_InsertEmbeddedAtSelection, }; @@ -721,26 +728,26 @@ static const ITfInsertAtSelectionVtbl Context_InsertAtSelectionVtbl = *****************************************************/ static HRESULT WINAPI SourceSingle_QueryInterface(ITfSourceSingle *iface, REFIID iid, LPVOID *ppvOut) { - Context *This = impl_from_ITfSourceSingleVtbl(iface); - return Context_QueryInterface((ITfContext *)This, iid, *ppvOut); + Context *This = impl_from_ITfSourceSingle(iface); + return ITfContext_QueryInterface(&This->ITfContext_iface, iid, ppvOut); } static ULONG WINAPI SourceSingle_AddRef(ITfSourceSingle *iface) { - Context *This = impl_from_ITfSourceSingleVtbl(iface); - return Context_AddRef((ITfContext *)This); + Context *This = impl_from_ITfSourceSingle(iface); + return ITfContext_AddRef(&This->ITfContext_iface); } static ULONG WINAPI SourceSingle_Release(ITfSourceSingle *iface) { - Context *This = impl_from_ITfSourceSingleVtbl(iface); - return Context_Release((ITfContext *)This); + Context *This = impl_from_ITfSourceSingle(iface); + return ITfContext_Release(&This->ITfContext_iface); } static HRESULT WINAPI SourceSingle_AdviseSingleSink( ITfSourceSingle *iface, TfClientId tid, REFIID riid, IUnknown *punk) { - Context *This = impl_from_ITfSourceSingleVtbl(iface); + Context *This = impl_from_ITfSourceSingle(iface); FIXME("STUB:(%p) %i %s %p\n",This, tid, debugstr_guid(riid),punk); return E_NOTIMPL; } @@ -748,17 +755,16 @@ static HRESULT WINAPI SourceSingle_AdviseSingleSink( ITfSourceSingle *iface, static HRESULT WINAPI SourceSingle_UnadviseSingleSink( ITfSourceSingle *iface, TfClientId tid, REFIID riid) { - Context *This = impl_from_ITfSourceSingleVtbl(iface); + Context *This = impl_from_ITfSourceSingle(iface); FIXME("STUB:(%p) %i %s\n",This, tid, debugstr_guid(riid)); return E_NOTIMPL; } -static const ITfSourceSingleVtbl Context_SourceSingleVtbl = +static const ITfSourceSingleVtbl ContextSourceSingleVtbl = { SourceSingle_QueryInterface, SourceSingle_AddRef, SourceSingle_Release, - SourceSingle_AdviseSingleSink, SourceSingle_UnadviseSingleSink, }; @@ -781,16 +787,16 @@ HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfDocumentMgr TRACE("(%p) %x %p %p %p\n",This, tidOwner, punk, ppOut, pecTextStore); - This->ContextVtbl= &Context_ContextVtbl; - This->SourceVtbl = &Context_SourceVtbl; - This->InsertAtSelectionVtbl = &Context_InsertAtSelectionVtbl; - This->SourceSingleVtbl = &Context_SourceSingleVtbl; + This->ITfContext_iface.lpVtbl= &ContextVtbl; + This->ITfSource_iface.lpVtbl = &ContextSourceVtbl; + This->ITfInsertAtSelection_iface.lpVtbl = &InsertAtSelectionVtbl; + This->ITfSourceSingle_iface.lpVtbl = &ContextSourceSingleVtbl; This->refCount = 1; This->tidOwner = tidOwner; This->connected = FALSE; This->manager = mgr; - CompartmentMgr_Constructor((IUnknown*)This, &IID_IUnknown, (IUnknown**)&This->CompartmentMgr); + CompartmentMgr_Constructor((IUnknown*)&This->ITfContext_iface, &IID_IUnknown, (IUnknown**)&This->CompartmentMgr); cookie->lockType = TF_ES_READ; cookie->pOwningContext = This; @@ -816,15 +822,15 @@ HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfDocumentMgr list_init(&This->pTextEditSink); list_init(&This->pTextLayoutSink); - *ppOut = (ITfContext*)This; - TRACE("returning %p\n", This); + *ppOut = &This->ITfContext_iface; + TRACE("returning %p\n", *ppOut); return S_OK; } HRESULT Context_Initialize(ITfContext *iface, ITfDocumentMgr *manager) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); if (This->pITextStoreACP) { @@ -839,7 +845,7 @@ HRESULT Context_Initialize(ITfContext *iface, ITfDocumentMgr *manager) HRESULT Context_Uninitialize(ITfContext *iface) { - Context *This = (Context *)iface; + Context *This = impl_from_ITfContext(iface); if (This->pITextStoreACPSink) { @@ -864,12 +870,12 @@ static void TextStoreACPSink_Destructor(TextStoreACPSink *This) static HRESULT WINAPI TextStoreACPSink_QueryInterface(ITextStoreACPSink *iface, REFIID iid, LPVOID *ppvOut) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITextStoreACPSink)) { - *ppvOut = This; + *ppvOut = &This->ITextStoreACPSink_iface; } if (*ppvOut) @@ -884,13 +890,13 @@ static HRESULT WINAPI TextStoreACPSink_QueryInterface(ITextStoreACPSink *iface, static ULONG WINAPI TextStoreACPSink_AddRef(ITextStoreACPSink *iface) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); return InterlockedIncrement(&This->refCount); } static ULONG WINAPI TextStoreACPSink_Release(ITextStoreACPSink *iface) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -906,14 +912,14 @@ static ULONG WINAPI TextStoreACPSink_Release(ITextStoreACPSink *iface) static HRESULT WINAPI TextStoreACPSink_OnTextChange(ITextStoreACPSink *iface, DWORD dwFlags, const TS_TEXTCHANGE *pChange) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } static HRESULT WINAPI TextStoreACPSink_OnSelectionChange(ITextStoreACPSink *iface) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -921,7 +927,7 @@ static HRESULT WINAPI TextStoreACPSink_OnSelectionChange(ITextStoreACPSink *ifac static HRESULT WINAPI TextStoreACPSink_OnLayoutChange(ITextStoreACPSink *iface, TsLayoutCode lcode, TsViewCookie vcView) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -929,7 +935,7 @@ static HRESULT WINAPI TextStoreACPSink_OnLayoutChange(ITextStoreACPSink *iface, static HRESULT WINAPI TextStoreACPSink_OnStatusChange(ITextStoreACPSink *iface, DWORD dwFlags) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); HRESULT hr, hrSession; TRACE("(%p) %x\n",This, dwFlags); @@ -957,7 +963,7 @@ static HRESULT WINAPI TextStoreACPSink_OnStatusChange(ITextStoreACPSink *iface, static HRESULT WINAPI TextStoreACPSink_OnAttrsChange(ITextStoreACPSink *iface, LONG acpStart, LONG acpEnd, ULONG cAttrs, const TS_ATTRID *paAttrs) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -965,7 +971,7 @@ static HRESULT WINAPI TextStoreACPSink_OnAttrsChange(ITextStoreACPSink *iface, static HRESULT WINAPI TextStoreACPSink_OnLockGranted(ITextStoreACPSink *iface, DWORD dwLockFlags) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); HRESULT hr; EditCookie *cookie,*sinkcookie; TfEditCookie ec; @@ -1033,24 +1039,23 @@ static HRESULT WINAPI TextStoreACPSink_OnLockGranted(ITextStoreACPSink *iface, static HRESULT WINAPI TextStoreACPSink_OnStartEditTransaction(ITextStoreACPSink *iface) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } static HRESULT WINAPI TextStoreACPSink_OnEndEditTransaction(ITextStoreACPSink *iface) { - TextStoreACPSink *This = (TextStoreACPSink *)iface; + TextStoreACPSink *This = impl_from_ITextStoreACPSink(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } -static const ITextStoreACPSinkVtbl TextStoreACPSink_TextStoreACPSinkVtbl = +static const ITextStoreACPSinkVtbl TextStoreACPSinkVtbl = { TextStoreACPSink_QueryInterface, TextStoreACPSink_AddRef, TextStoreACPSink_Release, - TextStoreACPSink_OnTextChange, TextStoreACPSink_OnSelectionChange, TextStoreACPSink_OnLayoutChange, @@ -1069,12 +1074,12 @@ static HRESULT TextStoreACPSink_Constructor(ITextStoreACPSink **ppOut, Context * if (This == NULL) return E_OUTOFMEMORY; - This->TextStoreACPSinkVtbl= &TextStoreACPSink_TextStoreACPSinkVtbl; + This->ITextStoreACPSink_iface.lpVtbl= &TextStoreACPSinkVtbl; This->refCount = 1; This->pContext = pContext; - TRACE("returning %p\n", This); - *ppOut = (ITextStoreACPSink*)This; + *ppOut = &This->ITextStoreACPSink_iface; + TRACE("returning %p\n", *ppOut); return S_OK; } diff --git a/dll/win32/msctf/displayattributemgr.c b/dll/win32/msctf/displayattributemgr.c index 0a0f32dce48..4c3e1aa7e6c 100644 --- a/dll/win32/msctf/displayattributemgr.c +++ b/dll/win32/msctf/displayattributemgr.c @@ -46,7 +46,7 @@ static HRESULT WINAPI DisplayAttributeMgr_QueryInterface(ITfDisplayAttributeMgr if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfDisplayAttributeMgr)) { - *ppvOut = This; + *ppvOut = &This->ITfDisplayAttributeMgr_iface; } if (*ppvOut) @@ -104,12 +104,11 @@ static HRESULT WINAPI DisplayAttributeMgr_GetDisplayAttributeInfo(ITfDisplayAttr return E_NOTIMPL; } -static const ITfDisplayAttributeMgrVtbl DisplayAttributeMgr_DisplayAttributeMgrVtbl = +static const ITfDisplayAttributeMgrVtbl DisplayAttributeMgrVtbl = { DisplayAttributeMgr_QueryInterface, DisplayAttributeMgr_AddRef, DisplayAttributeMgr_Release, - DisplayAttributeMgr_OnUpdateInfo, DisplayAttributeMgr_EnumDisplayAttributeInfo, DisplayAttributeMgr_GetDisplayAttributeInfo @@ -125,10 +124,10 @@ HRESULT DisplayAttributeMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) if (This == NULL) return E_OUTOFMEMORY; - This->ITfDisplayAttributeMgr_iface.lpVtbl = &DisplayAttributeMgr_DisplayAttributeMgrVtbl; + This->ITfDisplayAttributeMgr_iface.lpVtbl = &DisplayAttributeMgrVtbl; This->refCount = 1; - TRACE("returning %p\n", This); - *ppOut = (IUnknown *)This; + *ppOut = (IUnknown *)&This->ITfDisplayAttributeMgr_iface; + TRACE("returning %p\n", *ppOut); return S_OK; } diff --git a/dll/win32/msctf/documentmgr.c b/dll/win32/msctf/documentmgr.c index 9033a2daf79..9ab06750584 100644 --- a/dll/win32/msctf/documentmgr.c +++ b/dll/win32/msctf/documentmgr.c @@ -80,7 +80,7 @@ static HRESULT WINAPI DocumentMgr_QueryInterface(ITfDocumentMgr *iface, REFIID i if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfDocumentMgr)) { - *ppvOut = This; + *ppvOut = &This->ITfDocumentMgr_iface; } else if (IsEqualIID(iid, &IID_ITfSource)) { @@ -163,19 +163,17 @@ static HRESULT WINAPI DocumentMgr_Pop(ITfDocumentMgr *iface, DWORD dwFlags) if (dwFlags == TF_POPF_ALL) { - if (This->contextStack[0]) - { - ITfThreadMgrEventSink_OnPopContext(This->ThreadMgrSink,This->contextStack[0]); - Context_Uninitialize(This->contextStack[0]); - ITfContext_Release(This->contextStack[0]); - } - if (This->contextStack[1]) - { - ITfThreadMgrEventSink_OnPopContext(This->ThreadMgrSink,This->contextStack[1]); - Context_Uninitialize(This->contextStack[1]); - ITfContext_Release(This->contextStack[1]); - } - This->contextStack[0] = This->contextStack[1] = NULL; + int i; + + for (i = 0; i < sizeof(This->contextStack)/sizeof(This->contextStack[0]); i++) + if (This->contextStack[i]) + { + ITfThreadMgrEventSink_OnPopContext(This->ThreadMgrSink, This->contextStack[i]); + Context_Uninitialize(This->contextStack[i]); + ITfContext_Release(This->contextStack[i]); + This->contextStack[i] = NULL; + } + ITfThreadMgrEventSink_OnUninitDocumentMgr(This->ThreadMgrSink, iface); return S_OK; } @@ -242,12 +240,11 @@ static HRESULT WINAPI DocumentMgr_EnumContexts(ITfDocumentMgr *iface, IEnumTfCon return EnumTfContext_Constructor(This, ppEnum); } -static const ITfDocumentMgrVtbl DocumentMgr_DocumentMgrVtbl = +static const ITfDocumentMgrVtbl DocumentMgrVtbl = { DocumentMgr_QueryInterface, DocumentMgr_AddRef, DocumentMgr_Release, - DocumentMgr_CreateContext, DocumentMgr_Push, DocumentMgr_Pop, @@ -256,23 +253,22 @@ static const ITfDocumentMgrVtbl DocumentMgr_DocumentMgrVtbl = DocumentMgr_EnumContexts }; - -static HRESULT WINAPI Source_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) +static HRESULT WINAPI DocumentMgrSource_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) { DocumentMgr *This = impl_from_ITfSource(iface); - return DocumentMgr_QueryInterface(&This->ITfDocumentMgr_iface, iid, *ppvOut); + return ITfDocumentMgr_QueryInterface(&This->ITfDocumentMgr_iface, iid, ppvOut); } -static ULONG WINAPI Source_AddRef(ITfSource *iface) +static ULONG WINAPI DocumentMgrSource_AddRef(ITfSource *iface) { DocumentMgr *This = impl_from_ITfSource(iface); - return DocumentMgr_AddRef(&This->ITfDocumentMgr_iface); + return ITfDocumentMgr_AddRef(&This->ITfDocumentMgr_iface); } -static ULONG WINAPI Source_Release(ITfSource *iface) +static ULONG WINAPI DocumentMgrSource_Release(ITfSource *iface) { DocumentMgr *This = impl_from_ITfSource(iface); - return DocumentMgr_Release(&This->ITfDocumentMgr_iface); + return ITfDocumentMgr_Release(&This->ITfDocumentMgr_iface); } /***************************************************** @@ -293,12 +289,11 @@ static HRESULT WINAPI DocumentMgrSource_UnadviseSink(ITfSource *iface, DWORD pdw return E_NOTIMPL; } -static const ITfSourceVtbl DocumentMgr_SourceVtbl = +static const ITfSourceVtbl DocumentMgrSourceVtbl = { - Source_QueryInterface, - Source_AddRef, - Source_Release, - + DocumentMgrSource_QueryInterface, + DocumentMgrSource_AddRef, + DocumentMgrSource_Release, DocumentMgrSource_AdviseSink, DocumentMgrSource_UnadviseSink, }; @@ -311,15 +306,15 @@ HRESULT DocumentMgr_Constructor(ITfThreadMgrEventSink *ThreadMgrSink, ITfDocumen if (This == NULL) return E_OUTOFMEMORY; - This->ITfDocumentMgr_iface.lpVtbl = &DocumentMgr_DocumentMgrVtbl; - This->ITfSource_iface.lpVtbl = &DocumentMgr_SourceVtbl; + This->ITfDocumentMgr_iface.lpVtbl = &DocumentMgrVtbl; + This->ITfSource_iface.lpVtbl = &DocumentMgrSourceVtbl; This->refCount = 1; This->ThreadMgrSink = ThreadMgrSink; - CompartmentMgr_Constructor((IUnknown*)This, &IID_IUnknown, (IUnknown**)&This->CompartmentMgr); + CompartmentMgr_Constructor((IUnknown*)&This->ITfDocumentMgr_iface, &IID_IUnknown, (IUnknown**)&This->CompartmentMgr); - TRACE("returning %p\n", This); *ppOut = &This->ITfDocumentMgr_iface; + TRACE("returning %p\n", *ppOut); return S_OK; } @@ -339,7 +334,7 @@ static HRESULT WINAPI EnumTfContext_QueryInterface(IEnumTfContexts *iface, REFII if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumTfContexts)) { - *ppvOut = This; + *ppvOut = &This->IEnumTfContexts_iface; } if (*ppvOut) @@ -457,7 +452,7 @@ static HRESULT EnumTfContext_Constructor(DocumentMgr *mgr, IEnumTfContexts **ppO This->refCount = 1; This->docmgr = mgr; - TRACE("returning %p\n", This); *ppOut = &This->IEnumTfContexts_iface; + TRACE("returning %p\n", *ppOut); return S_OK; } diff --git a/dll/win32/msctf/inputprocessor.c b/dll/win32/msctf/inputprocessor.c index 91c9b74baa0..7d22540f046 100644 --- a/dll/win32/msctf/inputprocessor.c +++ b/dll/win32/msctf/inputprocessor.c @@ -40,8 +40,8 @@ typedef struct tagInputProcessorProfilesSink { } InputProcessorProfilesSink; typedef struct tagInputProcessorProfiles { - const ITfInputProcessorProfilesVtbl *InputProcessorProfilesVtbl; - const ITfSourceVtbl *SourceVtbl; + ITfInputProcessorProfiles ITfInputProcessorProfiles_iface; + ITfSource ITfSource_iface; /* const ITfInputProcessorProfileMgrVtbl *InputProcessorProfileMgrVtbl; */ /* const ITfInputProcessorProfilesExVtbl *InputProcessorProfilesExVtbl; */ /* const ITfInputProcessorProfileSubstituteLayoutVtbl *InputProcessorProfileSubstituteLayoutVtbl; */ @@ -53,7 +53,7 @@ typedef struct tagInputProcessorProfiles { } InputProcessorProfiles; typedef struct tagProfilesEnumGuid { - const IEnumGUIDVtbl *Vtbl; + IEnumGUID IEnumGUID_iface; LONG refCount; HKEY key; @@ -61,7 +61,7 @@ typedef struct tagProfilesEnumGuid { } ProfilesEnumGuid; typedef struct tagEnumTfLanguageProfiles { - const IEnumTfLanguageProfilesVtbl *Vtbl; + IEnumTfLanguageProfiles IEnumTfLanguageProfiles_iface; LONG refCount; HKEY tipkey; @@ -78,9 +78,24 @@ typedef struct tagEnumTfLanguageProfiles { static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut); static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguageProfiles **ppOut); -static inline InputProcessorProfiles *impl_from_ITfSourceVtbl(ITfSource *iface) +static inline InputProcessorProfiles *impl_from_ITfInputProcessorProfiles(ITfInputProcessorProfiles *iface) { - return (InputProcessorProfiles *)((char *)iface - FIELD_OFFSET(InputProcessorProfiles,SourceVtbl)); + return CONTAINING_RECORD(iface, InputProcessorProfiles, ITfInputProcessorProfiles_iface); +} + +static inline InputProcessorProfiles *impl_from_ITfSource(ITfSource *iface) +{ + return CONTAINING_RECORD(iface, InputProcessorProfiles, ITfSource_iface); +} + +static inline ProfilesEnumGuid *impl_from_IEnumGUID(IEnumGUID *iface) +{ + return CONTAINING_RECORD(iface, ProfilesEnumGuid, IEnumGUID_iface); +} + +static inline EnumTfLanguageProfiles *impl_from_IEnumTfLanguageProfiles(IEnumTfLanguageProfiles *iface) +{ + return CONTAINING_RECORD(iface, EnumTfLanguageProfiles, IEnumTfLanguageProfiles_iface); } static void free_sink(InputProcessorProfilesSink *sink) @@ -136,16 +151,16 @@ static void add_userkey( REFCLSID rclsid, LANGID langid, static HRESULT WINAPI InputProcessorProfiles_QueryInterface(ITfInputProcessorProfiles *iface, REFIID iid, LPVOID *ppvOut) { - InputProcessorProfiles *This = (InputProcessorProfiles *)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfInputProcessorProfiles)) { - *ppvOut = This; + *ppvOut = &This->ITfInputProcessorProfiles_iface; } else if (IsEqualIID(iid, &IID_ITfSource)) { - *ppvOut = &This->SourceVtbl; + *ppvOut = &This->ITfSource_iface; } if (*ppvOut) @@ -160,13 +175,13 @@ static HRESULT WINAPI InputProcessorProfiles_QueryInterface(ITfInputProcessorPro static ULONG WINAPI InputProcessorProfiles_AddRef(ITfInputProcessorProfiles *iface) { - InputProcessorProfiles *This = (InputProcessorProfiles *)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); return InterlockedIncrement(&This->refCount); } static ULONG WINAPI InputProcessorProfiles_Release(ITfInputProcessorProfiles *iface) { - InputProcessorProfiles *This = (InputProcessorProfiles *)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -181,7 +196,7 @@ static ULONG WINAPI InputProcessorProfiles_Release(ITfInputProcessorProfiles *if static HRESULT WINAPI InputProcessorProfiles_Register( ITfInputProcessorProfiles *iface, REFCLSID rclsid) { - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); HKEY tipkey; WCHAR buf[39]; WCHAR fullkey[68]; @@ -203,9 +218,9 @@ static HRESULT WINAPI InputProcessorProfiles_Register( static HRESULT WINAPI InputProcessorProfiles_Unregister( ITfInputProcessorProfiles *iface, REFCLSID rclsid) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); WCHAR buf[39]; WCHAR fullkey[68]; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; TRACE("(%p) %s\n",This,debugstr_guid(rclsid)); @@ -224,6 +239,7 @@ static HRESULT WINAPI InputProcessorProfiles_AddLanguageProfile( ULONG cchDesc, const WCHAR *pchIconFile, ULONG cchFile, ULONG uIconIndex) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); HKEY tipkey,fmtkey; WCHAR buf[39]; WCHAR fullkey[100]; @@ -235,8 +251,6 @@ static HRESULT WINAPI InputProcessorProfiles_AddLanguageProfile( static const WCHAR icnf[] = {'I','c','o','n','F','i','l','e',0}; static const WCHAR icni[] = {'I','c','o','n','I','n','d','e','x',0}; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; - TRACE("(%p) %s %x %s %s %s %i\n",This,debugstr_guid(rclsid), langid, debugstr_guid(guidProfile), debugstr_wn(pchDesc,cchDesc), debugstr_wn(pchIconFile,cchFile),uIconIndex); @@ -278,7 +292,7 @@ static HRESULT WINAPI InputProcessorProfiles_RemoveLanguageProfile( ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, REFGUID guidProfile) { - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -286,7 +300,7 @@ static HRESULT WINAPI InputProcessorProfiles_RemoveLanguageProfile( static HRESULT WINAPI InputProcessorProfiles_EnumInputProcessorInfo( ITfInputProcessorProfiles *iface, IEnumGUID **ppEnum) { - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); TRACE("(%p) %p\n",This,ppEnum); return ProfilesEnumGuid_Constructor(ppEnum); } @@ -295,12 +309,12 @@ static HRESULT WINAPI InputProcessorProfiles_GetDefaultLanguageProfile( ITfInputProcessorProfiles *iface, LANGID langid, REFGUID catid, CLSID *pclsid, GUID *pguidProfile) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); WCHAR fullkey[168]; WCHAR buf[39]; HKEY hkey; DWORD count; ULONG res; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; TRACE("%p) %x %s %p %p\n",This, langid, debugstr_guid(catid),pclsid,pguidProfile); @@ -336,13 +350,13 @@ static HRESULT WINAPI InputProcessorProfiles_SetDefaultLanguageProfile( ITfInputProcessorProfiles *iface, LANGID langid, REFCLSID rclsid, REFGUID guidProfiles) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); WCHAR fullkey[168]; WCHAR buf[39]; HKEY hkey; GUID catid; HRESULT hr; ITfCategoryMgr *catmgr; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; static const GUID * tipcats[3] = { &GUID_TFCAT_TIP_KEYBOARD, &GUID_TFCAT_TIP_SPEECH, &GUID_TFCAT_TIP_HANDWRITING }; @@ -386,10 +400,10 @@ static HRESULT WINAPI InputProcessorProfiles_ActivateLanguageProfile( ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, REFGUID guidProfiles) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); HRESULT hr; BOOL enabled; TF_LANGUAGEPROFILE LanguageProfile; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; TRACE("(%p) %s %x %s\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfiles)); @@ -422,8 +436,8 @@ static HRESULT WINAPI InputProcessorProfiles_GetActiveLanguageProfile( ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID *plangid, GUID *pguidProfile) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); TF_LANGUAGEPROFILE profile; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; TRACE("(%p) %s %p %p\n",This,debugstr_guid(rclsid),plangid,pguidProfile); @@ -447,7 +461,7 @@ static HRESULT WINAPI InputProcessorProfiles_GetLanguageProfileDescription( ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, REFGUID guidProfile, BSTR *pbstrProfile) { - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -455,7 +469,7 @@ static HRESULT WINAPI InputProcessorProfiles_GetLanguageProfileDescription( static HRESULT WINAPI InputProcessorProfiles_GetCurrentLanguage( ITfInputProcessorProfiles *iface, LANGID *plangid) { - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); TRACE("(%p) 0x%x\n",This,This->currentLanguage); if (!plangid) @@ -469,8 +483,8 @@ static HRESULT WINAPI InputProcessorProfiles_GetCurrentLanguage( static HRESULT WINAPI InputProcessorProfiles_ChangeCurrentLanguage( ITfInputProcessorProfiles *iface, LANGID langid) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); struct list *cursor; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; BOOL accept; FIXME("STUB:(%p)\n",This); @@ -491,7 +505,7 @@ static HRESULT WINAPI InputProcessorProfiles_ChangeCurrentLanguage( static HRESULT WINAPI InputProcessorProfiles_GetLanguageList( ITfInputProcessorProfiles *iface, LANGID **ppLangId, ULONG *pulCount) { - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); FIXME("Semi-STUB:(%p)\n",This); *ppLangId = CoTaskMemAlloc(sizeof(LANGID)); **ppLangId = This->currentLanguage; @@ -503,7 +517,7 @@ static HRESULT WINAPI InputProcessorProfiles_EnumLanguageProfiles( ITfInputProcessorProfiles *iface, LANGID langid, IEnumTfLanguageProfiles **ppEnum) { - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); TRACE("(%p) %x %p\n",This,langid,ppEnum); return EnumTfLanguageProfiles_Constructor(langid, ppEnum); } @@ -512,13 +526,13 @@ static HRESULT WINAPI InputProcessorProfiles_EnableLanguageProfile( ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, REFGUID guidProfile, BOOL fEnable) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); HKEY key; WCHAR buf[39]; WCHAR buf2[39]; WCHAR fullkey[168]; ULONG res; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; TRACE("(%p) %s %x %s %i\n",This, debugstr_guid(rclsid), langid, debugstr_guid(guidProfile), fEnable); StringFromGUID2(rclsid, buf, 39); @@ -542,13 +556,13 @@ static HRESULT WINAPI InputProcessorProfiles_IsEnabledLanguageProfile( ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, REFGUID guidProfile, BOOL *pfEnable) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); HKEY key; WCHAR buf[39]; WCHAR buf2[39]; WCHAR fullkey[168]; ULONG res; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; TRACE("(%p) %s, %i, %s, %p\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfile),pfEnable); if (!pfEnable) @@ -589,13 +603,13 @@ static HRESULT WINAPI InputProcessorProfiles_EnableLanguageProfileByDefault( ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, REFGUID guidProfile, BOOL fEnable) { + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); HKEY key; WCHAR buf[39]; WCHAR buf2[39]; WCHAR fullkey[168]; ULONG res; - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; TRACE("(%p) %s %x %s %i\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfile),fEnable); StringFromGUID2(rclsid, buf, 39); @@ -619,18 +633,16 @@ static HRESULT WINAPI InputProcessorProfiles_SubstituteKeyboardLayout( ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, REFGUID guidProfile, HKL hKL) { - InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } - -static const ITfInputProcessorProfilesVtbl InputProcessorProfiles_InputProcessorProfilesVtbl = +static const ITfInputProcessorProfilesVtbl InputProcessorProfilesVtbl = { InputProcessorProfiles_QueryInterface, InputProcessorProfiles_AddRef, InputProcessorProfiles_Release, - InputProcessorProfiles_Register, InputProcessorProfiles_Unregister, InputProcessorProfiles_AddLanguageProfile, @@ -656,27 +668,27 @@ static const ITfInputProcessorProfilesVtbl InputProcessorProfiles_InputProcessor *****************************************************/ static HRESULT WINAPI IPPSource_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) { - InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface); - return InputProcessorProfiles_QueryInterface((ITfInputProcessorProfiles *)This, iid, *ppvOut); + InputProcessorProfiles *This = impl_from_ITfSource(iface); + return ITfInputProcessorProfiles_QueryInterface(&This->ITfInputProcessorProfiles_iface, iid, ppvOut); } static ULONG WINAPI IPPSource_AddRef(ITfSource *iface) { - InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface); - return InputProcessorProfiles_AddRef((ITfInputProcessorProfiles*)This); + InputProcessorProfiles *This = impl_from_ITfSource(iface); + return ITfInputProcessorProfiles_AddRef(&This->ITfInputProcessorProfiles_iface); } static ULONG WINAPI IPPSource_Release(ITfSource *iface) { - InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface); - return InputProcessorProfiles_Release((ITfInputProcessorProfiles *)This); + InputProcessorProfiles *This = impl_from_ITfSource(iface); + return ITfInputProcessorProfiles_Release(&This->ITfInputProcessorProfiles_iface); } static HRESULT WINAPI IPPSource_AdviseSink(ITfSource *iface, REFIID riid, IUnknown *punk, DWORD *pdwCookie) { + InputProcessorProfiles *This = impl_from_ITfSource(iface); InputProcessorProfilesSink *ipps; - InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface); TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie); @@ -709,8 +721,8 @@ static HRESULT WINAPI IPPSource_AdviseSink(ITfSource *iface, static HRESULT WINAPI IPPSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) { + InputProcessorProfiles *This = impl_from_ITfSource(iface); InputProcessorProfilesSink *sink; - InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface); TRACE("(%p) %x\n",This,pdwCookie); @@ -727,12 +739,11 @@ static HRESULT WINAPI IPPSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) return S_OK; } -static const ITfSourceVtbl InputProcessorProfiles_SourceVtbl = +static const ITfSourceVtbl InputProcessorProfilesSourceVtbl = { IPPSource_QueryInterface, IPPSource_AddRef, IPPSource_Release, - IPPSource_AdviseSink, IPPSource_UnadviseSink, }; @@ -747,15 +758,15 @@ HRESULT InputProcessorProfiles_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut if (This == NULL) return E_OUTOFMEMORY; - This->InputProcessorProfilesVtbl= &InputProcessorProfiles_InputProcessorProfilesVtbl; - This->SourceVtbl = &InputProcessorProfiles_SourceVtbl; + This->ITfInputProcessorProfiles_iface.lpVtbl= &InputProcessorProfilesVtbl; + This->ITfSource_iface.lpVtbl = &InputProcessorProfilesSourceVtbl; This->refCount = 1; This->currentLanguage = GetUserDefaultLCID(); list_init(&This->LanguageProfileNotifySink); - TRACE("returning %p\n", This); - *ppOut = (IUnknown *)This; + *ppOut = (IUnknown *)&This->ITfInputProcessorProfiles_iface; + TRACE("returning %p\n", *ppOut); return S_OK; } @@ -771,12 +782,12 @@ static void ProfilesEnumGuid_Destructor(ProfilesEnumGuid *This) static HRESULT WINAPI ProfilesEnumGuid_QueryInterface(IEnumGUID *iface, REFIID iid, LPVOID *ppvOut) { - ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface; + ProfilesEnumGuid *This = impl_from_IEnumGUID(iface); *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumGUID)) { - *ppvOut = This; + *ppvOut = &This->IEnumGUID_iface; } if (*ppvOut) @@ -791,13 +802,13 @@ static HRESULT WINAPI ProfilesEnumGuid_QueryInterface(IEnumGUID *iface, REFIID i static ULONG WINAPI ProfilesEnumGuid_AddRef(IEnumGUID *iface) { - ProfilesEnumGuid *This = (ProfilesEnumGuid*)iface; + ProfilesEnumGuid *This = impl_from_IEnumGUID(iface); return InterlockedIncrement(&This->refCount); } static ULONG WINAPI ProfilesEnumGuid_Release(IEnumGUID *iface) { - ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface; + ProfilesEnumGuid *This = impl_from_IEnumGUID(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -812,7 +823,7 @@ static ULONG WINAPI ProfilesEnumGuid_Release(IEnumGUID *iface) static HRESULT WINAPI ProfilesEnumGuid_Next( LPENUMGUID iface, ULONG celt, GUID *rgelt, ULONG *pceltFetched) { - ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface; + ProfilesEnumGuid *This = impl_from_IEnumGUID(iface); ULONG fetched = 0; TRACE("(%p)\n",This); @@ -844,7 +855,7 @@ static HRESULT WINAPI ProfilesEnumGuid_Next( LPENUMGUID iface, static HRESULT WINAPI ProfilesEnumGuid_Skip( LPENUMGUID iface, ULONG celt) { - ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface; + ProfilesEnumGuid *This = impl_from_IEnumGUID(iface); TRACE("(%p)\n",This); This->next_index += celt; @@ -853,7 +864,7 @@ static HRESULT WINAPI ProfilesEnumGuid_Skip( LPENUMGUID iface, ULONG celt) static HRESULT WINAPI ProfilesEnumGuid_Reset( LPENUMGUID iface) { - ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface; + ProfilesEnumGuid *This = impl_from_IEnumGUID(iface); TRACE("(%p)\n",This); This->next_index = 0; return S_OK; @@ -862,7 +873,7 @@ static HRESULT WINAPI ProfilesEnumGuid_Reset( LPENUMGUID iface) static HRESULT WINAPI ProfilesEnumGuid_Clone( LPENUMGUID iface, IEnumGUID **ppenum) { - ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface; + ProfilesEnumGuid *This = impl_from_IEnumGUID(iface); HRESULT res; TRACE("(%p)\n",This); @@ -872,17 +883,17 @@ static HRESULT WINAPI ProfilesEnumGuid_Clone( LPENUMGUID iface, res = ProfilesEnumGuid_Constructor(ppenum); if (SUCCEEDED(res)) { - ProfilesEnumGuid *new_This = (ProfilesEnumGuid *)*ppenum; + ProfilesEnumGuid *new_This = impl_from_IEnumGUID(*ppenum); new_This->next_index = This->next_index; } return res; } -static const IEnumGUIDVtbl IEnumGUID_Vtbl ={ +static const IEnumGUIDVtbl EnumGUIDVtbl = +{ ProfilesEnumGuid_QueryInterface, ProfilesEnumGuid_AddRef, ProfilesEnumGuid_Release, - ProfilesEnumGuid_Next, ProfilesEnumGuid_Skip, ProfilesEnumGuid_Reset, @@ -897,7 +908,7 @@ static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut) if (This == NULL) return E_OUTOFMEMORY; - This->Vtbl= &IEnumGUID_Vtbl; + This->IEnumGUID_iface.lpVtbl= &EnumGUIDVtbl; This->refCount = 1; if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szwSystemTIPKey, 0, NULL, 0, @@ -907,8 +918,8 @@ static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut) return E_FAIL; } - TRACE("returning %p\n", This); - *ppOut = (IEnumGUID*)This; + *ppOut = &This->IEnumGUID_iface; + TRACE("returning %p\n", *ppOut); return S_OK; } @@ -927,12 +938,13 @@ static void EnumTfLanguageProfiles_Destructor(EnumTfLanguageProfiles *This) static HRESULT WINAPI EnumTfLanguageProfiles_QueryInterface(IEnumTfLanguageProfiles *iface, REFIID iid, LPVOID *ppvOut) { - EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface; + EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface); + *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumTfLanguageProfiles)) { - *ppvOut = This; + *ppvOut = &This->IEnumTfLanguageProfiles_iface; } if (*ppvOut) @@ -947,13 +959,13 @@ static HRESULT WINAPI EnumTfLanguageProfiles_QueryInterface(IEnumTfLanguageProfi static ULONG WINAPI EnumTfLanguageProfiles_AddRef(IEnumTfLanguageProfiles *iface) { - EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles*)iface; + EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface); return InterlockedIncrement(&This->refCount); } static ULONG WINAPI EnumTfLanguageProfiles_Release(IEnumTfLanguageProfiles *iface) { - EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface; + EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -1020,7 +1032,7 @@ static INT next_LanguageProfile(EnumTfLanguageProfiles *This, CLSID clsid, TF_LA static HRESULT WINAPI EnumTfLanguageProfiles_Next(IEnumTfLanguageProfiles *iface, ULONG ulCount, TF_LANGUAGEPROFILE *pProfile, ULONG *pcFetch) { - EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface; + EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface); ULONG fetched = 0; TRACE("(%p)\n",This); @@ -1062,14 +1074,14 @@ static HRESULT WINAPI EnumTfLanguageProfiles_Next(IEnumTfLanguageProfiles *iface static HRESULT WINAPI EnumTfLanguageProfiles_Skip( IEnumTfLanguageProfiles* iface, ULONG celt) { - EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface; + EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface); FIXME("STUB (%p)\n",This); return E_NOTIMPL; } static HRESULT WINAPI EnumTfLanguageProfiles_Reset( IEnumTfLanguageProfiles* iface) { - EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface; + EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface); TRACE("(%p)\n",This); This->tip_index = 0; if (This->langkey) @@ -1082,7 +1094,7 @@ static HRESULT WINAPI EnumTfLanguageProfiles_Reset( IEnumTfLanguageProfiles* ifa static HRESULT WINAPI EnumTfLanguageProfiles_Clone( IEnumTfLanguageProfiles *iface, IEnumTfLanguageProfiles **ppenum) { - EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface; + EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface); HRESULT res; TRACE("(%p)\n",This); @@ -1109,11 +1121,11 @@ static HRESULT WINAPI EnumTfLanguageProfiles_Clone( IEnumTfLanguageProfiles *ifa return res; } -static const IEnumTfLanguageProfilesVtbl IEnumTfLanguageProfiles_Vtbl ={ +static const IEnumTfLanguageProfilesVtbl EnumTfLanguageProfilesVtbl = +{ EnumTfLanguageProfiles_QueryInterface, EnumTfLanguageProfiles_AddRef, EnumTfLanguageProfiles_Release, - EnumTfLanguageProfiles_Clone, EnumTfLanguageProfiles_Next, EnumTfLanguageProfiles_Reset, @@ -1129,7 +1141,7 @@ static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguage if (This == NULL) return E_OUTOFMEMORY; - This->Vtbl= &IEnumTfLanguageProfiles_Vtbl; + This->IEnumTfLanguageProfiles_iface.lpVtbl= &EnumTfLanguageProfilesVtbl; This->refCount = 1; This->langid = langid; @@ -1147,7 +1159,7 @@ static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguage return E_FAIL; } - TRACE("returning %p\n", This); - *ppOut = (IEnumTfLanguageProfiles*)This; + *ppOut = &This->IEnumTfLanguageProfiles_iface; + TRACE("returning %p\n", *ppOut); return S_OK; } diff --git a/dll/win32/msctf/langbarmgr.c b/dll/win32/msctf/langbarmgr.c index a18be8d59d8..6b54ea9dea0 100644 --- a/dll/win32/msctf/langbarmgr.c +++ b/dll/win32/msctf/langbarmgr.c @@ -46,7 +46,7 @@ static HRESULT WINAPI LangBarMgr_QueryInterface(ITfLangBarMgr *iface, REFIID iid if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfLangBarMgr)) { - *ppvOut = This; + *ppvOut = &This->ITfLangBarMgr_iface; } if (*ppvOut) @@ -182,7 +182,7 @@ HRESULT LangBarMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) This->ITfLangBarMgr_iface.lpVtbl = &LangBarMgr_LangBarMgrVtbl; This->refCount = 1; - TRACE("returning %p\n", This); - *ppOut = (IUnknown *)This; + *ppOut = (IUnknown *)&This->ITfLangBarMgr_iface; + TRACE("returning %p\n", *ppOut); return S_OK; } diff --git a/dll/win32/msctf/msctf_classes.idl b/dll/win32/msctf/msctf_classes.idl index 805e1544ef4..66aadefb324 100644 --- a/dll/win32/msctf/msctf_classes.idl +++ b/dll/win32/msctf/msctf_classes.idl @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ threading(apartment), uuid(529a9e6b-6587-4f23-ab9e-9c7d683e3c50) diff --git a/dll/win32/msctf/msctf.rgs b/dll/win32/msctf/msctf_classes.rgs similarity index 100% rename from dll/win32/msctf/msctf.rgs rename to dll/win32/msctf/msctf_classes.rgs diff --git a/dll/win32/msctf/range.c b/dll/win32/msctf/range.c index 76926aaaf0d..e5a7fca2eee 100644 --- a/dll/win32/msctf/range.c +++ b/dll/win32/msctf/range.c @@ -52,7 +52,7 @@ static HRESULT WINAPI Range_QueryInterface(ITfRange *iface, REFIID iid, LPVOID * if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfRange)) { - *ppvOut = This; + *ppvOut = &This->ITfRange_iface; } if (*ppvOut) @@ -325,7 +325,7 @@ HRESULT Range_Constructor(ITfContext *context, ITextStoreACP *textstore, DWORD l This->anchorEnd = anchorEnd; *ppOut = &This->ITfRange_iface; - TRACE("returning %p\n", This); + TRACE("returning %p\n", *ppOut); return S_OK; } @@ -339,7 +339,7 @@ HRESULT TF_SELECTION_to_TS_SELECTION_ACP(const TF_SELECTION *tf, TS_SELECTION_AC if (!tf || !tsAcp || !tf->range) return E_INVALIDARG; - This = (Range *)tf->range; + This = impl_from_ITfRange(tf->range); tsAcp->acpStart = This->anchorStart; tsAcp->acpEnd = This->anchorEnd; diff --git a/dll/win32/msctf/threadmgr.c b/dll/win32/msctf/threadmgr.c index 9858ef8cdcd..3b6611c2781 100644 --- a/dll/win32/msctf/threadmgr.c +++ b/dll/win32/msctf/threadmgr.c @@ -57,22 +57,22 @@ typedef struct tagAssociatedWindow } AssociatedWindow; typedef struct tagACLMulti { - const ITfThreadMgrVtbl *ThreadMgrVtbl; - const ITfSourceVtbl *SourceVtbl; - const ITfKeystrokeMgrVtbl *KeystrokeMgrVtbl; - const ITfMessagePumpVtbl *MessagePumpVtbl; - const ITfClientIdVtbl *ClientIdVtbl; + ITfThreadMgr ITfThreadMgr_iface; + ITfSource ITfSource_iface; + ITfKeystrokeMgr ITfKeystrokeMgr_iface; + ITfMessagePump ITfMessagePump_iface; + ITfClientId ITfClientId_iface; /* const ITfThreadMgrExVtbl *ThreadMgrExVtbl; */ /* const ITfConfigureSystemKeystrokeFeedVtbl *ConfigureSystemKeystrokeFeedVtbl; */ /* const ITfLangBarItemMgrVtbl *LangBarItemMgrVtbl; */ /* const ITfUIElementMgrVtbl *UIElementMgrVtbl; */ - const ITfSourceSingleVtbl *SourceSingleVtbl; + ITfSourceSingle ITfSourceSingle_iface; LONG refCount; /* Aggregation */ ITfCompartmentMgr *CompartmentMgr; - const ITfThreadMgrEventSinkVtbl *ThreadMgrEventSinkVtbl; /* internal */ + ITfThreadMgrEventSink ITfThreadMgrEventSink_iface; /* internal */ ITfDocumentMgr *focus; LONG activationCount; @@ -96,7 +96,7 @@ typedef struct tagACLMulti { } ThreadMgr; typedef struct tagEnumTfDocumentMgr { - const IEnumTfDocumentMgrsVtbl *Vtbl; + IEnumTfDocumentMgrs IEnumTfDocumentMgrs_iface; LONG refCount; struct list *index; @@ -105,35 +105,44 @@ typedef struct tagEnumTfDocumentMgr { static HRESULT EnumTfDocumentMgr_Constructor(struct list* head, IEnumTfDocumentMgrs **ppOut); -static inline ThreadMgr *impl_from_ITfSourceVtbl(ITfSource *iface) +static inline ThreadMgr *impl_from_ITfThreadMgr(ITfThreadMgr *iface) { - return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,SourceVtbl)); + return CONTAINING_RECORD(iface, ThreadMgr, ITfThreadMgr_iface); } -static inline ThreadMgr *impl_from_ITfKeystrokeMgrVtbl(ITfKeystrokeMgr *iface) +static inline ThreadMgr *impl_from_ITfSource(ITfSource *iface) { - return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,KeystrokeMgrVtbl)); + return CONTAINING_RECORD(iface, ThreadMgr, ITfSource_iface); } -static inline ThreadMgr *impl_from_ITfMessagePumpVtbl(ITfMessagePump *iface) +static inline ThreadMgr *impl_from_ITfKeystrokeMgr(ITfKeystrokeMgr *iface) { - return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,MessagePumpVtbl)); + return CONTAINING_RECORD(iface, ThreadMgr, ITfKeystrokeMgr_iface); } -static inline ThreadMgr *impl_from_ITfClientIdVtbl(ITfClientId *iface) +static inline ThreadMgr *impl_from_ITfMessagePump(ITfMessagePump *iface) { - return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,ClientIdVtbl)); + return CONTAINING_RECORD(iface, ThreadMgr, ITfMessagePump_iface); +} + +static inline ThreadMgr *impl_from_ITfClientId(ITfClientId *iface) +{ + return CONTAINING_RECORD(iface, ThreadMgr, ITfClientId_iface); } static inline ThreadMgr *impl_from_ITfThreadMgrEventSink(ITfThreadMgrEventSink *iface) { - return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,ThreadMgrEventSinkVtbl)); + return CONTAINING_RECORD(iface, ThreadMgr, ITfThreadMgrEventSink_iface); } -static inline ThreadMgr *impl_from_ITfSourceSingleVtbl(ITfSourceSingle* iface) - +static inline ThreadMgr *impl_from_ITfSourceSingle(ITfSourceSingle *iface) { - return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,SourceSingleVtbl)); + return CONTAINING_RECORD(iface, ThreadMgr, ITfSourceSingle_iface); +} + +static inline EnumTfDocumentMgr *impl_from_IEnumTfDocumentMgrs(IEnumTfDocumentMgrs *iface) +{ + return CONTAINING_RECORD(iface, EnumTfDocumentMgr, IEnumTfDocumentMgrs_iface); } static void free_sink(ThreadMgrSink *sink) @@ -223,28 +232,28 @@ static void ThreadMgr_Destructor(ThreadMgr *This) static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgr *iface, REFIID iid, LPVOID *ppvOut) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfThreadMgr)) { - *ppvOut = This; + *ppvOut = &This->ITfThreadMgr_iface; } else if (IsEqualIID(iid, &IID_ITfSource)) { - *ppvOut = &This->SourceVtbl; + *ppvOut = &This->ITfSource_iface; } else if (IsEqualIID(iid, &IID_ITfKeystrokeMgr)) { - *ppvOut = &This->KeystrokeMgrVtbl; + *ppvOut = &This->ITfKeystrokeMgr_iface; } else if (IsEqualIID(iid, &IID_ITfMessagePump)) { - *ppvOut = &This->MessagePumpVtbl; + *ppvOut = &This->ITfMessagePump_iface; } else if (IsEqualIID(iid, &IID_ITfClientId)) { - *ppvOut = &This->ClientIdVtbl; + *ppvOut = &This->ITfClientId_iface; } else if (IsEqualIID(iid, &IID_ITfCompartmentMgr)) { @@ -252,7 +261,7 @@ static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgr *iface, REFIID iid, } else if (IsEqualIID(iid, &IID_ITfSourceSingle)) { - *ppvOut = &This->SourceSingleVtbl; + *ppvOut = &This->ITfSourceSingle_iface; } if (*ppvOut) @@ -267,13 +276,13 @@ static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgr *iface, REFIID iid, static ULONG WINAPI ThreadMgr_AddRef(ITfThreadMgr *iface) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); return InterlockedIncrement(&This->refCount); } static ULONG WINAPI ThreadMgr_Release(ITfThreadMgr *iface) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -288,7 +297,7 @@ static ULONG WINAPI ThreadMgr_Release(ITfThreadMgr *iface) static HRESULT WINAPI ThreadMgr_fnActivate( ITfThreadMgr* iface, TfClientId *ptid) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); TRACE("(%p) %p\n",This, ptid); @@ -299,7 +308,7 @@ static HRESULT WINAPI ThreadMgr_fnActivate( ITfThreadMgr* iface, TfClientId *pti { GUID guid; CoCreateGuid(&guid); - ITfClientId_GetClientId((ITfClientId*)&This->ClientIdVtbl,&guid,&processId); + ITfClientId_GetClientId(&This->ITfClientId_iface, &guid, &processId); } activate_textservices(iface); @@ -310,7 +319,7 @@ static HRESULT WINAPI ThreadMgr_fnActivate( ITfThreadMgr* iface, TfClientId *pti static HRESULT WINAPI ThreadMgr_fnDeactivate( ITfThreadMgr* iface) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); TRACE("(%p)\n",This); if (This->activationCount == 0) @@ -322,7 +331,7 @@ static HRESULT WINAPI ThreadMgr_fnDeactivate( ITfThreadMgr* iface) { if (This->focus) { - ITfThreadMgrEventSink_OnSetFocus((ITfThreadMgrEventSink*)&This->ThreadMgrEventSinkVtbl, 0, This->focus); + ITfThreadMgrEventSink_OnSetFocus(&This->ITfThreadMgrEventSink_iface, 0, This->focus); ITfDocumentMgr_Release(This->focus); This->focus = 0; } @@ -333,10 +342,9 @@ static HRESULT WINAPI ThreadMgr_fnDeactivate( ITfThreadMgr* iface) return S_OK; } -static HRESULT WINAPI ThreadMgr_CreateDocumentMgr( ITfThreadMgr* iface, ITfDocumentMgr -**ppdim) +static HRESULT WINAPI ThreadMgr_CreateDocumentMgr(ITfThreadMgr* iface, ITfDocumentMgr **ppdim) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); DocumentMgrEntry *mgrentry; HRESULT hr; @@ -345,7 +353,7 @@ static HRESULT WINAPI ThreadMgr_CreateDocumentMgr( ITfThreadMgr* iface, ITfDocum if (mgrentry == NULL) return E_OUTOFMEMORY; - hr = DocumentMgr_Constructor((ITfThreadMgrEventSink*)&This->ThreadMgrEventSinkVtbl, ppdim); + hr = DocumentMgr_Constructor(&This->ITfThreadMgrEventSink_iface, ppdim); if (SUCCEEDED(hr)) { @@ -358,10 +366,9 @@ static HRESULT WINAPI ThreadMgr_CreateDocumentMgr( ITfThreadMgr* iface, ITfDocum return hr; } -static HRESULT WINAPI ThreadMgr_EnumDocumentMgrs( ITfThreadMgr* iface, IEnumTfDocumentMgrs -**ppEnum) +static HRESULT WINAPI ThreadMgr_EnumDocumentMgrs( ITfThreadMgr* iface, IEnumTfDocumentMgrs **ppEnum) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); TRACE("(%p) %p\n",This,ppEnum); if (!ppEnum) @@ -373,7 +380,7 @@ static HRESULT WINAPI ThreadMgr_EnumDocumentMgrs( ITfThreadMgr* iface, IEnumTfDo static HRESULT WINAPI ThreadMgr_GetFocus( ITfThreadMgr* iface, ITfDocumentMgr **ppdimFocus) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); TRACE("(%p)\n",This); if (!ppdimFocus) @@ -393,8 +400,8 @@ static HRESULT WINAPI ThreadMgr_GetFocus( ITfThreadMgr* iface, ITfDocumentMgr static HRESULT WINAPI ThreadMgr_SetFocus( ITfThreadMgr* iface, ITfDocumentMgr *pdimFocus) { + ThreadMgr *This = impl_from_ITfThreadMgr(iface); ITfDocumentMgr *check; - ThreadMgr *This = (ThreadMgr *)iface; TRACE("(%p) %p\n",This,pdimFocus); @@ -403,7 +410,7 @@ static HRESULT WINAPI ThreadMgr_SetFocus( ITfThreadMgr* iface, ITfDocumentMgr *p else if (FAILED(ITfDocumentMgr_QueryInterface(pdimFocus,&IID_ITfDocumentMgr,(LPVOID*) &check))) return E_INVALIDARG; - ITfThreadMgrEventSink_OnSetFocus((ITfThreadMgrEventSink*)&This->ThreadMgrEventSinkVtbl, check, This->focus); + ITfThreadMgrEventSink_OnSetFocus(&This->ITfThreadMgrEventSink_iface, check, This->focus); if (This->focus) ITfDocumentMgr_Release(This->focus); @@ -467,8 +474,8 @@ static HRESULT SetupWindowsHook(ThreadMgr *This) static HRESULT WINAPI ThreadMgr_AssociateFocus( ITfThreadMgr* iface, HWND hwnd, ITfDocumentMgr *pdimNew, ITfDocumentMgr **ppdimPrev) { + ThreadMgr *This = impl_from_ITfThreadMgr(iface); struct list *cursor, *cursor2; - ThreadMgr *This = (ThreadMgr *)iface; AssociatedWindow *wnd; TRACE("(%p) %p %p %p\n",This,hwnd,pdimNew,ppdimPrev); @@ -508,8 +515,9 @@ ITfDocumentMgr *pdimNew, ITfDocumentMgr **ppdimPrev) static HRESULT WINAPI ThreadMgr_IsThreadFocus( ITfThreadMgr* iface, BOOL *pfThreadFocus) { + ThreadMgr *This = impl_from_ITfThreadMgr(iface); HWND focus; - ThreadMgr *This = (ThreadMgr *)iface; + TRACE("(%p) %p\n",This,pfThreadFocus); focus = GetFocus(); *pfThreadFocus = (focus == NULL); @@ -519,7 +527,7 @@ static HRESULT WINAPI ThreadMgr_IsThreadFocus( ITfThreadMgr* iface, BOOL *pfThre static HRESULT WINAPI ThreadMgr_GetFunctionProvider( ITfThreadMgr* iface, REFCLSID clsid, ITfFunctionProvider **ppFuncProv) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -527,7 +535,7 @@ ITfFunctionProvider **ppFuncProv) static HRESULT WINAPI ThreadMgr_EnumFunctionProviders( ITfThreadMgr* iface, IEnumTfFunctionProviders **ppEnum) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -535,7 +543,7 @@ IEnumTfFunctionProviders **ppEnum) static HRESULT WINAPI ThreadMgr_GetGlobalCompartment( ITfThreadMgr* iface, ITfCompartmentMgr **ppCompMgr) { - ThreadMgr *This = (ThreadMgr *)iface; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); HRESULT hr; TRACE("(%p) %p\n",This, ppCompMgr); @@ -554,12 +562,11 @@ ITfCompartmentMgr **ppCompMgr) return S_OK; } -static const ITfThreadMgrVtbl ThreadMgr_ThreadMgrVtbl = +static const ITfThreadMgrVtbl ThreadMgrVtbl = { ThreadMgr_QueryInterface, ThreadMgr_AddRef, ThreadMgr_Release, - ThreadMgr_fnActivate, ThreadMgr_fnDeactivate, ThreadMgr_CreateDocumentMgr, @@ -573,23 +580,22 @@ static const ITfThreadMgrVtbl ThreadMgr_ThreadMgrVtbl = ThreadMgr_GetGlobalCompartment }; - static HRESULT WINAPI Source_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) { - ThreadMgr *This = impl_from_ITfSourceVtbl(iface); - return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); + ThreadMgr *This = impl_from_ITfSource(iface); + return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, ppvOut); } static ULONG WINAPI Source_AddRef(ITfSource *iface) { - ThreadMgr *This = impl_from_ITfSourceVtbl(iface); - return ThreadMgr_AddRef((ITfThreadMgr*)This); + ThreadMgr *This = impl_from_ITfSource(iface); + return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface); } static ULONG WINAPI Source_Release(ITfSource *iface) { - ThreadMgr *This = impl_from_ITfSourceVtbl(iface); - return ThreadMgr_Release((ITfThreadMgr *)This); + ThreadMgr *This = impl_from_ITfSource(iface); + return ITfThreadMgr_Release(&This->ITfThreadMgr_iface); } /***************************************************** @@ -598,8 +604,8 @@ static ULONG WINAPI Source_Release(ITfSource *iface) static HRESULT WINAPI ThreadMgrSource_AdviseSink(ITfSource *iface, REFIID riid, IUnknown *punk, DWORD *pdwCookie) { + ThreadMgr *This = impl_from_ITfSource(iface); ThreadMgrSink *tms; - ThreadMgr *This = impl_from_ITfSourceVtbl(iface); TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie); @@ -632,8 +638,8 @@ static HRESULT WINAPI ThreadMgrSource_AdviseSink(ITfSource *iface, static HRESULT WINAPI ThreadMgrSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) { + ThreadMgr *This = impl_from_ITfSource(iface); ThreadMgrSink *sink; - ThreadMgr *This = impl_from_ITfSourceVtbl(iface); TRACE("(%p) %x\n",This,pdwCookie); @@ -650,12 +656,11 @@ static HRESULT WINAPI ThreadMgrSource_UnadviseSink(ITfSource *iface, DWORD pdwCo return S_OK; } -static const ITfSourceVtbl ThreadMgr_SourceVtbl = +static const ITfSourceVtbl ThreadMgrSourceVtbl = { Source_QueryInterface, Source_AddRef, Source_Release, - ThreadMgrSource_AdviseSink, ThreadMgrSource_UnadviseSink, }; @@ -666,26 +671,26 @@ static const ITfSourceVtbl ThreadMgr_SourceVtbl = static HRESULT WINAPI KeystrokeMgr_QueryInterface(ITfKeystrokeMgr *iface, REFIID iid, LPVOID *ppvOut) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); - return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); + return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, ppvOut); } static ULONG WINAPI KeystrokeMgr_AddRef(ITfKeystrokeMgr *iface) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); - return ThreadMgr_AddRef((ITfThreadMgr*)This); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); + return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface); } static ULONG WINAPI KeystrokeMgr_Release(ITfKeystrokeMgr *iface) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); - return ThreadMgr_Release((ITfThreadMgr *)This); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); + return ITfThreadMgr_Release(&This->ITfThreadMgr_iface); } static HRESULT WINAPI KeystrokeMgr_AdviseKeyEventSink(ITfKeystrokeMgr *iface, TfClientId tid, ITfKeyEventSink *pSink, BOOL fForeground) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); CLSID textservice; ITfKeyEventSink *check = NULL; @@ -725,7 +730,7 @@ static HRESULT WINAPI KeystrokeMgr_AdviseKeyEventSink(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_UnadviseKeyEventSink(ITfKeystrokeMgr *iface, TfClientId tid) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); CLSID textservice; ITfKeyEventSink *check = NULL; TRACE("(%p) %x\n",This,tid); @@ -757,7 +762,7 @@ static HRESULT WINAPI KeystrokeMgr_UnadviseKeyEventSink(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_GetForeground(ITfKeystrokeMgr *iface, CLSID *pclsid) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); TRACE("(%p) %p\n",This,pclsid); if (!pclsid) return E_INVALIDARG; @@ -772,7 +777,7 @@ static HRESULT WINAPI KeystrokeMgr_GetForeground(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_TestKeyDown(ITfKeystrokeMgr *iface, WPARAM wParam, LPARAM lParam, BOOL *pfEaten) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -780,7 +785,7 @@ static HRESULT WINAPI KeystrokeMgr_TestKeyDown(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_TestKeyUp(ITfKeystrokeMgr *iface, WPARAM wParam, LPARAM lParam, BOOL *pfEaten) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -788,7 +793,7 @@ static HRESULT WINAPI KeystrokeMgr_TestKeyUp(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_KeyDown(ITfKeystrokeMgr *iface, WPARAM wParam, LPARAM lParam, BOOL *pfEaten) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -796,7 +801,7 @@ static HRESULT WINAPI KeystrokeMgr_KeyDown(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_KeyUp(ITfKeystrokeMgr *iface, WPARAM wParam, LPARAM lParam, BOOL *pfEaten) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -804,7 +809,7 @@ static HRESULT WINAPI KeystrokeMgr_KeyUp(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_GetPreservedKey(ITfKeystrokeMgr *iface, ITfContext *pic, const TF_PRESERVEDKEY *pprekey, GUID *pguid) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -812,7 +817,7 @@ static HRESULT WINAPI KeystrokeMgr_GetPreservedKey(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_IsPreservedKey(ITfKeystrokeMgr *iface, REFGUID rguid, const TF_PRESERVEDKEY *pprekey, BOOL *pfRegistered) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); struct list *cursor; TRACE("(%p) %s (%x %x) %p\n",This,debugstr_guid(rguid), (pprekey)?pprekey->uVKey:0, (pprekey)?pprekey->uModifiers:0, pfRegistered); @@ -838,7 +843,7 @@ static HRESULT WINAPI KeystrokeMgr_PreserveKey(ITfKeystrokeMgr *iface, TfClientId tid, REFGUID rguid, const TF_PRESERVEDKEY *prekey, const WCHAR *pchDesc, ULONG cchDesc) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); struct list *cursor; PreservedKey *newkey; @@ -881,7 +886,7 @@ static HRESULT WINAPI KeystrokeMgr_PreserveKey(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_UnpreserveKey(ITfKeystrokeMgr *iface, REFGUID rguid, const TF_PRESERVEDKEY *pprekey) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); PreservedKey* key = NULL; struct list *cursor; TRACE("(%p) %s (%x %x)\n",This,debugstr_guid(rguid),(pprekey)?pprekey->uVKey:0, (pprekey)?pprekey->uModifiers:0); @@ -910,7 +915,7 @@ static HRESULT WINAPI KeystrokeMgr_UnpreserveKey(ITfKeystrokeMgr *iface, static HRESULT WINAPI KeystrokeMgr_SetPreservedKeyDescription(ITfKeystrokeMgr *iface, REFGUID rguid, const WCHAR *pchDesc, ULONG cchDesc) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -918,7 +923,7 @@ static HRESULT WINAPI KeystrokeMgr_SetPreservedKeyDescription(ITfKeystrokeMgr *i static HRESULT WINAPI KeystrokeMgr_GetPreservedKeyDescription(ITfKeystrokeMgr *iface, REFGUID rguid, BSTR *pbstrDesc) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } @@ -926,17 +931,16 @@ static HRESULT WINAPI KeystrokeMgr_GetPreservedKeyDescription(ITfKeystrokeMgr *i static HRESULT WINAPI KeystrokeMgr_SimulatePreservedKey(ITfKeystrokeMgr *iface, ITfContext *pic, REFGUID rguid, BOOL *pfEaten) { - ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } -static const ITfKeystrokeMgrVtbl ThreadMgr_KeystrokeMgrVtbl = +static const ITfKeystrokeMgrVtbl KeystrokeMgrVtbl = { KeystrokeMgr_QueryInterface, KeystrokeMgr_AddRef, KeystrokeMgr_Release, - KeystrokeMgr_AdviseKeyEventSink, KeystrokeMgr_UnadviseKeyEventSink, KeystrokeMgr_GetForeground, @@ -959,20 +963,20 @@ static const ITfKeystrokeMgrVtbl ThreadMgr_KeystrokeMgrVtbl = static HRESULT WINAPI MessagePump_QueryInterface(ITfMessagePump *iface, REFIID iid, LPVOID *ppvOut) { - ThreadMgr *This = impl_from_ITfMessagePumpVtbl(iface); - return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); + ThreadMgr *This = impl_from_ITfMessagePump(iface); + return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, ppvOut); } static ULONG WINAPI MessagePump_AddRef(ITfMessagePump *iface) { - ThreadMgr *This = impl_from_ITfMessagePumpVtbl(iface); - return ThreadMgr_AddRef((ITfThreadMgr*)This); + ThreadMgr *This = impl_from_ITfMessagePump(iface); + return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface); } static ULONG WINAPI MessagePump_Release(ITfMessagePump *iface) { - ThreadMgr *This = impl_from_ITfMessagePumpVtbl(iface); - return ThreadMgr_Release((ITfThreadMgr *)This); + ThreadMgr *This = impl_from_ITfMessagePump(iface); + return ITfThreadMgr_Release(&This->ITfThreadMgr_iface); } static HRESULT WINAPI MessagePump_PeekMessageA(ITfMessagePump *iface, @@ -1015,12 +1019,11 @@ static HRESULT WINAPI MessagePump_GetMessageW(ITfMessagePump *iface, return S_OK; } -static const ITfMessagePumpVtbl ThreadMgr_MessagePumpVtbl = +static const ITfMessagePumpVtbl MessagePumpVtbl = { MessagePump_QueryInterface, MessagePump_AddRef, MessagePump_Release, - MessagePump_PeekMessageA, MessagePump_GetMessageA, MessagePump_PeekMessageW, @@ -1033,29 +1036,29 @@ static const ITfMessagePumpVtbl ThreadMgr_MessagePumpVtbl = static HRESULT WINAPI ClientId_QueryInterface(ITfClientId *iface, REFIID iid, LPVOID *ppvOut) { - ThreadMgr *This = impl_from_ITfClientIdVtbl(iface); - return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); + ThreadMgr *This = impl_from_ITfClientId(iface); + return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, ppvOut); } static ULONG WINAPI ClientId_AddRef(ITfClientId *iface) { - ThreadMgr *This = impl_from_ITfClientIdVtbl(iface); - return ThreadMgr_AddRef((ITfThreadMgr*)This); + ThreadMgr *This = impl_from_ITfClientId(iface); + return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface); } static ULONG WINAPI ClientId_Release(ITfClientId *iface) { - ThreadMgr *This = impl_from_ITfClientIdVtbl(iface); - return ThreadMgr_Release((ITfThreadMgr *)This); + ThreadMgr *This = impl_from_ITfClientId(iface); + return ITfThreadMgr_Release(&This->ITfThreadMgr_iface); } static HRESULT WINAPI ClientId_GetClientId(ITfClientId *iface, REFCLSID rclsid, TfClientId *ptid) { + ThreadMgr *This = impl_from_ITfClientId(iface); HRESULT hr; ITfCategoryMgr *catmgr; - ThreadMgr *This = impl_from_ITfClientIdVtbl(iface); TRACE("(%p) %s\n",This,debugstr_guid(rclsid)); @@ -1066,12 +1069,11 @@ static HRESULT WINAPI ClientId_GetClientId(ITfClientId *iface, return hr; } -static const ITfClientIdVtbl ThreadMgr_ClientIdVtbl = +static const ITfClientIdVtbl ClientIdVtbl = { ClientId_QueryInterface, ClientId_AddRef, ClientId_Release, - ClientId_GetClientId }; @@ -1081,19 +1083,19 @@ static const ITfClientIdVtbl ThreadMgr_ClientIdVtbl = static HRESULT WINAPI ThreadMgrEventSink_QueryInterface(ITfThreadMgrEventSink *iface, REFIID iid, LPVOID *ppvOut) { ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface); - return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); + return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, ppvOut); } static ULONG WINAPI ThreadMgrEventSink_AddRef(ITfThreadMgrEventSink *iface) { ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface); - return ThreadMgr_AddRef((ITfThreadMgr*)This); + return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface); } static ULONG WINAPI ThreadMgrEventSink_Release(ITfThreadMgrEventSink *iface) { ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface); - return ThreadMgr_Release((ITfThreadMgr *)This); + return ITfThreadMgr_Release(&This->ITfThreadMgr_iface); } @@ -1183,12 +1185,11 @@ static HRESULT WINAPI ThreadMgrEventSink_OnPopContext( return S_OK; } -static const ITfThreadMgrEventSinkVtbl ThreadMgr_ThreadMgrEventSinkVtbl = +static const ITfThreadMgrEventSinkVtbl ThreadMgrEventSinkVtbl = { ThreadMgrEventSink_QueryInterface, ThreadMgrEventSink_AddRef, ThreadMgrEventSink_Release, - ThreadMgrEventSink_OnInitDocumentMgr, ThreadMgrEventSink_OnUninitDocumentMgr, ThreadMgrEventSink_OnSetFocus, @@ -1201,26 +1202,26 @@ static const ITfThreadMgrEventSinkVtbl ThreadMgr_ThreadMgrEventSinkVtbl = *****************************************************/ static HRESULT WINAPI ThreadMgrSourceSingle_QueryInterface(ITfSourceSingle *iface, REFIID iid, LPVOID *ppvOut) { - ThreadMgr *This = impl_from_ITfSourceSingleVtbl(iface); - return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); + ThreadMgr *This = impl_from_ITfSourceSingle(iface); + return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, ppvOut); } static ULONG WINAPI ThreadMgrSourceSingle_AddRef(ITfSourceSingle *iface) { - ThreadMgr *This = impl_from_ITfSourceSingleVtbl(iface); - return ThreadMgr_AddRef((ITfThreadMgr *)This); + ThreadMgr *This = impl_from_ITfSourceSingle(iface); + return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface); } static ULONG WINAPI ThreadMgrSourceSingle_Release(ITfSourceSingle *iface) { - ThreadMgr *This = impl_from_ITfSourceSingleVtbl(iface); - return ThreadMgr_Release((ITfThreadMgr *)This); + ThreadMgr *This = impl_from_ITfSourceSingle(iface); + return ITfThreadMgr_Release(&This->ITfThreadMgr_iface); } static HRESULT WINAPI ThreadMgrSourceSingle_AdviseSingleSink( ITfSourceSingle *iface, TfClientId tid, REFIID riid, IUnknown *punk) { - ThreadMgr *This = impl_from_ITfSourceSingleVtbl(iface); + ThreadMgr *This = impl_from_ITfSourceSingle(iface); FIXME("STUB:(%p) %i %s %p\n",This, tid, debugstr_guid(riid),punk); return E_NOTIMPL; } @@ -1228,19 +1229,18 @@ static HRESULT WINAPI ThreadMgrSourceSingle_AdviseSingleSink( ITfSourceSingle *i static HRESULT WINAPI ThreadMgrSourceSingle_UnadviseSingleSink( ITfSourceSingle *iface, TfClientId tid, REFIID riid) { - ThreadMgr *This = impl_from_ITfSourceSingleVtbl(iface); + ThreadMgr *This = impl_from_ITfSourceSingle(iface); FIXME("STUB:(%p) %i %s\n",This, tid, debugstr_guid(riid)); return E_NOTIMPL; } -static const ITfSourceSingleVtbl ThreadMgr_SourceSingleVtbl = +static const ITfSourceSingleVtbl SourceSingleVtbl = { ThreadMgrSourceSingle_QueryInterface, ThreadMgrSourceSingle_AddRef, ThreadMgrSourceSingle_Release, - ThreadMgrSourceSingle_AdviseSingleSink, - ThreadMgrSourceSingle_UnadviseSingleSink, + ThreadMgrSourceSingle_UnadviseSingleSink }; HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) @@ -1253,8 +1253,8 @@ HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) This = TlsGetValue(tlsIndex); if (This) { - ThreadMgr_AddRef((ITfThreadMgr*)This); - *ppOut = (IUnknown*)This; + ThreadMgr_AddRef(&This->ITfThreadMgr_iface); + *ppOut = (IUnknown*)&This->ITfThreadMgr_iface; return S_OK; } @@ -1262,13 +1262,13 @@ HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) if (This == NULL) return E_OUTOFMEMORY; - This->ThreadMgrVtbl= &ThreadMgr_ThreadMgrVtbl; - This->SourceVtbl = &ThreadMgr_SourceVtbl; - This->KeystrokeMgrVtbl= &ThreadMgr_KeystrokeMgrVtbl; - This->MessagePumpVtbl= &ThreadMgr_MessagePumpVtbl; - This->ClientIdVtbl = &ThreadMgr_ClientIdVtbl; - This->ThreadMgrEventSinkVtbl = &ThreadMgr_ThreadMgrEventSinkVtbl; - This->SourceSingleVtbl = &ThreadMgr_SourceSingleVtbl; + This->ITfThreadMgr_iface.lpVtbl= &ThreadMgrVtbl; + This->ITfSource_iface.lpVtbl = &ThreadMgrSourceVtbl; + This->ITfKeystrokeMgr_iface.lpVtbl= &KeystrokeMgrVtbl; + This->ITfMessagePump_iface.lpVtbl = &MessagePumpVtbl; + This->ITfClientId_iface.lpVtbl = &ClientIdVtbl; + This->ITfThreadMgrEventSink_iface.lpVtbl = &ThreadMgrEventSinkVtbl; + This->ITfSourceSingle_iface.lpVtbl = &SourceSingleVtbl; This->refCount = 1; TlsSetValue(tlsIndex,This); @@ -1286,7 +1286,7 @@ HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) list_init(&This->ThreadMgrEventSink); TRACE("returning %p\n", This); - *ppOut = (IUnknown *)This; + *ppOut = (IUnknown *)&This->ITfThreadMgr_iface; return S_OK; } @@ -1301,12 +1301,12 @@ static void EnumTfDocumentMgr_Destructor(EnumTfDocumentMgr *This) static HRESULT WINAPI EnumTfDocumentMgr_QueryInterface(IEnumTfDocumentMgrs *iface, REFIID iid, LPVOID *ppvOut) { - EnumTfDocumentMgr *This = (EnumTfDocumentMgr *)iface; + EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface); *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumTfDocumentMgrs)) { - *ppvOut = This; + *ppvOut = &This->IEnumTfDocumentMgrs_iface; } if (*ppvOut) @@ -1321,13 +1321,13 @@ static HRESULT WINAPI EnumTfDocumentMgr_QueryInterface(IEnumTfDocumentMgrs *ifac static ULONG WINAPI EnumTfDocumentMgr_AddRef(IEnumTfDocumentMgrs *iface) { - EnumTfDocumentMgr *This = (EnumTfDocumentMgr*)iface; + EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface); return InterlockedIncrement(&This->refCount); } static ULONG WINAPI EnumTfDocumentMgr_Release(IEnumTfDocumentMgrs *iface) { - EnumTfDocumentMgr *This = (EnumTfDocumentMgr *)iface; + EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -1339,7 +1339,7 @@ static ULONG WINAPI EnumTfDocumentMgr_Release(IEnumTfDocumentMgrs *iface) static HRESULT WINAPI EnumTfDocumentMgr_Next(IEnumTfDocumentMgrs *iface, ULONG ulCount, ITfDocumentMgr **rgDocumentMgr, ULONG *pcFetched) { - EnumTfDocumentMgr *This = (EnumTfDocumentMgr *)iface; + EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface); ULONG fetched = 0; TRACE("(%p)\n",This); @@ -1370,8 +1370,9 @@ static HRESULT WINAPI EnumTfDocumentMgr_Next(IEnumTfDocumentMgrs *iface, static HRESULT WINAPI EnumTfDocumentMgr_Skip( IEnumTfDocumentMgrs* iface, ULONG celt) { + EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface); ULONG i; - EnumTfDocumentMgr *This = (EnumTfDocumentMgr *)iface; + TRACE("(%p)\n",This); for(i = 0; i < celt && This->index != NULL; i++) This->index = list_next(This->head, This->index); @@ -1380,7 +1381,7 @@ static HRESULT WINAPI EnumTfDocumentMgr_Skip( IEnumTfDocumentMgrs* iface, ULONG static HRESULT WINAPI EnumTfDocumentMgr_Reset( IEnumTfDocumentMgrs* iface) { - EnumTfDocumentMgr *This = (EnumTfDocumentMgr *)iface; + EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface); TRACE("(%p)\n",This); This->index = list_head(This->head); return S_OK; @@ -1389,7 +1390,7 @@ static HRESULT WINAPI EnumTfDocumentMgr_Reset( IEnumTfDocumentMgrs* iface) static HRESULT WINAPI EnumTfDocumentMgr_Clone( IEnumTfDocumentMgrs *iface, IEnumTfDocumentMgrs **ppenum) { - EnumTfDocumentMgr *This = (EnumTfDocumentMgr *)iface; + EnumTfDocumentMgr *This = impl_from_IEnumTfDocumentMgrs(iface); HRESULT res; TRACE("(%p)\n",This); @@ -1399,17 +1400,17 @@ static HRESULT WINAPI EnumTfDocumentMgr_Clone( IEnumTfDocumentMgrs *iface, res = EnumTfDocumentMgr_Constructor(This->head, ppenum); if (SUCCEEDED(res)) { - EnumTfDocumentMgr *new_This = (EnumTfDocumentMgr *)*ppenum; + EnumTfDocumentMgr *new_This = impl_from_IEnumTfDocumentMgrs(*ppenum); new_This->index = This->index; } return res; } -static const IEnumTfDocumentMgrsVtbl IEnumTfDocumentMgrs_Vtbl ={ +static const IEnumTfDocumentMgrsVtbl EnumTfDocumentMgrsVtbl = +{ EnumTfDocumentMgr_QueryInterface, EnumTfDocumentMgr_AddRef, EnumTfDocumentMgr_Release, - EnumTfDocumentMgr_Clone, EnumTfDocumentMgr_Next, EnumTfDocumentMgr_Reset, @@ -1424,7 +1425,7 @@ static HRESULT EnumTfDocumentMgr_Constructor(struct list* head, IEnumTfDocumentM if (This == NULL) return E_OUTOFMEMORY; - This->Vtbl= &IEnumTfDocumentMgrs_Vtbl; + This->IEnumTfDocumentMgrs_iface.lpVtbl= &EnumTfDocumentMgrsVtbl; This->refCount = 1; This->head = head; This->index = list_head(This->head); @@ -1434,9 +1435,9 @@ static HRESULT EnumTfDocumentMgr_Constructor(struct list* head, IEnumTfDocumentM return S_OK; } -void ThreadMgr_OnDocumentMgrDestruction(ITfThreadMgr *tm, ITfDocumentMgr *mgr) +void ThreadMgr_OnDocumentMgrDestruction(ITfThreadMgr *iface, ITfDocumentMgr *mgr) { - ThreadMgr *This = (ThreadMgr *)tm; + ThreadMgr *This = impl_from_ITfThreadMgr(iface); struct list *cursor; LIST_FOR_EACH(cursor, &This->CreatedDocumentMgrs) { diff --git a/dll/win32/msctf/version.rc b/dll/win32/msctf/version.rc index 91042240f5b..956051f74a4 100644 --- a/dll/win32/msctf/version.rc +++ b/dll/win32/msctf/version.rc @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -1 WINE_REGISTRY "msctf.rgs" +1 WINE_REGISTRY msctf_classes.rgs #define WINE_FILEDESCRIPTION_STR "Wine Msctf" #define WINE_FILENAME_STR "msctf.dll" diff --git a/dll/win32/msgina/gui.c b/dll/win32/msgina/gui.c index 1bd863ea108..41b7689f470 100644 --- a/dll/win32/msgina/gui.c +++ b/dll/win32/msgina/gui.c @@ -975,6 +975,38 @@ TRACE("Account locked!\n"); MB_OK | MB_ICONERROR); goto done; } + else if ((SubStatus == STATUS_PASSWORD_MUST_CHANGE) || + (SubStatus == STATUS_PASSWORD_EXPIRED)) + { + if (SubStatus == STATUS_PASSWORD_MUST_CHANGE) + ResourceMessageBox(pgContext, + hwndDlg, + MB_OK | MB_ICONSTOP, + IDS_LOGONTITLE, + IDS_PASSWORDMUSTCHANGE); + else + ResourceMessageBox(pgContext, + hwndDlg, + MB_OK | MB_ICONSTOP, + IDS_LOGONTITLE, + IDS_PASSWORDEXPIRED); + + if (!OnChangePassword(hwndDlg, + pgContext)) + goto done; + + Status = DoLoginTasks(pgContext, + pgContext->UserName, + pgContext->Domain, + pgContext->Password, + &SubStatus); + if (!NT_SUCCESS(Status)) + { + TRACE("Login after password change failed! (Status 0x%08lx)\n", Status); + + goto done; + } + } else { TRACE("Other error!\n"); @@ -1018,6 +1050,43 @@ done: return result; } + +static +VOID +SetDomainComboBox( + HWND hwndDomainComboBox, + PGINA_CONTEXT pgContext) +{ + WCHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1]; + DWORD dwComputerNameLength; + LONG lIndex = 0; + LONG lFindIndex; + + SendMessageW(hwndDomainComboBox, CB_RESETCONTENT, 0, 0); + + dwComputerNameLength = sizeof(szComputerName) / sizeof(WCHAR); + if (GetComputerNameW(szComputerName, &dwComputerNameLength)) + { + lIndex = SendMessageW(hwndDomainComboBox, CB_ADDSTRING, 0, (LPARAM)szComputerName); + } + + if (wcslen(pgContext->Domain) != 0) + { + lFindIndex = SendMessageW(hwndDomainComboBox, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)pgContext->Domain); + if (lFindIndex == CB_ERR) + { + lIndex = SendMessageW(hwndDomainComboBox, CB_ADDSTRING, 0, (LPARAM)pgContext->Domain); + } + else + { + lIndex = lFindIndex; + } + } + + SendMessageW(hwndDomainComboBox, CB_SETCURSEL, lIndex, 0); +} + + static INT_PTR CALLBACK LoggedOutWindowProc( IN HWND hwndDlg, @@ -1045,8 +1114,7 @@ LoggedOutWindowProc( if (pgContext->bShutdownWithoutLogon == FALSE) EnableWindow(GetDlgItem(hwndDlg, IDC_SHUTDOWN), FALSE); - SendDlgItemMessageW(hwndDlg, IDC_LOGON_TO, CB_ADDSTRING, 0, (LPARAM)pgContext->Domain); - SendDlgItemMessageW(hwndDlg, IDC_LOGON_TO, CB_SETCURSEL, 0, 0); + SetDomainComboBox(GetDlgItem(hwndDlg, IDC_LOGON_TO), pgContext); SetFocus(GetDlgItem(hwndDlg, pgContext->bDontDisplayLastUserName ? IDC_USERNAME : IDC_PASSWORD)); diff --git a/dll/win32/msgina/lang/bg-BG.rc b/dll/win32/msgina/lang/bg-BG.rc index c6e41603d98..cee7c055f8e 100644 --- a/dll/win32/msgina/lang/bg-BG.rc +++ b/dll/win32/msgina/lang/bg-BG.rc @@ -148,6 +148,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/dll/win32/msgina/lang/cs-CZ.rc b/dll/win32/msgina/lang/cs-CZ.rc index fb7c834e92c..05c71e7f97c 100644 --- a/dll/win32/msgina/lang/cs-CZ.rc +++ b/dll/win32/msgina/lang/cs-CZ.rc @@ -153,6 +153,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/dll/win32/msgina/lang/de-DE.rc b/dll/win32/msgina/lang/de-DE.rc index 612afcf8a6e..e71838cc2be 100644 --- a/dll/win32/msgina/lang/de-DE.rc +++ b/dll/win32/msgina/lang/de-DE.rc @@ -148,6 +148,8 @@ BEGIN IDS_LOGONTITLE "Anmeldemeldung" IDS_LOGONWRONGUSERORPWD "Sie konnten nicht angemeldet werden. Prüfen Sie Benutzername und Domäne, und geben Sie das Passwort erneut ein. Bei Passworten wird Groß- und Kleinschreibung unterschieden." IDS_LOGONUSERDISABLED "Ihr Konto wurde deaktiviert. Wenden Sie sich an Ihren Systemadministrator." + IDS_PASSWORDMUSTCHANGE "Sie müssen Ihr Paasswort bei der ersten Anmeldung ändern." + IDS_PASSWORDEXPIRED "Ihr Passwort ist abgelaufen und muss geändert werden." END /* Shutdown Dialog Strings */ diff --git a/dll/win32/msgina/lang/en-US.rc b/dll/win32/msgina/lang/en-US.rc index b699b34c2b6..c8828ca2313 100644 --- a/dll/win32/msgina/lang/en-US.rc +++ b/dll/win32/msgina/lang/en-US.rc @@ -148,6 +148,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/dll/win32/msgina/lang/es-ES.rc b/dll/win32/msgina/lang/es-ES.rc index 83c9cb9981f..45a0f3dd9eb 100644 --- a/dll/win32/msgina/lang/es-ES.rc +++ b/dll/win32/msgina/lang/es-ES.rc @@ -150,6 +150,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/dll/win32/msgina/lang/fr-FR.rc b/dll/win32/msgina/lang/fr-FR.rc index 60b838c355d..4f0d3242a07 100644 --- a/dll/win32/msgina/lang/fr-FR.rc +++ b/dll/win32/msgina/lang/fr-FR.rc @@ -148,6 +148,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/dll/win32/msgina/lang/he-IL.rc b/dll/win32/msgina/lang/he-IL.rc index 89be4d60945..bb76396143e 100644 --- a/dll/win32/msgina/lang/he-IL.rc +++ b/dll/win32/msgina/lang/he-IL.rc @@ -148,6 +148,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/dll/win32/msgina/lang/id-ID.rc b/dll/win32/msgina/lang/id-ID.rc index 4e45a682551..6e33eb6a7fe 100644 --- a/dll/win32/msgina/lang/id-ID.rc +++ b/dll/win32/msgina/lang/id-ID.rc @@ -148,6 +148,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/dll/win32/msgina/lang/it-IT.rc b/dll/win32/msgina/lang/it-IT.rc index a1e442e1024..30a3facf970 100644 --- a/dll/win32/msgina/lang/it-IT.rc +++ b/dll/win32/msgina/lang/it-IT.rc @@ -1,9 +1,10 @@ /* - * PROJECT: ReactOS Console Configuration DLL - * LICENSE: GPL - See COPYING in the top level directory - * FILE: dll/win32/msgina/lang/it-IT.rc - * PURPOSE: Italian resource file - * TRANSLATOR: Paolo Devoti, devotip at tiscali.it, 2007-11-02 + * PROJECT: ReactOS Console Configuration DLL + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/win32/msgina/lang/it-IT.rc + * PURPOSE: Italian resource file + * TRANSLATORS: Paolo Devoti, devotip at tiscali.it, 2007-11-02 + Marco Maria Emanuele Bartucci, 2014-04-19 */ LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL @@ -37,7 +38,7 @@ BEGIN EDITTEXT IDC_USERNAME, 60, 57, 155, 14, ES_AUTOHSCROLL LTEXT "Password:", IDC_STATIC, 6, 78, 52, 8 EDITTEXT IDC_PASSWORD, 60, 76, 155, 14, ES_AUTOHSCROLL | ES_PASSWORD - LTEXT "Log on to:", IDC_STATIC, 6, 96, 52, 8 + LTEXT "Accedi a:", IDC_STATIC, 6, 96, 52, 8 COMBOBOX IDC_LOGON_TO, 60, 95, 155, 14, CBS_DROPDOWNLIST | WS_VSCROLL PUSHBUTTON "OK", IDOK, 106, 122, 50, 14, BS_DEFPUSHBUTTON PUSHBUTTON "Annulla", IDCANCEL, 160, 122, 50, 14 @@ -57,8 +58,8 @@ BEGIN PUSHBUTTON "Bloccare il computer", IDC_LOCK, 10, 135, 70, 14 PUSHBUTTON "Fine sessione", IDC_LOGOFF, 90, 135, 70, 14 PUSHBUTTON "Spegnimento", IDC_SHUTDOWN, 170, 135, 70, 14 - PUSHBUTTON "Change Password", IDC_CHANGEPWD, 10, 154, 76, 14 - PUSHBUTTON "Task manager", IDC_TASKMGR, 90, 154, 70, 14 + PUSHBUTTON "Cambia password", IDC_CHANGEPWD, 10, 154, 76, 14 + PUSHBUTTON "Gestione attività", IDC_TASKMGR, 90, 154, 70, 14 PUSHBUTTON "Annulla", IDCANCEL, 170, 154, 70, 14 END @@ -70,7 +71,7 @@ BEGIN CONTROL IDI_ROSLOGO, IDC_ROSLOGO, "Static", SS_BITMAP, 0, 0, 275, 54 ICON IDI_LOCKICON, -1, 7, 59, 20, 20 LTEXT "Questo computer è in uso ed è stato bloccato.", IDC_STATIC, 37, 61, 231, 8 - LTEXT "Message", IDC_LOCKMSG, 37, 75, 231, 26 + LTEXT "Messaggio", IDC_LOCKMSG, 37, 75, 231, 26 LTEXT "Premere Ctrl-Alt-Canc per sbloccare questo computer.", IDC_STATIC, 37, 106, 231, 8 END @@ -93,7 +94,7 @@ END IDD_CHANGE_PASSWORD DIALOGEX 0, 0, 275, 166 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP -CAPTION "Change Password" +CAPTION "Cambia password" FONT 8, "MS Shell Dlg", 400, 0, 1 BEGIN CONTROL IDI_ROSLOGO, IDC_ROSLOGO, "Static", SS_BITMAP, 0, 0, 275, 54 @@ -113,12 +114,12 @@ END IDD_LOGOFF_DLG DIALOGEX 0, 0, 188, 60 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_SYSMENU | WS_POPUP -CAPTION "Log Off ReactOS" +CAPTION "Disconetti da ReactOS" FONT 8, "MS Shell Dlg", 400, 0, 1 BEGIN ICON IDI_LOCKICON, -1, 7, 7, 20, 20 - LTEXT "Are you sure you want to log off?", IDC_STATIC, 35, 16, 146, 8 - PUSHBUTTON "Yes", IDYES, 41, 39, 50, 14, BS_DEFPUSHBUTTON + LTEXT "Sei sicuro di volerti disconettere?", IDC_STATIC, 35, 16, 146, 8 + PUSHBUTTON "Si", IDYES, 41, 39, 50, 14, BS_DEFPUSHBUTTON PUSHBUTTON "No", IDNO, 95, 39, 50, 14 END @@ -145,31 +146,33 @@ BEGIN IDS_ASKFORPASSWORD "Password: " IDS_FORCELOGOFF "Verrà terminata la sessione dell'utente attuale e tutti i dati non salvati verranno persi. Volete procedere?" IDS_LOCKMSG "Solo %s o un Amministratore possono sbloccare questo computer." - IDS_LOGONMSG "You are logged on as %s." + IDS_LOGONMSG "Sei entrato come %s." IDS_LOGONDATE "Dati di accesso: %s %s" - IDS_COMPUTERLOCKED "Computer locked" - IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." - IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." - IDS_CHANGEPWDTITLE "Change Password" - IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." - IDS_PASSWORDCHANGED "Your password has been changed." - IDS_LOGONTITLE "Logon Message" - IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." - IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_COMPUTERLOCKED "Computer Bloccato" + IDS_LOCKEDWRONGPASSWORD "La password è sbagliata. Per favore reinserisca la password. Le lettere nella password devono essere digitate differenziando le minuscole dalle maiuscole." + IDS_LOCKEDWRONGUSER "Il computer è bloccato. Solo %s\\%s o un amministratore può sbloccare questo computer." + IDS_CHANGEPWDTITLE "Cambia password" + IDS_NONMATCHINGPASSWORDS "Le password che hai digitato non corrispondono. Digita la stessa password in entrambe le caselle di testo." + IDS_PASSWORDCHANGED "La tua password è stata cambiata." + IDS_LOGONTITLE "Messaggio di accesso" + IDS_LOGONWRONGUSERORPWD "il sistema non ha potuto eseguire l'accesso. Si assicuri che nome utente e dominio sono corretti, allora digita nuovamente la password. Le lettere nella password devono essere digitate differenziando le minuscole dalle maiuscole." + IDS_LOGONUSERDISABLED "Il tuo account è stato disattivato. Per favore contatti l'amministratore di sistema." + IDS_PASSWORDMUSTCHANGE "Ti è chiesto di cambiare password al primo login." + IDS_PASSWORDEXPIRED "La tua password è scaduta e devi cambiarla." END /* Shutdown Dialog Strings */ STRINGTABLE BEGIN - IDS_SHUTDOWN_LOGOFF "Log off ""%s""" - IDS_SHUTDOWN_SHUTDOWN "Shut down" - IDS_SHUTDOWN_RESTART "Restart" - IDS_SHUTDOWN_SLEEP "Sleep" - IDS_SHUTDOWN_HIBERNATE "Hibernate" + IDS_SHUTDOWN_LOGOFF "Disconetti ""%s""" + IDS_SHUTDOWN_SHUTDOWN "Spegni" + IDS_SHUTDOWN_RESTART "Riavvia" + IDS_SHUTDOWN_SLEEP "Sospendi" + IDS_SHUTDOWN_HIBERNATE "Ibernazione" /* Shut down descriptions */ - IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." - IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." - IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." - IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." + IDS_SHUTDOWN_LOGOFF_DESC "Termina la sessione attuale e permette ad altri utenti di accedere al sistema." + IDS_SHUTDOWN_SHUTDOWN_DESC "Termina la sessione attuale e spegne il sistema così puoi staccare la corrente in sicurezza." + IDS_SHUTDOWN_RESTART_DESC "Termina la sessione attuale e riavvia il sistema." + IDS_SHUTDOWN_SLEEP_DESC "Mette il sistema in modalità riposo." + IDS_SHUTDOWN_HIBERNATE_DESC "Salva la sessione attuale e spegne il computer." END diff --git a/dll/win32/msgina/lang/ja-JP.rc b/dll/win32/msgina/lang/ja-JP.rc index b3af12c5549..118f1b10ce8 100644 --- a/dll/win32/msgina/lang/ja-JP.rc +++ b/dll/win32/msgina/lang/ja-JP.rc @@ -148,6 +148,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/dll/win32/msgina/lang/no-NO.rc b/dll/win32/msgina/lang/no-NO.rc index bce3ee2d0c3..062cc610a9b 100644 --- a/dll/win32/msgina/lang/no-NO.rc +++ b/dll/win32/msgina/lang/no-NO.rc @@ -148,6 +148,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/dll/win32/msgina/lang/pl-PL.rc b/dll/win32/msgina/lang/pl-PL.rc index a1d56bec798..86520561671 100644 --- a/dll/win32/msgina/lang/pl-PL.rc +++ b/dll/win32/msgina/lang/pl-PL.rc @@ -3,7 +3,8 @@ * testament@users.sourceforge.net * https://sourceforge.net/projects/reactospl * UTF-8 conversion by Caemyr (May, 2011) - * Updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (November, 2013) + * Updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (April, 2014) + * Updated by wojo664 - Wojtek Kozłowski (wojo664@gmail.com, wojtekkozlo664@op.pl) (April, 2014) */ @@ -38,7 +39,7 @@ BEGIN EDITTEXT IDC_USERNAME, 73, 57, 142, 14, ES_AUTOHSCROLL LTEXT "Hasło:", IDC_STATIC, 6, 78, 52, 8 EDITTEXT IDC_PASSWORD, 73, 76, 142, 14, ES_AUTOHSCROLL | ES_PASSWORD - LTEXT "Log on to:", IDC_STATIC, 6, 96, 52, 8 + LTEXT "Zaloguj do:", IDC_STATIC, 6, 96, 52, 8 COMBOBOX IDC_LOGON_TO, 73, 95, 142, 14, CBS_DROPDOWNLIST | WS_VSCROLL PUSHBUTTON "OK", IDOK, 106, 122, 50, 14, BS_DEFPUSHBUTTON PUSHBUTTON "Anuluj", IDCANCEL, 160, 122, 50, 14 @@ -114,13 +115,13 @@ END IDD_LOGOFF_DLG DIALOGEX 0, 0, 188, 60 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_SYSMENU | WS_POPUP -CAPTION "Log Off ReactOS" +CAPTION "ReactOS - Wylogowywanie z systemu" FONT 8, "MS Shell Dlg", 400, 0, 1 BEGIN ICON IDI_LOCKICON, -1, 7, 7, 20, 20 - LTEXT "Are you sure you want to log off?", IDC_STATIC, 35, 16, 146, 8 - PUSHBUTTON "Yes", IDYES, 41, 39, 50, 14, BS_DEFPUSHBUTTON - PUSHBUTTON "No", IDNO, 95, 39, 50, 14 + LTEXT "Czy na pewno chcesz się wylogować?", IDC_STATIC, 35, 16, 146, 8 + PUSHBUTTON "Tak", IDYES, 41, 39, 50, 14, BS_DEFPUSHBUTTON + PUSHBUTTON "Nie", IDNO, 95, 39, 50, 14 END IDD_SHUTDOWN_DLG DIALOGEX 0, 0, 275, 146 @@ -148,29 +149,30 @@ BEGIN IDS_LOCKMSG "Tylko %s lub Administrator może odblokować ten komputer." IDS_LOGONMSG "Jesteś zalogowany jako %s." IDS_LOGONDATE "Data logowania: %s %s" - IDS_COMPUTERLOCKED "Computer locked" - IDS_LOCKEDWRONGPASSWORD "The password is wrong. Please enter your password again. Letters in passwords must be typed using the correct case." - IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." - IDS_CHANGEPWDTITLE "Change Password" - IDS_NONMATCHINGPASSWORDS "The passwords you typed do not match. Type the same password in both text boxes." - IDS_PASSWORDCHANGED "Your password has been changed." - IDS_LOGONTITLE "Logon Message" - IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." - IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_COMPUTERLOCKED "Komputer zablokowany" + IDS_LOCKEDWRONGPASSWORD "Hasło jest niewłaściwe. Wpisz hasło ponownie. Wielkość liter w haśle ma znaczenie." + IDS_LOCKEDWRONGUSER "Ten komputer jest zablokowany. Tylko %s\\%s lub Administrator może odblokować ten komputer." + IDS_CHANGEPWDTITLE "Zmień hasło" + IDS_NONMATCHINGPASSWORDS "Wpisane hasła nie są zgodne. Wpisz takie same hasła w obu polach." + IDS_PASSWORDCHANGED "Twoje hasło zostało zmienione." + IDS_LOGONTITLE "Logowanie - wiadomość" + IDS_LOGONWRONGUSERORPWD "Logowanie w systemie nie jest możliwe. Upewnij się, że nazwa użytkownika i domena jest poprawna, a następnie wpisz ponownie hasło. Wielkość liter w haśle ma znaczenie." + IDS_LOGONUSERDISABLED "Twoje konto zostało wyłączone. Skontaktuj się z administratorem systemu." + IDS_PASSWORDMUSTCHANGE "Jesteś zobowiązany do zmiany hasła przy pierwszym logowaniu." + IDS_PASSWORDEXPIRED "Twoje hasło wygasło i musi zostać zmienione." END -/* Shutdown Dialog Strings */ -STRINGTABLE +/* Shutdown Dialog Strings */STRINGTABLE BEGIN - IDS_SHUTDOWN_LOGOFF "Log off ""%s""" - IDS_SHUTDOWN_SHUTDOWN "Shut down" + IDS_SHUTDOWN_LOGOFF "Wyloguj ""%s""" + IDS_SHUTDOWN_SHUTDOWN "Wyłącz" IDS_SHUTDOWN_RESTART "Restart" - IDS_SHUTDOWN_SLEEP "Sleep" - IDS_SHUTDOWN_HIBERNATE "Hibernate" + IDS_SHUTDOWN_SLEEP "Uśpij" + IDS_SHUTDOWN_HIBERNATE "Hibernacja" /* Shut down descriptions */ - IDS_SHUTDOWN_LOGOFF_DESC "Ends your current session and allows other users to log on to the system." - IDS_SHUTDOWN_SHUTDOWN_DESC "Ends your current session and shuts down the system so you can safely shut down the power." - IDS_SHUTDOWN_RESTART_DESC "Ends your current session and reboots the system." - IDS_SHUTDOWN_SLEEP_DESC "Puts the system in sleep mode." - IDS_SHUTDOWN_HIBERNATE_DESC "Saves the current session and shuts down the computer." + IDS_SHUTDOWN_LOGOFF_DESC "Kończy obecną sesję i pozwala na zalogowanie się innym użytkownikom do systemu." + IDS_SHUTDOWN_SHUTDOWN_DESC "Kończy obecną sesję i wyłącza sytem, pozwalając na bezpieczne wyłączenie zasilania." + IDS_SHUTDOWN_RESTART_DESC "Kończy obecną sesję i resetuje komputer." + IDS_SHUTDOWN_SLEEP_DESC "Przełącza system w tryb uśpienia." + IDS_SHUTDOWN_HIBERNATE_DESC "Zapisuje obecną sesję i wyłącza komputer." END diff --git a/dll/win32/msgina/lang/ro-RO.rc b/dll/win32/msgina/lang/ro-RO.rc index 4e517e63095..853a394f80a 100644 --- a/dll/win32/msgina/lang/ro-RO.rc +++ b/dll/win32/msgina/lang/ro-RO.rc @@ -150,6 +150,8 @@ BEGIN IDS_LOGONTITLE "Mesaj de autentificare" IDS_LOGONWRONGUSERORPWD "Sistemul nu vă poate autentifica. Asigurați-vă că numele și domeniul sunt corecte apoi tastați din nou parola. În parolă se face distincție între majuscule și minuscule." IDS_LOGONUSERDISABLED "Contul dumneavoastră a fost dezactivat. Contactați administratorul de sistem." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/dll/win32/msgina/lang/ru-RU.rc b/dll/win32/msgina/lang/ru-RU.rc index 1061218abb7..da9d9756297 100644 --- a/dll/win32/msgina/lang/ru-RU.rc +++ b/dll/win32/msgina/lang/ru-RU.rc @@ -51,7 +51,7 @@ BEGIN PUSHBUTTON "Заблокировать", IDC_LOCK, 7, 135, 86, 14 PUSHBUTTON "Завершение сеанса", IDC_LOGOFF, 102, 135, 86, 14 PUSHBUTTON "Выключение", IDC_SHUTDOWN, 198, 135, 70, 14 - PUSHBUTTON "Изменение пароля", IDC_CHANGEPWD, 7, 155, 86, 14 + PUSHBUTTON "Смена пароля", IDC_CHANGEPWD, 7, 155, 86, 14 PUSHBUTTON "Диспетчер задач", IDC_TASKMGR, 102, 154, 86, 14 PUSHBUTTON "Отмена", IDCANCEL, 198, 154, 70, 14 END @@ -87,7 +87,7 @@ END IDD_CHANGE_PASSWORD DIALOGEX 0, 0, 275, 166 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP -CAPTION "Изменение пароля" +CAPTION "Смена пароля" FONT 8, "MS Shell Dlg", 400, 0, 1 BEGIN CONTROL IDI_ROSLOGO, IDC_ROSLOGO, "Static", SS_BITMAP, 0, 0, 275, 54 @@ -142,14 +142,16 @@ BEGIN IDS_LOGONMSG "Вы вошли в систему как %s." IDS_LOGONDATE "Дата входа: %s %s" IDS_COMPUTERLOCKED "Компьютер заблокирован" - IDS_LOCKEDWRONGPASSWORD "Неверный пароль. Пожалуйста, введите пароль еще раз. Символы в Пароли вводятся с учетом регистра." + IDS_LOCKEDWRONGPASSWORD "Неверный пароль. Пожалуйста, введите пароль еще раз. Символы в пароле вводятся с учетом регистра." IDS_LOCKEDWRONGUSER "This computer is locked. Only %s\\%s or an Administrator can unlock this computer." - IDS_CHANGEPWDTITLE "Изменить пароль" + IDS_CHANGEPWDTITLE "Сменить пароль" IDS_NONMATCHINGPASSWORDS "Введенные пароли несовпадают. Введите пароль в оба поля" IDS_PASSWORDCHANGED "Ваш пароль был изменен." IDS_LOGONTITLE "Logon Message" - IDS_LOGONWRONGUSERORPWD "Системе не удается войти в. Убедитесь в том, ваше имя пользователя и домен верны, то введите пароль еще раз. Символы в Пароли вводятся с учетом регистра" - IDS_LOGONUSERDISABLED "Ваш аккаунт был отключен. Пожалуйста, обратитесь к системному администратору." + IDS_LOGONWRONGUSERORPWD "Системе не удается войти в. Проверьте правильность имени пользователя и домена и повторите ввод. Пароли вводятся с учетом регистра" + IDS_LOGONUSERDISABLED "Ваш аккаунт отключен. Пожалуйста, обратитесь к системному администратору." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ @@ -162,8 +164,8 @@ BEGIN IDS_SHUTDOWN_HIBERNATE "Гибернация" /* Shut down descriptions */ IDS_SHUTDOWN_LOGOFF_DESC "Завершает текущий сеанс и позволяет другим пользователям войти в систему." - IDS_SHUTDOWN_SHUTDOWN_DESC "Завершает текущий сеанс и отключает систему так что можно спокойно выключить питание." + IDS_SHUTDOWN_SHUTDOWN_DESC "Закрывает все программы, завершает работу ReactOS и выключает компьютер." IDS_SHUTDOWN_RESTART_DESC "Завершает текущий сеанс и перезагружает систему." IDS_SHUTDOWN_SLEEP_DESC "Переводит систему в режим ожидания." - IDS_SHUTDOWN_HIBERNATE_DESC "Сохраняет текущий сеанс и выключит компьютер." + IDS_SHUTDOWN_HIBERNATE_DESC "Сохраняет текущий сеанс и выключает компьютер." END diff --git a/dll/win32/msgina/lang/sk-SK.rc b/dll/win32/msgina/lang/sk-SK.rc index 31d4ab2418f..3b624ab09a1 100644 --- a/dll/win32/msgina/lang/sk-SK.rc +++ b/dll/win32/msgina/lang/sk-SK.rc @@ -153,6 +153,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/dll/win32/msgina/lang/sq-AL.rc b/dll/win32/msgina/lang/sq-AL.rc index cb9a93fb962..17257a22837 100644 --- a/dll/win32/msgina/lang/sq-AL.rc +++ b/dll/win32/msgina/lang/sq-AL.rc @@ -151,6 +151,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/dll/win32/msgina/lang/tr-TR.rc b/dll/win32/msgina/lang/tr-TR.rc index c216ef7b5f6..b6e731a5353 100644 --- a/dll/win32/msgina/lang/tr-TR.rc +++ b/dll/win32/msgina/lang/tr-TR.rc @@ -150,6 +150,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/dll/win32/msgina/lang/uk-UA.rc b/dll/win32/msgina/lang/uk-UA.rc index b125c5473c9..191b3053dd2 100644 --- a/dll/win32/msgina/lang/uk-UA.rc +++ b/dll/win32/msgina/lang/uk-UA.rc @@ -156,6 +156,8 @@ BEGIN IDS_LOGONTITLE "Logon Message" IDS_LOGONWRONGUSERORPWD "The system could not log you on. Make sure your User name and domain are correct, then type your password again. Letters in passwords must be typed using the correct case." IDS_LOGONUSERDISABLED "Your account has been disabled. Please see your system administrator." + IDS_PASSWORDMUSTCHANGE "You are required to change your password at first logon." + IDS_PASSWORDEXPIRED "Your password has expired and must be changed." END /* Shutdown Dialog Strings */ diff --git a/dll/win32/msgina/resource.h b/dll/win32/msgina/resource.h index e310dcf9a07..cee14bea090 100644 --- a/dll/win32/msgina/resource.h +++ b/dll/win32/msgina/resource.h @@ -57,6 +57,8 @@ #define IDS_LOGONTITLE 40015 #define IDS_LOGONWRONGUSERORPWD 40016 #define IDS_LOGONUSERDISABLED 40017 +#define IDS_PASSWORDMUSTCHANGE 40018 +#define IDS_PASSWORDEXPIRED 40019 #define IDS_SHUTDOWN_SHUTDOWN 50000 #define IDS_SHUTDOWN_LOGOFF 50001 diff --git a/dll/win32/msgsm32.acm/msgsm32.c b/dll/win32/msgsm32.acm/msgsm32.c index 358ed13cc4c..be09b905cf8 100644 --- a/dll/win32/msgsm32.acm/msgsm32.c +++ b/dll/win32/msgsm32.acm/msgsm32.c @@ -63,13 +63,13 @@ FUNCPTR(gsm_decode); if((p##f = wine_dlsym(libgsm_handle, #f, NULL, 0)) == NULL) { \ wine_dlclose(libgsm_handle, NULL, 0); \ libgsm_handle = NULL; \ - return 0; \ + return FALSE; \ } /*********************************************************************** * GSM_drvLoad */ -static LRESULT GSM_drvLoad(void) +static BOOL GSM_drvLoad(void) { char error[128]; @@ -81,12 +81,12 @@ static LRESULT GSM_drvLoad(void) LOAD_FUNCPTR(gsm_option); LOAD_FUNCPTR(gsm_encode); LOAD_FUNCPTR(gsm_decode); - return 1; + return TRUE; } else { ERR("Couldn't load " SONAME_LIBGSM ": %s\n", error); - return 0; + return FALSE; } } @@ -139,10 +139,10 @@ static LRESULT GSM_DriverDetails(PACMDRIVERDETAILSW add) } /* Validate a WAVEFORMATEX structure */ -static DWORD GSM_FormatValidate(const WAVEFORMATEX *wfx) +static BOOL GSM_FormatValidate(const WAVEFORMATEX *wfx) { if (wfx->nChannels != 1) - return 0; + return FALSE; switch (wfx->wFormatTag) { @@ -150,54 +150,54 @@ static DWORD GSM_FormatValidate(const WAVEFORMATEX *wfx) if (wfx->wBitsPerSample != 16) { WARN("PCM wBitsPerSample %u\n", wfx->wBitsPerSample); - return 0; + return FALSE; } if (wfx->nBlockAlign != 2) { WARN("PCM nBlockAlign %u\n", wfx->nBlockAlign); - return 0; + return FALSE; } if (wfx->nAvgBytesPerSec != wfx->nBlockAlign * wfx->nSamplesPerSec) { WARN("PCM nAvgBytesPerSec %u/%u\n", wfx->nAvgBytesPerSec, wfx->nBlockAlign * wfx->nSamplesPerSec); - return 0; + return FALSE; } - return 1; + return TRUE; case WAVE_FORMAT_GSM610: if (wfx->cbSize < sizeof(WORD)) { WARN("GSM cbSize %u\n", wfx->cbSize); - return 0; + return FALSE; } if (wfx->wBitsPerSample != 0) { WARN("GSM wBitsPerSample %u\n", wfx->wBitsPerSample); - return 0; + return FALSE; } if (wfx->nBlockAlign != 65) { WARN("GSM nBlockAlign %u\n", wfx->nBlockAlign); - return 0; + return FALSE; } if (((const GSM610WAVEFORMAT*)wfx)->wSamplesPerBlock != 320) { WARN("GSM wSamplesPerBlock %u\n", ((const GSM610WAVEFORMAT*)wfx)->wSamplesPerBlock); - return 0; + return FALSE; } if (wfx->nAvgBytesPerSec != wfx->nSamplesPerSec * 65 / 320) { WARN("GSM nAvgBytesPerSec %d / %d\n", wfx->nAvgBytesPerSec, wfx->nSamplesPerSec * 65 / 320); - return 0; + return FALSE; } - return 1; + return TRUE; default: - return 0; + return FALSE; } - return 0; + return FALSE; } static const DWORD gsm_rates[] = { 8000, 11025, 22050, 44100, 48000, 96000 }; @@ -512,7 +512,7 @@ static LRESULT GSM_StreamConvert(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMHEADER return ACMERR_NOTPOSSIBLE; } - /* The packing algorythm writes 32 bytes, then 33 bytes, + /* The packing algorithm writes 32 bytes, then 33 bytes, * and it seems to pad to align to 65 bytes always * adding extra data where necessary */ diff --git a/dll/win32/mshtml.tlb/mshtml_tlb.idl b/dll/win32/mshtml.tlb/mshtml_tlb.idl index 371cdaf9b0f..a7df069c386 100644 --- a/dll/win32/mshtml.tlb/mshtml_tlb.idl +++ b/dll/win32/mshtml.tlb/mshtml_tlb.idl @@ -16,4 +16,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep regtypelib + #include "mshtml.idl" diff --git a/dll/win32/msi/action.c b/dll/win32/msi/action.c index b6c18616bc7..b5c2412baf6 100644 --- a/dll/win32/msi/action.c +++ b/dll/win32/msi/action.c @@ -195,19 +195,20 @@ static int parse_prop( const WCHAR *str, WCHAR *value, int *quotes ) enum parse_state state = state_quote; const WCHAR *p; WCHAR *out = value; - int ignore, in_quotes = 0, count = 0, len = 0; + BOOL ignore, in_quotes = FALSE; + int count = 0, len = 0; for (p = str; *p; p++) { - ignore = 0; + ignore = FALSE; switch (state) { case state_whitespace: switch (*p) { case ' ': - in_quotes = 1; - ignore = 1; + in_quotes = TRUE; + ignore = TRUE; len++; break; case '"': @@ -217,7 +218,7 @@ static int parse_prop( const WCHAR *str, WCHAR *value, int *quotes ) break; default: state = state_token; - in_quotes = 1; + in_quotes = TRUE; len++; break; } @@ -234,12 +235,12 @@ static int parse_prop( const WCHAR *str, WCHAR *value, int *quotes ) case ' ': state = state_whitespace; if (!count) goto done; - in_quotes = 1; + in_quotes = TRUE; len++; break; default: - if (!count) in_quotes = 0; - else in_quotes = 1; + if (!count) in_quotes = FALSE; + else in_quotes = TRUE; len++; break; } @@ -255,13 +256,13 @@ static int parse_prop( const WCHAR *str, WCHAR *value, int *quotes ) case ' ': state = state_whitespace; if (!count || (count > 1 && !len)) goto done; - in_quotes = 1; + in_quotes = TRUE; len++; break; default: state = state_token; - if (!count) in_quotes = 0; - else in_quotes = 1; + if (!count) in_quotes = FALSE; + else in_quotes = TRUE; len++; break; } @@ -407,41 +408,21 @@ static BOOL ui_sequence_exists( MSIPACKAGE *package ) UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace) { - LPWSTR source, check; + WCHAR *source, *check, *p, *db; + DWORD len; - if (msi_get_property_int( package->db, szInstalled, 0 )) + if (!(db = msi_dup_property( package->db, szOriginalDatabase ))) + return ERROR_OUTOFMEMORY; + + if (!(p = strrchrW( db, '\\' )) && !(p = strrchrW( db, '/' ))) { - HKEY hkey; - - MSIREG_OpenInstallProps( package->ProductCode, package->Context, NULL, &hkey, FALSE ); - source = msi_reg_get_val_str( hkey, INSTALLPROPERTY_INSTALLSOURCEW ); - RegCloseKey( hkey ); - } - else - { - LPWSTR p, db; - DWORD len; - - db = msi_dup_property( package->db, szOriginalDatabase ); - if (!db) - return ERROR_OUTOFMEMORY; - - p = strrchrW( db, '\\' ); - if (!p) - { - p = strrchrW( db, '/' ); - if (!p) - { - msi_free(db); - return ERROR_SUCCESS; - } - } - - len = p - db + 2; - source = msi_alloc( len * sizeof(WCHAR) ); - lstrcpynW( source, db, len ); - msi_free( db ); + msi_free(db); + return ERROR_SUCCESS; } + len = p - db + 2; + source = msi_alloc( len * sizeof(WCHAR) ); + lstrcpynW( source, db, len ); + msi_free( db ); check = msi_dup_property( package->db, szSourceDir ); if (!check || replace) @@ -1890,7 +1871,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package) component->anyAbsent = 1; break; case INSTALLSTATE_ADVERTISED: - component->hasAdvertiseFeature = 1; + component->hasAdvertisedFeature = 1; break; case INSTALLSTATE_SOURCE: component->hasSourceFeature = 1; @@ -1900,7 +1881,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package) break; case INSTALLSTATE_DEFAULT: if (feature->Attributes & msidbFeatureAttributesFavorAdvertise) - component->hasAdvertiseFeature = 1; + component->hasAdvertisedFeature = 1; else if (feature->Attributes & msidbFeatureAttributesFavorSource) component->hasSourceFeature = 1; else @@ -1945,7 +1926,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package) component->ActionRequest = INSTALLSTATE_SOURCE; continue; } - if (component->hasAdvertiseFeature) + if (component->hasAdvertisedFeature) { component->Action = INSTALLSTATE_ADVERTISED; component->ActionRequest = INSTALLSTATE_ADVERTISED; @@ -3181,8 +3162,6 @@ static UINT ACTION_RemoveRegistryValues( MSIPACKAGE *package ) static UINT ACTION_InstallInitialize(MSIPACKAGE *package) { - package->script->CurrentlyScripting = TRUE; - return ERROR_SUCCESS; } @@ -3569,9 +3548,29 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) if (comp->num_clients <= 0) { if (package->Context == MSIINSTALLCONTEXT_MACHINE) - MSIREG_DeleteUserDataComponentKey( comp->ComponentId, szLocalSid ); + rc = MSIREG_DeleteUserDataComponentKey( comp->ComponentId, szLocalSid ); else - MSIREG_DeleteUserDataComponentKey( comp->ComponentId, NULL ); + rc = MSIREG_DeleteUserDataComponentKey( comp->ComponentId, NULL ); + + if (rc != ERROR_SUCCESS) WARN( "failed to delete component key %u\n", rc ); + } + else + { + LONG res; + + if (package->Context == MSIINSTALLCONTEXT_MACHINE) + rc = MSIREG_OpenUserDataComponentKey( comp->ComponentId, szLocalSid, &hkey, FALSE ); + else + rc = MSIREG_OpenUserDataComponentKey( comp->ComponentId, NULL, &hkey, FALSE ); + + if (rc != ERROR_SUCCESS) + { + WARN( "failed to open component key %u\n", rc ); + continue; + } + res = RegDeleteValueW( hkey, squished_pc ); + RegCloseKey(hkey); + if (res) WARN( "failed to delete component value %d\n", res ); } } @@ -3823,7 +3822,7 @@ static WCHAR *get_link_file( MSIPACKAGE *package, MSIRECORD *row ) filename = msi_dup_record_field( row, 3 ); msi_reduce_to_long_filename( filename ); - extension = strchrW( filename, '.' ); + extension = strrchrW( filename, '.' ); if (!extension || strcmpiW( extension, szlnk )) { int len = strlenW( filename ); @@ -5294,9 +5293,6 @@ static UINT ACTION_InstallFinalize(MSIPACKAGE *package) UINT rc; WCHAR *remove; - /* turn off scheduling */ - package->script->CurrentlyScripting= FALSE; - /* first do the same as an InstallExecute */ rc = ACTION_InstallExecute(package); if (rc != ERROR_SUCCESS) @@ -5801,7 +5797,11 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param) ERR("Query failed\n"); goto done; } - key = MSI_RecordGetString(row, 6); + if (!(key = MSI_RecordGetString(row, 6))) + { + msiobj_release(&row->hdr); + goto done; + } file = msi_get_loaded_file(package, key); msiobj_release(&row->hdr); if (!file) @@ -7823,8 +7823,6 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, else rc = ACTION_ProcessExecSequence(package, FALSE); - package->script->CurrentlyScripting = FALSE; - /* process the ending type action */ if (rc == ERROR_SUCCESS) ACTION_PerformActionSequence(package, -1); diff --git a/dll/win32/msi/classes.c b/dll/win32/msi/classes.c index 90df9025186..eb159798132 100644 --- a/dll/win32/msi/classes.c +++ b/dll/win32/msi/classes.c @@ -287,7 +287,7 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row ) cls->Feature = msi_get_loaded_feature(package, buffer); cls->Attributes = MSI_RecordGetInteger(row,13); - + cls->action = INSTALLSTATE_UNKNOWN; return cls; } @@ -416,7 +416,7 @@ static MSIEXTENSION *load_extension( MSIPACKAGE* package, MSIRECORD *row ) buffer = MSI_RecordGetString(row,5); ext->Feature = msi_get_loaded_feature( package, buffer ); - + ext->action = INSTALLSTATE_UNKNOWN; return ext; } @@ -689,59 +689,6 @@ static UINT load_classes_and_such( MSIPACKAGE *package ) return load_all_mimes( package ); } -static void mark_progid_for_install( MSIPACKAGE* package, MSIPROGID *progid ) -{ - MSIPROGID *child; - - if (!progid) - return; - - if (progid->InstallMe) - return; - - progid->InstallMe = TRUE; - - /* all children if this is a parent also install */ - LIST_FOR_EACH_ENTRY( child, &package->progids, MSIPROGID, entry ) - { - if (child->Parent == progid) - mark_progid_for_install( package, child ); - } -} - -static void mark_progid_for_uninstall( MSIPACKAGE *package, MSIPROGID *progid ) -{ - MSIPROGID *child; - - if (!progid) - return; - - if (!progid->InstallMe) - return; - - progid->InstallMe = FALSE; - - LIST_FOR_EACH_ENTRY( child, &package->progids, MSIPROGID, entry ) - { - if (child->Parent == progid) - mark_progid_for_uninstall( package, child ); - } -} - -static void mark_mime_for_install( MSIMIME *mime ) -{ - if (!mime) - return; - mime->InstallMe = TRUE; -} - -static void mark_mime_for_uninstall( MSIMIME *mime ) -{ - if (!mime) - return; - mime->InstallMe = FALSE; -} - static UINT register_appid(const MSIAPPID *appid, LPCWSTR app ) { static const WCHAR szRemoteServerName[] = @@ -847,8 +794,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) } TRACE("Registering class %s (%p)\n", debugstr_w(cls->clsid), cls); - cls->Installed = TRUE; - mark_progid_for_install( package, cls->ProgID ); + cls->action = INSTALLSTATE_LOCAL; RegCreateKeyW( hkey, cls->clsid, &hkey2 ); @@ -1005,8 +951,7 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package ) } TRACE("Unregistering class %s (%p)\n", debugstr_w(cls->clsid), cls); - cls->Installed = FALSE; - mark_progid_for_uninstall( package, cls->ProgID ); + cls->action = INSTALLSTATE_ABSENT; res = RegDeleteTreeW( hkey, cls->clsid ); if (res != ERROR_SUCCESS) @@ -1094,6 +1039,35 @@ static UINT register_progid( const MSIPROGID* progid ) return rc; } +static const MSICLASS *get_progid_class( const MSIPROGID *progid ) +{ + while (progid) + { + if (progid->Parent) progid = progid->Parent; + if (progid->Class) return progid->Class; + if (!progid->Parent || progid->Parent == progid) break; + } + return NULL; +} + +static BOOL has_class_installed( const MSIPROGID *progid ) +{ + const MSICLASS *class = get_progid_class( progid ); + if (!class || !class->ProgID) return FALSE; + return (class->action == INSTALLSTATE_LOCAL); +} + +static BOOL has_one_extension_installed( const MSIPACKAGE *package, const MSIPROGID *progid ) +{ + const MSIEXTENSION *extension; + LIST_FOR_EACH_ENTRY( extension, &package->extensions, MSIEXTENSION, entry ) + { + if (extension->ProgID == progid && !list_empty( &extension->verbs ) && + extension->action == INSTALLSTATE_LOCAL) return TRUE; + } + return FALSE; +} + UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package) { MSIPROGID *progid; @@ -1106,17 +1080,11 @@ UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package) LIST_FOR_EACH_ENTRY( progid, &package->progids, MSIPROGID, entry ) { - /* check if this progid is to be installed */ - if (progid->Class && progid->Class->Installed) - progid->InstallMe = TRUE; - - if (!progid->InstallMe) + if (!has_class_installed( progid ) && !has_one_extension_installed( package, progid )) { - TRACE("progid %s not scheduled to be installed\n", - debugstr_w(progid->ProgID)); + TRACE("progid %s not scheduled to be installed\n", debugstr_w(progid->ProgID)); continue; } - TRACE("Registering progid %s\n", debugstr_w(progid->ProgID)); register_progid( progid ); @@ -1129,6 +1097,36 @@ UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package) return ERROR_SUCCESS; } +static BOOL has_class_removed( const MSIPROGID *progid ) +{ + const MSICLASS *class = get_progid_class( progid ); + if (!class || !class->ProgID) return FALSE; + return (class->action == INSTALLSTATE_ABSENT); +} + +static BOOL has_extensions( const MSIPACKAGE *package, const MSIPROGID *progid ) +{ + const MSIEXTENSION *extension; + LIST_FOR_EACH_ENTRY( extension, &package->extensions, MSIEXTENSION, entry ) + { + if (extension->ProgID == progid && !list_empty( &extension->verbs )) return TRUE; + } + return FALSE; +} + +static BOOL has_all_extensions_removed( const MSIPACKAGE *package, const MSIPROGID *progid ) +{ + BOOL ret = FALSE; + const MSIEXTENSION *extension; + LIST_FOR_EACH_ENTRY( extension, &package->extensions, MSIEXTENSION, entry ) + { + if (extension->ProgID == progid && !list_empty( &extension->verbs ) && + extension->action == INSTALLSTATE_ABSENT) ret = TRUE; + else ret = FALSE; + } + return ret; +} + UINT ACTION_UnregisterProgIdInfo( MSIPACKAGE *package ) { MSIPROGID *progid; @@ -1142,16 +1140,12 @@ UINT ACTION_UnregisterProgIdInfo( MSIPACKAGE *package ) LIST_FOR_EACH_ENTRY( progid, &package->progids, MSIPROGID, entry ) { - /* check if this progid is to be removed */ - if (progid->Class && !progid->Class->Installed) - progid->InstallMe = FALSE; - - if (progid->InstallMe) + if (!has_class_removed( progid ) || + (has_extensions( package, progid ) && !has_all_extensions_removed( package, progid ))) { TRACE("progid %s not scheduled to be removed\n", debugstr_w(progid->ProgID)); continue; } - TRACE("Unregistering progid %s\n", debugstr_w(progid->ProgID)); res = RegDeleteTreeW( HKEY_CLASSES_ROOT, progid->ProgID ); @@ -1293,15 +1287,7 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) } TRACE("Registering extension %s (%p)\n", debugstr_w(ext->Extension), ext); - ext->Installed = TRUE; - - /* this is only registered if the extension has at least 1 verb - * according to MSDN - */ - if (ext->ProgID && !list_empty( &ext->verbs ) ) - mark_progid_for_install( package, ext->ProgID ); - - mark_mime_for_install(ext->Mime); + ext->action = INSTALLSTATE_LOCAL; extension = msi_alloc( (strlenW( ext->Extension ) + 2) * sizeof(WCHAR) ); if (extension) @@ -1399,12 +1385,7 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package ) } TRACE("Unregistering extension %s\n", debugstr_w(ext->Extension)); - ext->Installed = FALSE; - - if (ext->ProgID && !list_empty( &ext->verbs )) - mark_progid_for_uninstall( package, ext->ProgID ); - - mark_mime_for_uninstall( ext->Mime ); + ext->action = INSTALLSTATE_ABSENT; extension = msi_alloc( (strlenW( ext->Extension ) + 2) * sizeof(WCHAR) ); if (extension) @@ -1468,11 +1449,8 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package) * check if the MIME is to be installed. Either as requested by an * extension or Class */ - mt->InstallMe = (mt->InstallMe || - (mt->Class && mt->Class->Installed) || - (mt->Extension && mt->Extension->Installed)); - - if (!mt->InstallMe) + if ((!mt->Class || mt->Class->action != INSTALLSTATE_LOCAL) && + mt->Extension->action != INSTALLSTATE_LOCAL) { TRACE("MIME %s not scheduled to be installed\n", debugstr_w(mt->ContentType)); continue; @@ -1522,11 +1500,8 @@ UINT ACTION_UnregisterMIMEInfo( MSIPACKAGE *package ) LONG res; LPWSTR mime_key; - mime->InstallMe = (mime->InstallMe || - (mime->Class && mime->Class->Installed) || - (mime->Extension && mime->Extension->Installed)); - - if (mime->InstallMe) + if ((!mime->Class || mime->Class->action != INSTALLSTATE_ABSENT) && + mime->Extension->action != INSTALLSTATE_ABSENT) { TRACE("MIME %s not scheduled to be removed\n", debugstr_w(mime->ContentType)); continue; diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index aeab7b5f788..a750c7a3fe7 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -203,8 +203,8 @@ static MSIBINARY *create_temp_binary( MSIPACKAGE *package, LPCWSTR source, BOOL DWORD sz = MAX_PATH, write; UINT r; - if (msi_get_property(package->db, szTempFolder, fmt, &sz) != ERROR_SUCCESS) - GetTempPathW(MAX_PATH, fmt); + if (msi_get_property(package->db, szTempFolder, fmt, &sz) != ERROR_SUCCESS || + GetFileAttributesW(fmt) == INVALID_FILE_ATTRIBUTES) GetTempPathW(MAX_PATH, fmt); if (!GetTempFileNameW( fmt, szMsi, 0, tmpfile )) { @@ -991,7 +991,7 @@ static UINT HANDLE_CustomType5_6( MSIPACKAGE *package, const WCHAR *source, cons 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', '`','B','i' ,'n','a','r','y','`',' ','W','H','E','R','E',' ', '`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0}; - MSIRECORD *row = 0; + MSIRECORD *row = NULL; msi_custom_action_info *info; CHAR *buffer = NULL; WCHAR *bufferw = NULL; @@ -1005,10 +1005,14 @@ static UINT HANDLE_CustomType5_6( MSIPACKAGE *package, const WCHAR *source, cons return ERROR_FUNCTION_FAILED; r = MSI_RecordReadStream(row, 2, NULL, &sz); - if (r != ERROR_SUCCESS) return r; + if (r != ERROR_SUCCESS) goto done; buffer = msi_alloc( sz + 1 ); - if (!buffer) return ERROR_FUNCTION_FAILED; + if (!buffer) + { + r = ERROR_FUNCTION_FAILED; + goto done; + } r = MSI_RecordReadStream(row, 2, buffer, &sz); if (r != ERROR_SUCCESS) @@ -1028,6 +1032,7 @@ static UINT HANDLE_CustomType5_6( MSIPACKAGE *package, const WCHAR *source, cons done: msi_free(bufferw); msi_free(buffer); + msiobj_release(&row->hdr); return r; } diff --git a/dll/win32/msi/dialog.c b/dll/win32/msi/dialog.c index 923b9c6d17b..9959bd1287e 100644 --- a/dll/win32/msi/dialog.c +++ b/dll/win32/msi/dialog.c @@ -763,12 +763,13 @@ static msi_control *msi_dialog_add_control( msi_dialog *dialog, MSIRECORD *rec, LPCWSTR szCls, DWORD style ) { DWORD attributes; - LPCWSTR text, name; + const WCHAR *text = NULL, *name, *control_type; DWORD exstyle = 0; name = MSI_RecordGetString( rec, 2 ); + control_type = MSI_RecordGetString( rec, 3 ); attributes = MSI_RecordGetInteger( rec, 8 ); - text = MSI_RecordGetString( rec, 10 ); + if (strcmpW( control_type, szScrollableText )) text = MSI_RecordGetString( rec, 10 ); TRACE("%s, %s, %08x, %s, %08x\n", debugstr_w(szCls), debugstr_w(name), attributes, debugstr_w(text), style); @@ -1802,24 +1803,33 @@ static void msi_mask_control_change( struct msi_maskedit_info *info ) val = msi_alloc( (info->num_chars+1)*sizeof(WCHAR) ); for( i=0, n=0; inum_groups; i++ ) { - if( (info->group[i].len + n) > info->num_chars ) + if (info->group[i].len == ~0u) { - ERR("can't fit control %d text into template\n",i); - break; - } - if (!msi_mask_editable(info->group[i].type)) - { - for(r=0; rgroup[i].len; r++) - val[n+r] = info->group[i].type; - val[n+r] = 0; + UINT len = SendMessageW( info->group[i].hwnd, WM_GETTEXTLENGTH, 0, 0 ); + val = msi_realloc( val, (len + 1) * sizeof(WCHAR) ); + GetWindowTextW( info->group[i].hwnd, val, len + 1 ); } else { - r = GetWindowTextW( info->group[i].hwnd, &val[n], info->group[i].len+1 ); - if( r != info->group[i].len ) + if (info->group[i].len + n > info->num_chars) + { + ERR("can't fit control %d text into template\n",i); break; + } + if (!msi_mask_editable(info->group[i].type)) + { + for(r=0; rgroup[i].len; r++) + val[n+r] = info->group[i].type; + val[n+r] = 0; + } + else + { + r = GetWindowTextW( info->group[i].hwnd, &val[n], info->group[i].len+1 ); + if( r != info->group[i].len ) + break; + } + n += r; } - n += r; } TRACE("%d/%d controls were good\n", i, info->num_groups); @@ -1914,14 +1924,14 @@ msi_maskedit_set_text( struct msi_maskedit_info *info, LPCWSTR text ) static struct msi_maskedit_info * msi_dialog_parse_groups( LPCWSTR mask ) { - struct msi_maskedit_info * info = NULL; + struct msi_maskedit_info *info; int i = 0, n = 0, total = 0; LPCWSTR p; TRACE("masked control, template %s\n", debugstr_w(mask)); if( !mask ) - return info; + return NULL; info = msi_alloc_zero( sizeof *info ); if( !info ) @@ -1937,7 +1947,16 @@ static struct msi_maskedit_info * msi_dialog_parse_groups( LPCWSTR mask ) { /* stop at the end of the string */ if( p[0] == 0 || p[0] == '>' ) + { + if (!total) + { + /* create a group for the empty mask */ + info->group[0].type = '&'; + info->group[0].len = ~0u; + i = 1; + } break; + } /* count the number of the same identifier */ for( n=0; p[n] == p[0]; n++ ) @@ -1983,9 +2002,16 @@ msi_maskedit_create_children( struct msi_maskedit_info *info, LPCWSTR font ) { if (!msi_mask_editable( info->group[i].type )) continue; - wx = (info->group[i].ofs * width) / info->num_chars; - ww = (info->group[i].len * width) / info->num_chars; - + if (info->num_chars) + { + wx = (info->group[i].ofs * width) / info->num_chars; + ww = (info->group[i].len * width) / info->num_chars; + } + else + { + wx = 0; + ww = width; + } hwnd = CreateWindowW( szEdit, NULL, style, wx, 0, ww, height, info->hwnd, NULL, NULL, NULL ); if( !hwnd ) @@ -2969,7 +2995,7 @@ static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *c FindClose( file ); } -UINT msi_dialog_directorylist_up( msi_dialog *dialog ) +static UINT msi_dialog_directorylist_up( msi_dialog *dialog ) { msi_control *control; LPWSTR prop, path, ptr; @@ -3472,7 +3498,7 @@ static UINT msi_dialog_fill_controls( msi_dialog *dialog ) return r; } -UINT msi_dialog_reset( msi_dialog *dialog ) +static UINT msi_dialog_reset( msi_dialog *dialog ) { /* FIXME: should restore the original values of any properties we changed */ return msi_dialog_evaluate_control_conditions( dialog ); @@ -3906,7 +3932,7 @@ static msi_dialog *dialog_create( MSIPACKAGE *package, const WCHAR *name, msi_di return dialog; } -void msi_dialog_end_dialog( msi_dialog *dialog ) +static void msi_dialog_end_dialog( msi_dialog *dialog ) { TRACE("%p\n", dialog); dialog->finished = 1; @@ -3933,7 +3959,7 @@ void msi_dialog_check_messages( HANDLE handle ) return; } - /* there's two choices for the UI thread */ + /* there are two choices for the UI thread */ while (1) { process_pending_messages( NULL ); diff --git a/dll/win32/msi/format.c b/dll/win32/msi/format.c index a56b8f8a0d1..142f356155a 100644 --- a/dll/win32/msi/format.c +++ b/dll/win32/msi/format.c @@ -354,7 +354,11 @@ static LPWSTR build_default_format(const MSIRECORD* record) { max_len = len; buf = msi_realloc(buf, (max_len + 1) * sizeof(WCHAR)); - if (!buf) return NULL; + if (!buf) + { + msi_free(rc); + return NULL; + } } if (str) @@ -715,10 +719,10 @@ static UINT replace_stack(FORMAT *format, STACK *stack, STACK *values) format->n = n; beg = format_replace( format, propfound, nonprop, oldsize, type, replaced, len ); + msi_free(replaced); if (!beg) return ERROR_SUCCESS; - msi_free(replaced); format->n = beg->n + beg->len; top = stack_peek(stack); diff --git a/dll/win32/msi/media.c b/dll/win32/msi/media.c index 24f89693dd6..3d0eb8a9182 100644 --- a/dll/win32/msi/media.c +++ b/dll/win32/msi/media.c @@ -126,7 +126,6 @@ static void CDECL cabinet_free(void *pv) static INT_PTR CDECL cabinet_open(char *pszFile, int oflag, int pmode) { - HANDLE handle; DWORD dwAccess = 0; DWORD dwShareMode = 0; DWORD dwCreateDisposition = OPEN_EXISTING; @@ -152,12 +151,8 @@ static INT_PTR CDECL cabinet_open(char *pszFile, int oflag, int pmode) else if (oflag & _O_CREAT) dwCreateDisposition = CREATE_ALWAYS; - handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL, - dwCreateDisposition, 0, NULL); - if (handle == INVALID_HANDLE_VALUE) - return 0; - - return (INT_PTR)handle; + return (INT_PTR)CreateFileA(pszFile, dwAccess, dwShareMode, NULL, + dwCreateDisposition, 0, NULL); } static UINT CDECL cabinet_read(INT_PTR hf, void *pv, UINT cb) @@ -214,12 +209,12 @@ static INT_PTR CDECL cabinet_open_stream( char *pszFile, int oflag, int pmode ) if (!cab) { WARN("failed to get cabinet stream\n"); - return 0; + return -1; } if (!cab->stream[0] || !(encoded = encode_streamname( FALSE, cab->stream + 1 ))) { WARN("failed to encode stream name\n"); - return 0; + return -1; } if (msi_clone_open_stream( package_disk.package->db, cab->storage, encoded, &stream ) != ERROR_SUCCESS) { @@ -228,7 +223,7 @@ static INT_PTR CDECL cabinet_open_stream( char *pszFile, int oflag, int pmode ) { WARN("failed to open stream 0x%08x\n", hr); msi_free( encoded ); - return 0; + return -1; } } msi_free( encoded ); diff --git a/dll/win32/msi/msi.c b/dll/win32/msi/msi.c index 1098055953c..00ef89f3f1a 100644 --- a/dll/win32/msi/msi.c +++ b/dll/win32/msi/msi.c @@ -335,7 +335,7 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWS BOOL succeeded = FALSE; static const WCHAR fmt[] = {'%','s',' ','P','A','T','C','H','=','"','%','s','"',0}; - static WCHAR empty[] = {0}; + static const WCHAR empty[] = {0}; if (!szPatchPackage || !szPatchPackage[0]) return ERROR_INVALID_PARAMETER; @@ -1114,8 +1114,6 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, context = MSIINSTALLCONTEXT_MACHINE; } - MSIREG_OpenInstallProps(szProduct, context, NULL, &userdata, FALSE); - if (!strcmpW( szAttribute, INSTALLPROPERTY_HELPLINKW ) || !strcmpW( szAttribute, INSTALLPROPERTY_HELPTELEPHONEW ) || !strcmpW( szAttribute, INSTALLPROPERTY_INSTALLDATEW ) || @@ -1138,9 +1136,11 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, r = ERROR_UNKNOWN_PRODUCT; goto done; } - - if (!userdata) - return ERROR_UNKNOWN_PROPERTY; + if (MSIREG_OpenInstallProps(szProduct, context, NULL, &userdata, FALSE)) + { + r = ERROR_UNKNOWN_PROPERTY; + goto done; + } if (!strcmpW( szAttribute, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW )) szAttribute = display_name; @@ -1150,6 +1150,7 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, val = msi_reg_get_value(userdata, szAttribute, &type); if (!val) val = empty; + RegCloseKey(userdata); } else if (!strcmpW( szAttribute, INSTALLPROPERTY_INSTANCETYPEW ) || !strcmpW( szAttribute, INSTALLPROPERTY_TRANSFORMSW ) || @@ -1242,7 +1243,6 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, done: RegCloseKey(prodkey); - RegCloseKey(userdata); return r; } diff --git a/dll/win32/msi/msi.rc b/dll/win32/msi/msi.rc index 3e8d8d01a49..5597391a13f 100644 --- a/dll/win32/msi/msi.rc +++ b/dll/win32/msi/msi.rc @@ -69,7 +69,9 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL /* @makedep: msiserver.rgs */ 2 WINE_REGISTRY msiserver.rgs -3 WINE_REGISTRY "msi.rgs" +3 WINE_REGISTRY msiserver_r.rgs + +4 WINE_REGISTRY msiserver_t.rgs /* @makedep: instadvert.bmp */ 0x1001 BITMAP instadvert.bmp diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h index 37c06caa2cc..ec772b8b43e 100644 --- a/dll/win32/msi/msipriv.h +++ b/dll/win32/msi/msipriv.h @@ -501,7 +501,7 @@ typedef struct tagMSICOMPONENT int num_clients; unsigned int anyAbsent:1; - unsigned int hasAdvertiseFeature:1; + unsigned int hasAdvertisedFeature:1; unsigned int hasLocalFeature:1; unsigned int hasSourceFeature:1; } MSICOMPONENT; @@ -628,7 +628,7 @@ typedef struct tagMSICLASS MSIFEATURE *Feature; INT Attributes; /* not in the table, set during installation */ - BOOL Installed; + INSTALLSTATE action; } MSICLASS; typedef struct tagMSIMIME MSIMIME; @@ -643,7 +643,7 @@ typedef struct tagMSIEXTENSION MSIMIME *Mime; MSIFEATURE *Feature; /* not in the table, set during installation */ - BOOL Installed; + INSTALLSTATE action; struct list verbs; } MSIEXTENSION; @@ -656,7 +656,6 @@ struct tagMSIPROGID LPWSTR Description; LPWSTR IconPath; /* not in the table, set during installation */ - BOOL InstallMe; MSIPROGID *CurVer; MSIPROGID *VersionInd; }; @@ -678,8 +677,6 @@ struct tagMSIMIME LPWSTR suffix; LPWSTR clsid; MSICLASS *Class; - /* not in the table, set during installation */ - BOOL InstallMe; }; enum SCRIPTS @@ -700,7 +697,6 @@ typedef struct tagMSISCRIPT LPWSTR *Actions[SCRIPT_MAX]; UINT ActionCount[SCRIPT_MAX]; BOOL ExecuteSequenceRun; - BOOL CurrentlyScripting; UINT InWhatSequence; LPWSTR *UniqueActions; UINT UniqueActionsCount; diff --git a/dll/win32/msi/msiserver.idl b/dll/win32/msi/msiserver.idl index 669d7f28a89..50526024a27 100644 --- a/dll/win32/msi/msiserver.idl +++ b/dll/win32/msi/msiserver.idl @@ -17,6 +17,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep ident +#pragma makedep register +#pragma makedep regtypelib + #include "msiserver_dispids.h" import "unknwn.idl"; import "wtypes.idl"; @@ -148,6 +152,14 @@ coclass MsiServerMessage { interface IMsiMessage; } ] coclass PSFactoryBuffer { interface IPSFactoryBuffer; } +[ + helpstring("Microsoft Windows Installer"), + threading(apartment), + progid("WindowsInstaller.Installer"), + uuid(000c1090-0000-0000-c000-000000000046) +] +coclass MsiInstaller { interface Installer; } + [ uuid(000c1082-0000-0000-c000-000000000046) ] @@ -180,7 +192,6 @@ coclass WineMsiRemoteCustomAction { interface WineMsiRemoteCustomAction; } ] coclass WineMsiRemotePackage { interface WineMsiRemotePackage; } - [ uuid(000C1092-0000-0000-C000-000000000046), version(1.0) ] library WindowsInstaller { @@ -247,14 +258,14 @@ library WindowsInstaller [id(DISPID_INSTALLER_OPENPACKAGE)] Session* OpenPackage( [in] VARIANT PackagePath, - [in, optional, defaultvalue(0)] long Options); + [in, defaultvalue(0)] long Options); [id(DISPID_INSTALLER_OPENPRODUCT)] Session* OpenProduct( [in] BSTR ProductCode); [id(DISPID_INSTALLER_SUMMARYINFORMATION)] SummaryInfo* SummaryInformation( [in] BSTR PackagePath, - [in, optional, defaultvalue(0)] long UpdateCount); + [in, defaultvalue(0)] long UpdateCount); [id(DISPID_INSTALLER_OPENDATABASE)] Database *OpenDatabase( [in] BSTR DatabasePath, @@ -266,7 +277,7 @@ library WindowsInstaller [id(DISPID_INSTALLER_INSTALLPRODUCT)] void InstallProduct( [in] BSTR PackagePath, - [in, optional, defaultvalue("0")] BSTR PropertyValues); + [in, defaultvalue("0")] BSTR PropertyValues); [id(DISPID_INSTALLER_VERSION)] BSTR Version(); [id(DISPID_INSTALLER_LASTERRORRECORD)] @@ -389,7 +400,7 @@ library WindowsInstaller properties: methods: [id(DISPID_VIEW_EXECUTE)] - void Execute([in, optional, defaultvalue(0)] Record *Params); + void Execute([in, defaultvalue(0)] Record *Params); [id(DISPID_VIEW_FETCH)] Record* Fetch(); [id(DISPID_VIEW_MODIFY)] @@ -408,7 +419,7 @@ library WindowsInstaller [id(DISPID_DATABASE_OPENVIEW)] View* OpenView([in] BSTR Sql); [id(DISPID_DATABASE_SUMMARYINFORMATION), propget] - SummaryInfo *SummaryInformation([in, optional, defaultvalue(0)] long UpdateCount); + SummaryInfo *SummaryInformation([in, defaultvalue(0)] long UpdateCount); } typedef enum { @@ -547,12 +558,4 @@ library WindowsInstaller properties: methods: } - - [ - helpstring("Microsoft Windows Installer"), - threading(apartment), - progid("WindowsInstaller.Installer"), - uuid(000c1090-0000-0000-c000-000000000046) - ] - coclass MsiInstaller { interface Installer; } } diff --git a/dll/win32/msi/msiserver.rgs b/dll/win32/msi/msiserver.rgs index 9f408db4264..1313bd91ce5 100644 --- a/dll/win32/msi/msiserver.rgs +++ b/dll/win32/msi/msiserver.rgs @@ -2,7 +2,12 @@ HKCR { NoRemove CLSID { - '{000C101D-0000-0000-C000-000000000046}' { DllVersion = s '3.1.4000' } - '{000C1090-0000-0000-C000-000000000046}' { InProcHandler32 = s 'ole32.dll' } + '{000C101D-0000-0000-C000-000000000046}' { DllVersion = s '4.5.6001' } + '{000C1090-0000-0000-C000-000000000046}' + { + TypeLib = s '{000C1092-0000-0000-C000-000000000046}' + Version = s '1.0' + InProcHandler32 = s 'ole32.dll' + } } } diff --git a/dll/win32/msi/msiserver_r.rgs b/dll/win32/msi/msiserver_r.rgs new file mode 100644 index 00000000000..cdfd3be9689 --- /dev/null +++ b/dll/win32/msi/msiserver_r.rgs @@ -0,0 +1,92 @@ +HKCR +{ + NoRemove Interface + { + '{7BDE2046-D03B-4FFC-B84C-A098F38CFF0B}' = s 'IWineMsiRemoteDatabase' + { + NumMethods = s 8 + ProxyStubClsid32 = s '{000C103E-0000-0000-C000-000000000046}' + } + '{902B3592-9D08-4DFD-A593-D07C52546421}' = s 'IWineMsiRemotePackage' + { + NumMethods = s 25 + ProxyStubClsid32 = s '{000C103E-0000-0000-C000-000000000046}' + } + '{56D58B64-8780-4C22-A8BC-8B0B29E4A9F8}' = s 'IWineMsiRemoteCustomAction' + { + NumMethods = s 4 + ProxyStubClsid32 = s '{000C103E-0000-0000-C000-000000000046}' + } + '{000C101C-0000-0000-C000-000000000046}' = s 'IMsiServer' + { + NumMethods = s 3 + ProxyStubClsid32 = s '{000C103E-0000-0000-C000-000000000046}' + } + '{000C101D-0000-0000-C000-000000000046}' = s 'IMsiMessage' + { + NumMethods = s 3 + ProxyStubClsid32 = s '{000C103E-0000-0000-C000-000000000046}' + } + '{000C1025-0000-0000-C000-000000000046}' = s 'IMsiCustomAction' + { + NumMethods = s 3 + ProxyStubClsid32 = s '{000C103E-0000-0000-C000-000000000046}' + } + '{000C1033-0000-0000-C000-000000000046}' = s 'IMsiRemoteAPI' + { + NumMethods = s 3 + ProxyStubClsid32 = s '{000C103E-0000-0000-C000-000000000046}' + } + } + NoRemove CLSID + { + '{000C101C-0000-0000-C000-000000000046}' = s 'Msi install server' + { + ProgId = s 'IMsiServer' + } + '{000C101D-0000-0000-C000-000000000046}' = s 'Microsoft Windows Installer Message RPC' + { + ProgId = s 'WindowsInstaller.Message' + } + '{000C103E-0000-0000-C000-000000000046}' = s 'PSFactoryBuffer' + { + InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' } + } + '{000C1090-0000-0000-C000-000000000046}' = s 'Microsoft Windows Installer' + { + InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Apartment' } + ProgId = s 'WindowsInstaller.Installer' + } + '{000C1082-0000-0000-C000-000000000046}' = s 'MsiTransform' + { + } + '{000C1084-0000-0000-C000-000000000046}' = s 'MsiDatabase' + { + } + '{000C1086-0000-0000-C000-000000000046}' = s 'MsiPatch' + { + } + '{000C1094-0000-0000-C000-000000000046}' = s 'MsiServerX3' + { + InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Apartment' } + } + '{BA26E6FA-4F27-4F56-953A-3F90272018AA}' = s 'WineMsiRemoteCustomAction' + { + } + '{902B3592-9D08-4DFD-A593-D07C52546421}' = s 'WineMsiRemotePackage' + { + } + } + 'IMsiServer' = s 'Msi install server' + { + CLSID = s '{000C101C-0000-0000-C000-000000000046}' + } + 'WindowsInstaller.Message' = s 'Microsoft Windows Installer Message RPC' + { + CLSID = s '{000C101D-0000-0000-C000-000000000046}' + } + 'WindowsInstaller.Installer' = s 'Microsoft Windows Installer' + { + CLSID = s '{000C1090-0000-0000-C000-000000000046}' + } +} diff --git a/dll/win32/msi/msi.rgs b/dll/win32/msi/msiserver_t.rgs similarity index 56% rename from dll/win32/msi/msi.rgs rename to dll/win32/msi/msiserver_t.rgs index 7bd3efef385..6662cba9091 100644 --- a/dll/win32/msi/msi.rgs +++ b/dll/win32/msi/msiserver_t.rgs @@ -1,86 +1,5 @@ HKCR { - NoRemove Interface - { - '{7BDE2046-D03B-4FFC-B84C-A098F38CFF0B}' = s 'IWineMsiRemoteDatabase' - { - NumMethods = s 8 - ProxyStubClsid32 = s '{000C103E-0000-0000-C000-000000000046}' - } - '{902B3592-9D08-4DFD-A593-D07C52546421}' = s 'IWineMsiRemotePackage' - { - NumMethods = s 25 - ProxyStubClsid32 = s '{000C103E-0000-0000-C000-000000000046}' - } - '{56D58B64-8780-4C22-A8BC-8B0B29E4A9F8}' = s 'IWineMsiRemoteCustomAction' - { - NumMethods = s 4 - ProxyStubClsid32 = s '{000C103E-0000-0000-C000-000000000046}' - } - '{000C101C-0000-0000-C000-000000000046}' = s 'IMsiServer' - { - NumMethods = s 3 - ProxyStubClsid32 = s '{000C103E-0000-0000-C000-000000000046}' - } - '{000C101D-0000-0000-C000-000000000046}' = s 'IMsiMessage' - { - NumMethods = s 3 - ProxyStubClsid32 = s '{000C103E-0000-0000-C000-000000000046}' - } - '{000C1025-0000-0000-C000-000000000046}' = s 'IMsiCustomAction' - { - NumMethods = s 3 - ProxyStubClsid32 = s '{000C103E-0000-0000-C000-000000000046}' - } - '{000C1033-0000-0000-C000-000000000046}' = s 'IMsiRemoteAPI' - { - NumMethods = s 3 - ProxyStubClsid32 = s '{000C103E-0000-0000-C000-000000000046}' - } - } - NoRemove CLSID - { - '{000C101C-0000-0000-C000-000000000046}' = s 'Msi install server' - { - ProgId = s 'IMsiServer' - } - '{000C101D-0000-0000-C000-000000000046}' = s 'Microsoft Windows Installer Message RPC' - { - ProgId = s 'WindowsInstaller.Message' - } - '{000C103E-0000-0000-C000-000000000046}' = s 'PSFactoryBuffer' - { - InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' } - } - '{000C1082-0000-0000-C000-000000000046}' = s 'MsiTransform' - { - } - '{000C1084-0000-0000-C000-000000000046}' = s 'MsiDatabase' - { - } - '{000C1086-0000-0000-C000-000000000046}' = s 'MsiPatch' - { - } - '{000C1094-0000-0000-C000-000000000046}' = s 'MsiServerX3' - { - InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Apartment' } - } - '{BA26E6FA-4F27-4F56-953A-3F90272018AA}' = s 'WineMsiRemoteCustomAction' - { - } - '{902B3592-9D08-4DFD-A593-D07C52546421}' = s 'WineMsiRemotePackage' - { - } - } - 'IMsiServer' = s 'Msi install server' - { - CLSID = s '{000C101C-0000-0000-C000-000000000046}' - } - 'WindowsInstaller.Message' = s 'Microsoft Windows Installer Message RPC' - { - CLSID = s '{000C101D-0000-0000-C000-000000000046}' - } - NoRemove Typelib { NoRemove '{000C1092-0000-0000-C000-000000000046}' @@ -169,16 +88,5 @@ HKCR } NoRemove CLSID { - '{000C1090-0000-0000-C000-000000000046}' = s 'Microsoft Windows Installer' - { - InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Apartment' } - ProgId = s 'WindowsInstaller.Installer' - TypeLib = s '{000C1092-0000-0000-C000-000000000046}' - Version = s '1.0' - } - } - 'WindowsInstaller.Installer' = s 'Microsoft Windows Installer' - { - CLSID = s '{000C1090-0000-0000-C000-000000000046}' } } diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index 50343597fa7..a63bd427ad0 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -1052,6 +1052,7 @@ static UINT msi_load_summary_properties( MSIPACKAGE *package ) if (rc != ERROR_SUCCESS) { WARN("Unable to query rev number: %d\n", rc); + msi_free( package_code ); goto done; } diff --git a/dll/win32/msi/record.c b/dll/win32/msi/record.c index 792dc6e973d..74a30b255ba 100644 --- a/dll/win32/msi/record.c +++ b/dll/win32/msi/record.c @@ -358,7 +358,7 @@ BOOL WINAPI MsiRecordIsNull( MSIHANDLE handle, UINT iField ) rec = msihandle2msiinfo( handle, MSIHANDLETYPE_RECORD ); if( !rec ) - return 0; + return FALSE; msiobj_lock( &rec->hdr ); ret = MSI_RecordIsNull( rec, iField ); msiobj_unlock( &rec->hdr ); @@ -663,7 +663,7 @@ static UINT RECORD_StreamFromFile(LPCWSTR szFile, IStream **pstm) hGlob = GlobalAlloc(GMEM_FIXED, sz); if( hGlob ) { - BOOL r = ReadFile(handle, hGlob, sz, &read, NULL); + BOOL r = ReadFile(handle, hGlob, sz, &read, NULL) && read == sz; if( !r ) { GlobalFree(hGlob); diff --git a/dll/win32/msi/source.c b/dll/win32/msi/source.c index 37cdec20d4f..ecfcde4c6d0 100644 --- a/dll/win32/msi/source.c +++ b/dll/win32/msi/source.c @@ -1135,7 +1135,7 @@ UINT WINAPI MsiSourceListAddSourceExW( LPCWSTR szProduct, LPCWSTR szUserSid, list_init(&sourcelist); rc = fill_source_list(&sourcelist, typekey, &count); if (rc != ERROR_NO_MORE_ITEMS) - return rc; + goto done; size = (lstrlenW(source) + 1) * sizeof(WCHAR); diff --git a/dll/win32/msi/sql.y b/dll/win32/msi/sql.y index fa547412c03..553cc6dd0b5 100644 --- a/dll/win32/msi/sql.y +++ b/dll/win32/msi/sql.y @@ -816,7 +816,7 @@ UINT SQL_getstring( void *info, const struct sql_str *strdata, LPWSTR *str ) ( (p[0]=='\'') && (p[len-1]!='\'') ) ) return ERROR_FUNCTION_FAILED; - /* if there's quotes, remove them */ + /* if there are quotes, remove them */ if( ( (p[0]=='`') && (p[len-1]=='`') ) || ( (p[0]=='\'') && (p[len-1]=='\'') ) ) { diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c index 87f7fbb0e8e..41f48e7f87e 100644 --- a/dll/win32/msi/table.c +++ b/dll/win32/msi/table.c @@ -545,7 +545,7 @@ static UINT table_get_column_info( MSIDATABASE *db, LPCWSTR name, MSICOLUMNINFO *pcount = column_count; - /* if there's no columns, there's no table */ + /* if there are no columns, there's no table */ if (!column_count) return ERROR_INVALID_PARAMETER; @@ -1509,7 +1509,7 @@ static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec, UINT *column ) { UINT r, row, i; - /* check there's no null values where they're not allowed */ + /* check there are no null values where they're not allowed */ for( i = 0; i < tv->num_cols; i++ ) { if ( tv->columns[i].type & MSITYPE_NULLABLE ) @@ -1541,7 +1541,7 @@ static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec, UINT *column ) } } - /* check there's no duplicate keys */ + /* check there are no duplicate keys */ r = msi_table_find_row( tv, rec, &row, column ); if (r == ERROR_SUCCESS) return ERROR_FUNCTION_FAILED; @@ -1951,7 +1951,10 @@ static UINT TABLE_remove_column(struct tagMSIVIEW *view, LPCWSTR table, UINT num r = TABLE_CreateView(tv->db, szColumns, &columns); if (r != ERROR_SUCCESS) + { + msiobj_release(&rec->hdr); return r; + } r = msi_table_find_row((MSITABLEVIEW *)columns, rec, &row, NULL); if (r != ERROR_SUCCESS) @@ -2073,7 +2076,10 @@ static UINT TABLE_drop(struct tagMSIVIEW *view) r = TABLE_CreateView(tv->db, szTables, &tables); if (r != ERROR_SUCCESS) + { + msiobj_release(&rec->hdr); return r; + } r = msi_table_find_row((MSITABLEVIEW *)tables, rec, &row, NULL); if (r != ERROR_SUCCESS) diff --git a/dll/win32/msvidc32/msvideo1.c b/dll/win32/msvidc32/msvideo1.c index 981c6f4cef6..bfa413c5f1c 100644 --- a/dll/win32/msvidc32/msvideo1.c +++ b/dll/win32/msvidc32/msvideo1.c @@ -71,7 +71,7 @@ typedef BYTE uint8_t; typedef struct Msvideo1Context { DWORD dwMagic; - int mode_8bit; /* if it's not 8-bit, it's 16-bit */ + BOOL mode_8bit; /* if it's not 8-bit, it's 16-bit */ } Msvideo1Context; static void @@ -374,12 +374,12 @@ static LRESULT CRAM_DecompressBegin( Msvideo1Context *info, LPBITMAPINFO in, LPB TRACE("bitmap is %d bpp\n", in->bmiHeader.biBitCount); if( in->bmiHeader.biBitCount == 8 ) - info->mode_8bit = 1; + info->mode_8bit = TRUE; else if( in->bmiHeader.biBitCount == 16 ) - info->mode_8bit = 0; + info->mode_8bit = FALSE; else { - info->mode_8bit = 0; + info->mode_8bit = FALSE; FIXME("Unsupported output format %i\n", in->bmiHeader.biBitCount); } diff --git a/dll/win32/msxml3/CMakeLists.txt b/dll/win32/msxml3/CMakeLists.txt index 8a7ee4e69ef..31b11f14309 100644 --- a/dll/win32/msxml3/CMakeLists.txt +++ b/dll/win32/msxml3/CMakeLists.txt @@ -9,7 +9,10 @@ if(MSVC) add_compile_flags("/FIwine/typeof.h /FImsvc.h") endif() -include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) +include_directories( + ${REACTOS_SOURCE_DIR}/include/reactos/wine + ${REACTOS_SOURCE_DIR}/lib/3rdparty/libwin-iconv) + spec2def(msxml3.dll msxml3.spec ADD_IMPORTLIB) add_typelib(msxml3_v1.idl) @@ -66,7 +69,7 @@ add_library(msxml3 SHARED add_idl_headers(xmlparser_idlheader xmlparser.idl) set_module_type(msxml3 win32dll) -target_link_libraries(msxml3 libxml2 iconv-static uuid wine) +target_link_libraries(msxml3 libxml2 iconv-static uuid wine zlib) add_importlibs(msxml3 urlmon ws2_32 shlwapi oleaut32 ole32 user32 msvcrt kernel32 ntdll) add_dependencies(msxml3 xmlparser_idlheader stdole2) # msxml3_v1.tlb needs stdole2.tlb add_pch(msxml3 precomp.h SOURCE) diff --git a/dll/win32/msxml3/bsc.c b/dll/win32/msxml3/bsc.c index b660d5bfa19..9e148cb4051 100644 --- a/dll/win32/msxml3/bsc.c +++ b/dll/win32/msxml3/bsc.c @@ -149,7 +149,7 @@ static HRESULT WINAPI bsc_OnStopBinding( DWORD len = GlobalSize(hglobal); char *ptr = GlobalLock(hglobal); - This->hres = hr = This->onDataAvailable(This->obj, ptr, len); + This->hres = This->onDataAvailable(This->obj, ptr, len); GlobalUnlock(hglobal); } @@ -234,7 +234,7 @@ HRESULT create_moniker_from_url(LPCWSTR url, IMoniker **mon) return E_FAIL; } - if(FAILED(UrlCreateFromPathW(url, fileUrl, &needed, 0))) + if(FAILED(UrlCreateFromPathW(fullpath, fileUrl, &needed, 0))) { ERR("can't create url from path\n"); return E_FAIL; diff --git a/dll/win32/msxml3/dispex.c b/dll/win32/msxml3/dispex.c index 578d052f5b4..e425084fc6c 100644 --- a/dll/win32/msxml3/dispex.c +++ b/dll/win32/msxml3/dispex.c @@ -18,6 +18,8 @@ #include "precomp.h" +#include + static CRITICAL_SECTION cs_dispex_static_data; static CRITICAL_SECTION_DEBUG cs_dispex_static_data_dbg = { @@ -59,20 +61,6 @@ struct dispex_data_t { struct list entry; }; -typedef struct { - VARIANT var; - LPWSTR name; -} dynamic_prop_t; - -struct dispex_dynamic_data_t { - DWORD buf_size; - DWORD prop_cnt; - dynamic_prop_t *props; -}; - -#define DISPID_DYNPROP_0 0x50000000 -#define DISPID_DYNPROP_MAX 0x5fffffff - static struct list dispex_data_list = LIST_INIT(dispex_data_list); static ITypeLib *typelib[LibXml_Last]; static ITypeInfo *typeinfos[LAST_tid]; @@ -314,11 +302,6 @@ static dispex_data_t *get_dispex_data(DispatchEx *This) return This->data->data; } -static inline BOOL is_dynamic_dispid(DISPID id) -{ - return DISPID_DYNPROP_0 <= id && id <= DISPID_DYNPROP_MAX; -} - static inline DispatchEx *impl_from_IDispatchEx(IDispatchEx *iface) { return CONTAINING_RECORD(iface, DispatchEx, IDispatchEx_iface); @@ -391,7 +374,7 @@ static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, { DispatchEx *This = impl_from_IDispatchEx(iface); - TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), + TRACE("(%p)->(%x %s %x %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); return IDispatchEx_InvokeEx(&This->IDispatchEx_iface, dispIdMember, lcid, wFlags, @@ -434,17 +417,6 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW min = n+1; } - if(This->dynamic_data) { - unsigned i; - - for(i=0; i < This->dynamic_data->prop_cnt; i++) { - if(!strcmpW(This->dynamic_data->props[i].name, bstrName)) { - *pid = DISPID_DYNPROP_0 + i; - return S_OK; - } - } - } - if(This->data->vtbl && This->data->vtbl->get_dispid) { HRESULT hres; @@ -453,46 +425,34 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW return hres; } - if(grfdex & fdexNameEnsure) { - dispex_dynamic_data_t *dynamic_data; - - TRACE("creating dynamic prop %s\n", debugstr_w(bstrName)); - - if(This->dynamic_data) { - dynamic_data = This->dynamic_data; - }else { - dynamic_data = This->dynamic_data = heap_alloc_zero(sizeof(dispex_dynamic_data_t)); - if(!dynamic_data) - return E_OUTOFMEMORY; - } - - if(!dynamic_data->buf_size) { - dynamic_data->props = heap_alloc(sizeof(dynamic_prop_t)*4); - if(!dynamic_data->props) - return E_OUTOFMEMORY; - dynamic_data->buf_size = 4; - }else if(dynamic_data->buf_size == dynamic_data->prop_cnt) { - dynamic_prop_t *new_props; - - new_props = heap_realloc(dynamic_data->props, sizeof(dynamic_prop_t)*(dynamic_data->buf_size<<1)); - if(!new_props) - return E_OUTOFMEMORY; - - dynamic_data->props = new_props; - dynamic_data->buf_size <<= 1; - } - - dynamic_data->props[dynamic_data->prop_cnt].name = heap_strdupW(bstrName); - VariantInit(&dynamic_data->props[dynamic_data->prop_cnt].var); - *pid = DISPID_DYNPROP_0 + dynamic_data->prop_cnt++; - - return S_OK; - } - TRACE("not found %s\n", debugstr_w(bstrName)); return DISP_E_UNKNOWNNAME; } +static BOOL is_propputref_id(DISPID id) +{ + switch (id) + { + case DISPID_DOM_DOCUMENT_DOCUMENTELEMENT: + case DISPID_XMLDOM_DOCUMENT2_SCHEMAS: + case DISPID_XMLDOM_SELECTION_CONTEXT: + case DISPID_XMLDOM_TEMPLATE_STYLESHEET: + case DISPID_SAX_CONTENTHANDLER_DOCUMENTLOCATOR: + case DISPID_SAX_XMLFILTER_PARENT: + case DISPID_SAX_XMLREADER_ENTITYRESOLVER: + case DISPID_SAX_XMLREADER_CONTENTHANDLER: + case DISPID_SAX_XMLREADER_DTDHANDLER: + case DISPID_SAX_XMLREADER_ERRORHANDLER: + case DISPID_MXXML_FILTER_ENTITYRESOLVER: + case DISPID_MXXML_FILTER_CONTENTHANDLER: + case DISPID_MXXML_FILTER_DTDHANDLER: + case DISPID_MXXML_FILTER_ERRORHANDLER: + return TRUE; + default: + return FALSE; + } +} + static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) { @@ -516,28 +476,6 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc return E_NOTIMPL; } - if(is_dynamic_dispid(id)) { - DWORD idx = id - DISPID_DYNPROP_0; - VARIANT *var; - - if(!This->dynamic_data || This->dynamic_data->prop_cnt <= idx) - return DISP_E_UNKNOWNNAME; - - var = &This->dynamic_data->props[idx].var; - - switch(wFlags) { - case INVOKE_PROPERTYGET: - V_VT(pvarRes) = VT_EMPTY; - return VariantCopy(pvarRes, var); - case INVOKE_PROPERTYPUT: - VariantClear(var); - return VariantCopy(var, pdp->rgvarg); - default: - FIXME("unhandled wFlags %x\n", wFlags); - return E_NOTIMPL; - } - } - data = get_dispex_data(This); if(!data) return E_FAIL; @@ -575,6 +513,8 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc return E_FAIL; } + if (is_propputref_id(id) && wFlags == DISPATCH_PROPERTYPUT) + wFlags = DISPATCH_PROPERTYPUTREF; hres = ITypeInfo_Invoke(ti, unk, id, wFlags, pdp, pvarRes, pei, &argerr); ITypeInfo_Release(ti); @@ -673,26 +613,9 @@ BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv) return TRUE; } -void release_dispex(DispatchEx *This) -{ - dynamic_prop_t *prop; - - if(!This->dynamic_data) - return; - - for(prop = This->dynamic_data->props; prop < This->dynamic_data->props + This->dynamic_data->prop_cnt; prop++) { - VariantClear(&prop->var); - heap_free(prop->name); - } - - heap_free(This->dynamic_data->props); - heap_free(This->dynamic_data); -} - void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *data) { dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl; dispex->outer = outer; dispex->data = data; - dispex->dynamic_data = NULL; } diff --git a/dll/win32/msxml3/domdoc.c b/dll/win32/msxml3/domdoc.c index db25d5c558b..0fca3e0a499 100644 --- a/dll/win32/msxml3/domdoc.c +++ b/dll/win32/msxml3/domdoc.c @@ -64,6 +64,7 @@ typedef struct { xmlChar const* selectNsStr; LONG selectNsStr_len; BOOL XPath; + WCHAR *url; } domdoc_properties; typedef struct ConnectionPoint ConnectionPoint; @@ -107,10 +108,9 @@ struct domdoc VARIANT_BOOL validating; VARIANT_BOOL resolving; domdoc_properties* properties; - bsc_t *bsc; HRESULT error; - /* IObjectWithSite*/ + /* IObjectWithSite */ IUnknown *site; /* IObjectSafety */ @@ -276,6 +276,9 @@ static domdoc_properties *create_properties(MSXML_VERSION version) properties->version = version; properties->XPath = (version == MSXML4 || version == MSXML6); + /* document url */ + properties->url = NULL; + return properties; } @@ -310,6 +313,16 @@ static domdoc_properties* copy_properties(domdoc_properties const* properties) list_add_tail(&pcopy->selectNsList, &new_ns->entry); } + if (properties->url) + { + int len = strlenW(properties->url); + + pcopy->url = CoTaskMemAlloc((len+1)*sizeof(WCHAR)); + memcpy(pcopy->url, properties->url, len*sizeof(WCHAR)); + pcopy->url[len] = 0; + } + else + pcopy->url = NULL; } return pcopy; @@ -323,6 +336,7 @@ static void free_properties(domdoc_properties* properties) IXMLDOMSchemaCollection2_Release(properties->schemaCache); clear_selectNsList(&properties->selectNsList); heap_free((xmlChar*)properties->selectNsStr); + CoTaskMemFree(properties->url); heap_free(properties); } } @@ -918,9 +932,6 @@ static ULONG WINAPI domdoc_Release( IXMLDOMDocument3 *iface ) { int eid; - if(This->bsc) - detach_bsc(This->bsc); - if (This->site) IUnknown_Release( This->site ); destroy_xmlnode(&This->node); @@ -2045,7 +2056,7 @@ static HRESULT domdoc_onDataAvailable(void *obj, char *ptr, DWORD len) return attach_xmldoc(This, xmldoc); } - return S_OK; + return E_FAIL; } static HRESULT domdoc_load_moniker(domdoc *This, IMoniker *mon) @@ -2057,14 +2068,7 @@ static HRESULT domdoc_load_moniker(domdoc *This, IMoniker *mon) if(FAILED(hr)) return hr; - if(This->bsc) { - hr = detach_bsc(This->bsc); - if(FAILED(hr)) - return hr; - } - - This->bsc = bsc; - return S_OK; + return detach_bsc(bsc); } static HRESULT WINAPI domdoc_load( @@ -2188,10 +2192,15 @@ static HRESULT WINAPI domdoc_load( { IMoniker *mon; + CoTaskMemFree(This->properties->url); + This->properties->url = NULL; + hr = create_moniker_from_url( filename, &mon); if ( SUCCEEDED(hr) ) { hr = domdoc_load_moniker( This, mon ); + if (hr == S_OK) + IMoniker_GetDisplayName(mon, NULL, NULL, &This->properties->url); IMoniker_Release(mon); } @@ -2254,11 +2263,25 @@ static HRESULT WINAPI domdoc_get_parseError( static HRESULT WINAPI domdoc_get_url( IXMLDOMDocument3 *iface, - BSTR* urlString ) + BSTR* url ) { domdoc *This = impl_from_IXMLDOMDocument3(iface); - FIXME("(%p)->(%p)\n", This, urlString); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, url); + + if (!url) + return E_INVALIDARG; + + if (This->properties->url) + { + *url = SysAllocString(This->properties->url); + if (!*url) + return E_OUTOFMEMORY; + + return S_OK; + } + else + return return_null_bstr(url); } @@ -2581,7 +2604,7 @@ static HRESULT WINAPI domdoc_get_namespaces( if (!This->namespaces) { - hr = SchemaCache_create(This->properties->version, NULL, (void**)&This->namespaces); + hr = SchemaCache_create(This->properties->version, (void**)&This->namespaces); if (hr != S_OK) return hr; hr = cache_from_doc_ns(This->namespaces, &This->node); @@ -3533,7 +3556,6 @@ HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document) doc->error = S_OK; doc->site = NULL; doc->safeopt = 0; - doc->bsc = NULL; doc->cp_list = NULL; doc->namespaces = NULL; memset(doc->events, 0, sizeof(doc->events)); @@ -3552,12 +3574,12 @@ HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document) return S_OK; } -HRESULT DOMDocument_create(MSXML_VERSION version, IUnknown *pUnkOuter, void **ppObj) +HRESULT DOMDocument_create(MSXML_VERSION version, void **ppObj) { xmlDocPtr xmldoc; HRESULT hr; - TRACE("(%d, %p, %p)\n", version, pUnkOuter, ppObj); + TRACE("(%d, %p)\n", version, ppObj); xmldoc = xmlNewDoc(NULL); if(!xmldoc) @@ -3593,7 +3615,7 @@ IUnknown* create_domdoc( xmlNodePtr document ) #else -HRESULT DOMDocument_create(MSXML_VERSION version, IUnknown *pUnkOuter, void **ppObj) +HRESULT DOMDocument_create(MSXML_VERSION version, void **ppObj) { MESSAGE("This program tried to use a DOMDocument object, but\n" "libxml2 support was not present at compile time.\n"); diff --git a/dll/win32/msxml3/domimpl.c b/dll/win32/msxml3/domimpl.c index 5cb8df72a91..a18070a7590 100644 --- a/dll/win32/msxml3/domimpl.c +++ b/dll/win32/msxml3/domimpl.c @@ -81,10 +81,7 @@ static ULONG WINAPI dimimpl_Release( TRACE("(%p)->(%d)\n", This, ref); if ( ref == 0 ) - { - release_dispex(&This->dispex); heap_free( This ); - } return ref; } diff --git a/dll/win32/msxml3/factory.c b/dll/win32/msxml3/factory.c index cb9ac32d3ca..3a01490ebe3 100644 --- a/dll/win32/msxml3/factory.c +++ b/dll/win32/msxml3/factory.c @@ -47,8 +47,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml); -typedef HRESULT (*ClassFactoryCreateInstanceFunc)(IUnknown*, void**); -typedef HRESULT (*DOMFactoryCreateInstanceFunc)(MSXML_VERSION, IUnknown*, void**); +typedef HRESULT (*ClassFactoryCreateInstanceFunc)(void**); +typedef HRESULT (*DOMFactoryCreateInstanceFunc)(MSXML_VERSION, void**); struct clsid_version_t { @@ -175,7 +175,7 @@ static HRESULT WINAPI ClassFactory_CreateInstance( if (pOuter) return CLASS_E_NOAGGREGATION; - r = This->pCreateInstance( pOuter, (void**) &punk ); + r = This->pCreateInstance( (void**) &punk ); if (FAILED(r)) return r; @@ -233,7 +233,7 @@ static HRESULT WINAPI DOMClassFactory_CreateInstance( if (pOuter) return CLASS_E_NOAGGREGATION; - r = This->pCreateInstance( This->version, pOuter, (void**) &punk ); + r = This->pCreateInstance( This->version, (void**) &punk ); if (FAILED(r)) return r; diff --git a/dll/win32/msxml3/httprequest.c b/dll/win32/msxml3/httprequest.c index 8f8e64495f7..ea22ebf2a12 100644 --- a/dll/win32/msxml3/httprequest.c +++ b/dll/win32/msxml3/httprequest.c @@ -433,9 +433,11 @@ static HRESULT WINAPI BSCHttpNegotiate_BeginningTransaction(IHttpNegotiate *ifac { static const WCHAR content_type_utf8W[] = {'C','o','n','t','e','n','t','-','T','y','p','e',':',' ', 't','e','x','t','/','p','l','a','i','n',';','c','h','a','r','s','e','t','=','u','t','f','-','8','\r','\n',0}; + static const WCHAR refererW[] = {'R','e','f','e','r','e','r',':',' ',0}; BindStatusCallback *This = impl_from_IHttpNegotiate(iface); const struct httpheader *entry; + BSTR base_uri = NULL; WCHAR *buff, *ptr; int size = 0; @@ -449,10 +451,24 @@ static HRESULT WINAPI BSCHttpNegotiate_BeginningTransaction(IHttpNegotiate *ifac if (!list_empty(&This->request->reqheaders)) size += This->request->reqheader_size*sizeof(WCHAR); - if (!size) return S_OK; + if (This->request->base_uri) + { + IUri_GetRawUri(This->request->base_uri, &base_uri); + size += SysStringLen(base_uri)*sizeof(WCHAR) + sizeof(refererW) + sizeof(crlfW); + } + + if (!size) + { + SysFreeString(base_uri); + return S_OK; + } buff = CoTaskMemAlloc(size); - if (!buff) return E_OUTOFMEMORY; + if (!buff) + { + SysFreeString(base_uri); + return E_OUTOFMEMORY; + } ptr = buff; if (This->request->use_utf8_content) @@ -461,6 +477,15 @@ static HRESULT WINAPI BSCHttpNegotiate_BeginningTransaction(IHttpNegotiate *ifac ptr += sizeof(content_type_utf8W)/sizeof(WCHAR)-1; } + if (base_uri) + { + strcpyW(ptr, refererW); + strcatW(ptr, base_uri); + strcatW(ptr, crlfW); + ptr += strlenW(refererW) + SysStringLen(base_uri) + strlenW(crlfW); + SysFreeString(base_uri); + } + /* user headers */ LIST_FOR_EACH_ENTRY(entry, &This->request->reqheaders, struct httpheader, entry) { @@ -1116,7 +1141,7 @@ static HRESULT httprequest_get_responseXML(httprequest *This, IDispatch **body) if (!body) return E_INVALIDARG; if (This->state != READYSTATE_COMPLETE) return E_FAIL; - hr = DOMDocument_create(MSXML_DEFAULT, NULL, (void**)&doc); + hr = DOMDocument_create(MSXML_DEFAULT, (void**)&doc); if (hr != S_OK) return hr; hr = httprequest_get_responseText(This, &str); @@ -1546,6 +1571,8 @@ static void get_base_uri(httprequest *This) return; hr = IServiceProvider_QueryService(provider, &SID_SContainerDispatch, &IID_IHTMLDocument2, (void**)&doc); + if(FAILED(hr)) + hr = IServiceProvider_QueryService(provider, &SID_SInternetHostSecurityManager, &IID_IHTMLDocument2, (void**)&doc); IServiceProvider_Release(provider); if(FAILED(hr)) return; @@ -1955,11 +1982,11 @@ static void init_httprequest(httprequest *req) req->safeopt = 0; } -HRESULT XMLHTTPRequest_create(IUnknown *outer, void **obj) +HRESULT XMLHTTPRequest_create(void **obj) { httprequest *req; - TRACE("(%p, %p)\n", outer, obj); + TRACE("(%p)\n", obj); req = heap_alloc( sizeof (*req) ); if( !req ) @@ -1973,11 +2000,11 @@ HRESULT XMLHTTPRequest_create(IUnknown *outer, void **obj) return S_OK; } -HRESULT ServerXMLHTTP_create(IUnknown *outer, void **obj) +HRESULT ServerXMLHTTP_create(void **obj) { serverhttp *req; - TRACE("(%p, %p)\n", outer, obj); + TRACE("(%p)\n", obj); req = heap_alloc( sizeof (*req) ); if( !req ) @@ -1996,14 +2023,14 @@ HRESULT ServerXMLHTTP_create(IUnknown *outer, void **obj) #else -HRESULT XMLHTTPRequest_create(IUnknown *pUnkOuter, void **ppObj) +HRESULT XMLHTTPRequest_create(void **ppObj) { MESSAGE("This program tried to use a XMLHTTPRequest object, but\n" "libxml2 support was not present at compile time.\n"); return E_NOTIMPL; } -HRESULT ServerXMLHTTP_create(IUnknown *outer, void **obj) +HRESULT ServerXMLHTTP_create(void **obj) { MESSAGE("This program tried to use a ServerXMLHTTP object, but\n" "libxml2 support was not present at compile time.\n"); diff --git a/dll/win32/msxml3/main.c b/dll/win32/msxml3/main.c index 939743f744e..e3247c33977 100644 --- a/dll/win32/msxml3/main.c +++ b/dll/win32/msxml3/main.c @@ -31,7 +31,9 @@ # ifdef HAVE_LIBXSLT_TRANSFORM_H # include # endif +# include # include +# include # include # endif #endif @@ -48,7 +50,7 @@ void wineXmlCallbackLog(char const* caller, xmlErrorLevel lvl, char const* msg, { enum __wine_debug_class dbcl; char buff[200]; - static const int max_size = sizeof(buff) / sizeof(buff[0]); + const int max_size = sizeof(buff) / sizeof(buff[0]); int len; switch (lvl) @@ -145,22 +147,19 @@ static int wineXmlFileCloseCallback (void * context) return CloseHandle(context) ? 0 : -1; } -#endif - - -HRESULT WINAPI DllCanUnloadNow(void) -{ - return S_FALSE; -} - - void* libxslt_handle = NULL; #ifdef SONAME_LIBXSLT # define DECL_FUNCPTR(f) typeof(f) * p##f = NULL DECL_FUNCPTR(xsltApplyStylesheet); +DECL_FUNCPTR(xsltApplyStylesheetUser); DECL_FUNCPTR(xsltCleanupGlobals); DECL_FUNCPTR(xsltFreeStylesheet); +DECL_FUNCPTR(xsltFreeTransformContext); +DECL_FUNCPTR(xsltNewTransformContext); +DECL_FUNCPTR(xsltNextImport); DECL_FUNCPTR(xsltParseStylesheetDoc); +DECL_FUNCPTR(xsltQuoteUserParams); +DECL_FUNCPTR(xsltSaveResultTo); # undef DECL_FUNCPTR #endif @@ -178,9 +177,15 @@ static void init_libxslt(void) if (needed) { WARN("Can't find symbol %s\n", #f); goto sym_not_found; } LOAD_FUNCPTR(xsltInit, 0); LOAD_FUNCPTR(xsltApplyStylesheet, 1); + LOAD_FUNCPTR(xsltApplyStylesheetUser, 1); LOAD_FUNCPTR(xsltCleanupGlobals, 1); LOAD_FUNCPTR(xsltFreeStylesheet, 1); + LOAD_FUNCPTR(xsltFreeTransformContext, 1); + LOAD_FUNCPTR(xsltNewTransformContext, 1); + LOAD_FUNCPTR(xsltNextImport, 1); LOAD_FUNCPTR(xsltParseStylesheetDoc, 1); + LOAD_FUNCPTR(xsltQuoteUserParams, 1); + LOAD_FUNCPTR(xsltSaveResultTo, 1); #undef LOAD_FUNCPTR if (pxsltInit) @@ -193,6 +198,15 @@ static void init_libxslt(void) #endif } +#endif /* HAVE_LIBXML2 */ + + +HRESULT WINAPI DllCanUnloadNow(void) +{ + return S_FALSE; +} + + BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID reserved) { MSXML_hInstance = hInstDLL; @@ -214,11 +228,13 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID reserved) WARN("Failed to register callbacks\n"); schemasInit(); -#endif init_libxslt(); +#endif DisableThreadLibraryCalls(hInstDLL); break; case DLL_PROCESS_DETACH: + if (reserved) break; +#ifdef HAVE_LIBXML2 #ifdef SONAME_LIBXSLT if (libxslt_handle) { @@ -226,7 +242,6 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID reserved) wine_dlclose(libxslt_handle, NULL, 0); } #endif -#ifdef HAVE_LIBXML2 /* Restore default Callbacks */ xmlCleanupInputCallbacks(); xmlRegisterDefaultInputCallbacks(); diff --git a/dll/win32/msxml3/msxml3_v1.idl b/dll/win32/msxml3/msxml3_v1.idl index d80833fafb6..9987e545b4c 100644 --- a/dll/win32/msxml3/msxml3_v1.idl +++ b/dll/win32/msxml3/msxml3_v1.idl @@ -16,4 +16,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep regtypelib + #include "msxml2.idl" diff --git a/dll/win32/msxml3/msxml_private.h b/dll/win32/msxml3/msxml_private.h index 9f11add0b04..ee457691000 100644 --- a/dll/win32/msxml3/msxml_private.h +++ b/dll/win32/msxml3/msxml_private.h @@ -24,6 +24,7 @@ #include #include +#include #ifndef __WINE_CONFIG_H # error You must include config.h to use this header @@ -133,7 +134,6 @@ extern HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo) DECLSPEC_HIDDEN; extern void release_typelib(void) DECLSPEC_HIDDEN; typedef struct dispex_data_t dispex_data_t; -typedef struct dispex_dynamic_data_t dispex_dynamic_data_t; typedef struct { HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*); @@ -153,7 +153,6 @@ typedef struct { IUnknown *outer; dispex_static_data_t *data; - dispex_dynamic_data_t *dynamic_data; } DispatchEx; extern HINSTANCE MSXML_hInstance DECLSPEC_HIDDEN; @@ -180,6 +179,11 @@ static inline void *heap_realloc(void *mem, size_t len) return HeapReAlloc(GetProcessHeap(), 0, mem, len); } +static inline void *heap_realloc_zero(void *mem, size_t len) +{ + return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len); +} + static inline BOOL heap_free(void *mem) { return HeapFree(GetProcessHeap(), 0, mem); @@ -217,6 +221,20 @@ static inline LPSTR heap_strdupWtoA(LPCWSTR str) return ret; } +/* XSLProcessor parameter list */ +struct xslprocessor_par +{ + struct list entry; + BSTR name; + BSTR value; +}; + +struct xslprocessor_params +{ + struct list list; + unsigned int count; +}; + #ifdef HAVE_LIBXML2 extern void schemasInit(void) DECLSPEC_HIDDEN; @@ -300,7 +318,7 @@ extern HRESULT xmldoc_remove_orphan( xmlDocPtr doc, xmlNodePtr node ) DECLSPEC_H extern void xmldoc_link_xmldecl(xmlDocPtr doc, xmlNodePtr node) DECLSPEC_HIDDEN; extern xmlNodePtr xmldoc_unlink_xmldecl(xmlDocPtr doc) DECLSPEC_HIDDEN; -extern HRESULT XMLElement_create( IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj, BOOL own ) DECLSPEC_HIDDEN; +extern HRESULT XMLElement_create( xmlNodePtr node, LPVOID *ppObj, BOOL own ) DECLSPEC_HIDDEN; extern void wineXmlCallbackLog(char const* caller, xmlErrorLevel lvl, char const* msg, va_list ap) DECLSPEC_HIDDEN; extern void wineXmlCallbackError(char const* caller, xmlErrorPtr err) DECLSPEC_HIDDEN; @@ -354,6 +372,7 @@ extern HRESULT node_get_text(const xmlnode*,BSTR*) DECLSPEC_HIDDEN; extern HRESULT node_select_nodes(const xmlnode*,BSTR,IXMLDOMNodeList**) DECLSPEC_HIDDEN; extern HRESULT node_select_singlenode(const xmlnode*,BSTR,IXMLDOMNode**) DECLSPEC_HIDDEN; extern HRESULT node_transform_node(const xmlnode*,IXMLDOMNode*,BSTR*) DECLSPEC_HIDDEN; +extern HRESULT node_transform_node_params(const xmlnode*,IXMLDOMNode*,BSTR*,IStream*,const struct xslprocessor_params*) DECLSPEC_HIDDEN; extern HRESULT node_create_supporterrorinfo(const tid_t*,void**) DECLSPEC_HIDDEN; extern HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document) DECLSPEC_HIDDEN; @@ -441,6 +460,18 @@ static inline HRESULT return_bstr(const WCHAR *value, BSTR *p) return S_OK; } +static inline HRESULT return_bstrn(const WCHAR *value, int len, BSTR *p) +{ + if(value) { + *p = SysAllocStringLen(value, len); + if(!*p) + return E_OUTOFMEMORY; + }else + *p = NULL; + + return S_OK; +} + static inline HRESULT return_null_node(IXMLDOMNode **p) { if(!p) @@ -486,18 +517,18 @@ static inline HRESULT return_var_false(VARIANT_BOOL *p) extern IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText, LONG line, LONG linepos, LONG filepos ) DECLSPEC_HIDDEN; -extern HRESULT DOMDocument_create(MSXML_VERSION, IUnknown*, void**) DECLSPEC_HIDDEN; -extern HRESULT SchemaCache_create(MSXML_VERSION, IUnknown*, void**) DECLSPEC_HIDDEN; -extern HRESULT XMLDocument_create(IUnknown*, void**) DECLSPEC_HIDDEN; -extern HRESULT SAXXMLReader_create(MSXML_VERSION, IUnknown*, void**) DECLSPEC_HIDDEN; -extern HRESULT SAXAttributes_create(MSXML_VERSION, IUnknown*, void**) DECLSPEC_HIDDEN; -extern HRESULT XMLHTTPRequest_create(IUnknown*, void **) DECLSPEC_HIDDEN; -extern HRESULT ServerXMLHTTP_create(IUnknown*, void **) DECLSPEC_HIDDEN; -extern HRESULT XSLTemplate_create(IUnknown*, void**) DECLSPEC_HIDDEN; -extern HRESULT MXWriter_create(MSXML_VERSION, IUnknown*, void**) DECLSPEC_HIDDEN; -extern HRESULT MXNamespaceManager_create(IUnknown*,void**) DECLSPEC_HIDDEN; -extern HRESULT XMLParser_create(IUnknown*,void**) DECLSPEC_HIDDEN; -extern HRESULT XMLView_create(IUnknown*,void**) DECLSPEC_HIDDEN; +extern HRESULT DOMDocument_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN; +extern HRESULT SchemaCache_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN; +extern HRESULT XMLDocument_create(void**) DECLSPEC_HIDDEN; +extern HRESULT SAXXMLReader_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN; +extern HRESULT SAXAttributes_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN; +extern HRESULT XMLHTTPRequest_create(void **) DECLSPEC_HIDDEN; +extern HRESULT ServerXMLHTTP_create(void **) DECLSPEC_HIDDEN; +extern HRESULT XSLTemplate_create(void**) DECLSPEC_HIDDEN; +extern HRESULT MXWriter_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN; +extern HRESULT MXNamespaceManager_create(void**) DECLSPEC_HIDDEN; +extern HRESULT XMLParser_create(void**) DECLSPEC_HIDDEN; +extern HRESULT XMLView_create(void**) DECLSPEC_HIDDEN; static inline const CLSID* DOMDocument_version(MSXML_VERSION v) { diff --git a/dll/win32/msxml3/mxnamespace.c b/dll/win32/msxml3/mxnamespace.c index 69a7cbea0a6..e41d1a45e69 100644 --- a/dll/win32/msxml3/mxnamespace.c +++ b/dll/win32/msxml3/mxnamespace.c @@ -438,7 +438,6 @@ static ULONG WINAPI vbnamespacemanager_Release(IVBMXNamespaceManager *iface) free_ns_context(ctxt); } - release_dispex(&This->dispex); heap_free( This ); } @@ -622,12 +621,12 @@ static dispex_static_data_t namespacemanager_dispex = { namespacemanager_iface_tids }; -HRESULT MXNamespaceManager_create(IUnknown *outer, void **obj) +HRESULT MXNamespaceManager_create(void **obj) { namespacemanager *This; struct nscontext *ctxt; - TRACE("(%p, %p)\n", outer, obj); + TRACE("(%p)\n", obj); This = heap_alloc( sizeof (*This) ); if( !This ) diff --git a/dll/win32/msxml3/mxwriter.c b/dll/win32/msxml3/mxwriter.c index 6aad6c6c9d0..511f45fdde1 100644 --- a/dll/win32/msxml3/mxwriter.c +++ b/dll/win32/msxml3/mxwriter.c @@ -1,7 +1,7 @@ /* * MXWriter implementation * - * Copyright 2011-2013 Nikolay Sivov for CodeWeavers + * Copyright 2011-2014 Nikolay Sivov for CodeWeavers * Copyright 2011 Thomas Mullaly * * This library is free software; you can redistribute it and/or @@ -122,6 +122,13 @@ typedef struct ISAXContentHandler ISAXContentHandler_iface; ISAXLexicalHandler ISAXLexicalHandler_iface; ISAXDeclHandler ISAXDeclHandler_iface; + ISAXDTDHandler ISAXDTDHandler_iface; + ISAXErrorHandler ISAXErrorHandler_iface; + IVBSAXDeclHandler IVBSAXDeclHandler_iface; + IVBSAXLexicalHandler IVBSAXLexicalHandler_iface; + IVBSAXContentHandler IVBSAXContentHandler_iface; + IVBSAXDTDHandler IVBSAXDTDHandler_iface; + IVBSAXErrorHandler IVBSAXErrorHandler_iface; LONG ref; MSXML_VERSION class_version; @@ -373,11 +380,14 @@ static void close_output_buffer(mxwriter *This) get_code_page(This->xml_enc, &This->buffer->code_page); } -/* escapes special characters like: +/* Escapes special characters like: '<' -> "<" '&' -> "&" '"' -> """ '>' -> ">" + + On call 'len' contains a length of 'str' in chars or -1 if it's null terminated. + After a call it's updated with actual new length if it wasn't -1 initially. */ static WCHAR *get_escaped_string(const WCHAR *str, escape_mode mode, int *len) { @@ -609,16 +619,51 @@ static inline mxwriter *impl_from_ISAXContentHandler(ISAXContentHandler *iface) return CONTAINING_RECORD(iface, mxwriter, ISAXContentHandler_iface); } +static inline mxwriter *impl_from_IVBSAXContentHandler(IVBSAXContentHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, IVBSAXContentHandler_iface); +} + static inline mxwriter *impl_from_ISAXLexicalHandler(ISAXLexicalHandler *iface) { return CONTAINING_RECORD(iface, mxwriter, ISAXLexicalHandler_iface); } +static inline mxwriter *impl_from_IVBSAXLexicalHandler(IVBSAXLexicalHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, IVBSAXLexicalHandler_iface); +} + static inline mxwriter *impl_from_ISAXDeclHandler(ISAXDeclHandler *iface) { return CONTAINING_RECORD(iface, mxwriter, ISAXDeclHandler_iface); } +static inline mxwriter *impl_from_IVBSAXDeclHandler(IVBSAXDeclHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, IVBSAXDeclHandler_iface); +} + +static inline mxwriter *impl_from_ISAXDTDHandler(ISAXDTDHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, ISAXDTDHandler_iface); +} + +static inline mxwriter *impl_from_IVBSAXDTDHandler(IVBSAXDTDHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, IVBSAXDTDHandler_iface); +} + +static inline mxwriter *impl_from_ISAXErrorHandler(ISAXErrorHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, ISAXErrorHandler_iface); +} + +static inline mxwriter *impl_from_IVBSAXErrorHandler(IVBSAXErrorHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, IVBSAXErrorHandler_iface); +} + static HRESULT WINAPI mxwriter_QueryInterface(IMXWriter *iface, REFIID riid, void **obj) { mxwriter *This = impl_from_IMXWriter( iface ); @@ -645,6 +690,34 @@ static HRESULT WINAPI mxwriter_QueryInterface(IMXWriter *iface, REFIID riid, voi { *obj = &This->ISAXDeclHandler_iface; } + else if ( IsEqualGUID( riid, &IID_ISAXDTDHandler ) ) + { + *obj = &This->ISAXDTDHandler_iface; + } + else if ( IsEqualGUID( riid, &IID_ISAXErrorHandler ) ) + { + *obj = &This->ISAXErrorHandler_iface; + } + else if ( IsEqualGUID( riid, &IID_IVBSAXDeclHandler ) ) + { + *obj = &This->IVBSAXDeclHandler_iface; + } + else if ( IsEqualGUID( riid, &IID_IVBSAXLexicalHandler ) ) + { + *obj = &This->IVBSAXLexicalHandler_iface; + } + else if ( IsEqualGUID( riid, &IID_IVBSAXContentHandler ) ) + { + *obj = &This->IVBSAXContentHandler_iface; + } + else if ( IsEqualGUID( riid, &IID_IVBSAXDTDHandler ) ) + { + *obj = &This->IVBSAXDTDHandler_iface; + } + else if ( IsEqualGUID( riid, &IID_IVBSAXErrorHandler ) ) + { + *obj = &This->IVBSAXErrorHandler_iface; + } else if (dispex_query_interface(&This->dispex, riid, obj)) { return *obj ? S_OK : E_NOINTERFACE; @@ -688,7 +761,6 @@ static ULONG WINAPI mxwriter_Release(IMXWriter *iface) SysFreeString(This->encoding); SysFreeString(This->element); - release_dispex(&This->dispex); heap_free(This); } @@ -1067,8 +1139,8 @@ static HRESULT WINAPI SAXContentHandler_startPrefixMapping( int nuri) { mxwriter *This = impl_from_ISAXContentHandler( iface ); - FIXME("(%p)->(%s %s)\n", This, debugstr_wn(prefix, nprefix), debugstr_wn(uri, nuri)); - return E_NOTIMPL; + TRACE("(%p)->(%s %s)\n", This, debugstr_wn(prefix, nprefix), debugstr_wn(uri, nuri)); + return S_OK; } static HRESULT WINAPI SAXContentHandler_endPrefixMapping( @@ -1077,8 +1149,42 @@ static HRESULT WINAPI SAXContentHandler_endPrefixMapping( int nprefix) { mxwriter *This = impl_from_ISAXContentHandler( iface ); - FIXME("(%p)->(%s)\n", This, debugstr_wn(prefix, nprefix)); - return E_NOTIMPL; + TRACE("(%p)->(%s)\n", This, debugstr_wn(prefix, nprefix)); + return S_OK; +} + +static void mxwriter_write_attribute(mxwriter *writer, const WCHAR *qname, int qname_len, + const WCHAR *value, int value_len, BOOL escape) +{ + static const WCHAR eqW[] = {'='}; + + /* space separator in front of every attribute */ + write_output_buffer(writer->buffer, spaceW, 1); + write_output_buffer(writer->buffer, qname, qname_len); + write_output_buffer(writer->buffer, eqW, 1); + + if (escape) + { + WCHAR *escaped = get_escaped_string(value, EscapeValue, &value_len); + write_output_buffer_quoted(writer->buffer, escaped, value_len); + heap_free(escaped); + } + else + write_output_buffer_quoted(writer->buffer, value, value_len); +} + +static void mxwriter_write_starttag(mxwriter *writer, const WCHAR *qname, int len) +{ + static const WCHAR ltW[] = {'<'}; + + close_element_starttag(writer); + set_element_name(writer, qname ? qname : emptyW, qname ? len : 0); + + write_node_indent(writer); + + write_output_buffer(writer->buffer, ltW, 1); + write_output_buffer(writer->buffer, qname ? qname : emptyW, qname ? len : 0); + writer_inc_indent(writer); } static HRESULT WINAPI SAXContentHandler_startElement( @@ -1092,7 +1198,6 @@ static HRESULT WINAPI SAXContentHandler_startElement( ISAXAttributes *attr) { mxwriter *This = impl_from_ISAXContentHandler( iface ); - static const WCHAR ltW[] = {'<'}; TRACE("(%p)->(%s %s %s %p)\n", This, debugstr_wn(namespaceUri, nnamespaceUri), debugstr_wn(local_name, nlocal_name), debugstr_wn(QName, nQName), attr); @@ -1101,15 +1206,7 @@ static HRESULT WINAPI SAXContentHandler_startElement( (nQName == -1 && This->class_version == MSXML6)) return E_INVALIDARG; - close_element_starttag(This); - set_element_name(This, QName ? QName : emptyW, - QName ? nQName : 0); - - write_node_indent(This); - - write_output_buffer(This->buffer, ltW, 1); - write_output_buffer(This->buffer, QName, nQName); - writer_inc_indent(This); + mxwriter_write_starttag(This, QName, nQName); if (attr) { @@ -1124,31 +1221,16 @@ static HRESULT WINAPI SAXContentHandler_startElement( for (i = 0; i < length; i++) { - static const WCHAR eqW[] = {'='}; - const WCHAR *str; - int len = 0; + int qname_len = 0, value_len = 0; + const WCHAR *qname, *value; - hr = ISAXAttributes_getQName(attr, i, &str, &len); + hr = ISAXAttributes_getQName(attr, i, &qname, &qname_len); if (FAILED(hr)) return hr; - /* space separator in front of every attribute */ - write_output_buffer(This->buffer, spaceW, 1); - write_output_buffer(This->buffer, str, len); - - write_output_buffer(This->buffer, eqW, 1); - - len = 0; - hr = ISAXAttributes_getValue(attr, i, &str, &len); + hr = ISAXAttributes_getValue(attr, i, &value, &value_len); if (FAILED(hr)) return hr; - if (escape) - { - WCHAR *escaped = get_escaped_string(str, EscapeValue, &len); - write_output_buffer_quoted(This->buffer, escaped, len); - heap_free(escaped); - } - else - write_output_buffer_quoted(This->buffer, str, len); + mxwriter_write_attribute(This, qname, qname_len, value, value_len, escape); } } @@ -1628,6 +1710,743 @@ static const ISAXDeclHandlerVtbl SAXDeclHandlerVtbl = { SAXDeclHandler_externalEntityDecl }; +/*** IVBSAXDeclHandler ***/ +static HRESULT WINAPI VBSAXDeclHandler_QueryInterface(IVBSAXDeclHandler *iface, + REFIID riid, void **obj) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI VBSAXDeclHandler_AddRef(IVBSAXDeclHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI VBSAXDeclHandler_Release(IVBSAXDeclHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI VBSAXDeclHandler_GetTypeInfoCount(IVBSAXDeclHandler *iface, UINT* pctinfo) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_GetTypeInfoCount(&This->IMXWriter_iface, pctinfo); +} + +static HRESULT WINAPI VBSAXDeclHandler_GetTypeInfo(IVBSAXDeclHandler *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_GetTypeInfo(&This->IMXWriter_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI VBSAXDeclHandler_GetIDsOfNames(IVBSAXDeclHandler *iface, REFIID riid, LPOLESTR* rgszNames, + UINT cNames, LCID lcid, DISPID* rgDispId ) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_GetIDsOfNames(&This->IMXWriter_iface, riid, rgszNames, cNames, lcid, rgDispId); +} + +static HRESULT WINAPI VBSAXDeclHandler_Invoke(IVBSAXDeclHandler *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr ) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_Invoke(&This->IMXWriter_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, + pExcepInfo, puArgErr); +} + +static HRESULT WINAPI VBSAXDeclHandler_elementDecl(IVBSAXDeclHandler *iface, BSTR *name, BSTR *model) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + + TRACE("(%p)->(%p %p)\n", This, name, model); + + if (!name || !model) + return E_POINTER; + + return ISAXDeclHandler_elementDecl(&This->ISAXDeclHandler_iface, *name, -1, *model, -1); +} + +static HRESULT WINAPI VBSAXDeclHandler_attributeDecl(IVBSAXDeclHandler *iface, + BSTR *element, BSTR *attr, BSTR *type, BSTR *default_value, BSTR *value) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + + TRACE("(%p)->(%p %p %p %p %p)\n", This, element, attr, type, default_value, value); + + if (!element || !attr || !type || !default_value || !value) + return E_POINTER; + + return ISAXDeclHandler_attributeDecl(&This->ISAXDeclHandler_iface, *element, -1, *attr, -1, *type, -1, + *default_value, -1, *value, -1); +} + +static HRESULT WINAPI VBSAXDeclHandler_internalEntityDecl(IVBSAXDeclHandler *iface, BSTR *name, BSTR *value) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + + TRACE("(%p)->(%p %p)\n", This, name, value); + + if (!name || !value) + return E_POINTER; + + return ISAXDeclHandler_internalEntityDecl(&This->ISAXDeclHandler_iface, *name, -1, *value, -1); +} + +static HRESULT WINAPI VBSAXDeclHandler_externalEntityDecl(IVBSAXDeclHandler *iface, + BSTR *name, BSTR *publicid, BSTR *systemid) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + + TRACE("(%p)->(%p %p %p)\n", This, name, publicid, systemid); + + if (!name || !publicid || !systemid) + return E_POINTER; + + return ISAXDeclHandler_externalEntityDecl(&This->ISAXDeclHandler_iface, *name, -1, *publicid, -1, *systemid, -1); +} + +static const IVBSAXDeclHandlerVtbl VBSAXDeclHandlerVtbl = { + VBSAXDeclHandler_QueryInterface, + VBSAXDeclHandler_AddRef, + VBSAXDeclHandler_Release, + VBSAXDeclHandler_GetTypeInfoCount, + VBSAXDeclHandler_GetTypeInfo, + VBSAXDeclHandler_GetIDsOfNames, + VBSAXDeclHandler_Invoke, + VBSAXDeclHandler_elementDecl, + VBSAXDeclHandler_attributeDecl, + VBSAXDeclHandler_internalEntityDecl, + VBSAXDeclHandler_externalEntityDecl +}; + +/*** IVBSAXLexicalHandler ***/ +static HRESULT WINAPI VBSAXLexicalHandler_QueryInterface(IVBSAXLexicalHandler *iface, + REFIID riid, void **obj) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI VBSAXLexicalHandler_AddRef(IVBSAXLexicalHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI VBSAXLexicalHandler_Release(IVBSAXLexicalHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI VBSAXLexicalHandler_GetTypeInfoCount(IVBSAXLexicalHandler *iface, UINT* pctinfo) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_GetTypeInfoCount(&This->IMXWriter_iface, pctinfo); +} + +static HRESULT WINAPI VBSAXLexicalHandler_GetTypeInfo(IVBSAXLexicalHandler *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_GetTypeInfo(&This->IMXWriter_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI VBSAXLexicalHandler_GetIDsOfNames(IVBSAXLexicalHandler *iface, REFIID riid, LPOLESTR* rgszNames, + UINT cNames, LCID lcid, DISPID* rgDispId ) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_GetIDsOfNames(&This->IMXWriter_iface, riid, rgszNames, cNames, lcid, rgDispId); +} + +static HRESULT WINAPI VBSAXLexicalHandler_Invoke(IVBSAXLexicalHandler *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr ) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_Invoke(&This->IMXWriter_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, + pExcepInfo, puArgErr); +} + +static HRESULT WINAPI VBSAXLexicalHandler_startDTD(IVBSAXLexicalHandler *iface, BSTR *name, BSTR *publicId, BSTR *systemId) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + + TRACE("(%p)->(%p %p %p)\n", This, name, publicId, systemId); + + if (!name || !publicId || !systemId) + return E_POINTER; + + return ISAXLexicalHandler_startDTD(&This->ISAXLexicalHandler_iface, *name, -1, *publicId, -1, *systemId, -1); +} + +static HRESULT WINAPI VBSAXLexicalHandler_endDTD(IVBSAXLexicalHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return ISAXLexicalHandler_endDTD(&This->ISAXLexicalHandler_iface); +} + +static HRESULT WINAPI VBSAXLexicalHandler_startEntity(IVBSAXLexicalHandler *iface, BSTR *name) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + + TRACE("(%p)->(%p)\n", This, name); + + if (!name) + return E_POINTER; + + return ISAXLexicalHandler_startEntity(&This->ISAXLexicalHandler_iface, *name, -1); +} + +static HRESULT WINAPI VBSAXLexicalHandler_endEntity(IVBSAXLexicalHandler *iface, BSTR *name) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + + TRACE("(%p)->(%p)\n", This, name); + + if (!name) + return E_POINTER; + + return ISAXLexicalHandler_endEntity(&This->ISAXLexicalHandler_iface, *name, -1); +} + +static HRESULT WINAPI VBSAXLexicalHandler_startCDATA(IVBSAXLexicalHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return ISAXLexicalHandler_startCDATA(&This->ISAXLexicalHandler_iface); +} + +static HRESULT WINAPI VBSAXLexicalHandler_endCDATA(IVBSAXLexicalHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return ISAXLexicalHandler_endCDATA(&This->ISAXLexicalHandler_iface); +} + +static HRESULT WINAPI VBSAXLexicalHandler_comment(IVBSAXLexicalHandler *iface, BSTR *chars) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + + TRACE("(%p)->(%p)\n", This, chars); + + if (!chars) + return E_POINTER; + + return ISAXLexicalHandler_comment(&This->ISAXLexicalHandler_iface, *chars, -1); +} + +static const IVBSAXLexicalHandlerVtbl VBSAXLexicalHandlerVtbl = { + VBSAXLexicalHandler_QueryInterface, + VBSAXLexicalHandler_AddRef, + VBSAXLexicalHandler_Release, + VBSAXLexicalHandler_GetTypeInfoCount, + VBSAXLexicalHandler_GetTypeInfo, + VBSAXLexicalHandler_GetIDsOfNames, + VBSAXLexicalHandler_Invoke, + VBSAXLexicalHandler_startDTD, + VBSAXLexicalHandler_endDTD, + VBSAXLexicalHandler_startEntity, + VBSAXLexicalHandler_endEntity, + VBSAXLexicalHandler_startCDATA, + VBSAXLexicalHandler_endCDATA, + VBSAXLexicalHandler_comment +}; + +/*** IVBSAXContentHandler ***/ +static HRESULT WINAPI VBSAXContentHandler_QueryInterface(IVBSAXContentHandler *iface, REFIID riid, void **obj) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI VBSAXContentHandler_AddRef(IVBSAXContentHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI VBSAXContentHandler_Release(IVBSAXContentHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI VBSAXContentHandler_GetTypeInfoCount(IVBSAXContentHandler *iface, UINT* pctinfo) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_GetTypeInfoCount(&This->IMXWriter_iface, pctinfo); +} + +static HRESULT WINAPI VBSAXContentHandler_GetTypeInfo(IVBSAXContentHandler *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_GetTypeInfo(&This->IMXWriter_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI VBSAXContentHandler_GetIDsOfNames(IVBSAXContentHandler *iface, REFIID riid, LPOLESTR* rgszNames, + UINT cNames, LCID lcid, DISPID* rgDispId ) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_GetIDsOfNames(&This->IMXWriter_iface, riid, rgszNames, cNames, lcid, rgDispId); +} + +static HRESULT WINAPI VBSAXContentHandler_Invoke(IVBSAXContentHandler *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr ) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_Invoke(&This->IMXWriter_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, + pExcepInfo, puArgErr); +} + +static HRESULT WINAPI VBSAXContentHandler_putref_documentLocator(IVBSAXContentHandler *iface, IVBSAXLocator *locator) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + TRACE("(%p)->(%p)\n", This, locator); + return S_OK; +} + +static HRESULT WINAPI VBSAXContentHandler_startDocument(IVBSAXContentHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return ISAXContentHandler_startDocument(&This->ISAXContentHandler_iface); +} + +static HRESULT WINAPI VBSAXContentHandler_endDocument(IVBSAXContentHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return ISAXContentHandler_endDocument(&This->ISAXContentHandler_iface); +} + +static HRESULT WINAPI VBSAXContentHandler_startPrefixMapping(IVBSAXContentHandler *iface, BSTR *prefix, BSTR *uri) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p %p)\n", This, prefix, uri); + + if (!prefix || !uri) + return E_POINTER; + + return ISAXContentHandler_startPrefixMapping(&This->ISAXContentHandler_iface, *prefix, -1, *uri, -1); +} + +static HRESULT WINAPI VBSAXContentHandler_endPrefixMapping(IVBSAXContentHandler *iface, BSTR *prefix) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p)\n", This, prefix); + + if (!prefix) + return E_POINTER; + + return ISAXContentHandler_endPrefixMapping(&This->ISAXContentHandler_iface, *prefix, -1); +} + +static HRESULT WINAPI VBSAXContentHandler_startElement(IVBSAXContentHandler *iface, + BSTR *namespaceURI, BSTR *localName, BSTR *QName, IVBSAXAttributes *attrs) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p %p %p %p)\n", This, namespaceURI, localName, QName, attrs); + + if (!namespaceURI || !localName || !QName) + return E_POINTER; + + TRACE("(%s %s %s)\n", debugstr_w(*namespaceURI), debugstr_w(*localName), debugstr_w(*QName)); + + mxwriter_write_starttag(This, *QName, SysStringLen(*QName)); + + if (attrs) + { + int length, i, escape; + HRESULT hr; + + hr = IVBSAXAttributes_get_length(attrs, &length); + if (FAILED(hr)) return hr; + + escape = This->props[MXWriter_DisableEscaping] == VARIANT_FALSE || + (This->class_version == MSXML4 || This->class_version == MSXML6); + + for (i = 0; i < length; i++) + { + BSTR qname, value; + + hr = IVBSAXAttributes_getQName(attrs, i, &qname); + if (FAILED(hr)) return hr; + + hr = IVBSAXAttributes_getValue(attrs, i, &value); + if (FAILED(hr)) + { + SysFreeString(qname); + return hr; + } + + mxwriter_write_attribute(This, qname, SysStringLen(qname), value, SysStringLen(value), escape); + SysFreeString(qname); + SysFreeString(value); + } + } + + return S_OK; +} + +static HRESULT WINAPI VBSAXContentHandler_endElement(IVBSAXContentHandler *iface, BSTR *namespaceURI, + BSTR *localName, BSTR *QName) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p %p %p)\n", This, namespaceURI, localName, QName); + + if (!namespaceURI || !localName || !QName) + return E_POINTER; + + return ISAXContentHandler_endElement(&This->ISAXContentHandler_iface, + *namespaceURI, SysStringLen(*namespaceURI), + *localName, SysStringLen(*localName), + *QName, SysStringLen(*QName)); +} + +static HRESULT WINAPI VBSAXContentHandler_characters(IVBSAXContentHandler *iface, BSTR *chars) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p)\n", This, chars); + + if (!chars) + return E_POINTER; + + return ISAXContentHandler_characters(&This->ISAXContentHandler_iface, *chars, -1); +} + +static HRESULT WINAPI VBSAXContentHandler_ignorableWhitespace(IVBSAXContentHandler *iface, BSTR *chars) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p)\n", This, chars); + + if (!chars) + return E_POINTER; + + return ISAXContentHandler_ignorableWhitespace(&This->ISAXContentHandler_iface, *chars, -1); +} + +static HRESULT WINAPI VBSAXContentHandler_processingInstruction(IVBSAXContentHandler *iface, + BSTR *target, BSTR *data) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p %p)\n", This, target, data); + + if (!target || !data) + return E_POINTER; + + return ISAXContentHandler_processingInstruction(&This->ISAXContentHandler_iface, *target, -1, *data, -1); +} + +static HRESULT WINAPI VBSAXContentHandler_skippedEntity(IVBSAXContentHandler *iface, BSTR *name) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p)\n", This, name); + + if (!name) + return E_POINTER; + + return ISAXContentHandler_skippedEntity(&This->ISAXContentHandler_iface, *name, -1); +} + +static const IVBSAXContentHandlerVtbl VBSAXContentHandlerVtbl = { + VBSAXContentHandler_QueryInterface, + VBSAXContentHandler_AddRef, + VBSAXContentHandler_Release, + VBSAXContentHandler_GetTypeInfoCount, + VBSAXContentHandler_GetTypeInfo, + VBSAXContentHandler_GetIDsOfNames, + VBSAXContentHandler_Invoke, + VBSAXContentHandler_putref_documentLocator, + VBSAXContentHandler_startDocument, + VBSAXContentHandler_endDocument, + VBSAXContentHandler_startPrefixMapping, + VBSAXContentHandler_endPrefixMapping, + VBSAXContentHandler_startElement, + VBSAXContentHandler_endElement, + VBSAXContentHandler_characters, + VBSAXContentHandler_ignorableWhitespace, + VBSAXContentHandler_processingInstruction, + VBSAXContentHandler_skippedEntity +}; + +static HRESULT WINAPI SAXDTDHandler_QueryInterface(ISAXDTDHandler *iface, REFIID riid, void **obj) +{ + mxwriter *This = impl_from_ISAXDTDHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI SAXDTDHandler_AddRef(ISAXDTDHandler *iface) +{ + mxwriter *This = impl_from_ISAXDTDHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI SAXDTDHandler_Release(ISAXDTDHandler *iface) +{ + mxwriter *This = impl_from_ISAXDTDHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI SAXDTDHandler_notationDecl(ISAXDTDHandler *iface, + const WCHAR *name, INT nname, + const WCHAR *publicid, INT npublicid, + const WCHAR *systemid, INT nsystemid) +{ + mxwriter *This = impl_from_ISAXDTDHandler( iface ); + FIXME("(%p)->(%s:%d, %s:%d, %s:%d): stub\n", This, debugstr_wn(name, nname), nname, + debugstr_wn(publicid, npublicid), npublicid, debugstr_wn(systemid, nsystemid), nsystemid); + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXDTDHandler_unparsedEntityDecl(ISAXDTDHandler *iface, + const WCHAR *name, INT nname, + const WCHAR *publicid, INT npublicid, + const WCHAR *systemid, INT nsystemid, + const WCHAR *notation, INT nnotation) +{ + mxwriter *This = impl_from_ISAXDTDHandler( iface ); + FIXME("(%p)->(%s:%d, %s:%d, %s:%d, %s:%d): stub\n", This, debugstr_wn(name, nname), nname, + debugstr_wn(publicid, npublicid), npublicid, debugstr_wn(systemid, nsystemid), nsystemid, + debugstr_wn(notation, nnotation), nnotation); + return E_NOTIMPL; +} + +static const ISAXDTDHandlerVtbl SAXDTDHandlerVtbl = { + SAXDTDHandler_QueryInterface, + SAXDTDHandler_AddRef, + SAXDTDHandler_Release, + SAXDTDHandler_notationDecl, + SAXDTDHandler_unparsedEntityDecl +}; + +/*** IVBSAXDTDHandler ***/ +static HRESULT WINAPI VBSAXDTDHandler_QueryInterface(IVBSAXDTDHandler *iface, REFIID riid, void **obj) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI VBSAXDTDHandler_AddRef(IVBSAXDTDHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI VBSAXDTDHandler_Release(IVBSAXDTDHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI VBSAXDTDHandler_GetTypeInfoCount(IVBSAXDTDHandler *iface, UINT* pctinfo) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_GetTypeInfoCount(&This->IMXWriter_iface, pctinfo); +} + +static HRESULT WINAPI VBSAXDTDHandler_GetTypeInfo(IVBSAXDTDHandler *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_GetTypeInfo(&This->IMXWriter_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI VBSAXDTDHandler_GetIDsOfNames(IVBSAXDTDHandler *iface, REFIID riid, LPOLESTR* rgszNames, + UINT cNames, LCID lcid, DISPID* rgDispId ) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_GetIDsOfNames(&This->IMXWriter_iface, riid, rgszNames, cNames, lcid, rgDispId); +} + +static HRESULT WINAPI VBSAXDTDHandler_Invoke(IVBSAXDTDHandler *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr ) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_Invoke(&This->IMXWriter_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, + pExcepInfo, puArgErr); +} + +static HRESULT WINAPI VBSAXDTDHandler_notationDecl(IVBSAXDTDHandler *iface, BSTR *name, BSTR *publicId, BSTR *systemId) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + + TRACE("(%p)->(%p %p %p)\n", This, name, publicId, systemId); + + if (!name || !publicId || !systemId) + return E_POINTER; + + return ISAXDTDHandler_notationDecl(&This->ISAXDTDHandler_iface, *name, -1, *publicId, -1, *systemId, -1); +} + +static HRESULT WINAPI VBSAXDTDHandler_unparsedEntityDecl(IVBSAXDTDHandler *iface, BSTR *name, BSTR *publicId, + BSTR *systemId, BSTR *notation) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + + TRACE("(%p)->(%p %p %p %p)\n", This, name, publicId, systemId, notation); + + if (!name || !publicId || !systemId || !notation) + return E_POINTER; + + return ISAXDTDHandler_unparsedEntityDecl(&This->ISAXDTDHandler_iface, *name, -1, *publicId, -1, + *systemId, -1, *notation, -1); +} + +static const IVBSAXDTDHandlerVtbl VBSAXDTDHandlerVtbl = { + VBSAXDTDHandler_QueryInterface, + VBSAXDTDHandler_AddRef, + VBSAXDTDHandler_Release, + VBSAXDTDHandler_GetTypeInfoCount, + VBSAXDTDHandler_GetTypeInfo, + VBSAXDTDHandler_GetIDsOfNames, + VBSAXDTDHandler_Invoke, + VBSAXDTDHandler_notationDecl, + VBSAXDTDHandler_unparsedEntityDecl +}; + +/* ISAXErrorHandler */ +static HRESULT WINAPI SAXErrorHandler_QueryInterface(ISAXErrorHandler *iface, REFIID riid, void **obj) +{ + mxwriter *This = impl_from_ISAXErrorHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI SAXErrorHandler_AddRef(ISAXErrorHandler *iface) +{ + mxwriter *This = impl_from_ISAXErrorHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI SAXErrorHandler_Release(ISAXErrorHandler *iface) +{ + mxwriter *This = impl_from_ISAXErrorHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI SAXErrorHandler_error(ISAXErrorHandler *iface, + ISAXLocator *locator, const WCHAR *message, HRESULT hr) +{ + mxwriter *This = impl_from_ISAXErrorHandler( iface ); + + FIXME("(%p)->(%p %s 0x%08x)\n", This, locator, debugstr_w(message), hr); + + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXErrorHandler_fatalError(ISAXErrorHandler *iface, + ISAXLocator *locator, const WCHAR *message, HRESULT hr) +{ + mxwriter *This = impl_from_ISAXErrorHandler( iface ); + + FIXME("(%p)->(%p %s 0x%08x)\n", This, locator, debugstr_w(message), hr); + + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXErrorHandler_ignorableWarning(ISAXErrorHandler *iface, + ISAXLocator *locator, const WCHAR *message, HRESULT hr) +{ + mxwriter *This = impl_from_ISAXErrorHandler( iface ); + + FIXME("(%p)->(%p %s 0x%08x)\n", This, locator, debugstr_w(message), hr); + + return E_NOTIMPL; +} + +static const ISAXErrorHandlerVtbl SAXErrorHandlerVtbl = { + SAXErrorHandler_QueryInterface, + SAXErrorHandler_AddRef, + SAXErrorHandler_Release, + SAXErrorHandler_error, + SAXErrorHandler_fatalError, + SAXErrorHandler_ignorableWarning +}; + +/*** IVBSAXErrorHandler ***/ +static HRESULT WINAPI VBSAXErrorHandler_QueryInterface(IVBSAXErrorHandler *iface, REFIID riid, void **obj) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI VBSAXErrorHandler_AddRef(IVBSAXErrorHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI VBSAXErrorHandler_Release(IVBSAXErrorHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI VBSAXErrorHandler_GetTypeInfoCount(IVBSAXErrorHandler *iface, UINT* pctinfo) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_GetTypeInfoCount(&This->IMXWriter_iface, pctinfo); +} + +static HRESULT WINAPI VBSAXErrorHandler_GetTypeInfo(IVBSAXErrorHandler *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_GetTypeInfo(&This->IMXWriter_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI VBSAXErrorHandler_GetIDsOfNames(IVBSAXErrorHandler *iface, REFIID riid, LPOLESTR* rgszNames, + UINT cNames, LCID lcid, DISPID* rgDispId ) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_GetIDsOfNames(&This->IMXWriter_iface, riid, rgszNames, cNames, lcid, rgDispId); +} + +static HRESULT WINAPI VBSAXErrorHandler_Invoke(IVBSAXErrorHandler *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr ) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_Invoke(&This->IMXWriter_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, + pExcepInfo, puArgErr); +} + +static HRESULT WINAPI VBSAXErrorHandler_error(IVBSAXErrorHandler *iface, IVBSAXLocator *locator, BSTR *message, LONG code) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + FIXME("(%p)->(%p %p %x): stub\n", This, locator, message, code); + return E_NOTIMPL; +} + +static HRESULT WINAPI VBSAXErrorHandler_fatalError(IVBSAXErrorHandler *iface, IVBSAXLocator *locator, BSTR *message, LONG code) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + FIXME("(%p)->(%p %p %x): stub\n", This, locator, message, code); + return E_NOTIMPL; +} + +static HRESULT WINAPI VBSAXErrorHandler_ignorableWarning(IVBSAXErrorHandler *iface, IVBSAXLocator *locator, BSTR *message, LONG code) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + FIXME("(%p)->(%p %p %x): stub\n", This, locator, message, code); + return E_NOTIMPL; +} + +static const IVBSAXErrorHandlerVtbl VBSAXErrorHandlerVtbl = { + VBSAXErrorHandler_QueryInterface, + VBSAXErrorHandler_AddRef, + VBSAXErrorHandler_Release, + VBSAXErrorHandler_GetTypeInfoCount, + VBSAXErrorHandler_GetTypeInfo, + VBSAXErrorHandler_GetIDsOfNames, + VBSAXErrorHandler_Invoke, + VBSAXErrorHandler_error, + VBSAXErrorHandler_fatalError, + VBSAXErrorHandler_ignorableWarning +}; + static const tid_t mxwriter_iface_tids[] = { IMXWriter_tid, 0 @@ -1640,15 +2459,13 @@ static dispex_static_data_t mxwriter_dispex = { mxwriter_iface_tids }; -HRESULT MXWriter_create(MSXML_VERSION version, IUnknown *outer, void **ppObj) +HRESULT MXWriter_create(MSXML_VERSION version, void **ppObj) { static const WCHAR version10W[] = {'1','.','0',0}; mxwriter *This; HRESULT hr; - TRACE("(%p, %p)\n", outer, ppObj); - - if (outer) FIXME("support aggregation, outer\n"); + TRACE("(%p)\n", ppObj); This = heap_alloc( sizeof (*This) ); if(!This) @@ -1658,6 +2475,13 @@ HRESULT MXWriter_create(MSXML_VERSION version, IUnknown *outer, void **ppObj) This->ISAXContentHandler_iface.lpVtbl = &SAXContentHandlerVtbl; This->ISAXLexicalHandler_iface.lpVtbl = &SAXLexicalHandlerVtbl; This->ISAXDeclHandler_iface.lpVtbl = &SAXDeclHandlerVtbl; + This->ISAXDTDHandler_iface.lpVtbl = &SAXDTDHandlerVtbl; + This->ISAXErrorHandler_iface.lpVtbl = &SAXErrorHandlerVtbl; + This->IVBSAXDeclHandler_iface.lpVtbl = &VBSAXDeclHandlerVtbl; + This->IVBSAXLexicalHandler_iface.lpVtbl = &VBSAXLexicalHandlerVtbl; + This->IVBSAXContentHandler_iface.lpVtbl = &VBSAXContentHandlerVtbl; + This->IVBSAXDTDHandler_iface.lpVtbl = &VBSAXDTDHandlerVtbl; + This->IVBSAXErrorHandler_iface.lpVtbl = &VBSAXErrorHandlerVtbl; This->ref = 1; This->class_version = version; @@ -1762,7 +2586,6 @@ static ULONG WINAPI MXAttributes_Release(IMXAttributes *iface) SysFreeString(This->attr[i].value); } - release_dispex(&This->dispex); heap_free(This->attr); heap_free(This); } @@ -2373,25 +3196,61 @@ static HRESULT WINAPI VBSAXAttributes_get_length(IVBSAXAttributes* iface, int *l static HRESULT WINAPI VBSAXAttributes_getURI(IVBSAXAttributes* iface, int index, BSTR *uri) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *uriW; + HRESULT hr; int len; - return ISAXAttributes_getURI(&This->ISAXAttributes_iface, index, (const WCHAR**)uri, &len); + TRACE("(%p)->(%d %p)\n", This, index, uri); + + if (!uri) + return E_POINTER; + + *uri = NULL; + hr = ISAXAttributes_getURI(&This->ISAXAttributes_iface, index, &uriW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(uriW, len, uri); } static HRESULT WINAPI VBSAXAttributes_getLocalName(IVBSAXAttributes* iface, int index, BSTR *name) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *nameW; + HRESULT hr; int len; - return ISAXAttributes_getLocalName(&This->ISAXAttributes_iface, index, (const WCHAR**)name, &len); + TRACE("(%p)->(%d %p)\n", This, index, name); + + if (!name) + return E_POINTER; + + *name = NULL; + hr = ISAXAttributes_getLocalName(&This->ISAXAttributes_iface, index, &nameW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(nameW, len, name); } static HRESULT WINAPI VBSAXAttributes_getQName(IVBSAXAttributes* iface, int index, BSTR *qname) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *qnameW; + HRESULT hr; int len; - return ISAXAttributes_getQName(&This->ISAXAttributes_iface, index, (const WCHAR**)qname, &len); + TRACE("(%p)->(%d %p)\n", This, index, qname); + + if (!qname) + return E_POINTER; + + *qname = NULL; + hr = ISAXAttributes_getQName(&This->ISAXAttributes_iface, index, &qnameW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(qnameW, len, qname); } static HRESULT WINAPI VBSAXAttributes_getIndexFromName(IVBSAXAttributes* iface, BSTR uri, BSTR name, int *index) @@ -2408,58 +3267,130 @@ static HRESULT WINAPI VBSAXAttributes_getIndexFromQName(IVBSAXAttributes* iface, SysStringLen(qname), index); } -static HRESULT WINAPI VBSAXAttributes_getType(IVBSAXAttributes* iface, int index,BSTR *type) +static HRESULT WINAPI VBSAXAttributes_getType(IVBSAXAttributes* iface, int index, BSTR *type) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *typeW; + HRESULT hr; int len; - return ISAXAttributes_getType(&This->ISAXAttributes_iface, index, (const WCHAR**)type, &len); + TRACE("(%p)->(%d %p)\n", This, index, type); + + if (!type) + return E_POINTER; + + *type = NULL; + hr = ISAXAttributes_getType(&This->ISAXAttributes_iface, index, &typeW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(typeW, len, type); } static HRESULT WINAPI VBSAXAttributes_getTypeFromName(IVBSAXAttributes* iface, BSTR uri, BSTR name, BSTR *type) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *typeW; + HRESULT hr; int len; - return ISAXAttributes_getTypeFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), - name, SysStringLen(name), (const WCHAR**)type, &len); + TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(uri), debugstr_w(name), type); + + if (!type) + return E_POINTER; + + *type = NULL; + hr = ISAXAttributes_getTypeFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), + name, SysStringLen(name), &typeW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(typeW, len, type); } static HRESULT WINAPI VBSAXAttributes_getTypeFromQName(IVBSAXAttributes* iface, BSTR qname, BSTR *type) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *typeW; + HRESULT hr; int len; - return ISAXAttributes_getTypeFromQName(&This->ISAXAttributes_iface, qname, SysStringLen(qname), - (const WCHAR**)type, &len); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(qname), type); + + if (!type) + return E_POINTER; + + *type = NULL; + hr = ISAXAttributes_getTypeFromQName(&This->ISAXAttributes_iface, qname, SysStringLen(qname), + &typeW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(typeW, len, type); } static HRESULT WINAPI VBSAXAttributes_getValue(IVBSAXAttributes* iface, int index, BSTR *value) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *valueW; + HRESULT hr; int len; - return ISAXAttributes_getValue(&This->ISAXAttributes_iface, index, (const WCHAR**)value, &len); + TRACE("(%p)->(%d %p)\n", This, index, value); + + if (!value) + return E_POINTER; + + *value = NULL; + hr = ISAXAttributes_getValue(&This->ISAXAttributes_iface, index, &valueW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(valueW, len, value); } static HRESULT WINAPI VBSAXAttributes_getValueFromName(IVBSAXAttributes* iface, BSTR uri, BSTR name, BSTR *value) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *valueW; + HRESULT hr; int len; - return ISAXAttributes_getValueFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), - name, SysStringLen(name), (const WCHAR**)value, &len); + TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(uri), debugstr_w(name), value); + + if (!value) + return E_POINTER; + + *value = NULL; + hr = ISAXAttributes_getValueFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), + name, SysStringLen(name), &valueW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(valueW, len, value); } static HRESULT WINAPI VBSAXAttributes_getValueFromQName(IVBSAXAttributes* iface, BSTR qname, BSTR *value) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *valueW; + HRESULT hr; int len; - return ISAXAttributes_getValueFromQName(&This->ISAXAttributes_iface, qname, SysStringLen(qname), - (const WCHAR**)value, &len); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(qname), value); + + if (!value) + return E_POINTER; + + *value = NULL; + hr = ISAXAttributes_getValueFromQName(&This->ISAXAttributes_iface, qname, SysStringLen(qname), + &valueW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(valueW, len, value); } static const struct IVBSAXAttributesVtbl VBSAXAttributesVtbl = @@ -2497,12 +3428,12 @@ static dispex_static_data_t mxattrs_dispex = { mxattrs_iface_tids }; -HRESULT SAXAttributes_create(MSXML_VERSION version, IUnknown *outer, void **ppObj) +HRESULT SAXAttributes_create(MSXML_VERSION version, void **ppObj) { static const int default_count = 10; mxattributes *This; - TRACE("(%p, %p)\n", outer, ppObj); + TRACE("(%p)\n", ppObj); This = heap_alloc( sizeof (*This) ); if( !This ) diff --git a/dll/win32/msxml3/node.c b/dll/win32/msxml3/node.c index b9f79dbc0af..cf15f8585a5 100644 --- a/dll/win32/msxml3/node.c +++ b/dll/win32/msxml3/node.c @@ -29,6 +29,8 @@ # ifdef HAVE_LIBXSLT_TRANSFORM_H # include # endif +# include +# include # include # include # endif @@ -40,9 +42,15 @@ extern void* libxslt_handle; # define MAKE_FUNCPTR(f) extern typeof(f) * p##f MAKE_FUNCPTR(xsltApplyStylesheet); +MAKE_FUNCPTR(xsltApplyStylesheetUser); MAKE_FUNCPTR(xsltCleanupGlobals); MAKE_FUNCPTR(xsltFreeStylesheet); +MAKE_FUNCPTR(xsltFreeTransformContext); +MAKE_FUNCPTR(xsltNewTransformContext); +MAKE_FUNCPTR(xsltNextImport); MAKE_FUNCPTR(xsltParseStylesheetDoc); +MAKE_FUNCPTR(xsltQuoteUserParams); +MAKE_FUNCPTR(xsltSaveResultTo); # undef MAKE_FUNCPTR #endif @@ -600,6 +608,9 @@ HRESULT node_append_child(xmlnode *This, IXMLDOMNode *child, IXMLDOMNode **outCh VARIANT var; HRESULT hr; + if (!child) + return E_INVALIDARG; + hr = IXMLDOMNode_get_nodeType(child, &type); if(FAILED(hr) || type == NODE_ATTRIBUTE) { if (outChild) *outChild = NULL; @@ -877,6 +888,8 @@ HRESULT node_get_xml(xmlnode *This, BOOL ensure_eol, BSTR *ret) return *ret ? S_OK : E_OUTOFMEMORY; } +#ifdef SONAME_LIBXSLT + /* duplicates xmlBufferWriteQuotedString() logic */ static void xml_write_quotedstring(xmlOutputBufferPtr buf, const xmlChar *string) { @@ -886,7 +899,7 @@ static void xml_write_quotedstring(xmlOutputBufferPtr buf, const xmlChar *string { if (xmlStrchr(string, '\'')) { - xmlOutputBufferWrite(buf, 1, "\""); + xmlOutputBufferWrite(buf, 1, "\""); base = cur = string; while (*cur) @@ -904,13 +917,13 @@ static void xml_write_quotedstring(xmlOutputBufferPtr buf, const xmlChar *string } if (base != cur) xmlOutputBufferWrite(buf, cur-base, (const char*)base); - xmlOutputBufferWrite(buf, 1, "\""); - } + xmlOutputBufferWrite(buf, 1, "\""); + } else { - xmlOutputBufferWrite(buf, 1, "\'"); + xmlOutputBufferWrite(buf, 1, "\'"); xmlOutputBufferWriteString(buf, (const char*)string); - xmlOutputBufferWrite(buf, 1, "\'"); + xmlOutputBufferWrite(buf, 1, "\'"); } } else @@ -921,6 +934,112 @@ static void xml_write_quotedstring(xmlOutputBufferPtr buf, const xmlChar *string } } +static int XMLCALL transform_to_stream_write(void *context, const char *buffer, int len) +{ + DWORD written; + HRESULT hr = IStream_Write((IStream*)context, buffer, len, &written); + return hr == S_OK ? written : -1; +} + +/* Output for method "text" */ +static void transform_write_text(xmlDocPtr result, xsltStylesheetPtr style, xmlOutputBufferPtr output) +{ + xmlNodePtr cur = result->children; + while (cur) + { + if (cur->type == XML_TEXT_NODE) + xmlOutputBufferWriteString(output, (const char*)cur->content); + + /* skip to next node */ + if (cur->children) + { + if ((cur->children->type != XML_ENTITY_DECL) && + (cur->children->type != XML_ENTITY_REF_NODE) && + (cur->children->type != XML_ENTITY_NODE)) + { + cur = cur->children; + continue; + } + } + + if (cur->next) { + cur = cur->next; + continue; + } + + do + { + cur = cur->parent; + if (cur == NULL) + break; + if (cur == (xmlNodePtr) style->doc) { + cur = NULL; + break; + } + if (cur->next) { + cur = cur->next; + break; + } + } while (cur); + } +} + +#undef XSLT_GET_IMPORT_PTR +#define XSLT_GET_IMPORT_PTR(res, style, name) { \ + xsltStylesheetPtr st = style; \ + res = NULL; \ + while (st != NULL) { \ + if (st->name != NULL) { res = st->name; break; } \ + st = pxsltNextImport(st); \ + }} + +#undef XSLT_GET_IMPORT_INT +#define XSLT_GET_IMPORT_INT(res, style, name) { \ + xsltStylesheetPtr st = style; \ + res = -1; \ + while (st != NULL) { \ + if (st->name != -1) { res = st->name; break; } \ + st = pxsltNextImport(st); \ + }} + +static void transform_write_xmldecl(xmlDocPtr result, xsltStylesheetPtr style, BOOL omit_encoding, xmlOutputBufferPtr output) +{ + int omit_xmldecl, standalone; + + XSLT_GET_IMPORT_INT(omit_xmldecl, style, omitXmlDeclaration); + if (omit_xmldecl == 1) return; + + XSLT_GET_IMPORT_INT(standalone, style, standalone); + + xmlOutputBufferWriteString(output, "version) + { + xmlOutputBufferWriteString(output, "\""); + xmlOutputBufferWriteString(output, (const char *)result->version); + xmlOutputBufferWriteString(output, "\""); + } + else + xmlOutputBufferWriteString(output, "\"1.0\""); + + if (!omit_encoding) + { + const xmlChar *encoding; + + /* default encoding is UTF-16 */ + XSLT_GET_IMPORT_PTR(encoding, style, encoding); + xmlOutputBufferWriteString(output, " encoding="); + xmlOutputBufferWriteString(output, "\""); + xmlOutputBufferWriteString(output, encoding ? (const char *)encoding : "UTF-16"); + xmlOutputBufferWriteString(output, "\""); + } + + /* standalone attribute */ + if (standalone != -1) + xmlOutputBufferWriteString(output, standalone == 0 ? " standalone=\"no\"" : " standalone=\"yes\""); + + xmlOutputBufferWriteString(output, "?>"); +} + static void htmldtd_dumpcontent(xmlOutputBufferPtr buf, xmlDocPtr doc) { xmlDtdPtr cur = doc->intSubset; @@ -935,7 +1054,7 @@ static void htmldtd_dumpcontent(xmlOutputBufferPtr buf, xmlDocPtr doc) { xmlOutputBufferWriteString(buf, " "); xml_write_quotedstring(buf, cur->SystemID); - } + } } else if (cur->SystemID) { @@ -945,7 +1064,8 @@ static void htmldtd_dumpcontent(xmlOutputBufferPtr buf, xmlDocPtr doc) xmlOutputBufferWriteString(buf, ">\n"); } -static void htmldoc_dumpcontent(xmlOutputBufferPtr buf, xmlDocPtr doc) +/* Duplicates htmlDocContentDumpFormatOutput() the way we need it - doesn't add trailing newline. */ +static void htmldoc_dumpcontent(xmlOutputBufferPtr buf, xmlDocPtr doc, const char *encoding, int format) { xmlElementType type; @@ -954,33 +1074,155 @@ static void htmldoc_dumpcontent(xmlOutputBufferPtr buf, xmlDocPtr doc) doc->type = XML_HTML_DOCUMENT_NODE; if (doc->intSubset) htmldtd_dumpcontent(buf, doc); - if (doc->children) - { + if (doc->children) { xmlNodePtr cur = doc->children; - - while (cur) - { - htmlNodeDumpFormatOutput(buf, doc, cur, NULL, 1); + while (cur) { + htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format); cur = cur->next; } - } doc->type = type; } -static const xmlChar *get_output_buffer_content(xmlOutputBufferPtr output) +static inline BOOL transform_is_empty_resultdoc(xmlDocPtr result) { -#ifdef LIBXML2_NEW_BUFFER - return xmlOutputBufferGetContent(output); -#else - return xmlBufferContent(output->buffer); -#endif + return !result->children || ((result->children->type == XML_DTD_NODE) && !result->children->next); } -HRESULT node_transform_node(const xmlnode *This, IXMLDOMNode *stylesheet, BSTR *p) +static inline BOOL transform_is_valid_method(xsltStylesheetPtr style) +{ + return !style->methodURI || !(style->method && xmlStrEqual(style->method, (const xmlChar *)"xhtml")); +} + +/* Helper to write transformation result to specified output buffer. */ +static HRESULT node_transform_write(xsltStylesheetPtr style, xmlDocPtr result, BOOL omit_encoding, const char *encoding, xmlOutputBufferPtr output) +{ + const xmlChar *method; + int indent; + + if (!transform_is_valid_method(style)) + { + ERR("unknown output method\n"); + return E_FAIL; + } + + XSLT_GET_IMPORT_PTR(method, style, method) + XSLT_GET_IMPORT_INT(indent, style, indent); + + if (!method && (result->type == XML_HTML_DOCUMENT_NODE)) + method = (const xmlChar *) "html"; + + if (method && xmlStrEqual(method, (const xmlChar *)"html")) + { + htmlSetMetaEncoding(result, (const xmlChar *)encoding); + if (indent == -1) + indent = 1; + htmldoc_dumpcontent(output, result, (const char*)encoding, indent); + } + else if (method && xmlStrEqual(method, (const xmlChar *)"xhtml")) + { + htmlSetMetaEncoding(result, (const xmlChar *) encoding); + htmlDocContentDumpOutput(output, result, encoding); + } + else if (method && xmlStrEqual(method, (const xmlChar *)"text")) + transform_write_text(result, style, output); + else + { + transform_write_xmldecl(result, style, omit_encoding, output); + + if (result->children) + { + xmlNodePtr child = result->children; + + while (child) + { + xmlNodeDumpOutput(output, result, child, 0, indent == 1, encoding); + if (indent && ((child->type == XML_DTD_NODE) || ((child->type == XML_COMMENT_NODE) && child->next))) + xmlOutputBufferWriteString(output, "\r\n"); + child = child->next; + } + } + } + + xmlOutputBufferFlush(output); + return S_OK; +} + +/* For BSTR output is always UTF-16, without 'encoding' attribute */ +static HRESULT node_transform_write_to_bstr(xsltStylesheetPtr style, xmlDocPtr result, BSTR *str) +{ + HRESULT hr = S_OK; + + if (transform_is_empty_resultdoc(result)) + *str = SysAllocStringLen(NULL, 0); + else + { + xmlOutputBufferPtr output = xmlAllocOutputBuffer(xmlFindCharEncodingHandler("UTF-16")); + const xmlChar *content; + size_t len; + + *str = NULL; + if (!output) + return E_OUTOFMEMORY; + + hr = node_transform_write(style, result, TRUE, "UTF-16", output); +#ifdef LIBXML2_NEW_BUFFER + content = xmlBufContent(output->conv); + len = xmlBufUse(output->conv); +#else + content = xmlBufferContent(output->conv); + len = xmlBufferLength(output->conv); +#endif + /* UTF-16 encoder places UTF-16 bom, we don't need it for BSTR */ + content += sizeof(WCHAR); + *str = SysAllocStringLen((WCHAR*)content, len/sizeof(WCHAR) - 1); + xmlOutputBufferClose(output); + } + + return *str ? hr : E_OUTOFMEMORY; +} + +static HRESULT node_transform_write_to_stream(xsltStylesheetPtr style, xmlDocPtr result, IStream *stream) +{ + static const xmlChar *utf16 = (const xmlChar*)"UTF-16"; + xmlOutputBufferPtr output; + const xmlChar *encoding; + HRESULT hr; + + if (transform_is_empty_resultdoc(result)) + { + WARN("empty result document\n"); + return S_OK; + } + + if (style->methodURI && (!style->method || !xmlStrEqual(style->method, (const xmlChar *) "xhtml"))) + { + ERR("unknown output method\n"); + return E_FAIL; + } + + /* default encoding is UTF-16 */ + XSLT_GET_IMPORT_PTR(encoding, style, encoding); + if (!encoding) + encoding = utf16; + + output = xmlOutputBufferCreateIO(transform_to_stream_write, NULL, stream, xmlFindCharEncodingHandler((const char*)encoding)); + if (!output) + return E_OUTOFMEMORY; + + hr = node_transform_write(style, result, FALSE, (const char*)encoding, output); + xmlOutputBufferClose(output); + return hr; +} + +#endif + +HRESULT node_transform_node_params(const xmlnode *This, IXMLDOMNode *stylesheet, BSTR *p, + IStream *stream, const struct xslprocessor_params *params) { #ifdef SONAME_LIBXSLT xsltStylesheetPtr xsltSS; + HRESULT hr = S_OK; xmlnode *sheet; if (!libxslt_handle) return E_NOTIMPL; @@ -994,36 +1236,47 @@ HRESULT node_transform_node(const xmlnode *This, IXMLDOMNode *stylesheet, BSTR * xsltSS = pxsltParseStylesheetDoc(sheet->node->doc); if(xsltSS) { - xmlDocPtr result = pxsltApplyStylesheet(xsltSS, This->node->doc, NULL); - if(result) - { - const xmlChar *content; + const char **xslparams = NULL; + xmlDocPtr result; + unsigned int i; - if(result->type == XML_HTML_DOCUMENT_NODE) + /* convert our parameter list to libxml2 format */ + if (params && params->count) + { + struct xslprocessor_par *par; + + i = 0; + xslparams = heap_alloc((params->count*2 + 1)*sizeof(char*)); + LIST_FOR_EACH_ENTRY(par, ¶ms->list, struct xslprocessor_par, entry) { - xmlOutputBufferPtr output = xmlAllocOutputBuffer(NULL); - if (output) - { - htmldoc_dumpcontent(output, result->doc); - content = get_output_buffer_content(output); - *p = bstr_from_xmlChar(content); - xmlOutputBufferClose(output); - } + xslparams[i++] = (char*)xmlchar_from_wchar(par->name); + xslparams[i++] = (char*)xmlchar_from_wchar(par->value); } + xslparams[i] = NULL; + } + + if (xslparams) + { + xsltTransformContextPtr ctxt = pxsltNewTransformContext(xsltSS, This->node->doc); + + /* push parameters to user context */ + pxsltQuoteUserParams(ctxt, xslparams); + result = pxsltApplyStylesheetUser(xsltSS, This->node->doc, NULL, NULL, NULL, ctxt); + pxsltFreeTransformContext(ctxt); + + for (i = 0; i < params->count*2; i++) + heap_free((char*)xslparams[i]); + heap_free(xslparams); + } + else + result = pxsltApplyStylesheet(xsltSS, This->node->doc, NULL); + + if (result) + { + if (stream) + hr = node_transform_write_to_stream(xsltSS, result, stream); else - { - xmlBufferPtr buf = xmlBufferCreate(); - if (buf) - { - int size = xmlNodeDump(buf, NULL, (xmlNodePtr)result, 0, 0); - if(size > 0) - { - content = xmlBufferContent(buf); - *p = bstr_from_xmlChar(content); - } - xmlBufferFree(buf); - } - } + hr = node_transform_write_to_bstr(xsltSS, result, p); xmlFreeDoc(result); } /* libxslt "helpfully" frees the XML document the stylesheet was @@ -1034,13 +1287,18 @@ HRESULT node_transform_node(const xmlnode *This, IXMLDOMNode *stylesheet, BSTR * if(!*p) *p = SysAllocStringLen(NULL, 0); - return S_OK; + return hr; #else FIXME("libxslt headers were not found at compile time\n"); return E_NOTIMPL; #endif } +HRESULT node_transform_node(const xmlnode *node, IXMLDOMNode *stylesheet, BSTR *p) +{ + return node_transform_node_params(node, stylesheet, p, NULL, NULL); +} + HRESULT node_select_nodes(const xmlnode *This, BSTR query, IXMLDOMNodeList **nodes) { xmlChar* str; @@ -1134,7 +1392,6 @@ void destroy_xmlnode(xmlnode *This) xmlnode_release(This->node); xmldoc_release(This->node->doc); } - release_dispex(&This->dispex); } void init_xmlnode(xmlnode *This, xmlNodePtr node, IXMLDOMNode *node_iface, dispex_static_data_t *dispex_data) diff --git a/dll/win32/msxml3/nodelist.c b/dll/win32/msxml3/nodelist.c index 171d2a37a0d..f52357019de 100644 --- a/dll/win32/msxml3/nodelist.c +++ b/dll/win32/msxml3/nodelist.c @@ -68,6 +68,7 @@ static HRESULT WINAPI xmlnodelist_QueryInterface( TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); +#ifdef __REACTOS__ if (!ppvObject) { /* NOTE: Interface documentation for IUnknown explicitly states @@ -76,6 +77,7 @@ static HRESULT WINAPI xmlnodelist_QueryInterface( */ return E_INVALIDARG; } +#endif if ( IsEqualGUID( riid, &IID_IUnknown ) || IsEqualGUID( riid, &IID_IDispatch ) || diff --git a/dll/win32/msxml3/nodemap.c b/dll/win32/msxml3/nodemap.c index 9924d8c5342..bdb1942caa7 100644 --- a/dll/win32/msxml3/nodemap.c +++ b/dll/win32/msxml3/nodemap.c @@ -122,7 +122,6 @@ static ULONG WINAPI xmlnodemap_Release( { xmldoc_release( This->node->doc ); if (This->enumvariant) IEnumVARIANT_Release(This->enumvariant); - release_dispex(&This->dispex); heap_free( This ); } diff --git a/dll/win32/msxml3/parseerror.c b/dll/win32/msxml3/parseerror.c index 100c86a0d86..13fcb97402e 100644 --- a/dll/win32/msxml3/parseerror.c +++ b/dll/win32/msxml3/parseerror.c @@ -87,7 +87,6 @@ static ULONG WINAPI parseError_Release( SysFreeString(This->url); SysFreeString(This->reason); SysFreeString(This->srcText); - release_dispex(&This->dispex); heap_free( This ); } diff --git a/dll/win32/msxml3/saxreader.c b/dll/win32/msxml3/saxreader.c index 4ba8c18eee0..dc38cb90b97 100644 --- a/dll/win32/msxml3/saxreader.c +++ b/dll/win32/msxml3/saxreader.c @@ -320,7 +320,7 @@ static inline saxlocator *impl_from_ISAXAttributes( ISAXAttributes *iface ) return CONTAINING_RECORD(iface, saxlocator, ISAXAttributes_iface); } -static inline int saxreader_has_handler(const saxlocator *locator, enum saxhandler_type type) +static inline BOOL saxreader_has_handler(const saxlocator *locator, enum saxhandler_type type) { struct saxanyhandler_iface *iface = &locator->saxreader->saxhandlers[type].u.anyhandler; return (locator->vbInterface && iface->vbhandler) || (!locator->vbInterface && iface->handler); @@ -468,6 +468,7 @@ static void free_element_entry(element_entry *element) SysFreeString(element->prefix); SysFreeString(element->local); + SysFreeString(element->qname); heap_free(element->ns); heap_free(element); @@ -682,7 +683,6 @@ static void update_position(saxlocator *This, BOOL fix_column) } /*** IVBSAXAttributes interface ***/ -/*** IUnknown methods ***/ static HRESULT WINAPI ivbsaxattributes_QueryInterface( IVBSAXAttributes* iface, REFIID riid, @@ -696,16 +696,15 @@ static HRESULT WINAPI ivbsaxattributes_QueryInterface( static ULONG WINAPI ivbsaxattributes_AddRef(IVBSAXAttributes* iface) { saxlocator *This = impl_from_IVBSAXAttributes(iface); - return ISAXLocator_AddRef(&This->ISAXLocator_iface); + return IVBSAXLocator_AddRef(&This->IVBSAXLocator_iface); } static ULONG WINAPI ivbsaxattributes_Release(IVBSAXAttributes* iface) { saxlocator *This = impl_from_IVBSAXAttributes(iface); - return ISAXLocator_Release(&This->ISAXLocator_iface); + return IVBSAXLocator_Release(&This->IVBSAXLocator_iface); } -/*** IDispatch methods ***/ static HRESULT WINAPI ivbsaxattributes_GetTypeInfoCount( IVBSAXAttributes *iface, UINT* pctinfo ) { saxlocator *This = impl_from_IVBSAXAttributes( iface ); @@ -722,13 +721,10 @@ static HRESULT WINAPI ivbsaxattributes_GetTypeInfo( UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo ) { saxlocator *This = impl_from_IVBSAXAttributes( iface ); - HRESULT hr; TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); - hr = get_typeinfo(IVBSAXAttributes_tid, ppTInfo); - - return hr; + return get_typeinfo(IVBSAXAttributes_tid, ppTInfo); } static HRESULT WINAPI ivbsaxattributes_GetIDsOfNames( @@ -802,20 +798,45 @@ static HRESULT WINAPI ivbsaxattributes_getURI( int nIndex, BSTR *uri) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getURI(&This->ISAXAttributes_iface, nIndex, (const WCHAR**)uri, &len); + const WCHAR *uriW; + HRESULT hr; + int len; + + TRACE("(%p)->(%d %p)\n", This, nIndex, uri); + + if (!uri) + return E_POINTER; + + *uri = NULL; + hr = ISAXAttributes_getURI(&This->ISAXAttributes_iface, nIndex, &uriW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(uriW, len, uri); } static HRESULT WINAPI ivbsaxattributes_getLocalName( IVBSAXAttributes* iface, int nIndex, - BSTR *localName) + BSTR *name) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getLocalName(&This->ISAXAttributes_iface, nIndex, - (const WCHAR**)localName, &len); + const WCHAR *nameW; + HRESULT hr; + int len; + + TRACE("(%p)->(%d %p)\n", This, nIndex, name); + + if (!name) + return E_POINTER; + + *name = NULL; + hr = ISAXAttributes_getLocalName(&This->ISAXAttributes_iface, nIndex, &nameW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(nameW, len, name); } static HRESULT WINAPI ivbsaxattributes_getQName( @@ -823,9 +844,22 @@ static HRESULT WINAPI ivbsaxattributes_getQName( int nIndex, BSTR *QName) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getQName(&This->ISAXAttributes_iface, nIndex, (const WCHAR**)QName, &len); + const WCHAR *nameW; + HRESULT hr; + int len; + + TRACE("(%p)->(%d %p)\n", This, nIndex, QName); + + if (!QName) + return E_POINTER; + + *QName = NULL; + hr = ISAXAttributes_getQName(&This->ISAXAttributes_iface, nIndex, &nameW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(nameW, len, QName); } static HRESULT WINAPI ivbsaxattributes_getIndexFromName( @@ -854,9 +888,22 @@ static HRESULT WINAPI ivbsaxattributes_getType( int nIndex, BSTR *type) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getType(&This->ISAXAttributes_iface, nIndex, (const WCHAR**)type, &len); + const WCHAR *typeW; + HRESULT hr; + int len; + + TRACE("(%p)->(%d %p)\n", This, nIndex, type); + + if (!type) + return E_POINTER; + + *type = NULL; + hr = ISAXAttributes_getType(&This->ISAXAttributes_iface, nIndex, &typeW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(typeW, len, type); } static HRESULT WINAPI ivbsaxattributes_getTypeFromName( @@ -865,10 +912,23 @@ static HRESULT WINAPI ivbsaxattributes_getTypeFromName( BSTR localName, BSTR *type) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getTypeFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), - localName, SysStringLen(localName), (const WCHAR**)type, &len); + const WCHAR *typeW; + HRESULT hr; + int len; + + TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(uri), debugstr_w(localName), type); + + if (!type) + return E_POINTER; + + *type = NULL; + hr = ISAXAttributes_getTypeFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), + localName, SysStringLen(localName), &typeW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(typeW, len, type); } static HRESULT WINAPI ivbsaxattributes_getTypeFromQName( @@ -876,10 +936,23 @@ static HRESULT WINAPI ivbsaxattributes_getTypeFromQName( BSTR QName, BSTR *type) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getTypeFromQName(&This->ISAXAttributes_iface, QName, SysStringLen(QName), - (const WCHAR**)type, &len); + const WCHAR *typeW; + HRESULT hr; + int len; + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(QName), type); + + if (!type) + return E_POINTER; + + *type = NULL; + hr = ISAXAttributes_getTypeFromQName(&This->ISAXAttributes_iface, QName, SysStringLen(QName), + &typeW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(typeW, len, type); } static HRESULT WINAPI ivbsaxattributes_getValue( @@ -887,9 +960,22 @@ static HRESULT WINAPI ivbsaxattributes_getValue( int nIndex, BSTR *value) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getValue(&This->ISAXAttributes_iface, nIndex, (const WCHAR**)value, &len); + const WCHAR *valueW; + HRESULT hr; + int len; + + TRACE("(%p)->(%d %p)\n", This, nIndex, value); + + if (!value) + return E_POINTER; + + *value = NULL; + hr = ISAXAttributes_getValue(&This->ISAXAttributes_iface, nIndex, &valueW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(valueW, len, value); } static HRESULT WINAPI ivbsaxattributes_getValueFromName( @@ -898,10 +984,23 @@ static HRESULT WINAPI ivbsaxattributes_getValueFromName( BSTR localName, BSTR *value) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getValueFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), - localName, SysStringLen(localName), (const WCHAR**)value, &len); + const WCHAR *valueW; + HRESULT hr; + int len; + + TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(uri), debugstr_w(localName), value); + + if (!value) + return E_POINTER; + + *value = NULL; + hr = ISAXAttributes_getValueFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), + localName, SysStringLen(localName), &valueW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(valueW, len, value); } static HRESULT WINAPI ivbsaxattributes_getValueFromQName( @@ -909,10 +1008,23 @@ static HRESULT WINAPI ivbsaxattributes_getValueFromQName( BSTR QName, BSTR *value) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getValueFromQName(&This->ISAXAttributes_iface, QName, - SysStringLen(QName), (const WCHAR**)value, &len); + const WCHAR *valueW; + HRESULT hr; + int len; + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(QName), value); + + if (!value) + return E_POINTER; + + *value = NULL; + hr = ISAXAttributes_getValueFromQName(&This->ISAXAttributes_iface, QName, + SysStringLen(QName), &valueW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(valueW, len, value); } static const struct IVBSAXAttributesVtbl ivbsaxattributes_vtbl = @@ -1285,6 +1397,23 @@ static BSTR saxreader_get_unescaped_value(const xmlChar *buf, int len) return bstr; } +static void free_attribute_values(saxlocator *locator) +{ + int i; + + for (i = 0; i < locator->nb_attributes; i++) + { + SysFreeString(locator->attributes[i].szLocalname); + locator->attributes[i].szLocalname = NULL; + + SysFreeString(locator->attributes[i].szValue); + locator->attributes[i].szValue = NULL; + + SysFreeString(locator->attributes[i].szQName); + locator->attributes[i].szQName = NULL; + } +} + static HRESULT SAXAttributes_populate(saxlocator *locator, int nb_namespaces, const xmlChar **xmlNamespaces, int nb_attributes, const xmlChar **xmlAttributes) @@ -1302,13 +1431,16 @@ static HRESULT SAXAttributes_populate(saxlocator *locator, locator->nb_attributes = nb_namespaces + nb_attributes; if(locator->nb_attributes > locator->attributesSize) { - attrs = heap_realloc(locator->attributes, sizeof(struct _attributes)*locator->nb_attributes*2); + int new_size = locator->attributesSize * 2; + attrs = heap_realloc_zero(locator->attributes, new_size * sizeof(struct _attributes)); if(!attrs) { + free_attribute_values(locator); locator->nb_attributes = 0; return E_OUTOFMEMORY; } locator->attributes = attrs; + locator->attributesSize = new_size; } else { @@ -1317,9 +1449,15 @@ static HRESULT SAXAttributes_populate(saxlocator *locator, for (i = 0; i < nb_namespaces; i++) { + SysFreeString(attrs[nb_attributes+i].szLocalname); attrs[nb_attributes+i].szLocalname = SysAllocStringLen(NULL, 0); + attrs[nb_attributes+i].szURI = locator->namespaceUri; + + SysFreeString(attrs[nb_attributes+i].szValue); attrs[nb_attributes+i].szValue = bstr_from_xmlChar(xmlNamespaces[2*i+1]); + + SysFreeString(attrs[nb_attributes+i].szQName); if(!xmlNamespaces[2*i]) attrs[nb_attributes+i].szQName = SysAllocString(xmlnsW); else @@ -1336,10 +1474,14 @@ static HRESULT SAXAttributes_populate(saxlocator *locator, /* that's an important feature to keep same uri pointer for every reported attribute */ attrs[i].szURI = find_element_uri(locator, xmlAttributes[i*5+2]); + SysFreeString(attrs[i].szLocalname); attrs[i].szLocalname = bstr_from_xmlChar(xmlAttributes[i*5]); + + SysFreeString(attrs[i].szValue); attrs[i].szValue = saxreader_get_unescaped_value(xmlAttributes[i*5+3], xmlAttributes[i*5+4]-xmlAttributes[i*5+3]); - attrs[i].szQName = QName_from_xmlChar(xmlAttributes[i*5+1], - xmlAttributes[i*5]); + + SysFreeString(attrs[i].szQName); + attrs[i].szQName = QName_from_xmlChar(xmlAttributes[i*5+1], xmlAttributes[i*5]); } return S_OK; @@ -1541,6 +1683,7 @@ static void libxmlEndElementNS( if (!saxreader_has_handler(This, SAXContentHandler)) { + free_attribute_values(This); This->nb_attributes = 0; free_element_entry(element); return; @@ -1562,6 +1705,7 @@ static void libxmlEndElementNS( local, SysStringLen(local), element->qname, SysStringLen(element->qname)); + free_attribute_values(This); This->nb_attributes = 0; if (sax_callback_failed(This, hr)) @@ -1946,14 +2090,13 @@ static ULONG WINAPI ivbsaxlocator_AddRef(IVBSAXLocator* iface) { saxlocator *This = impl_from_IVBSAXLocator( iface ); TRACE("%p\n", This ); - return InterlockedIncrement( &This->ref ); + return ISAXLocator_AddRef(&This->ISAXLocator_iface); } -static ULONG WINAPI ivbsaxlocator_Release( - IVBSAXLocator* iface) +static ULONG WINAPI ivbsaxlocator_Release(IVBSAXLocator* iface) { saxlocator *This = impl_from_IVBSAXLocator( iface ); - return ISAXLocator_Release((ISAXLocator*)&This->IVBSAXLocator_iface); + return ISAXLocator_Release(&This->ISAXLocator_iface); } /*** IDispatch methods ***/ @@ -1973,13 +2116,10 @@ static HRESULT WINAPI ivbsaxlocator_GetTypeInfo( UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo ) { saxlocator *This = impl_from_IVBSAXLocator( iface ); - HRESULT hr; TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); - hr = get_typeinfo(IVBSAXLocator_tid, ppTInfo); - - return hr; + return get_typeinfo(IVBSAXLocator_tid, ppTInfo); } static HRESULT WINAPI ivbsaxlocator_GetIDsOfNames( @@ -2045,7 +2185,7 @@ static HRESULT WINAPI ivbsaxlocator_get_columnNumber( int *pnColumn) { saxlocator *This = impl_from_IVBSAXLocator( iface ); - return ISAXLocator_getColumnNumber((ISAXLocator*)&This->IVBSAXLocator_iface, pnColumn); + return ISAXLocator_getColumnNumber(&This->ISAXLocator_iface, pnColumn); } static HRESULT WINAPI ivbsaxlocator_get_lineNumber( @@ -2053,25 +2193,45 @@ static HRESULT WINAPI ivbsaxlocator_get_lineNumber( int *pnLine) { saxlocator *This = impl_from_IVBSAXLocator( iface ); - return ISAXLocator_getLineNumber((ISAXLocator*)&This->IVBSAXLocator_iface, pnLine); + return ISAXLocator_getLineNumber(&This->ISAXLocator_iface, pnLine); } -static HRESULT WINAPI ivbsaxlocator_get_publicId( - IVBSAXLocator* iface, - BSTR* publicId) +static HRESULT WINAPI ivbsaxlocator_get_publicId(IVBSAXLocator* iface, BSTR *ret) { saxlocator *This = impl_from_IVBSAXLocator( iface ); - return ISAXLocator_getPublicId((ISAXLocator*)&This->IVBSAXLocator_iface, - (const WCHAR**)publicId); + const WCHAR *publicidW; + HRESULT hr; + + TRACE("(%p)->(%p)\n", This, ret); + + if (!ret) + return E_POINTER; + + *ret = NULL; + hr = ISAXLocator_getPublicId(&This->ISAXLocator_iface, &publicidW); + if (FAILED(hr)) + return hr; + + return return_bstr(publicidW, ret); } -static HRESULT WINAPI ivbsaxlocator_get_systemId( - IVBSAXLocator* iface, - BSTR* systemId) +static HRESULT WINAPI ivbsaxlocator_get_systemId(IVBSAXLocator* iface, BSTR *ret) { saxlocator *This = impl_from_IVBSAXLocator( iface ); - return ISAXLocator_getSystemId((ISAXLocator*)&This->IVBSAXLocator_iface, - (const WCHAR**)systemId); + const WCHAR *systemidW; + HRESULT hr; + + TRACE("(%p)->(%p)\n", This, ret); + + if (!ret) + return E_POINTER; + + *ret = NULL; + hr = ISAXLocator_getSystemId(&This->ISAXLocator_iface, &systemidW); + if (FAILED(hr)) + return hr; + + return return_bstr(systemidW, ret); } static const struct IVBSAXLocatorVtbl VBSAXLocatorVtbl = @@ -2144,7 +2304,7 @@ static ULONG WINAPI isaxlocator_Release( SysFreeString(This->systemId); SysFreeString(This->namespaceUri); - for(index=0; indexnb_attributes; index++) + for(index=0; indexattributesSize; index++) { SysFreeString(This->attributes[index].szLocalname); SysFreeString(This->attributes[index].szValue); @@ -2282,7 +2442,7 @@ static HRESULT SAXLocator_create(saxreader *reader, saxlocator **ppsaxlocator, B locator->attributesSize = 8; locator->nb_attributes = 0; - locator->attributes = heap_alloc(sizeof(struct _attributes)*locator->attributesSize); + locator->attributes = heap_alloc_zero(sizeof(struct _attributes)*locator->attributesSize); if(!locator->attributes) { ISAXXMLReader_Release(&reader->ISAXXMLReader_iface); @@ -2389,7 +2549,7 @@ static HRESULT internal_parseStream(saxreader *This, ISequentialStream *stream, saxlocator *locator; HRESULT hr; ULONG dataRead; - char data[1024]; + char data[2048]; int ret; dataRead = 0; @@ -2410,32 +2570,21 @@ static HRESULT internal_parseStream(saxreader *This, ISequentialStream *stream, This->isParsing = TRUE; - if(dataRead != sizeof(data)) + do { + dataRead = 0; + hr = ISequentialStream_Read(stream, data, sizeof(data), &dataRead); + if (FAILED(hr) || !dataRead) break; + + ret = xmlParseChunk(locator->pParserCtxt, data, dataRead, 0); + hr = ret!=XML_ERR_OK && locator->ret==S_OK ? E_FAIL : locator->ret; + }while(hr == S_OK); + + if(SUCCEEDED(hr)) { ret = xmlParseChunk(locator->pParserCtxt, data, 0, 1); hr = ret!=XML_ERR_OK && locator->ret==S_OK ? E_FAIL : locator->ret; } - else - { - while(1) - { - dataRead = 0; - hr = ISequentialStream_Read(stream, data, sizeof(data), &dataRead); - if (FAILED(hr)) break; - ret = xmlParseChunk(locator->pParserCtxt, data, dataRead, 0); - hr = ret!=XML_ERR_OK && locator->ret==S_OK ? E_FAIL : locator->ret; - - if (hr != S_OK) break; - - if (dataRead != sizeof(data)) - { - ret = xmlParseChunk(locator->pParserCtxt, data, 0, 1); - hr = ret!=XML_ERR_OK && locator->ret==S_OK ? E_FAIL : locator->ret; - break; - } - } - } This->isParsing = FALSE; @@ -2460,9 +2609,12 @@ static HRESULT internal_parse( switch(V_VT(&varInput)) { case VT_BSTR: - hr = internal_parseBuffer(This, (const char*)V_BSTR(&varInput), - strlenW(V_BSTR(&varInput))*sizeof(WCHAR), vbInterface); + case VT_BSTR|VT_BYREF: + { + BSTR str = V_ISBYREF(&varInput) ? *V_BSTRREF(&varInput) : V_BSTR(&varInput); + hr = internal_parseBuffer(This, (const char*)str, strlenW(str)*sizeof(WCHAR), vbInterface); break; + } case VT_ARRAY|VT_UI1: { void *pSAData; LONG lBound, uBound; @@ -2587,99 +2739,85 @@ static HRESULT internal_parseURL( return detach_bsc(bsc); } +static HRESULT saxreader_put_handler_from_variant(saxreader *This, enum saxhandler_type type, const VARIANT *v, BOOL vb) +{ + const IID *riid; + + if (V_VT(v) == VT_EMPTY) + return saxreader_put_handler(This, type, NULL, vb); + + switch (type) + { + case SAXDeclHandler: + riid = vb ? &IID_IVBSAXDeclHandler : &IID_ISAXDeclHandler; + break; + case SAXLexicalHandler: + riid = vb ? &IID_IVBSAXLexicalHandler : &IID_ISAXLexicalHandler; + break; + default: + ERR("wrong handler type %d\n", type); + return E_FAIL; + } + + switch (V_VT(v)) + { + case VT_DISPATCH: + case VT_UNKNOWN: + { + IUnknown *handler = NULL; + + if (V_UNKNOWN(v)) + { + HRESULT hr = IUnknown_QueryInterface(V_UNKNOWN(v), riid, (void**)&handler); + if (FAILED(hr)) return hr; + } + + saxreader_put_handler(This, type, handler, vb); + if (handler) IUnknown_Release(handler); + break; + } + default: + ERR("value type %d not supported\n", V_VT(v)); + return E_INVALIDARG; + } + + return S_OK; +} + static HRESULT internal_putProperty( saxreader* This, const WCHAR *prop, VARIANT value, BOOL vbInterface) { + VARIANT *v; + TRACE("(%p)->(%s %s)\n", This, debugstr_w(prop), debugstr_variant(&value)); + if (This->isParsing) return E_FAIL; + + v = V_VT(&value) == (VT_VARIANT|VT_BYREF) ? V_VARIANTREF(&value) : &value; if(!memcmp(prop, PropertyDeclHandlerW, sizeof(PropertyDeclHandlerW))) - { - if(This->isParsing) return E_FAIL; - - switch (V_VT(&value)) - { - case VT_EMPTY: - saxreader_put_handler(This, SAXDeclHandler, NULL, vbInterface); - break; - case VT_UNKNOWN: - { - IUnknown *handler = NULL; - - if (V_UNKNOWN(&value)) - { - HRESULT hr; - - if (vbInterface) - hr = IUnknown_QueryInterface(V_UNKNOWN(&value), &IID_IVBSAXDeclHandler, (void**)&handler); - else - hr = IUnknown_QueryInterface(V_UNKNOWN(&value), &IID_ISAXDeclHandler, (void**)&handler); - if (FAILED(hr)) return hr; - } - - saxreader_put_handler(This, SAXDeclHandler, handler, vbInterface); - if (handler) IUnknown_Release(handler); - break; - } - default: - return E_INVALIDARG; - } - - return S_OK; - } + return saxreader_put_handler_from_variant(This, SAXDeclHandler, v, vbInterface); if(!memcmp(prop, PropertyLexicalHandlerW, sizeof(PropertyLexicalHandlerW))) - { - if(This->isParsing) return E_FAIL; - - switch (V_VT(&value)) - { - case VT_EMPTY: - saxreader_put_handler(This, SAXLexicalHandler, NULL, vbInterface); - break; - case VT_UNKNOWN: - { - IUnknown *handler = NULL; - - if (V_UNKNOWN(&value)) - { - HRESULT hr; - - if (vbInterface) - hr = IUnknown_QueryInterface(V_UNKNOWN(&value), &IID_IVBSAXLexicalHandler, (void**)&handler); - else - hr = IUnknown_QueryInterface(V_UNKNOWN(&value), &IID_ISAXLexicalHandler, (void**)&handler); - if (FAILED(hr)) return hr; - } - - saxreader_put_handler(This, SAXLexicalHandler, handler, vbInterface); - if (handler) IUnknown_Release(handler); - break; - } - default: - return E_INVALIDARG; - } - - return S_OK; - } + return saxreader_put_handler_from_variant(This, SAXLexicalHandler, v, vbInterface); if(!memcmp(prop, PropertyMaxXMLSizeW, sizeof(PropertyMaxXMLSizeW))) { - if (V_VT(&value) == VT_I4 && V_I4(&value) == 0) return S_OK; - FIXME("(%p)->(%s): max-xml-size unsupported\n", This, debugstr_variant(&value)); + if (V_VT(v) == VT_I4 && V_I4(v) == 0) return S_OK; + FIXME("(%p)->(%s): max-xml-size unsupported\n", This, debugstr_variant(v)); return E_NOTIMPL; } if(!memcmp(prop, PropertyMaxElementDepthW, sizeof(PropertyMaxElementDepthW))) { - if (V_VT(&value) == VT_I4 && V_I4(&value) == 0) return S_OK; - FIXME("(%p)->(%s): max-element-depth unsupported\n", This, debugstr_variant(&value)); + if (V_VT(v) == VT_I4 && V_I4(v) == 0) return S_OK; + FIXME("(%p)->(%s): max-element-depth unsupported\n", This, debugstr_variant(v)); return E_NOTIMPL; } - FIXME("(%p)->(%s:%s): unsupported property\n", This, debugstr_w(prop), debugstr_variant(&value)); + FIXME("(%p)->(%s:%s): unsupported property\n", This, debugstr_w(prop), debugstr_variant(v)); if(!memcmp(prop, PropertyCharsetW, sizeof(PropertyCharsetW))) return E_NOTIMPL; @@ -2794,19 +2932,18 @@ static ULONG WINAPI saxxmlreader_Release( for (i = 0; i < SAXHandler_Last; i++) { - struct saxanyhandler_iface *iface = &This->saxhandlers[i].u.anyhandler; + struct saxanyhandler_iface *saxiface = &This->saxhandlers[i].u.anyhandler; - if (iface->handler) - IUnknown_Release(iface->handler); + if (saxiface->handler) + IUnknown_Release(saxiface->handler); - if (iface->vbhandler) - IUnknown_Release(iface->vbhandler); + if (saxiface->vbhandler) + IUnknown_Release(saxiface->vbhandler); } SysFreeString(This->xmldecl_version); free_bstr_pool(&This->pool); - release_dispex(&This->dispex); heap_free( This ); } @@ -2860,56 +2997,25 @@ static HRESULT WINAPI saxxmlreader_Invoke( /*** IVBSAXXMLReader methods ***/ static HRESULT WINAPI saxxmlreader_getFeature( IVBSAXXMLReader* iface, - const WCHAR *feature_name, + BSTR feature_name, VARIANT_BOOL *value) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); - saxreader_feature feature; - - TRACE("(%p)->(%s %p)\n", This, debugstr_w(feature_name), value); - - feature = get_saxreader_feature(feature_name); - if (feature == Namespaces || feature == NamespacePrefixes) - return get_feature_value(This, feature, value); - - FIXME("(%p)->(%s %p) stub\n", This, debugstr_w(feature_name), value); - return E_NOTIMPL; + return ISAXXMLReader_getFeature(&This->ISAXXMLReader_iface, feature_name, value); } static HRESULT WINAPI saxxmlreader_putFeature( IVBSAXXMLReader* iface, - const WCHAR *feature_name, + BSTR feature_name, VARIANT_BOOL value) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); - saxreader_feature feature; - - TRACE("(%p)->(%s %x)\n", This, debugstr_w(feature_name), value); - - feature = get_saxreader_feature(feature_name); - - /* accepted cases */ - if ((feature == ExternalGeneralEntities && value == VARIANT_FALSE) || - (feature == ExternalParameterEntities && value == VARIANT_FALSE) || - feature == Namespaces || - feature == NamespacePrefixes) - { - return set_feature_value(This, feature, value); - } - - if (feature == LexicalHandlerParEntities || feature == ProhibitDTD) - { - FIXME("(%p)->(%s %x) stub\n", This, debugstr_w(feature_name), value); - return set_feature_value(This, feature, value); - } - - FIXME("(%p)->(%s %x) stub\n", This, debugstr_w(feature_name), value); - return E_NOTIMPL; + return ISAXXMLReader_putFeature(&This->ISAXXMLReader_iface, feature_name, value); } static HRESULT WINAPI saxxmlreader_getProperty( IVBSAXXMLReader* iface, - const WCHAR *prop, + BSTR prop, VARIANT *value) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); @@ -2918,7 +3024,7 @@ static HRESULT WINAPI saxxmlreader_getProperty( static HRESULT WINAPI saxxmlreader_putProperty( IVBSAXXMLReader* iface, - const WCHAR *pProp, + BSTR pProp, VARIANT value) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); @@ -2991,7 +3097,7 @@ static HRESULT WINAPI saxxmlreader_put_errorHandler( static HRESULT WINAPI saxxmlreader_get_baseURL( IVBSAXXMLReader* iface, - const WCHAR **pBaseUrl) + BSTR *pBaseUrl) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); @@ -3001,17 +3107,15 @@ static HRESULT WINAPI saxxmlreader_get_baseURL( static HRESULT WINAPI saxxmlreader_put_baseURL( IVBSAXXMLReader* iface, - const WCHAR *pBaseUrl) + BSTR pBaseUrl) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); - - FIXME("(%p)->(%s) stub\n", This, debugstr_w(pBaseUrl)); - return E_NOTIMPL; + return ISAXXMLReader_putBaseURL(&This->ISAXXMLReader_iface, pBaseUrl); } static HRESULT WINAPI saxxmlreader_get_secureBaseURL( IVBSAXXMLReader* iface, - const WCHAR **pSecureBaseUrl) + BSTR *pSecureBaseUrl) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); @@ -3019,15 +3123,12 @@ static HRESULT WINAPI saxxmlreader_get_secureBaseURL( return E_NOTIMPL; } - static HRESULT WINAPI saxxmlreader_put_secureBaseURL( IVBSAXXMLReader* iface, - const WCHAR *secureBaseUrl) + BSTR secureBaseUrl) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); - - FIXME("(%p)->(%s) stub\n", This, debugstr_w(secureBaseUrl)); - return E_NOTIMPL; + return ISAXXMLReader_putSecureBaseURL(&This->ISAXXMLReader_iface, secureBaseUrl); } static HRESULT WINAPI saxxmlreader_parse( @@ -3040,7 +3141,7 @@ static HRESULT WINAPI saxxmlreader_parse( static HRESULT WINAPI saxxmlreader_parseURL( IVBSAXXMLReader* iface, - const WCHAR *url) + BSTR url) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); return internal_parseURL(This, url, TRUE); @@ -3080,38 +3181,69 @@ static const struct IVBSAXXMLReaderVtbl VBSAXXMLReaderVtbl = static HRESULT WINAPI isaxxmlreader_QueryInterface(ISAXXMLReader* iface, REFIID riid, void **ppvObject) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return saxxmlreader_QueryInterface(&This->IVBSAXXMLReader_iface, riid, ppvObject); + return IVBSAXXMLReader_QueryInterface(&This->IVBSAXXMLReader_iface, riid, ppvObject); } static ULONG WINAPI isaxxmlreader_AddRef(ISAXXMLReader* iface) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return saxxmlreader_AddRef(&This->IVBSAXXMLReader_iface); + return IVBSAXXMLReader_AddRef(&This->IVBSAXXMLReader_iface); } static ULONG WINAPI isaxxmlreader_Release(ISAXXMLReader* iface) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return saxxmlreader_Release(&This->IVBSAXXMLReader_iface); + return IVBSAXXMLReader_Release(&This->IVBSAXXMLReader_iface); } /*** ISAXXMLReader methods ***/ static HRESULT WINAPI isaxxmlreader_getFeature( ISAXXMLReader* iface, - const WCHAR *pFeature, - VARIANT_BOOL *pValue) + const WCHAR *feature_name, + VARIANT_BOOL *value) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return IVBSAXXMLReader_getFeature(&This->IVBSAXXMLReader_iface, pFeature, pValue); + saxreader_feature feature; + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(feature_name), value); + + feature = get_saxreader_feature(feature_name); + if (feature == Namespaces || feature == NamespacePrefixes) + return get_feature_value(This, feature, value); + + FIXME("(%p)->(%s %p) stub\n", This, debugstr_w(feature_name), value); + return E_NOTIMPL; } static HRESULT WINAPI isaxxmlreader_putFeature( ISAXXMLReader* iface, - const WCHAR *pFeature, - VARIANT_BOOL vfValue) + const WCHAR *feature_name, + VARIANT_BOOL value) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return IVBSAXXMLReader_putFeature(&This->IVBSAXXMLReader_iface, pFeature, vfValue); + saxreader_feature feature; + + TRACE("(%p)->(%s %x)\n", This, debugstr_w(feature_name), value); + + feature = get_saxreader_feature(feature_name); + + /* accepted cases */ + if ((feature == ExternalGeneralEntities && value == VARIANT_FALSE) || + (feature == ExternalParameterEntities && value == VARIANT_FALSE) || + feature == Namespaces || + feature == NamespacePrefixes) + { + return set_feature_value(This, feature, value); + } + + if (feature == LexicalHandlerParEntities || feature == ProhibitDTD) + { + FIXME("(%p)->(%s %x) stub\n", This, debugstr_w(feature_name), value); + return set_feature_value(This, feature, value); + } + + FIXME("(%p)->(%s %x) stub\n", This, debugstr_w(feature_name), value); + return E_NOTIMPL; } static HRESULT WINAPI isaxxmlreader_getProperty( @@ -3196,10 +3328,12 @@ static HRESULT WINAPI isaxxmlreader_putErrorHandler(ISAXXMLReader* iface, ISAXEr static HRESULT WINAPI isaxxmlreader_getBaseURL( ISAXXMLReader* iface, - const WCHAR **pBaseUrl) + const WCHAR **base_url) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return IVBSAXXMLReader_get_baseURL(&This->IVBSAXXMLReader_iface, pBaseUrl); + + FIXME("(%p)->(%p) stub\n", This, base_url); + return E_NOTIMPL; } static HRESULT WINAPI isaxxmlreader_putBaseURL( @@ -3207,7 +3341,9 @@ static HRESULT WINAPI isaxxmlreader_putBaseURL( const WCHAR *pBaseUrl) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return IVBSAXXMLReader_put_baseURL(&This->IVBSAXXMLReader_iface, pBaseUrl); + + FIXME("(%p)->(%s) stub\n", This, debugstr_w(pBaseUrl)); + return E_NOTIMPL; } static HRESULT WINAPI isaxxmlreader_getSecureBaseURL( @@ -3215,7 +3351,8 @@ static HRESULT WINAPI isaxxmlreader_getSecureBaseURL( const WCHAR **pSecureBaseUrl) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return IVBSAXXMLReader_get_secureBaseURL(&This->IVBSAXXMLReader_iface, pSecureBaseUrl); + FIXME("(%p)->(%p) stub\n", This, pSecureBaseUrl); + return E_NOTIMPL; } static HRESULT WINAPI isaxxmlreader_putSecureBaseURL( @@ -3223,7 +3360,9 @@ static HRESULT WINAPI isaxxmlreader_putSecureBaseURL( const WCHAR *secureBaseUrl) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return IVBSAXXMLReader_put_secureBaseURL(&This->IVBSAXXMLReader_iface, secureBaseUrl); + + FIXME("(%p)->(%s) stub\n", This, debugstr_w(secureBaseUrl)); + return E_NOTIMPL; } static HRESULT WINAPI isaxxmlreader_parse( @@ -3278,11 +3417,11 @@ static dispex_static_data_t saxreader_dispex = { saxreader_iface_tids }; -HRESULT SAXXMLReader_create(MSXML_VERSION version, IUnknown *outer, LPVOID *ppObj) +HRESULT SAXXMLReader_create(MSXML_VERSION version, LPVOID *ppObj) { saxreader *reader; - TRACE("(%p, %p)\n", outer, ppObj); + TRACE("(%p)\n", ppObj); reader = heap_alloc( sizeof (*reader) ); if( !reader ) @@ -3325,7 +3464,7 @@ HRESULT SAXXMLReader_create(MSXML_VERSION version, IUnknown *outer, LPVOID *ppOb #else -HRESULT SAXXMLReader_create(MSXML_VERSION version, IUnknown *pUnkOuter, LPVOID *ppObj) +HRESULT SAXXMLReader_create(MSXML_VERSION version, LPVOID *ppObj) { MESSAGE("This program tried to use a SAX XML Reader object, but\n" "libxml2 support was not present at compile time.\n"); diff --git a/dll/win32/msxml3/schema.c b/dll/win32/msxml3/schema.c index b491890c8f4..8bd78ff0061 100644 --- a/dll/win32/msxml3/schema.c +++ b/dll/win32/msxml3/schema.c @@ -96,6 +96,12 @@ typedef struct LONG ref; } cache_entry; +static const tid_t schema_cache_se_tids[] = { + IXMLDOMSchemaCollection_tid, + IXMLDOMSchemaCollection2_tid, + NULL_tid +}; + /* datatypes lookup stuff * generated with help from gperf */ #define DT_MIN_STR_LEN 2 @@ -910,7 +916,7 @@ static cache_entry* cache_entry_from_url(VARIANT url, xmlChar const* nsURI, MSXM cache_entry* entry; IXMLDOMDocument3* domdoc = NULL; xmlDocPtr doc = NULL; - HRESULT hr = DOMDocument_create(version, NULL, (void**)&domdoc); + HRESULT hr = DOMDocument_create(version, (void**)&domdoc); VARIANT_BOOL b = VARIANT_FALSE; CacheEntryType type = CacheEntryType_Invalid; @@ -1085,6 +1091,10 @@ static HRESULT WINAPI schema_cache_QueryInterface(IXMLDOMSchemaCollection2* ifac { return *ppvObject ? S_OK : E_NOINTERFACE; } + else if(IsEqualGUID( riid, &IID_ISupportErrorInfo )) + { + return node_create_supporterrorinfo(schema_cache_se_tids, ppvObject); + } else { FIXME("interface %s not implemented\n", debugstr_guid(riid)); @@ -1119,7 +1129,6 @@ static ULONG WINAPI schema_cache_Release(IXMLDOMSchemaCollection2* iface) heap_free(This->uris[i]); heap_free(This->uris); xmlHashFree(This->cache, cache_free); - release_dispex(&This->dispex); heap_free(This); } @@ -1263,11 +1272,17 @@ static HRESULT WINAPI schema_cache_get(IXMLDOMSchemaCollection2* iface, BSTR uri TRACE("(%p)->(%s %p)\n", This, debugstr_w(uri), node); - if (This->version == MSXML6) return E_NOTIMPL; + if (This->version == MSXML6) + { + if (node) *node = NULL; + return E_NOTIMPL; + } if (!node) return E_POINTER; + *node = NULL; + name = uri ? xmlchar_from_wchar(uri) : xmlchar_from_wchar(emptyW); entry = (cache_entry*) xmlHashLookup(This->cache, name); heap_free(name); @@ -1276,7 +1291,6 @@ static HRESULT WINAPI schema_cache_get(IXMLDOMSchemaCollection2* iface, BSTR uri if (entry && entry->doc) return get_domdoc_from_xmldoc(entry->doc, (IXMLDOMDocument3**)node); - *node = NULL; return S_OK; } @@ -1315,6 +1329,9 @@ static HRESULT WINAPI schema_cache_get_namespaceURI(IXMLDOMSchemaCollection2* if if (!uri) return E_POINTER; + if (This->version == MSXML6) + *uri = NULL; + if (index >= This->count) return E_FAIL; @@ -1538,13 +1555,13 @@ static dispex_static_data_t schemacache_dispex = { schemacache_iface_tids }; -HRESULT SchemaCache_create(MSXML_VERSION version, IUnknown* outer, void** obj) +HRESULT SchemaCache_create(MSXML_VERSION version, void** obj) { schema_cache* This = heap_alloc(sizeof(schema_cache)); if (!This) return E_OUTOFMEMORY; - TRACE("(%d %p %p)\n", version, outer, obj); + TRACE("(%d %p)\n", version, obj); This->IXMLDOMSchemaCollection2_iface.lpVtbl = &XMLDOMSchemaCollection2Vtbl; This->cache = xmlHashCreate(DEFAULT_HASHTABLE_SIZE); @@ -1563,7 +1580,7 @@ HRESULT SchemaCache_create(MSXML_VERSION version, IUnknown* outer, void** obj) #else -HRESULT SchemaCache_create(MSXML_VERSION version, IUnknown* outer, void** obj) +HRESULT SchemaCache_create(MSXML_VERSION version, void** obj) { MESSAGE("This program tried to use a SchemaCache object, but\n" "libxml2 support was not present at compile time.\n"); diff --git a/dll/win32/msxml3/selection.c b/dll/win32/msxml3/selection.c index 01fc8476ca9..b0fccb381da 100644 --- a/dll/win32/msxml3/selection.c +++ b/dll/win32/msxml3/selection.c @@ -160,7 +160,6 @@ static ULONG WINAPI domselection_Release( xmlXPathFreeObject(This->result); xmldoc_release(This->node->doc); if (This->enumvariant) IEnumVARIANT_Release(This->enumvariant); - release_dispex(&This->dispex); heap_free(This); } diff --git a/dll/win32/msxml3/stylesheet.c b/dll/win32/msxml3/stylesheet.c index d9543a90c2d..2417968fee8 100644 --- a/dll/win32/msxml3/stylesheet.c +++ b/dll/win32/msxml3/stylesheet.c @@ -40,6 +40,8 @@ typedef struct IStream *output; BSTR outstr; + + struct xslprocessor_params params; } xslprocessor; static HRESULT XSLProcessor_create(xsltemplate*, IXSLProcessor**); @@ -54,6 +56,15 @@ static inline xslprocessor *impl_from_IXSLProcessor( IXSLProcessor *iface ) return CONTAINING_RECORD(iface, xslprocessor, IXSLProcessor_iface); } +static void xslprocessor_par_free(struct xslprocessor_params *params, struct xslprocessor_par *par) +{ + params->count--; + list_remove(&par->entry); + SysFreeString(par->name); + SysFreeString(par->value); + heap_free(par); +} + static void xsltemplate_set_node( xsltemplate *This, IXMLDOMNode *node ) { if (This->node) IXMLDOMNode_Release(This->node); @@ -107,7 +118,6 @@ static ULONG WINAPI xsltemplate_Release( IXSLTemplate *iface ) if ( ref == 0 ) { if (This->node) IXMLDOMNode_Release( This->node ); - release_dispex(&This->dispex); heap_free( This ); } @@ -217,13 +227,11 @@ static dispex_static_data_t xsltemplate_dispex = { xsltemplate_iface_tids }; -HRESULT XSLTemplate_create(IUnknown *outer, void **ppObj) +HRESULT XSLTemplate_create(void **ppObj) { xsltemplate *This; - TRACE("(%p, %p)\n", outer, ppObj); - - if(outer) FIXME("support aggregation, outer\n"); + TRACE("(%p)\n", ppObj); This = heap_alloc( sizeof (*This) ); if(!This) @@ -287,11 +295,16 @@ static ULONG WINAPI xslprocessor_Release( IXSLProcessor *iface ) TRACE("(%p)->(%d)\n", This, ref); if ( ref == 0 ) { + struct xslprocessor_par *par, *par2; + if (This->input) IXMLDOMNode_Release(This->input); if (This->output) IStream_Release(This->output); SysFreeString(This->outstr); + + LIST_FOR_EACH_ENTRY_SAFE(par, par2, &This->params.list, struct xslprocessor_par, entry) + xslprocessor_par_free(&This->params, par); + IXSLTemplate_Release(&This->stylesheet->IXSLTemplate_iface); - release_dispex(&This->dispex); heap_free( This ); } @@ -352,7 +365,7 @@ static HRESULT WINAPI xslprocessor_put_input( IXSLProcessor *iface, VARIANT inpu { IXMLDOMDocument *doc; - hr = DOMDocument_create(MSXML_DEFAULT, NULL, (void**)&doc); + hr = DOMDocument_create(MSXML_DEFAULT, (void**)&doc); if (hr == S_OK) { VARIANT_BOOL b; @@ -430,7 +443,7 @@ static HRESULT WINAPI xslprocessor_put_output( IStream *stream; HRESULT hr; - FIXME("(%p)->(%s): semi-stub\n", This, debugstr_variant(&output)); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&output)); switch (V_VT(&output)) { @@ -440,8 +453,11 @@ static HRESULT WINAPI xslprocessor_put_output( break; case VT_UNKNOWN: hr = IUnknown_QueryInterface(V_UNKNOWN(&output), &IID_IStream, (void**)&stream); + if (FAILED(hr)) + WARN("failed to get IStream from output, 0x%08x\n", hr); break; default: + FIXME("output type %d not handled\n", V_VT(&output)); hr = E_FAIL; } @@ -485,6 +501,7 @@ static HRESULT WINAPI xslprocessor_transform( IXSLProcessor *iface, VARIANT_BOOL *ret) { +#ifdef HAVE_LIBXML2 xslprocessor *This = impl_from_IXSLProcessor( iface ); HRESULT hr; @@ -493,22 +510,13 @@ static HRESULT WINAPI xslprocessor_transform( if (!ret) return E_INVALIDARG; SysFreeString(This->outstr); - hr = IXMLDOMNode_transformNode(This->input, This->stylesheet->node, &This->outstr); - if (hr == S_OK) - { - if (This->output) - { - ULONG len = 0; - - /* output to stream */ - hr = IStream_Write(This->output, This->outstr, SysStringByteLen(This->outstr), &len); - *ret = len == SysStringByteLen(This->outstr) ? VARIANT_TRUE : VARIANT_FALSE; - } - } - else - *ret = VARIANT_FALSE; - + hr = node_transform_node_params(get_node_obj(This->input), This->stylesheet->node, &This->outstr, This->output, &This->params); + *ret = hr == S_OK ? VARIANT_TRUE : VARIANT_FALSE; return hr; +#else + FIXME("libxml2 is required but wasn't present at compile time\n"); + return E_NOTIMPL; +#endif } static HRESULT WINAPI xslprocessor_reset( IXSLProcessor *iface ) @@ -529,6 +537,26 @@ static HRESULT WINAPI xslprocessor_get_readyState( return E_NOTIMPL; } +static HRESULT xslprocessor_set_parvalue(const VARIANT *var, struct xslprocessor_par *par) +{ + HRESULT hr = S_OK; + + switch (V_VT(var)) + { + case VT_BSTR: + { + par->value = SysAllocString(V_BSTR(var)); + if (!par->value) hr = E_OUTOFMEMORY; + break; + } + default: + FIXME("value type %d not handled\n", V_VT(var)); + hr = E_NOTIMPL; + } + + return hr; +} + static HRESULT WINAPI xslprocessor_addParameter( IXSLProcessor *iface, BSTR p, @@ -536,10 +564,58 @@ static HRESULT WINAPI xslprocessor_addParameter( BSTR uri) { xslprocessor *This = impl_from_IXSLProcessor( iface ); + struct xslprocessor_par *cur, *par = NULL; + HRESULT hr; - FIXME("(%p)->(%s %s %s): stub\n", This, debugstr_w(p), debugstr_variant(&var), + TRACE("(%p)->(%s %s %s)\n", This, debugstr_w(p), debugstr_variant(&var), debugstr_w(uri)); - return E_NOTIMPL; + + if (uri && *uri) + FIXME("namespace uri is not supported\n"); + + /* search for existing parameter first */ + LIST_FOR_EACH_ENTRY(cur, &This->params.list, struct xslprocessor_par, entry) + { + if (!strcmpW(cur->name, p)) + { + par = cur; + break; + } + } + + /* override with new value or add new parameter */ + if (par) + { + if (V_VT(&var) == VT_NULL || V_VT(&var) == VT_EMPTY) + { + /* remove parameter */ + xslprocessor_par_free(&This->params, par); + return S_OK; + } + SysFreeString(par->value); + par->value = NULL; + } + else + { + /* new parameter */ + par = heap_alloc(sizeof(struct xslprocessor_par)); + if (!par) return E_OUTOFMEMORY; + + par->name = SysAllocString(p); + if (!par->name) + { + heap_free(par); + return E_OUTOFMEMORY; + } + list_add_tail(&This->params.list, &par->entry); + This->params.count++; + } + + hr = xslprocessor_set_parvalue(&var, par); + if (FAILED(hr)) + xslprocessor_par_free(&This->params, par); + + return hr; } static HRESULT WINAPI xslprocessor_addObject( @@ -615,6 +691,8 @@ HRESULT XSLProcessor_create(xsltemplate *template, IXSLProcessor **ppObj) This->input = NULL; This->output = NULL; This->outstr = NULL; + list_init(&This->params.list); + This->params.count = 0; This->stylesheet = template; IXSLTemplate_AddRef(&template->IXSLTemplate_iface); init_dispex(&This->dispex, (IUnknown*)&This->IXSLProcessor_iface, &xslprocessor_dispex); diff --git a/dll/win32/msxml3/text.c b/dll/win32/msxml3/text.c index b412ff4c25c..41f80614353 100644 --- a/dll/win32/msxml3/text.c +++ b/dll/win32/msxml3/text.c @@ -599,7 +599,7 @@ static HRESULT WINAPI domtext_put_data( BSTR data) { domtext *This = impl_from_IXMLDOMText( iface ); - static WCHAR rnW[] = {'\r','\n',0}; + static const WCHAR rnW[] = {'\r','\n',0}; TRACE("(%p)->(%s)\n", This, debugstr_w(data)); diff --git a/dll/win32/msxml3/xmldoc.c b/dll/win32/msxml3/xmldoc.c index bb12bca2bb4..34aa8dae3de 100644 --- a/dll/win32/msxml3/xmldoc.c +++ b/dll/win32/msxml3/xmldoc.c @@ -188,7 +188,7 @@ static HRESULT WINAPI xmldoc_get_root(IXMLDocument *iface, IXMLElement **p) if (!(root = xmlDocGetRootElement(This->xmldoc))) return E_FAIL; - return XMLElement_create((IUnknown *)This, root, (LPVOID *)p, FALSE); + return XMLElement_create(root, (LPVOID *)p, FALSE); } static HRESULT WINAPI xmldoc_get_fileSize(IXMLDocument *iface, BSTR *p) @@ -500,7 +500,7 @@ static HRESULT WINAPI xmldoc_createElement(IXMLDocument *iface, VARIANT vType, node->type = type_msxml_to_libxml(V_I4(&vType)); /* FIXME: create xmlNodePtr based on vType and var1 */ - return XMLElement_create((IUnknown *)iface, node, (LPVOID *)ppElem, TRUE); + return XMLElement_create(node, (LPVOID *)ppElem, TRUE); } static const struct IXMLDocumentVtbl xmldoc_vtbl = @@ -672,11 +672,11 @@ static const IPersistStreamInitVtbl xmldoc_IPersistStreamInit_VTable = xmldoc_IPersistStreamInit_InitNew }; -HRESULT XMLDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj) +HRESULT XMLDocument_create(LPVOID *ppObj) { xmldoc *doc; - TRACE("(%p,%p)\n", pUnkOuter, ppObj); + TRACE("(%p)\n", ppObj); doc = heap_alloc(sizeof (*doc)); if(!doc) @@ -697,7 +697,7 @@ HRESULT XMLDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj) #else -HRESULT XMLDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj) +HRESULT XMLDocument_create(LPVOID *ppObj) { MESSAGE("This program tried to use an XMLDocument object, but\n" "libxml2 support was not present at compile time.\n"); diff --git a/dll/win32/msxml3/xmlelem.c b/dll/win32/msxml3/xmlelem.c index dd9f8e648aa..f356c249068 100644 --- a/dll/win32/msxml3/xmlelem.c +++ b/dll/win32/msxml3/xmlelem.c @@ -22,7 +22,7 @@ #ifdef HAVE_LIBXML2 -static HRESULT XMLElementCollection_create( IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj ); +static HRESULT XMLElementCollection_create( xmlNodePtr node, LPVOID *ppObj ); /********************************************************************** * IXMLElement @@ -168,8 +168,12 @@ static HRESULT WINAPI xmlelem_get_tagName(IXMLElement *iface, BSTR *p) if (!p) return E_INVALIDARG; - *p = bstr_from_xmlChar(This->node->name); - CharUpperBuffW(*p, SysStringLen(*p)); + if (*This->node->name) { + *p = bstr_from_xmlChar(This->node->name); + CharUpperBuffW(*p, SysStringLen(*p)); + }else { + *p = NULL; + } TRACE("returning %s\n", debugstr_w(*p)); @@ -202,7 +206,7 @@ static HRESULT WINAPI xmlelem_get_parent(IXMLElement *iface, IXMLElement **paren if (!This->node->parent) return S_FALSE; - return XMLElement_create((IUnknown *)iface, This->node->parent, (LPVOID *)parent, FALSE); + return XMLElement_create(This->node->parent, (LPVOID *)parent, FALSE); } static HRESULT WINAPI xmlelem_setAttribute(IXMLElement *iface, BSTR strPropertyName, @@ -325,7 +329,7 @@ static HRESULT WINAPI xmlelem_get_children(IXMLElement *iface, IXMLElementCollec if (!p) return E_INVALIDARG; - return XMLElementCollection_create((IUnknown *)iface, This->node, (LPVOID *)p); + return XMLElementCollection_create(This->node, (LPVOID *)p); } static LONG type_libxml_to_msxml(xmlElementType type) @@ -466,11 +470,11 @@ static const struct IXMLElementVtbl xmlelem_vtbl = xmlelem_removeChild }; -HRESULT XMLElement_create(IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj, BOOL own) +HRESULT XMLElement_create(xmlNodePtr node, LPVOID *ppObj, BOOL own) { xmlelem *elem; - TRACE("(%p,%p)\n", pUnkOuter, ppObj); + TRACE("(%p)\n", ppObj); if (!ppObj) return E_INVALIDARG; @@ -548,6 +552,7 @@ static HRESULT WINAPI xmlelem_collection_QueryInterface(IXMLElementCollection *i else { FIXME("interface %s not implemented\n", debugstr_guid(riid)); + *ppvObject = NULL; return E_NOINTERFACE; } @@ -638,8 +643,8 @@ static HRESULT WINAPI xmlelem_collection_get__newEnum(IXMLElementCollection *ifa if (!ppUnk) return E_INVALIDARG; - *ppUnk = (IUnknown *)This; - IUnknown_AddRef(*ppUnk); + IXMLElementCollection_AddRef(iface); + *ppUnk = (IUnknown *)&This->IEnumVARIANT_iface; return S_OK; } @@ -668,7 +673,7 @@ static HRESULT WINAPI xmlelem_collection_item(IXMLElementCollection *iface, VARI for (i = 0; i < index; i++) ptr = ptr->next; - return XMLElement_create((IUnknown *)iface, ptr, (LPVOID *)ppDisp, FALSE); + return XMLElement_create(ptr, (LPVOID *)ppDisp, FALSE); } static const struct IXMLElementCollectionVtbl xmlelem_collection_vtbl = @@ -693,21 +698,34 @@ static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_QueryInterface( IEnumVARIANT *iface, REFIID riid, LPVOID *ppvObj) { xmlelem_collection *this = impl_from_IEnumVARIANT(iface); - return IXMLDocument_QueryInterface((IXMLDocument *)this, riid, ppvObj); + + TRACE("(%p)->(%s %p)\n", this, debugstr_guid(riid), ppvObj); + + if (IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_IEnumVARIANT)) + { + *ppvObj = iface; + IEnumVARIANT_AddRef(iface); + return S_OK; + } + + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + *ppvObj = NULL; + return E_NOINTERFACE; } static ULONG WINAPI xmlelem_collection_IEnumVARIANT_AddRef( IEnumVARIANT *iface) { xmlelem_collection *this = impl_from_IEnumVARIANT(iface); - return IXMLDocument_AddRef((IXMLDocument *)this); + return IXMLElementCollection_AddRef(&this->IXMLElementCollection_iface); } static ULONG WINAPI xmlelem_collection_IEnumVARIANT_Release( IEnumVARIANT *iface) { xmlelem_collection *this = impl_from_IEnumVARIANT(iface); - return IXMLDocument_Release((IXMLDocument *)this); + return IXMLElementCollection_Release(&this->IXMLElementCollection_iface); } static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Next( @@ -735,7 +753,7 @@ static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Next( } V_VT(rgVar) = VT_DISPATCH; - return XMLElement_create((IUnknown *)iface, ptr, (LPVOID *)&V_DISPATCH(rgVar), FALSE); + return XMLElement_create(ptr, (LPVOID *)&V_DISPATCH(rgVar), FALSE); } static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Skip( @@ -774,11 +792,11 @@ static const struct IEnumVARIANTVtbl xmlelem_collection_IEnumVARIANTvtbl = xmlelem_collection_IEnumVARIANT_Clone }; -static HRESULT XMLElementCollection_create(IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj) +static HRESULT XMLElementCollection_create(xmlNodePtr node, LPVOID *ppObj) { xmlelem_collection *collection; - TRACE("(%p,%p)\n", pUnkOuter, ppObj); + TRACE("(%p)\n", ppObj); *ppObj = NULL; diff --git a/dll/win32/msxml3/xmlparser.c b/dll/win32/msxml3/xmlparser.c index 1d116125eba..0f515bb81eb 100644 --- a/dll/win32/msxml3/xmlparser.c +++ b/dll/win32/msxml3/xmlparser.c @@ -413,14 +413,11 @@ static const struct IXMLParserVtbl xmlparser_vtbl = xmlparser_GetSecureBaseURL }; -HRESULT XMLParser_create(IUnknown* pUnkOuter, void**ppObj) +HRESULT XMLParser_create(void **ppObj) { xmlparser *This; - TRACE("(%p,%p)\n", pUnkOuter, ppObj); - - if (pUnkOuter) - FIXME("support aggregation, outer\n"); + TRACE("(%p)\n", ppObj); This = heap_alloc( sizeof(xmlparser) ); if(!This) diff --git a/dll/win32/msxml3/xmlparser.idl b/dll/win32/msxml3/xmlparser.idl index a0ce97efd7a..7f02b149b24 100644 --- a/dll/win32/msxml3/xmlparser.idl +++ b/dll/win32/msxml3/xmlparser.idl @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + import "unknwn.idl"; import "objidl.idl"; import "oaidl.idl"; diff --git a/dll/win32/msxml3/xmlview.c b/dll/win32/msxml3/xmlview.c index ce5467af190..c2aaaaa0b39 100644 --- a/dll/win32/msxml3/xmlview.c +++ b/dll/win32/msxml3/xmlview.c @@ -380,7 +380,7 @@ static inline HRESULT handle_xml_load(BindStatusCallback *This) if(FAILED(hres)) return display_error_page(This); - hres = DOMDocument_create(MSXML_DEFAULT, NULL, (void**)&xml); + hres = DOMDocument_create(MSXML_DEFAULT, (void**)&xml); if(FAILED(hres)) return display_error_page(This); @@ -456,7 +456,7 @@ static inline HRESULT handle_xml_load(BindStatusCallback *This) return display_error_page(This); } - hres = DOMDocument_create(MSXML_DEFAULT, NULL, (void**)&xsl); + hres = DOMDocument_create(MSXML_DEFAULT, (void**)&xsl); if(FAILED(hres)) { VariantClear(&var); IXMLDOMDocument3_Release(xml); @@ -1405,15 +1405,12 @@ static IOleObjectVtbl XMLView_OleObjectVtbl = { XMLView_OleObject_SetColorScheme }; -HRESULT XMLView_create(IUnknown *outer, void **ppObj) +HRESULT XMLView_create(void **ppObj) { XMLView *This; HRESULT hres; - TRACE("(%p %p)\n", outer, ppObj); - - if(outer) - return E_FAIL; + TRACE("(%p)\n", ppObj); This = heap_alloc_zero(sizeof(*This)); if(!This) @@ -1438,7 +1435,7 @@ HRESULT XMLView_create(IUnknown *outer, void **ppObj) #else -HRESULT XMLView_create(IUnknown *outer, void **ppObj) +HRESULT XMLView_create(void **ppObj) { MESSAGE("This program tried to use a XMLView object, but\n" "libxml2 support was not present at compile time.\n"); diff --git a/dll/win32/odbc32/proxyodbc.c b/dll/win32/odbc32/proxyodbc.c index e95ca078b6d..a386a62fac7 100644 --- a/dll/win32/odbc32/proxyodbc.c +++ b/dll/win32/odbc32/proxyodbc.c @@ -199,9 +199,9 @@ static void ODBC_ReplicateODBCInstToRegistry (SQLHENV hEnv) { HKEY hODBCInst; LONG reg_ret; - int success; + BOOL success; - success = 0; + success = FALSE; TRACE ("Driver settings are not currently replicated to the registry\n"); if ((reg_ret = RegCreateKeyExA (HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBCINST.INI", 0, NULL, @@ -220,7 +220,7 @@ static void ODBC_ReplicateODBCInstToRegistry (SQLHENV hEnv) CHAR desc [256]; SQLSMALLINT sizedesc; - success = 1; + success = TRUE; dirn = SQL_FETCH_FIRST; while ((sql_ret = SQLDrivers (hEnv, dirn, (SQLCHAR*)desc, sizeof(desc), &sizedesc, NULL, 0, NULL)) == SQL_SUCCESS || @@ -239,14 +239,14 @@ static void ODBC_ReplicateODBCInstToRegistry (SQLHENV hEnv) { TRACE ("Error %d replicating driver %s\n", reg_ret, desc); - success = 0; + success = FALSE; } } else if (reg_ret != ERROR_SUCCESS) { TRACE ("Error %d checking for %s in drivers\n", reg_ret, desc); - success = 0; + success = FALSE; } if ((reg_ret = RegCreateKeyExA (hODBCInst, desc, 0, NULL, REG_OPTION_NON_VOLATILE, @@ -268,20 +268,20 @@ static void ODBC_ReplicateODBCInstToRegistry (SQLHENV hEnv) { TRACE ("Error %d ensuring driver key %s\n", reg_ret, desc); - success = 0; + success = FALSE; } } else { WARN ("Unusually long driver name %s not replicated\n", desc); - success = 0; + success = FALSE; } } if (sql_ret != SQL_NO_DATA) { TRACE ("Error %d enumerating drivers\n", (int)sql_ret); - success = 0; + success = FALSE; } if ((reg_ret = RegCloseKey (hDrivers)) != ERROR_SUCCESS) { @@ -327,7 +327,7 @@ static void ODBC_ReplicateODBCInstToRegistry (SQLHENV hEnv) * that this will add a requirement that this function be called after * ODBC_ReplicateODBCInstToRegistry) */ -static void ODBC_ReplicateODBCToRegistry (int is_user, SQLHENV hEnv) +static void ODBC_ReplicateODBCToRegistry (BOOL is_user, SQLHENV hEnv) { HKEY hODBC; LONG reg_ret; @@ -337,17 +337,17 @@ static void ODBC_ReplicateODBCToRegistry (int is_user, SQLHENV hEnv) SQLSMALLINT sizedsn; CHAR desc [256]; SQLSMALLINT sizedesc; - int success; + BOOL success; const char *which = is_user ? "user" : "system"; - success = 0; + success = FALSE; if ((reg_ret = RegCreateKeyExA ( is_user ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS /* a couple more than we need */, NULL, &hODBC, NULL)) == ERROR_SUCCESS) { - success = 1; + success = TRUE; dirn = is_user ? SQL_FETCH_FIRST_USER : SQL_FETCH_FIRST_SYSTEM; while ((sql_ret = SQLDataSources (hEnv, dirn, (SQLCHAR*)dsn, sizeof(dsn), &sizedsn, @@ -374,14 +374,14 @@ static void ODBC_ReplicateODBCToRegistry (int is_user, SQLHENV hEnv) { TRACE ("Error %d replicating description of " "%s(%s)\n", reg_ret, dsn, desc); - success = 0; + success = FALSE; } } else if (reg_ret != ERROR_SUCCESS) { TRACE ("Error %d checking for description of %s\n", reg_ret, dsn); - success = 0; + success = FALSE; } if ((reg_ret = RegCloseKey (hDSN)) != ERROR_SUCCESS) { @@ -393,21 +393,21 @@ static void ODBC_ReplicateODBCToRegistry (int is_user, SQLHENV hEnv) { TRACE ("Error %d opening %s DSN key %s\n", reg_ret, which, dsn); - success = 0; + success = FALSE; } } else { WARN ("Unusually long %s data source name %s (%s) not " "replicated\n", which, dsn, desc); - success = 0; + success = FALSE; } } if (sql_ret != SQL_NO_DATA) { TRACE ("Error %d enumerating %s datasources\n", (int)sql_ret, which); - success = 0; + success = FALSE; } if ((reg_ret = RegCloseKey (hODBC)) != ERROR_SUCCESS) { @@ -452,8 +452,8 @@ static void ODBC_ReplicateToRegistry (void) if ((sql_ret = SQLAllocEnv (&hEnv)) == SQL_SUCCESS) { ODBC_ReplicateODBCInstToRegistry (hEnv); - ODBC_ReplicateODBCToRegistry (0 /* system dsns */, hEnv); - ODBC_ReplicateODBCToRegistry (1 /* user dsns */, hEnv); + ODBC_ReplicateODBCToRegistry (FALSE /* system dsns */, hEnv); + ODBC_ReplicateODBCToRegistry (TRUE /* user dsns */, hEnv); if ((sql_ret = SQLFreeEnv (hEnv)) != SQL_SUCCESS) { @@ -1986,7 +1986,7 @@ SQLRETURN WINAPI SQLSetScrollOptions( return pSQLSetScrollOptions(statement_handle, f_concurrency, crow_keyset, crow_rowset); } -static int SQLColAttributes_KnownStringAttribute(SQLUSMALLINT fDescType) +static BOOL SQLColAttributes_KnownStringAttribute(SQLUSMALLINT fDescType) { static const SQLUSMALLINT attrList[] = { @@ -2011,9 +2011,9 @@ static int SQLColAttributes_KnownStringAttribute(SQLUSMALLINT fDescType) unsigned int i; for (i = 0; i < sizeof(attrList) / sizeof(SQLUSMALLINT); i++) { - if (attrList[i] == fDescType) return 1; + if (attrList[i] == fDescType) return TRUE; } - return 0; + return FALSE; } /************************************************************************* diff --git a/dll/win32/ole32/antimoniker.c b/dll/win32/ole32/antimoniker.c index 93a714056bc..86d30267dae 100644 --- a/dll/win32/ole32/antimoniker.c +++ b/dll/win32/ole32/antimoniker.c @@ -112,7 +112,7 @@ AntiMonikerImpl_Release(IMoniker* iface) ref = InterlockedDecrement(&This->ref); - /* destroy the object if there's no more reference on it */ + /* destroy the object if there are no more references to it */ if (ref == 0) { if (This->pMarshal) IUnknown_Release(This->pMarshal); diff --git a/dll/win32/ole32/bindctx.c b/dll/win32/ole32/bindctx.c index 18e52da470f..d3f27d7b905 100644 --- a/dll/win32/ole32/bindctx.c +++ b/dll/win32/ole32/bindctx.c @@ -421,9 +421,8 @@ static HRESULT BindCtxImpl_GetObjectIndex(BindCtxImpl* This, LPOLESTR pszkey, DWORD *index) { - DWORD i; - BYTE found=0; + BOOL found = FALSE; TRACE("(%p,%p,%p,%p)\n",This,punk,pszkey,index); @@ -440,14 +439,14 @@ static HRESULT BindCtxImpl_GetObjectIndex(BindCtxImpl* This, ) ) - found=1; + found = TRUE; } } else /* search object identified by a moniker*/ for(i=0; ( (ibindCtxTableLastIndex) && (!found));i++) if(This->bindCtxTable[i].pObj==punk) - found=1; + found = TRUE; if (index != NULL) *index=i-1; diff --git a/dll/win32/ole32/classmoniker.c b/dll/win32/ole32/classmoniker.c index c3a937b2d93..2d3dff884eb 100644 --- a/dll/win32/ole32/classmoniker.c +++ b/dll/win32/ole32/classmoniker.c @@ -103,20 +103,6 @@ static ULONG WINAPI ClassMoniker_AddRef(IMoniker* iface) return InterlockedIncrement(&This->ref); } -/****************************************************************************** - * ClassMoniker_Destroy (local function) - *******************************************************************************/ -static HRESULT ClassMoniker_Destroy(ClassMoniker* This) -{ - TRACE("(%p)\n",This); - - if (This->pMarshal) IUnknown_Release(This->pMarshal); - - HeapFree(GetProcessHeap(),0,This); - - return S_OK; -} - /****************************************************************************** * ClassMoniker_Release ******************************************************************************/ @@ -129,8 +115,12 @@ static ULONG WINAPI ClassMoniker_Release(IMoniker* iface) ref = InterlockedDecrement(&This->ref); - /* destroy the object if there's no more reference on it */ - if (ref == 0) ClassMoniker_Destroy(This); + /* destroy the object if there are no more references to it */ + if (ref == 0) + { + if (This->pMarshal) IUnknown_Release(This->pMarshal); + HeapFree(GetProcessHeap(),0,This); + } return ref; } @@ -262,7 +252,7 @@ static HRESULT WINAPI ClassMoniker_BindToStorage(IMoniker* iface, VOID** ppvResult) { TRACE("(%p,%p,%p,%p)\n",pbc, pmkToLeft, riid, ppvResult); - return ClassMoniker_BindToObject(iface, pbc, pmkToLeft, riid, ppvResult); + return IMoniker_BindToObject(iface, pbc, pmkToLeft, riid, ppvResult); } /****************************************************************************** @@ -279,7 +269,7 @@ static HRESULT WINAPI ClassMoniker_Reduce(IMoniker* iface, if (!ppmkReduced) return E_POINTER; - ClassMoniker_AddRef(iface); + IMoniker_AddRef(iface); *ppmkReduced = iface; @@ -585,7 +575,7 @@ static HRESULT WINAPI ClassMonikerROTData_QueryInterface(IROTData *iface,REFIID TRACE("(%p,%p,%p)\n",iface,riid,ppvObject); - return ClassMoniker_QueryInterface(&This->IMoniker_iface, riid, ppvObject); + return IMoniker_QueryInterface(&This->IMoniker_iface, riid, ppvObject); } /*********************************************************************** @@ -597,7 +587,7 @@ static ULONG WINAPI ClassMonikerROTData_AddRef(IROTData *iface) TRACE("(%p)\n",iface); - return ClassMoniker_AddRef(&This->IMoniker_iface); + return IMoniker_AddRef(&This->IMoniker_iface); } /*********************************************************************** @@ -609,7 +599,7 @@ static ULONG WINAPI ClassMonikerROTData_Release(IROTData* iface) TRACE("(%p)\n",iface); - return ClassMoniker_Release(&This->IMoniker_iface); + return IMoniker_Release(&This->IMoniker_iface); } /****************************************************************************** @@ -859,9 +849,10 @@ static const IClassFactoryVtbl ClassMonikerCFVtbl = ClassMonikerCF_CreateInstance, ClassMonikerCF_LockServer }; -static const IClassFactoryVtbl *ClassMonikerCF = &ClassMonikerCFVtbl; + +static IClassFactory ClassMonikerCF = { &ClassMonikerCFVtbl }; HRESULT ClassMonikerCF_Create(REFIID riid, LPVOID *ppv) { - return IClassFactory_QueryInterface((IClassFactory *)&ClassMonikerCF, riid, ppv); + return IClassFactory_QueryInterface(&ClassMonikerCF, riid, ppv); } diff --git a/dll/win32/ole32/comcat.c b/dll/win32/ole32/comcat.c index 0f23debd955..d0cebba0b52 100644 --- a/dll/win32/ole32/comcat.c +++ b/dll/win32/ole32/comcat.c @@ -38,14 +38,16 @@ static ComCatMgrImpl COMCAT_ComCatMgr = { &COMCAT_ICatInformation_Vtbl } }; -struct class_categories { - LPCWSTR impl_strings; - LPCWSTR req_strings; +struct class_categories +{ + ULONG size; /* total length, including structure itself */ + ULONG impl_offset; + ULONG req_offset; }; -static IEnumCATEGORYINFO *COMCAT_IEnumCATEGORYINFO_Construct(LCID lcid); -static LPENUMGUID COMCAT_CLSID_IEnumGUID_Construct(struct class_categories *class_categories); -static LPENUMGUID COMCAT_CATID_IEnumGUID_Construct(REFCLSID rclsid, LPCWSTR impl_req); +static HRESULT EnumCATEGORYINFO_Construct(LCID lcid, IEnumCATEGORYINFO **ret); +static HRESULT CLSIDEnumGUID_Construct(struct class_categories *class_categories, IEnumCLSID **ret); +static HRESULT CATIDEnumGUID_Construct(REFCLSID rclsid, LPCWSTR impl_req, IEnumCATID **ret); /********************************************************************** * File-scope string constants @@ -68,14 +70,14 @@ static HRESULT COMCAT_RegisterClassCategories( ULONG cCategories, const CATID *rgcatid) { - WCHAR keyname[39]; + WCHAR keyname[CHARS_IN_GUID]; HRESULT res; HKEY clsid_key, class_key, type_key; if (cCategories && rgcatid == NULL) return E_POINTER; /* Format the class key name. */ - res = StringFromGUID2(rclsid, keyname, 39); + res = StringFromGUID2(rclsid, keyname, CHARS_IN_GUID); if (FAILED(res)) return res; /* Create (or open) the CLSID key. */ @@ -92,7 +94,7 @@ static HRESULT COMCAT_RegisterClassCategories( HKEY key; /* Format the category key name. */ - res = StringFromGUID2(rgcatid, keyname, 39); + res = StringFromGUID2(rgcatid, keyname, CHARS_IN_GUID); if (FAILED(res)) continue; /* Do the register. */ @@ -124,7 +126,7 @@ static HRESULT COMCAT_UnRegisterClassCategories( if (cCategories && rgcatid == NULL) return E_POINTER; /* Format the class category type key name. */ - res = StringFromGUID2(rclsid, keyname + 6, 39); + res = StringFromGUID2(rclsid, keyname + 6, CHARS_IN_GUID); if (FAILED(res)) return res; keyname[44] = '\\'; lstrcpyW(keyname + 45, type); @@ -135,7 +137,7 @@ static HRESULT COMCAT_UnRegisterClassCategories( for (; cCategories; --cCategories, ++rgcatid) { /* Format the category key name. */ - res = StringFromGUID2(rgcatid, keyname, 39); + res = StringFromGUID2(rgcatid, keyname, CHARS_IN_GUID); if (FAILED(res)) continue; /* Do the unregister. */ @@ -179,25 +181,26 @@ static struct class_categories *COMCAT_PrepareClassCategories( { struct class_categories *categories; WCHAR *strings; + ULONG size; - categories = HeapAlloc( - GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof(struct class_categories) + - ((impl_count + req_count) * 39 + 2) * sizeof(WCHAR)); + size = sizeof(struct class_categories) + ((impl_count + req_count)*CHARS_IN_GUID + 2)*sizeof(WCHAR); + categories = HeapAlloc(GetProcessHeap(), 0, size); if (categories == NULL) return categories; + categories->size = size; + categories->impl_offset = sizeof(struct class_categories); + categories->req_offset = categories->impl_offset + (impl_count*CHARS_IN_GUID + 1)*sizeof(WCHAR); + strings = (WCHAR *)(categories + 1); - categories->impl_strings = strings; while (impl_count--) { - StringFromGUID2(impl_catids++, strings, 39); - strings += 39; + StringFromGUID2(impl_catids++, strings, CHARS_IN_GUID); + strings += CHARS_IN_GUID; } *strings++ = 0; - categories->req_strings = strings; while (req_count--) { - StringFromGUID2(req_catids++, strings, 39); - strings += 39; + StringFromGUID2(req_catids++, strings, CHARS_IN_GUID); + strings += CHARS_IN_GUID; } *strings++ = 0; @@ -211,16 +214,20 @@ static HRESULT COMCAT_IsClassOfCategories( HKEY key, struct class_categories const* categories) { + const WCHAR *impl_strings, *req_strings; HKEY subkey; HRESULT res; DWORD index; LPCWSTR string; + impl_strings = (WCHAR*)((BYTE*)categories + categories->impl_offset); + req_strings = (WCHAR*)((BYTE*)categories + categories->req_offset); + /* Check that every given category is implemented by class. */ - if (*categories->impl_strings) { + if (*impl_strings) { res = open_classes_key(key, impl_keyname, KEY_READ, &subkey); if (res != ERROR_SUCCESS) return S_FALSE; - for (string = categories->impl_strings; *string; string += 39) { + for (string = impl_strings; *string; string += CHARS_IN_GUID) { HKEY catkey; res = open_classes_key(subkey, string, 0, &catkey); if (res != ERROR_SUCCESS) { @@ -236,14 +243,14 @@ static HRESULT COMCAT_IsClassOfCategories( res = open_classes_key(key, req_keyname, KEY_READ, &subkey); if (res == ERROR_SUCCESS) { for (index = 0; ; ++index) { - WCHAR keyname[39]; - DWORD size = 39; + WCHAR keyname[CHARS_IN_GUID]; + DWORD size = CHARS_IN_GUID; res = RegEnumKeyExW(subkey, index, keyname, &size, NULL, NULL, NULL, NULL); if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) break; - if (size != 38) continue; /* bogus catid in registry */ - for (string = categories->req_strings; *string; string += 39) + if (size != CHARS_IN_GUID-1) continue; /* bogus catid in registry */ + for (string = req_strings; *string; string += CHARS_IN_GUID) if (!strcmpiW(string, keyname)) break; if (!*string) { RegCloseKey(subkey); @@ -321,19 +328,18 @@ static HRESULT WINAPI COMCAT_ICatRegister_RegisterCategories( for (; cCategories; --cCategories, ++rgci) { static const WCHAR fmt[] = { '%', 'l', 'X', 0 }; - WCHAR keyname[39]; + WCHAR keyname[CHARS_IN_GUID]; WCHAR valname[9]; HKEY cat_key; /* Create (or open) the key for this category. */ - if (!StringFromGUID2(&rgci->catid, keyname, 39)) continue; + if (!StringFromGUID2(&rgci->catid, keyname, CHARS_IN_GUID)) continue; res = create_classes_key(comcat_key, keyname, KEY_READ|KEY_WRITE, &cat_key); if (res != ERROR_SUCCESS) continue; /* Set the value for this locale's description. */ wsprintfW(valname, fmt, rgci->lcid); - RegSetValueExW(cat_key, valname, 0, REG_SZ, - (CONST BYTE*)(rgci->szDescription), + RegSetValueExW(cat_key, valname, 0, REG_SZ, (const BYTE*)rgci->szDescription, (lstrlenW(rgci->szDescription) + 1) * sizeof(WCHAR)); RegCloseKey(cat_key); @@ -364,10 +370,10 @@ static HRESULT WINAPI COMCAT_ICatRegister_UnRegisterCategories( if (res != ERROR_SUCCESS) return E_FAIL; for (; cCategories; --cCategories, ++rgcatid) { - WCHAR keyname[39]; + WCHAR keyname[CHARS_IN_GUID]; /* Delete the key for this category. */ - if (!StringFromGUID2(rgcatid, keyname, 39)) continue; + if (!StringFromGUID2(rgcatid, keyname, CHARS_IN_GUID)) continue; RegDeleteKeyW(comcat_key, keyname); } @@ -474,10 +480,7 @@ static HRESULT WINAPI COMCAT_ICatInformation_EnumCategories( if (ppenumCatInfo == NULL) return E_POINTER; - *ppenumCatInfo = COMCAT_IEnumCATEGORYINFO_Construct(lcid); - if (*ppenumCatInfo == NULL) return E_OUTOFMEMORY; - IEnumCATEGORYINFO_AddRef(*ppenumCatInfo); - return S_OK; + return EnumCATEGORYINFO_Construct(lcid, ppenumCatInfo); } /********************************************************************** @@ -500,7 +503,7 @@ static HRESULT WINAPI COMCAT_ICatInformation_GetCategoryDesc( if (rcatid == NULL || ppszDesc == NULL) return E_INVALIDARG; /* Open the key for this category. */ - if (!StringFromGUID2(rcatid, keyname + 21, 39)) return E_FAIL; + if (!StringFromGUID2(rcatid, keyname + 21, CHARS_IN_GUID)) return E_FAIL; res = open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ, &key); if (res != ERROR_SUCCESS) return CAT_E_CATIDNOEXIST; @@ -534,6 +537,7 @@ static HRESULT WINAPI COMCAT_ICatInformation_EnumClassesOfCategories( LPENUMCLSID *ppenumCLSID) { struct class_categories *categories; + HRESULT hr; TRACE("\n"); @@ -549,13 +553,15 @@ static HRESULT WINAPI COMCAT_ICatInformation_EnumClassesOfCategories( categories = COMCAT_PrepareClassCategories(cImplemented, rgcatidImpl, cRequired, rgcatidReq); if (categories == NULL) return E_OUTOFMEMORY; - *ppenumCLSID = COMCAT_CLSID_IEnumGUID_Construct(categories); - if (*ppenumCLSID == NULL) { + + hr = CLSIDEnumGUID_Construct(categories, ppenumCLSID); + if (FAILED(hr)) + { HeapFree(GetProcessHeap(), 0, categories); - return E_OUTOFMEMORY; + return hr; } - IEnumGUID_AddRef(*ppenumCLSID); - return S_OK; + + return hr; } /********************************************************************** @@ -587,7 +593,7 @@ static HRESULT WINAPI COMCAT_ICatInformation_IsClassOfCategories( if ((cImplemented && rgcatidImpl == NULL) || (cRequired && rgcatidReq == NULL)) return E_POINTER; - res = StringFromGUID2(rclsid, keyname + 6, 39); + res = StringFromGUID2(rclsid, keyname + 6, CHARS_IN_GUID); if (FAILED(res)) return res; categories = COMCAT_PrepareClassCategories(cImplemented, rgcatidImpl, @@ -622,9 +628,7 @@ static HRESULT WINAPI COMCAT_ICatInformation_EnumImplCategoriesOfClass( if (rclsid == NULL || ppenumCATID == NULL) return E_POINTER; - *ppenumCATID = COMCAT_CATID_IEnumGUID_Construct(rclsid, postfix); - if (*ppenumCATID == NULL) return E_OUTOFMEMORY; - return S_OK; + return CATIDEnumGUID_Construct(rclsid, postfix, ppenumCATID); } /********************************************************************** @@ -644,9 +648,7 @@ static HRESULT WINAPI COMCAT_ICatInformation_EnumReqCategoriesOfClass( if (rclsid == NULL || ppenumCATID == NULL) return E_POINTER; - *ppenumCATID = COMCAT_CATID_IEnumGUID_Construct(rclsid, postfix); - if (*ppenumCATID == NULL) return E_OUTOFMEMORY; - return S_OK; + return CATIDEnumGUID_Construct(rclsid, postfix, ppenumCATID); } /********************************************************************** @@ -857,8 +859,8 @@ static HRESULT WINAPI COMCAT_IEnumCATEGORYINFO_Next( if (This->key) while (fetched < celt) { LSTATUS res; HRESULT hr; - WCHAR catid[39]; - DWORD cName = 39; + WCHAR catid[CHARS_IN_GUID]; + DWORD cName = CHARS_IN_GUID; HKEY subkey; res = RegEnumKeyExW(This->key, This->next_index, catid, &cName, @@ -948,21 +950,23 @@ static const IEnumCATEGORYINFOVtbl COMCAT_IEnumCATEGORYINFO_Vtbl = COMCAT_IEnumCATEGORYINFO_Clone }; -static IEnumCATEGORYINFO *COMCAT_IEnumCATEGORYINFO_Construct(LCID lcid) +static HRESULT EnumCATEGORYINFO_Construct(LCID lcid, IEnumCATEGORYINFO **ret) { + static const WCHAR keyname[] = {'C','o','m','p','o','n','e','n','t',' ','C','a','t','e','g','o','r','i','e','s',0}; IEnumCATEGORYINFOImpl *This; - This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumCATEGORYINFOImpl)); - if (This) { - static const WCHAR keyname[] = { 'C', 'o', 'm', 'p', 'o', 'n', 'e', 'n', - 't', ' ', 'C', 'a', 't', 'e', 'g', 'o', - 'r', 'i', 'e', 's', 0 }; + *ret = NULL; - This->IEnumCATEGORYINFO_iface.lpVtbl = &COMCAT_IEnumCATEGORYINFO_Vtbl; - This->lcid = lcid; - open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ, &This->key); - } - return &This->IEnumCATEGORYINFO_iface; + This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumCATEGORYINFOImpl)); + if (!This) return E_OUTOFMEMORY; + + This->IEnumCATEGORYINFO_iface.lpVtbl = &COMCAT_IEnumCATEGORYINFO_Vtbl; + This->ref = 1; + This->lcid = lcid; + open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ, &This->key); + + *ret = &This->IEnumCATEGORYINFO_iface; + return S_OK; } /********************************************************************** @@ -973,23 +977,20 @@ static IEnumCATEGORYINFO *COMCAT_IEnumCATEGORYINFO_Construct(LCID lcid) */ typedef struct { - const IEnumGUIDVtbl *lpVtbl; + IEnumGUID IEnumGUID_iface; LONG ref; struct class_categories *categories; HKEY key; DWORD next_index; } CLSID_IEnumGUIDImpl; -static ULONG WINAPI COMCAT_CLSID_IEnumGUID_AddRef(LPENUMGUID iface) +static inline CLSID_IEnumGUIDImpl *impl_from_IEnumCLSID(IEnumGUID *iface) { - CLSID_IEnumGUIDImpl *This = (CLSID_IEnumGUIDImpl *)iface; - TRACE("\n"); - - return InterlockedIncrement(&This->ref); + return CONTAINING_RECORD(iface, CLSID_IEnumGUIDImpl, IEnumGUID_iface); } -static HRESULT WINAPI COMCAT_CLSID_IEnumGUID_QueryInterface( - LPENUMGUID iface, +static HRESULT WINAPI CLSIDEnumGUID_QueryInterface( + IEnumGUID *iface, REFIID riid, LPVOID *ppvObj) { @@ -1001,16 +1002,24 @@ static HRESULT WINAPI COMCAT_CLSID_IEnumGUID_QueryInterface( IsEqualGUID(riid, &IID_IEnumGUID)) { *ppvObj = iface; - COMCAT_CLSID_IEnumGUID_AddRef(iface); + IEnumGUID_AddRef(iface); return S_OK; } return E_NOINTERFACE; } -static ULONG WINAPI COMCAT_CLSID_IEnumGUID_Release(LPENUMGUID iface) +static ULONG WINAPI CLSIDEnumGUID_AddRef(IEnumGUID *iface) { - CLSID_IEnumGUIDImpl *This = (CLSID_IEnumGUIDImpl *)iface; + CLSID_IEnumGUIDImpl *This = impl_from_IEnumCLSID(iface); + TRACE("\n"); + + return InterlockedIncrement(&This->ref); +} + +static ULONG WINAPI CLSIDEnumGUID_Release(IEnumGUID *iface) +{ + CLSID_IEnumGUIDImpl *This = impl_from_IEnumCLSID(iface); ULONG ref; TRACE("\n"); @@ -1025,13 +1034,13 @@ static ULONG WINAPI COMCAT_CLSID_IEnumGUID_Release(LPENUMGUID iface) return ref; } -static HRESULT WINAPI COMCAT_CLSID_IEnumGUID_Next( - LPENUMGUID iface, +static HRESULT WINAPI CLSIDEnumGUID_Next( + IEnumGUID *iface, ULONG celt, GUID *rgelt, ULONG *pceltFetched) { - CLSID_IEnumGUIDImpl *This = (CLSID_IEnumGUIDImpl *)iface; + CLSID_IEnumGUIDImpl *This = impl_from_IEnumCLSID(iface); ULONG fetched = 0; TRACE("\n"); @@ -1041,8 +1050,8 @@ static HRESULT WINAPI COMCAT_CLSID_IEnumGUID_Next( if (This->key) while (fetched < celt) { LSTATUS res; HRESULT hr; - WCHAR clsid[39]; - DWORD cName = 39; + WCHAR clsid[CHARS_IN_GUID]; + DWORD cName = CHARS_IN_GUID; HKEY subkey; res = RegEnumKeyExW(This->key, This->next_index, clsid, &cName, @@ -1068,11 +1077,11 @@ static HRESULT WINAPI COMCAT_CLSID_IEnumGUID_Next( return fetched == celt ? S_OK : S_FALSE; } -static HRESULT WINAPI COMCAT_CLSID_IEnumGUID_Skip( - LPENUMGUID iface, +static HRESULT WINAPI CLSIDEnumGUID_Skip( + IEnumGUID *iface, ULONG celt) { - CLSID_IEnumGUIDImpl *This = (CLSID_IEnumGUIDImpl *)iface; + CLSID_IEnumGUIDImpl *This = impl_from_IEnumCLSID(iface); TRACE("\n"); @@ -1081,9 +1090,9 @@ static HRESULT WINAPI COMCAT_CLSID_IEnumGUID_Skip( return S_OK; } -static HRESULT WINAPI COMCAT_CLSID_IEnumGUID_Reset(LPENUMGUID iface) +static HRESULT WINAPI CLSIDEnumGUID_Reset(IEnumGUID *iface) { - CLSID_IEnumGUIDImpl *This = (CLSID_IEnumGUIDImpl *)iface; + CLSID_IEnumGUIDImpl *This = impl_from_IEnumCLSID(iface); TRACE("\n"); @@ -1091,64 +1100,70 @@ static HRESULT WINAPI COMCAT_CLSID_IEnumGUID_Reset(LPENUMGUID iface) return S_OK; } -static HRESULT WINAPI COMCAT_CLSID_IEnumGUID_Clone( - LPENUMGUID iface, +static HRESULT WINAPI CLSIDEnumGUID_Clone( + IEnumGUID *iface, IEnumGUID **ppenum) { - CLSID_IEnumGUIDImpl *This = (CLSID_IEnumGUIDImpl *)iface; - static const WCHAR keyname[] = { 'C', 'L', 'S', 'I', 'D', 0 }; - CLSID_IEnumGUIDImpl *new_this; - DWORD size; + static const WCHAR keynameW[] = {'C','L','S','I','D',0}; + CLSID_IEnumGUIDImpl *This = impl_from_IEnumCLSID(iface); + CLSID_IEnumGUIDImpl *cloned; - TRACE("\n"); + TRACE("(%p)->(%p)\n", This, ppenum); if (ppenum == NULL) return E_POINTER; - new_this = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLSID_IEnumGUIDImpl)); - if (new_this == NULL) return E_OUTOFMEMORY; + *ppenum = NULL; - new_this->lpVtbl = This->lpVtbl; - new_this->ref = 1; - size = HeapSize(GetProcessHeap(), 0, This->categories); - new_this->categories = - HeapAlloc(GetProcessHeap(), 0, size); - if (new_this->categories == NULL) { - HeapFree(GetProcessHeap(), 0, new_this); + cloned = HeapAlloc(GetProcessHeap(), 0, sizeof(CLSID_IEnumGUIDImpl)); + if (cloned == NULL) return E_OUTOFMEMORY; + + cloned->IEnumGUID_iface.lpVtbl = This->IEnumGUID_iface.lpVtbl; + cloned->ref = 1; + + cloned->categories = HeapAlloc(GetProcessHeap(), 0, This->categories->size); + if (cloned->categories == NULL) { + HeapFree(GetProcessHeap(), 0, cloned); return E_OUTOFMEMORY; } - memcpy(new_this->categories, This->categories, size); - /* FIXME: could we more efficiently use DuplicateHandle? */ - open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ, &new_this->key); - new_this->next_index = This->next_index; + memcpy(cloned->categories, This->categories, This->categories->size); - *ppenum = (LPENUMGUID)new_this; + cloned->key = NULL; + open_classes_key(HKEY_CLASSES_ROOT, keynameW, KEY_READ, &cloned->key); + cloned->next_index = This->next_index; + + *ppenum = &cloned->IEnumGUID_iface; return S_OK; } -static const IEnumGUIDVtbl COMCAT_CLSID_IEnumGUID_Vtbl = +static const IEnumGUIDVtbl CLSIDEnumGUIDVtbl = { - COMCAT_CLSID_IEnumGUID_QueryInterface, - COMCAT_CLSID_IEnumGUID_AddRef, - COMCAT_CLSID_IEnumGUID_Release, - COMCAT_CLSID_IEnumGUID_Next, - COMCAT_CLSID_IEnumGUID_Skip, - COMCAT_CLSID_IEnumGUID_Reset, - COMCAT_CLSID_IEnumGUID_Clone + CLSIDEnumGUID_QueryInterface, + CLSIDEnumGUID_AddRef, + CLSIDEnumGUID_Release, + CLSIDEnumGUID_Next, + CLSIDEnumGUID_Skip, + CLSIDEnumGUID_Reset, + CLSIDEnumGUID_Clone }; -static LPENUMGUID COMCAT_CLSID_IEnumGUID_Construct(struct class_categories *categories) +static HRESULT CLSIDEnumGUID_Construct(struct class_categories *categories, IEnumCLSID **ret) { + static const WCHAR keyname[] = {'C','L','S','I','D',0}; CLSID_IEnumGUIDImpl *This; - This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLSID_IEnumGUIDImpl)); - if (This) { - static const WCHAR keyname[] = { 'C', 'L', 'S', 'I', 'D', 0 }; + *ret = NULL; - This->lpVtbl = &COMCAT_CLSID_IEnumGUID_Vtbl; - This->categories = categories; - open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ, &This->key); - } - return (LPENUMGUID)This; + This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLSID_IEnumGUIDImpl)); + if (!This) return E_OUTOFMEMORY; + + This->IEnumGUID_iface.lpVtbl = &CLSIDEnumGUIDVtbl; + This->ref = 1; + This->categories = categories; + open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ, &This->key); + + *ret = &This->IEnumGUID_iface; + + return S_OK; } /********************************************************************** @@ -1159,23 +1174,20 @@ static LPENUMGUID COMCAT_CLSID_IEnumGUID_Construct(struct class_categories *cate */ typedef struct { - const IEnumGUIDVtbl *lpVtbl; + IEnumGUID IEnumGUID_iface; LONG ref; WCHAR keyname[68]; HKEY key; DWORD next_index; } CATID_IEnumGUIDImpl; -static ULONG WINAPI COMCAT_CATID_IEnumGUID_AddRef(LPENUMGUID iface) +static inline CATID_IEnumGUIDImpl *impl_from_IEnumCATID(IEnumGUID *iface) { - CATID_IEnumGUIDImpl *This = (CATID_IEnumGUIDImpl *)iface; - TRACE("\n"); - - return InterlockedIncrement(&This->ref); + return CONTAINING_RECORD(iface, CATID_IEnumGUIDImpl, IEnumGUID_iface); } -static HRESULT WINAPI COMCAT_CATID_IEnumGUID_QueryInterface( - LPENUMGUID iface, +static HRESULT WINAPI CATIDEnumGUID_QueryInterface( + IEnumGUID *iface, REFIID riid, LPVOID *ppvObj) { @@ -1187,16 +1199,24 @@ static HRESULT WINAPI COMCAT_CATID_IEnumGUID_QueryInterface( IsEqualGUID(riid, &IID_IEnumGUID)) { *ppvObj = iface; - COMCAT_CATID_IEnumGUID_AddRef(iface); + IEnumGUID_AddRef(iface); return S_OK; } return E_NOINTERFACE; } -static ULONG WINAPI COMCAT_CATID_IEnumGUID_Release(LPENUMGUID iface) +static ULONG WINAPI CATIDEnumGUID_AddRef(IEnumGUID *iface) { - CATID_IEnumGUIDImpl *This = (CATID_IEnumGUIDImpl *)iface; + CATID_IEnumGUIDImpl *This = impl_from_IEnumCATID(iface); + TRACE("\n"); + + return InterlockedIncrement(&This->ref); +} + +static ULONG WINAPI CATIDEnumGUID_Release(IEnumGUID *iface) +{ + CATID_IEnumGUIDImpl *This = impl_from_IEnumCATID(iface); ULONG ref; TRACE("\n"); @@ -1210,13 +1230,13 @@ static ULONG WINAPI COMCAT_CATID_IEnumGUID_Release(LPENUMGUID iface) return ref; } -static HRESULT WINAPI COMCAT_CATID_IEnumGUID_Next( - LPENUMGUID iface, +static HRESULT WINAPI CATIDEnumGUID_Next( + IEnumGUID *iface, ULONG celt, GUID *rgelt, ULONG *pceltFetched) { - CATID_IEnumGUIDImpl *This = (CATID_IEnumGUIDImpl *)iface; + CATID_IEnumGUIDImpl *This = impl_from_IEnumCATID(iface); ULONG fetched = 0; TRACE("\n"); @@ -1226,8 +1246,8 @@ static HRESULT WINAPI COMCAT_CATID_IEnumGUID_Next( if (This->key) while (fetched < celt) { LSTATUS res; HRESULT hr; - WCHAR catid[39]; - DWORD cName = 39; + WCHAR catid[CHARS_IN_GUID]; + DWORD cName = CHARS_IN_GUID; res = RegEnumKeyExW(This->key, This->next_index, catid, &cName, NULL, NULL, NULL, NULL); @@ -1245,11 +1265,11 @@ static HRESULT WINAPI COMCAT_CATID_IEnumGUID_Next( return fetched == celt ? S_OK : S_FALSE; } -static HRESULT WINAPI COMCAT_CATID_IEnumGUID_Skip( - LPENUMGUID iface, +static HRESULT WINAPI CATIDEnumGUID_Skip( + IEnumGUID *iface, ULONG celt) { - CATID_IEnumGUIDImpl *This = (CATID_IEnumGUIDImpl *)iface; + CATID_IEnumGUIDImpl *This = impl_from_IEnumCATID(iface); TRACE("\n"); @@ -1258,9 +1278,9 @@ static HRESULT WINAPI COMCAT_CATID_IEnumGUID_Skip( return S_OK; } -static HRESULT WINAPI COMCAT_CATID_IEnumGUID_Reset(LPENUMGUID iface) +static HRESULT WINAPI CATIDEnumGUID_Reset(IEnumGUID *iface) { - CATID_IEnumGUIDImpl *This = (CATID_IEnumGUIDImpl *)iface; + CATID_IEnumGUIDImpl *This = impl_from_IEnumCATID(iface); TRACE("\n"); @@ -1268,11 +1288,11 @@ static HRESULT WINAPI COMCAT_CATID_IEnumGUID_Reset(LPENUMGUID iface) return S_OK; } -static HRESULT WINAPI COMCAT_CATID_IEnumGUID_Clone( - LPENUMGUID iface, +static HRESULT WINAPI CATIDEnumGUID_Clone( + IEnumGUID *iface, IEnumGUID **ppenum) { - CATID_IEnumGUIDImpl *This = (CATID_IEnumGUIDImpl *)iface; + CATID_IEnumGUIDImpl *This = impl_from_IEnumCATID(iface); CATID_IEnumGUIDImpl *new_this; TRACE("\n"); @@ -1282,42 +1302,49 @@ static HRESULT WINAPI COMCAT_CATID_IEnumGUID_Clone( new_this = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CATID_IEnumGUIDImpl)); if (new_this == NULL) return E_OUTOFMEMORY; - new_this->lpVtbl = This->lpVtbl; + new_this->IEnumGUID_iface.lpVtbl = This->IEnumGUID_iface.lpVtbl; new_this->ref = 1; lstrcpyW(new_this->keyname, This->keyname); /* FIXME: could we more efficiently use DuplicateHandle? */ open_classes_key(HKEY_CLASSES_ROOT, new_this->keyname, KEY_READ, &new_this->key); new_this->next_index = This->next_index; - *ppenum = (LPENUMGUID)new_this; + *ppenum = &new_this->IEnumGUID_iface; return S_OK; } -static const IEnumGUIDVtbl COMCAT_CATID_IEnumGUID_Vtbl = +static const IEnumGUIDVtbl CATIDEnumGUIDVtbl = { - COMCAT_CATID_IEnumGUID_QueryInterface, - COMCAT_CATID_IEnumGUID_AddRef, - COMCAT_CATID_IEnumGUID_Release, - COMCAT_CATID_IEnumGUID_Next, - COMCAT_CATID_IEnumGUID_Skip, - COMCAT_CATID_IEnumGUID_Reset, - COMCAT_CATID_IEnumGUID_Clone + CATIDEnumGUID_QueryInterface, + CATIDEnumGUID_AddRef, + CATIDEnumGUID_Release, + CATIDEnumGUID_Next, + CATIDEnumGUID_Skip, + CATIDEnumGUID_Reset, + CATIDEnumGUID_Clone }; -static LPENUMGUID COMCAT_CATID_IEnumGUID_Construct( - REFCLSID rclsid, LPCWSTR postfix) +static HRESULT CATIDEnumGUID_Construct(REFCLSID rclsid, LPCWSTR postfix, IEnumGUID **ret) { + static const WCHAR prefixW[] = {'C','L','S','I','D','\\',0}; + WCHAR keyname[100], clsidW[CHARS_IN_GUID]; CATID_IEnumGUIDImpl *This; - This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CATID_IEnumGUIDImpl)); - if (This) { - WCHAR prefix[] = { 'C', 'L', 'S', 'I', 'D', '\\' }; + *ret = NULL; - This->lpVtbl = &COMCAT_CATID_IEnumGUID_Vtbl; - memcpy(This->keyname, prefix, sizeof(prefix)); - StringFromGUID2(rclsid, This->keyname + 6, 39); - lstrcpyW(This->keyname + 44, postfix); - open_classes_key(HKEY_CLASSES_ROOT, This->keyname, KEY_READ, &This->key); - } - return (LPENUMGUID)This; + This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CATID_IEnumGUIDImpl)); + if (!This) return E_OUTOFMEMORY; + + StringFromGUID2(rclsid, clsidW, CHARS_IN_GUID); + + This->IEnumGUID_iface.lpVtbl = &CATIDEnumGUIDVtbl; + This->ref = 1; + strcpyW(keyname, prefixW); + strcatW(keyname, clsidW); + strcatW(keyname, postfix); + + open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ, &This->key); + + *ret = &This->IEnumGUID_iface; + return S_OK; } diff --git a/dll/win32/ole32/compobj.c b/dll/win32/ole32/compobj.c index 5baffd159de..5d8fb0c3b2f 100644 --- a/dll/win32/ole32/compobj.c +++ b/dll/win32/ole32/compobj.c @@ -62,6 +62,82 @@ static CRITICAL_SECTION_DEBUG critsect_debug = }; static CRITICAL_SECTION csApartment = { &critsect_debug, -1, 0, 0, 0, 0 }; +enum comclass_threadingmodel +{ + ThreadingModel_Apartment = 1, + ThreadingModel_Free = 2, + ThreadingModel_No = 3, + ThreadingModel_Both = 4, + ThreadingModel_Neutral = 5 +}; + +enum comclass_miscfields +{ + MiscStatus = 1, + MiscStatusIcon = 2, + MiscStatusContent = 4, + MiscStatusThumbnail = 8, + MiscStatusDocPrint = 16 +}; + +struct comclassredirect_data +{ + ULONG size; + BYTE res; + BYTE miscmask; + BYTE res1[2]; + DWORD model; + GUID clsid; + GUID alias; + GUID clsid2; + GUID tlbid; + ULONG name_len; + ULONG name_offset; + ULONG progid_len; + ULONG progid_offset; + ULONG clrdata_len; + ULONG clrdata_offset; + DWORD miscstatus; + DWORD miscstatuscontent; + DWORD miscstatusthumbnail; + DWORD miscstatusicon; + DWORD miscstatusdocprint; +}; + +struct ifacepsredirect_data +{ + ULONG size; + DWORD mask; + GUID iid; + ULONG nummethods; + GUID tlbid; + GUID base; + ULONG name_len; + ULONG name_offset; +}; + +struct progidredirect_data +{ + ULONG size; + DWORD reserved; + ULONG clsid_offset; +}; + +struct class_reg_data +{ + union + { + struct + { + struct comclassredirect_data *data; + void *section; + HANDLE hactctx; + } actctx; + HKEY hkey; + } u; + BOOL hkey; +}; + struct registered_psclsid { struct list entry; @@ -123,6 +199,71 @@ static CRITICAL_SECTION_DEBUG class_cs_debug = }; static CRITICAL_SECTION csRegisteredClassList = { &class_cs_debug, -1, 0, 0, 0, 0 }; +static inline enum comclass_miscfields dvaspect_to_miscfields(DWORD aspect) +{ + switch (aspect) + { + case DVASPECT_CONTENT: + return MiscStatusContent; + case DVASPECT_THUMBNAIL: + return MiscStatusThumbnail; + case DVASPECT_ICON: + return MiscStatusIcon; + case DVASPECT_DOCPRINT: + return MiscStatusDocPrint; + default: + return MiscStatus; + }; +} + +BOOL actctx_get_miscstatus(const CLSID *clsid, DWORD aspect, DWORD *status) +{ + ACTCTX_SECTION_KEYED_DATA data; + + data.cbSize = sizeof(data); + if (FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, + clsid, &data)) + { + struct comclassredirect_data *comclass = (struct comclassredirect_data*)data.lpData; + enum comclass_miscfields misc = dvaspect_to_miscfields(aspect); + + if (!(comclass->miscmask & misc)) + { + if (!(comclass->miscmask & MiscStatus)) + { + *status = 0; + return TRUE; + } + misc = MiscStatus; + } + + switch (misc) + { + case MiscStatus: + *status = comclass->miscstatus; + break; + case MiscStatusIcon: + *status = comclass->miscstatusicon; + break; + case MiscStatusContent: + *status = comclass->miscstatuscontent; + break; + case MiscStatusThumbnail: + *status = comclass->miscstatusthumbnail; + break; + case MiscStatusDocPrint: + *status = comclass->miscstatusdocprint; + break; + default: + ; + }; + + return TRUE; + } + else + return FALSE; +} + /* wrapper for NtCreateKey that creates the key recursively if necessary */ static NTSTATUS create_key( HKEY *retkey, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr ) { @@ -320,7 +461,7 @@ static HRESULT COMPOBJ_DllList_Add(LPCWSTR library_name, OpenDll **ret) DllCanUnloadNowFunc DllCanUnloadNow; DllGetClassObjectFunc DllGetClassObject; - TRACE("\n"); + TRACE("%s\n", debugstr_w(library_name)); *ret = COMPOBJ_DllList_Get(library_name); if (*ret) return S_OK; @@ -1203,14 +1344,17 @@ static HRESULT apartment_getclassobject(struct apartment *apt, LPCWSTR dllpath, * * Reads a registry value and expands it when necessary */ -static DWORD COM_RegReadPath(HKEY hkeyroot, WCHAR * dst, DWORD dstlen) +static DWORD COM_RegReadPath(const struct class_reg_data *regdata, WCHAR *dst, DWORD dstlen) { - DWORD ret; + DWORD ret; + + if (regdata->hkey) + { DWORD keytype; WCHAR src[MAX_PATH]; DWORD dwLength = dstlen * sizeof(WCHAR); - if( (ret = RegQueryValueExW(hkeyroot, NULL, NULL, &keytype, (LPBYTE)src, &dwLength)) == ERROR_SUCCESS ) { + if( (ret = RegQueryValueExW(regdata->u.hkey, NULL, NULL, &keytype, (BYTE*)src, &dwLength)) == ERROR_SUCCESS ) { if (keytype == REG_EXPAND_SZ) { if (dstlen <= ExpandEnvironmentStringsW(src, dst, dstlen)) ret = ERROR_MORE_DATA; } else { @@ -1228,11 +1372,24 @@ static DWORD COM_RegReadPath(HKEY hkeyroot, WCHAR * dst, DWORD dstlen) } } return ret; + } + else + { + ULONG_PTR cookie; + WCHAR *nameW; + + *dst = 0; + nameW = (WCHAR*)((BYTE*)regdata->u.actctx.section + regdata->u.actctx.data->name_offset); + ActivateActCtx(regdata->u.actctx.hactctx, &cookie); + ret = SearchPathW(NULL, nameW, NULL, dstlen, dst, NULL); + DeactivateActCtx(0, cookie); + return !*dst; + } } struct host_object_params { - HKEY hkeydll; + struct class_reg_data regdata; CLSID clsid; /* clsid of object to marshal */ IID iid; /* interface to marshal */ HANDLE event; /* event signalling when ready for multi-threaded case */ @@ -1251,7 +1408,7 @@ static HRESULT apartment_hostobject(struct apartment *apt, TRACE("clsid %s, iid %s\n", debugstr_guid(¶ms->clsid), debugstr_guid(¶ms->iid)); - if (COM_RegReadPath(params->hkeydll, dllpath, ARRAYSIZE(dllpath)) != ERROR_SUCCESS) + if (COM_RegReadPath(¶ms->regdata, dllpath, ARRAYSIZE(dllpath)) != ERROR_SUCCESS) { /* failure: CLSID is not found in registry */ WARN("class %s not registered inproc\n", debugstr_guid(¶ms->clsid)); @@ -1348,7 +1505,7 @@ static DWORD CALLBACK apartment_hostobject_thread(LPVOID p) * caller of this function */ static HRESULT apartment_hostobject_in_hostapt( struct apartment *apt, BOOL multi_threaded, BOOL main_apartment, - HKEY hkeydll, REFCLSID rclsid, REFIID riid, void **ppv) + const struct class_reg_data *regdata, REFCLSID rclsid, REFIID riid, void **ppv) { struct host_object_params params; HWND apartment_hwnd = NULL; @@ -1418,7 +1575,7 @@ static HRESULT apartment_hostobject_in_hostapt( } } - params.hkeydll = hkeydll; + params.regdata = *regdata; params.clsid = *rclsid; params.iid = *riid; hr = CreateStreamOnHGlobal(NULL, TRUE, ¶ms.stream); @@ -1454,6 +1611,29 @@ static HRESULT apartment_hostobject_in_hostapt( return hr; } +#ifndef __REACTOS__ +static BOOL WINAPI register_class( INIT_ONCE *once, void *param, void **context ) +{ + WNDCLASSW wclass; + + /* Dispatching to the correct thread in an apartment is done through + * window messages rather than RPC transports. When an interface is + * marshalled into another apartment in the same process, a window of the + * following class is created. The *caller* of CoMarshalInterface (i.e., the + * application) is responsible for pumping the message loop in that thread. + * The WM_USER messages which point to the RPCs are then dispatched to + * apartment_wndproc by the user's code from the apartment in which the + * interface was unmarshalled. + */ + memset(&wclass, 0, sizeof(wclass)); + wclass.lpfnWndProc = apartment_wndproc; + wclass.hInstance = hProxyDll; + wclass.lpszClassName = wszAptWinClass; + RegisterClassW(&wclass); + return TRUE; +} +#endif + /* create a window for the apartment or return the current one if one has * already been created */ HRESULT apartment_createwindowifneeded(struct apartment *apt) @@ -1492,6 +1672,8 @@ void apartment_joinmta(void) COM_CurrentInfo()->apt = MTA; } +#ifdef __REACTOS__ + static void COMPOBJ_InitProcess( void ) { WNDCLASSW wclass; @@ -1517,6 +1699,8 @@ static void COMPOBJ_UninitProcess( void ) UnregisterClassW(wszAptWinClass, hProxyDll); } +#endif + static void COM_TlsDestroy(void) { struct oletls *info = NtCurrentTeb()->ReservedForOle; @@ -1883,9 +2067,103 @@ static inline BOOL is_valid_hex(WCHAR c) return TRUE; } +static const BYTE guid_conv_table[256] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, /* 0x30 */ + 0, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ + 0, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf /* 0x60 */ +}; + +/* conversion helper for CLSIDFromString/IIDFromString */ +static BOOL guid_from_string(LPCWSTR s, GUID *id) +{ + int i; + + if (!s || s[0]!='{') { + memset( id, 0, sizeof (CLSID) ); + if(!s) return TRUE; + return FALSE; + } + + TRACE("%s -> %p\n", debugstr_w(s), id); + + /* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */ + + id->Data1 = 0; + for (i = 1; i < 9; i++) { + if (!is_valid_hex(s[i])) return FALSE; + id->Data1 = (id->Data1 << 4) | guid_conv_table[s[i]]; + } + if (s[9]!='-') return FALSE; + + id->Data2 = 0; + for (i = 10; i < 14; i++) { + if (!is_valid_hex(s[i])) return FALSE; + id->Data2 = (id->Data2 << 4) | guid_conv_table[s[i]]; + } + if (s[14]!='-') return FALSE; + + id->Data3 = 0; + for (i = 15; i < 19; i++) { + if (!is_valid_hex(s[i])) return FALSE; + id->Data3 = (id->Data3 << 4) | guid_conv_table[s[i]]; + } + if (s[19]!='-') return FALSE; + + for (i = 20; i < 37; i+=2) { + if (i == 24) { + if (s[i]!='-') return FALSE; + i++; + } + if (!is_valid_hex(s[i]) || !is_valid_hex(s[i+1])) return FALSE; + id->Data4[(i-20)/2] = guid_conv_table[s[i]] << 4 | guid_conv_table[s[i+1]]; + } + + if (s[37] == '}' && s[38] == '\0') + return TRUE; + + return FALSE; +} + +/*****************************************************************************/ + +static HRESULT clsid_from_string_reg(LPCOLESTR progid, CLSID *clsid) +{ + static const WCHAR clsidW[] = { '\\','C','L','S','I','D',0 }; + WCHAR buf2[CHARS_IN_GUID]; + LONG buf2len = sizeof(buf2); + HKEY xhkey; + WCHAR *buf; + + memset(clsid, 0, sizeof(*clsid)); + buf = HeapAlloc( GetProcessHeap(),0,(strlenW(progid)+8) * sizeof(WCHAR) ); + if (!buf) return E_OUTOFMEMORY; + strcpyW( buf, progid ); + strcatW( buf, clsidW ); + if (open_classes_key(HKEY_CLASSES_ROOT, buf, MAXIMUM_ALLOWED, &xhkey)) + { + HeapFree(GetProcessHeap(),0,buf); + WARN("couldn't open key for ProgID %s\n", debugstr_w(progid)); + return CO_E_CLASSSTRING; + } + HeapFree(GetProcessHeap(),0,buf); + + if (RegQueryValueW(xhkey,NULL,buf2,&buf2len)) + { + RegCloseKey(xhkey); + WARN("couldn't query clsid value for ProgID %s\n", debugstr_w(progid)); + return CO_E_CLASSSTRING; + } + RegCloseKey(xhkey); + return guid_from_string(buf2, clsid) ? S_OK : CO_E_CLASSSTRING; +} + /****************************************************************************** * CLSIDFromString [OLE32.@] - * IIDFromString [OLE32.@] * * Converts a unique identifier from its string representation into * the GUID struct. @@ -1901,87 +2179,61 @@ static inline BOOL is_valid_hex(WCHAR c) * SEE ALSO * StringFromCLSID */ -static HRESULT __CLSIDFromString(LPCWSTR s, LPCLSID id) -{ - int i; - BYTE table[256]; - - if (!s || s[0]!='{') { - memset( id, 0, sizeof (CLSID) ); - if(!s) return S_OK; - return CO_E_CLASSSTRING; - } - - TRACE("%s -> %p\n", debugstr_w(s), id); - - /* quick lookup table */ - memset(table, 0, 256); - - for (i = 0; i < 10; i++) { - table['0' + i] = i; - } - for (i = 0; i < 6; i++) { - table['A' + i] = i+10; - table['a' + i] = i+10; - } - - /* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */ - - id->Data1 = 0; - for (i = 1; i < 9; i++) { - if (!is_valid_hex(s[i])) return CO_E_CLASSSTRING; - id->Data1 = (id->Data1 << 4) | table[s[i]]; - } - if (s[9]!='-') return CO_E_CLASSSTRING; - - id->Data2 = 0; - for (i = 10; i < 14; i++) { - if (!is_valid_hex(s[i])) return CO_E_CLASSSTRING; - id->Data2 = (id->Data2 << 4) | table[s[i]]; - } - if (s[14]!='-') return CO_E_CLASSSTRING; - - id->Data3 = 0; - for (i = 15; i < 19; i++) { - if (!is_valid_hex(s[i])) return CO_E_CLASSSTRING; - id->Data3 = (id->Data3 << 4) | table[s[i]]; - } - if (s[19]!='-') return CO_E_CLASSSTRING; - - for (i = 20; i < 37; i+=2) { - if (i == 24) { - if (s[i]!='-') return CO_E_CLASSSTRING; - i++; - } - if (!is_valid_hex(s[i]) || !is_valid_hex(s[i+1])) return CO_E_CLASSSTRING; - id->Data4[(i-20)/2] = table[s[i]] << 4 | table[s[i+1]]; - } - - if (s[37] == '}' && s[38] == '\0') - return S_OK; - - return CO_E_CLASSSTRING; -} - -/*****************************************************************************/ - HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id ) { - HRESULT ret; + HRESULT ret = CO_E_CLASSSTRING; + CLSID tmp_id; if (!id) return E_INVALIDARG; - ret = __CLSIDFromString(idstr, id); - if(ret != S_OK) { /* It appears a ProgID is also valid */ - CLSID tmp_id; - ret = CLSIDFromProgID(idstr, &tmp_id); - if(SUCCEEDED(ret)) - *id = tmp_id; - } + if (guid_from_string(idstr, id)) + return S_OK; + + /* It appears a ProgID is also valid */ + ret = clsid_from_string_reg(idstr, &tmp_id); + if(SUCCEEDED(ret)) + *id = tmp_id; + return ret; } +/****************************************************************************** + * IIDFromString [OLE32.@] + * + * Converts a interface identifier from its string representation into + * the IID struct. + * + * PARAMS + * idstr [I] The string representation of the GUID. + * id [O] IID converted from the string. + * + * RETURNS + * S_OK on success + * CO_E_IIDSTRING if idstr is not a valid IID + * + * SEE ALSO + * StringFromIID + */ +HRESULT WINAPI IIDFromString(LPCOLESTR s, IID *iid) +{ + TRACE("%s -> %p\n", debugstr_w(s), iid); + + if (!s) + { + memset(iid, 0, sizeof(*iid)); + return S_OK; + } + + /* length mismatch is a special case */ + if (strlenW(s) + 1 != CHARS_IN_GUID) + return E_INVALIDARG; + + if (s[0] != '{') + return CO_E_IIDSTRING; + + return guid_from_string(s, iid) ? S_OK : CO_E_IIDSTRING; +} /****************************************************************************** * StringFromCLSID [OLE32.@] @@ -2003,11 +2255,7 @@ HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id ) */ HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr) { - HRESULT ret; - LPMALLOC mllc; - - if ((ret = CoGetMalloc(0,&mllc))) return ret; - if (!(*idstr = IMalloc_Alloc( mllc, CHARS_IN_GUID * sizeof(WCHAR) ))) return E_OUTOFMEMORY; + if (!(*idstr = CoTaskMemAlloc(CHARS_IN_GUID * sizeof(WCHAR)))) return E_OUTOFMEMORY; StringFromGUID2( id, *idstr, CHARS_IN_GUID ); return S_OK; } @@ -2123,20 +2371,39 @@ HRESULT COM_OpenKeyForAppIdFromCLSID(REFCLSID clsid, REGSAM access, HKEY *subkey * E_OUTOFMEMORY * REGDB_E_CLASSNOTREG if the given clsid has no associated ProgID */ -HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *ppszProgID) +HRESULT WINAPI DECLSPEC_HOTPATCH ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *ppszProgID) { static const WCHAR wszProgID[] = {'P','r','o','g','I','D',0}; + ACTCTX_SECTION_KEYED_DATA data; HKEY hkey; HRESULT ret; LONG progidlen = 0; if (!ppszProgID) - { - ERR("ppszProgId isn't optional\n"); return E_INVALIDARG; - } *ppszProgID = NULL; + + data.cbSize = sizeof(data); + if (FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, + clsid, &data)) + { + struct comclassredirect_data *comclass = (struct comclassredirect_data*)data.lpData; + if (comclass->progid_len) + { + WCHAR *ptrW; + + *ppszProgID = CoTaskMemAlloc(comclass->progid_len + sizeof(WCHAR)); + if (!*ppszProgID) return E_OUTOFMEMORY; + + ptrW = (WCHAR*)((BYTE*)comclass + comclass->progid_offset); + memcpy(*ppszProgID, ptrW, comclass->progid_len + sizeof(WCHAR)); + return S_OK; + } + else + return REGDB_E_CLASSNOTREG; + } + ret = COM_OpenKeyForCLSID(clsid, wszProgID, KEY_READ, &hkey); if (FAILED(ret)) return ret; @@ -2176,42 +2443,24 @@ HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *ppszProgID) * Success: S_OK * Failure: CO_E_CLASSSTRING - the given ProgID cannot be found. */ -HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid) +HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid) { - static const WCHAR clsidW[] = { '\\','C','L','S','I','D',0 }; - WCHAR buf2[CHARS_IN_GUID]; - LONG buf2len = sizeof(buf2); - HKEY xhkey; - WCHAR *buf; + ACTCTX_SECTION_KEYED_DATA data; if (!progid || !clsid) - { - ERR("neither progid (%p) nor clsid (%p) are optional\n", progid, clsid); return E_INVALIDARG; - } - /* initialise clsid in case of failure */ - memset(clsid, 0, sizeof(*clsid)); - - buf = HeapAlloc( GetProcessHeap(),0,(strlenW(progid)+8) * sizeof(WCHAR) ); - strcpyW( buf, progid ); - strcatW( buf, clsidW ); - if (open_classes_key(HKEY_CLASSES_ROOT, buf, MAXIMUM_ALLOWED, &xhkey)) + data.cbSize = sizeof(data); + if (FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION, + progid, &data)) { - HeapFree(GetProcessHeap(),0,buf); - WARN("couldn't open key for ProgID %s\n", debugstr_w(progid)); - return CO_E_CLASSSTRING; + struct progidredirect_data *progiddata = (struct progidredirect_data*)data.lpData; + CLSID *alias = (CLSID*)((BYTE*)data.lpSectionBase + progiddata->clsid_offset); + *clsid = *alias; + return S_OK; } - HeapFree(GetProcessHeap(),0,buf); - if (RegQueryValueW(xhkey,NULL,buf2,&buf2len)) - { - RegCloseKey(xhkey); - WARN("couldn't query clsid value for ProgID %s\n", debugstr_w(progid)); - return CO_E_CLASSSTRING; - } - RegCloseKey(xhkey); - return __CLSIDFromString(buf2,clsid); + return clsid_from_string_reg(progid, clsid); } /****************************************************************************** @@ -2270,6 +2519,7 @@ HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid) HKEY hkey; APARTMENT *apt = COM_CurrentApt(); struct registered_psclsid *registered_psclsid; + ACTCTX_SECTION_KEYED_DATA data; TRACE("() riid=%s, pclsid=%p\n", debugstr_guid(riid), pclsid); @@ -2280,10 +2530,7 @@ HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid) } if (!pclsid) - { - ERR("pclsid isn't optional\n"); return E_INVALIDARG; - } EnterCriticalSection(&apt->cs); @@ -2297,6 +2544,15 @@ HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid) LeaveCriticalSection(&apt->cs); + data.cbSize = sizeof(data); + if (FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION, + riid, &data)) + { + struct ifacepsredirect_data *ifaceps = (struct ifacepsredirect_data*)data.lpData; + *pclsid = ifaceps->iid; + return S_OK; + } + /* Interface\\{string form of riid}\\ProxyStubClsid32 */ strcpyW(path, wszInterface); StringFromGUID2(riid, path + ARRAYSIZE(wszInterface) - 1, CHARS_IN_GUID); @@ -2561,19 +2817,36 @@ HRESULT WINAPI CoRegisterClassObject( return S_OK; } -static void get_threading_model(HKEY key, LPWSTR value, DWORD len) +static enum comclass_threadingmodel get_threading_model(const struct class_reg_data *data) { - static const WCHAR wszThreadingModel[] = {'T','h','r','e','a','d','i','n','g','M','o','d','e','l',0}; - DWORD keytype; - DWORD ret; - DWORD dwLength = len * sizeof(WCHAR); + if (data->hkey) + { + static const WCHAR wszThreadingModel[] = {'T','h','r','e','a','d','i','n','g','M','o','d','e','l',0}; + static const WCHAR wszApartment[] = {'A','p','a','r','t','m','e','n','t',0}; + static const WCHAR wszFree[] = {'F','r','e','e',0}; + static const WCHAR wszBoth[] = {'B','o','t','h',0}; + WCHAR threading_model[10 /* strlenW(L"apartment")+1 */]; + DWORD dwLength = sizeof(threading_model); + DWORD keytype; + DWORD ret; - ret = RegQueryValueExW(key, wszThreadingModel, NULL, &keytype, (LPBYTE)value, &dwLength); - if ((ret != ERROR_SUCCESS) || (keytype != REG_SZ)) - value[0] = '\0'; + ret = RegQueryValueExW(data->u.hkey, wszThreadingModel, NULL, &keytype, (BYTE*)threading_model, &dwLength); + if ((ret != ERROR_SUCCESS) || (keytype != REG_SZ)) + threading_model[0] = '\0'; + + if (!strcmpiW(threading_model, wszApartment)) return ThreadingModel_Apartment; + if (!strcmpiW(threading_model, wszFree)) return ThreadingModel_Free; + if (!strcmpiW(threading_model, wszBoth)) return ThreadingModel_Both; + + /* there's not specific handling for this case */ + if (threading_model[0]) return ThreadingModel_Neutral; + return ThreadingModel_No; + } + else + return data->u.actctx.data->model; } -static HRESULT get_inproc_class_object(APARTMENT *apt, HKEY hkeydll, +static HRESULT get_inproc_class_object(APARTMENT *apt, const struct class_reg_data *regdata, REFCLSID rclsid, REFIID riid, BOOL hostifnecessary, void **ppv) { @@ -2582,37 +2855,30 @@ static HRESULT get_inproc_class_object(APARTMENT *apt, HKEY hkeydll, if (hostifnecessary) { - static const WCHAR wszApartment[] = {'A','p','a','r','t','m','e','n','t',0}; - static const WCHAR wszFree[] = {'F','r','e','e',0}; - static const WCHAR wszBoth[] = {'B','o','t','h',0}; - WCHAR threading_model[10 /* strlenW(L"apartment")+1 */]; + enum comclass_threadingmodel model = get_threading_model(regdata); - get_threading_model(hkeydll, threading_model, ARRAYSIZE(threading_model)); - /* "Apartment" */ - if (!strcmpiW(threading_model, wszApartment)) + if (model == ThreadingModel_Apartment) { apartment_threaded = TRUE; if (apt->multi_threaded) - return apartment_hostobject_in_hostapt(apt, FALSE, FALSE, hkeydll, rclsid, riid, ppv); + return apartment_hostobject_in_hostapt(apt, FALSE, FALSE, regdata, rclsid, riid, ppv); } - /* "Free" */ - else if (!strcmpiW(threading_model, wszFree)) + else if (model == ThreadingModel_Free) { apartment_threaded = FALSE; if (!apt->multi_threaded) - return apartment_hostobject_in_hostapt(apt, TRUE, FALSE, hkeydll, rclsid, riid, ppv); + return apartment_hostobject_in_hostapt(apt, TRUE, FALSE, regdata, rclsid, riid, ppv); } /* everything except "Apartment", "Free" and "Both" */ - else if (strcmpiW(threading_model, wszBoth)) + else if (model != ThreadingModel_Both) { apartment_threaded = TRUE; /* everything else is main-threaded */ - if (threading_model[0]) - FIXME("unrecognised threading model %s for object %s, should be main-threaded?\n", - debugstr_w(threading_model), debugstr_guid(rclsid)); + if (model != ThreadingModel_No) + FIXME("unrecognised threading model %d for object %s, should be main-threaded?\n", model, debugstr_guid(rclsid)); if (apt->multi_threaded || !apt->main) - return apartment_hostobject_in_hostapt(apt, FALSE, TRUE, hkeydll, rclsid, riid, ppv); + return apartment_hostobject_in_hostapt(apt, FALSE, TRUE, regdata, rclsid, riid, ppv); } else apartment_threaded = FALSE; @@ -2620,7 +2886,7 @@ static HRESULT get_inproc_class_object(APARTMENT *apt, HKEY hkeydll, else apartment_threaded = !apt->multi_threaded; - if (COM_RegReadPath(hkeydll, dllpath, ARRAYSIZE(dllpath)) != ERROR_SUCCESS) + if (COM_RegReadPath(regdata, dllpath, ARRAYSIZE(dllpath)) != ERROR_SUCCESS) { /* failure: CLSID is not found in registry */ WARN("class %s not registered inproc\n", debugstr_guid(rclsid)); @@ -2657,11 +2923,12 @@ static HRESULT get_inproc_class_object(APARTMENT *apt, HKEY hkeydll, * SEE ALSO * CoCreateInstance() */ -HRESULT WINAPI CoGetClassObject( +HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject( REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv) { - LPUNKNOWN regClassObject; + struct class_reg_data clsreg; + IUnknown *regClassObject; HRESULT hres = E_UNEXPECTED; APARTMENT *apt; BOOL release_apt = FALSE; @@ -2688,6 +2955,39 @@ HRESULT WINAPI CoGetClassObject( debugstr_w(pServerInfo->pwszName), pServerInfo->pAuthInfo); } + if (CLSCTX_INPROC_SERVER & dwClsContext) + { + if (IsEqualCLSID(rclsid, &CLSID_InProcFreeMarshaler)) + { + if (release_apt) apartment_release(apt); + return FTMarshalCF_Create(iid, ppv); + } + } + + if (CLSCTX_INPROC & dwClsContext) + { + ACTCTX_SECTION_KEYED_DATA data; + + data.cbSize = sizeof(data); + /* search activation context first */ + if (FindActCtxSectionGuid(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL, + ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, + rclsid, &data)) + { + struct comclassredirect_data *comclass = (struct comclassredirect_data*)data.lpData; + + clsreg.u.actctx.hactctx = data.hActCtx; + clsreg.u.actctx.data = data.lpData; + clsreg.u.actctx.section = data.lpSectionBase; + clsreg.hkey = FALSE; + + hres = get_inproc_class_object(apt, &clsreg, &comclass->clsid, iid, !(dwClsContext & WINE_CLSCTX_DONT_HOST), ppv); + ReleaseActCtx(data.hActCtx); + if (release_apt) apartment_release(apt); + return hres; + } + } + /* * First, try and see if we can't match the class ID with one of the * registered classes. @@ -2714,12 +3014,6 @@ HRESULT WINAPI CoGetClassObject( static const WCHAR wszInprocServer32[] = {'I','n','p','r','o','c','S','e','r','v','e','r','3','2',0}; HKEY hkey; - if (IsEqualCLSID(rclsid, &CLSID_InProcFreeMarshaler)) - { - if (release_apt) apartment_release(apt); - return FTMarshalCF_Create(iid, ppv); - } - hres = COM_OpenKeyForCLSID(rclsid, wszInprocServer32, KEY_READ, &hkey); if (FAILED(hres)) { @@ -2734,8 +3028,10 @@ HRESULT WINAPI CoGetClassObject( if (SUCCEEDED(hres)) { - hres = get_inproc_class_object(apt, hkey, rclsid, iid, - !(dwClsContext & WINE_CLSCTX_DONT_HOST), ppv); + clsreg.u.hkey = hkey; + clsreg.hkey = TRUE; + + hres = get_inproc_class_object(apt, &clsreg, rclsid, iid, !(dwClsContext & WINE_CLSCTX_DONT_HOST), ppv); RegCloseKey(hkey); } @@ -2768,8 +3064,10 @@ HRESULT WINAPI CoGetClassObject( if (SUCCEEDED(hres)) { - hres = get_inproc_class_object(apt, hkey, rclsid, iid, - !(dwClsContext & WINE_CLSCTX_DONT_HOST), ppv); + clsreg.u.hkey = hkey; + clsreg.hkey = TRUE; + + hres = get_inproc_class_object(apt, &clsreg, rclsid, iid, !(dwClsContext & WINE_CLSCTX_DONT_HOST), ppv); RegCloseKey(hkey); } @@ -2850,7 +3148,7 @@ HRESULT WINAPI CoResumeClassObjects(void) * SEE ALSO * CoGetClassObject() */ -HRESULT WINAPI CoCreateInstance( +HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance( REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, @@ -2925,10 +3223,40 @@ HRESULT WINAPI CoCreateInstance( return hres; } +static void init_multi_qi(DWORD count, MULTI_QI *mqi) +{ + ULONG i; + + for (i = 0; i < count; i++) + { + mqi[i].pItf = NULL; + mqi[i].hr = E_NOINTERFACE; + } +} + +static HRESULT return_multi_qi(IUnknown *unk, DWORD count, MULTI_QI *mqi) +{ + ULONG index, fetched = 0; + + for (index = 0; index < count; index++) + { + mqi[index].hr = IUnknown_QueryInterface(unk, mqi[index].pIID, (void**)&mqi[index].pItf); + if (mqi[index].hr == S_OK) + fetched++; + } + + IUnknown_Release(unk); + + if (fetched == 0) + return E_NOINTERFACE; + + return fetched == count ? S_OK : CO_S_NOTALLINTERFACES; +} + /*********************************************************************** * CoCreateInstanceEx [OLE32.@] */ -HRESULT WINAPI CoCreateInstanceEx( +HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstanceEx( REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, @@ -2938,8 +3266,6 @@ HRESULT WINAPI CoCreateInstanceEx( { IUnknown* pUnk = NULL; HRESULT hr; - ULONG index; - ULONG successCount = 0; /* * Sanity check @@ -2950,14 +3276,7 @@ HRESULT WINAPI CoCreateInstanceEx( if (pServerInfo!=NULL) FIXME("() non-NULL pServerInfo not supported!\n"); - /* - * Initialize all the "out" parameters. - */ - for (index = 0; index < cmq; index++) - { - pResults[index].pItf = NULL; - pResults[index].hr = E_NOINTERFACE; - } + init_multi_qi(cmq, pResults); /* * Get the object and get its IUnknown pointer. @@ -2971,31 +3290,133 @@ HRESULT WINAPI CoCreateInstanceEx( if (hr != S_OK) return hr; - /* - * Then, query for all the interfaces requested. - */ - for (index = 0; index < cmq; index++) - { - pResults[index].hr = IUnknown_QueryInterface(pUnk, - pResults[index].pIID, - (VOID**)&(pResults[index].pItf)); + return return_multi_qi(pUnk, cmq, pResults); +} - if (pResults[index].hr == S_OK) - successCount++; +/*********************************************************************** + * CoGetInstanceFromFile [OLE32.@] + */ +HRESULT WINAPI CoGetInstanceFromFile( + COSERVERINFO *server_info, + CLSID *rclsid, + IUnknown *outer, + DWORD cls_context, + DWORD grfmode, + OLECHAR *filename, + DWORD count, + MULTI_QI *results +) +{ + IPersistFile *pf = NULL; + IUnknown* unk = NULL; + CLSID clsid; + HRESULT hr; + + if (count == 0 || !results) + return E_INVALIDARG; + + if (server_info) + FIXME("() non-NULL server_info not supported\n"); + + init_multi_qi(count, results); + + /* optionaly get CLSID from a file */ + if (!rclsid) + { + hr = GetClassFile(filename, &clsid); + if (FAILED(hr)) + { + ERR("failed to get CLSID from a file\n"); + return hr; + } + + rclsid = &clsid; } - /* - * Release our temporary unknown pointer. - */ - IUnknown_Release(pUnk); + hr = CoCreateInstance(rclsid, + outer, + cls_context, + &IID_IUnknown, + (void**)&unk); - if (successCount == 0) - return E_NOINTERFACE; + if (hr != S_OK) + return hr; - if (successCount!=cmq) - return CO_S_NOTALLINTERFACES; + /* init from file */ + hr = IUnknown_QueryInterface(unk, &IID_IPersistFile, (void**)&pf); + if (FAILED(hr)) + ERR("failed to get IPersistFile\n"); - return S_OK; + if (pf) + { + IPersistFile_Load(pf, filename, grfmode); + IPersistFile_Release(pf); + } + + return return_multi_qi(unk, count, results); +} + +/*********************************************************************** + * CoGetInstanceFromIStorage [OLE32.@] + */ +HRESULT WINAPI CoGetInstanceFromIStorage( + COSERVERINFO *server_info, + CLSID *rclsid, + IUnknown *outer, + DWORD cls_context, + IStorage *storage, + DWORD count, + MULTI_QI *results +) +{ + IPersistStorage *ps = NULL; + IUnknown* unk = NULL; + STATSTG stat; + HRESULT hr; + + if (count == 0 || !results || !storage) + return E_INVALIDARG; + + if (server_info) + FIXME("() non-NULL server_info not supported\n"); + + init_multi_qi(count, results); + + /* optionaly get CLSID from a file */ + if (!rclsid) + { + memset(&stat.clsid, 0, sizeof(stat.clsid)); + hr = IStorage_Stat(storage, &stat, STATFLAG_NONAME); + if (FAILED(hr)) + { + ERR("failed to get CLSID from a file\n"); + return hr; + } + + rclsid = &stat.clsid; + } + + hr = CoCreateInstance(rclsid, + outer, + cls_context, + &IID_IUnknown, + (void**)&unk); + + if (hr != S_OK) + return hr; + + /* init from IStorage */ + hr = IUnknown_QueryInterface(unk, &IID_IPersistStorage, (void**)&ps); + if (FAILED(hr)) + ERR("failed to get IPersistStorage\n"); + + if (ps) + { + IPersistStorage_Load(ps, storage); + IPersistStorage_Release(ps); + } + + return return_multi_qi(unk, count, results); } /*********************************************************************** @@ -3074,7 +3495,7 @@ void WINAPI CoFreeAllLibraries(void) * SEE ALSO * CoLoadLibrary, CoFreeAllLibraries, CoFreeLibrary */ -void WINAPI CoFreeUnusedLibrariesEx(DWORD dwUnloadDelay, DWORD dwReserved) +void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibrariesEx(DWORD dwUnloadDelay, DWORD dwReserved) { struct apartment *apt = COM_CurrentApt(); if (!apt) @@ -3098,7 +3519,7 @@ void WINAPI CoFreeUnusedLibrariesEx(DWORD dwUnloadDelay, DWORD dwReserved) * SEE ALSO * CoLoadLibrary, CoFreeAllLibraries, CoFreeLibrary */ -void WINAPI CoFreeUnusedLibraries(void) +void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibraries(void) { CoFreeUnusedLibrariesEx(INFINITE, 0); } @@ -4532,9 +4953,13 @@ HRESULT Handler_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) hres = COM_OpenKeyForCLSID(rclsid, wszInprocHandler32, KEY_READ, &hkey); if (SUCCEEDED(hres)) { + struct class_reg_data regdata; WCHAR dllpath[MAX_PATH+1]; - if (COM_RegReadPath(hkey, dllpath, ARRAYSIZE(dllpath)) == ERROR_SUCCESS) + regdata.u.hkey = hkey; + regdata.hkey = TRUE; + + if (COM_RegReadPath(®data, dllpath, ARRAYSIZE(dllpath)) == ERROR_SUCCESS) { static const WCHAR wszOle32[] = {'o','l','e','3','2','.','d','l','l',0}; if (!strcmpiW(dllpath, wszOle32)) diff --git a/dll/win32/ole32/compobj_private.h b/dll/win32/ole32/compobj_private.h index dd3400d8d6c..5dc8eb8e5aa 100644 --- a/dll/win32/ole32/compobj_private.h +++ b/dll/win32/ole32/compobj_private.h @@ -304,6 +304,8 @@ extern UINT ole_private_data_clipboard_format DECLSPEC_HIDDEN; extern LSTATUS create_classes_key(HKEY, const WCHAR *, REGSAM, HKEY *) DECLSPEC_HIDDEN; extern LSTATUS open_classes_key(HKEY, const WCHAR *, REGSAM, HKEY *) DECLSPEC_HIDDEN; +extern BOOL actctx_get_miscstatus(const CLSID*, DWORD, DWORD*) DECLSPEC_HIDDEN; + static inline void *heap_alloc(size_t len) { return HeapAlloc(GetProcessHeap(), 0, len); diff --git a/dll/win32/ole32/compositemoniker.c b/dll/win32/ole32/compositemoniker.c index 076033bc3fa..15417ceb482 100644 --- a/dll/win32/ole32/compositemoniker.c +++ b/dll/win32/ole32/compositemoniker.c @@ -22,7 +22,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole); -#define BLOCK_TAB_SIZE 5 /* represent the first size table and it's increment block size */ +#define BLOCK_TAB_SIZE 5 /* represent the first size table and its increment block size */ /* CompositeMoniker data structure */ typedef struct CompositeMonikerImpl{ @@ -141,7 +141,7 @@ CompositeMonikerImpl_Release(IMoniker* iface) ref = InterlockedDecrement(&This->ref); - /* destroy the object if there's no more reference on it */ + /* destroy the object if there are no more references to it */ if (ref == 0){ /* release all the components before destroying this object */ @@ -1527,7 +1527,7 @@ EnumMonikerImpl_Release(IEnumMoniker* iface) ref = InterlockedDecrement(&This->ref); - /* destroy the object if there's no more reference on it */ + /* destroy the object if there are no more references to it */ if (ref == 0) { for(i=0;itabSize;i++) @@ -1923,10 +1923,12 @@ CreateGenericComposite(IMoniker *pmkFirst, IMoniker *pmkRest, IMoniker **ppmkCom if (pmkFirst==NULL && pmkRest!=NULL){ *ppmkComposite=pmkRest; + IMoniker_AddRef(pmkRest); return S_OK; } else if (pmkFirst!=NULL && pmkRest==NULL){ *ppmkComposite=pmkFirst; + IMoniker_AddRef(pmkFirst); return S_OK; } else if (pmkFirst==NULL && pmkRest==NULL) diff --git a/dll/win32/ole32/dcom.idl b/dll/win32/ole32/dcom.idl index 4517b46d871..c3d090a9cb6 100644 --- a/dll/win32/ole32/dcom.idl +++ b/dll/win32/ole32/dcom.idl @@ -19,6 +19,9 @@ /* see the official DCOM specification * (there's a copy at http://www.grimes.demon.co.uk/DCOM/DCOMSpec.htm) */ +#pragma makedep proxy +#pragma makedep register + import "unknwn.idl"; [ diff --git a/dll/win32/ole32/filemoniker.c b/dll/win32/ole32/filemoniker.c index d327e96922d..95e0e13e2c8 100644 --- a/dll/win32/ole32/filemoniker.c +++ b/dll/win32/ole32/filemoniker.c @@ -119,7 +119,7 @@ FileMonikerImpl_Release(IMoniker* iface) ref = InterlockedDecrement(&This->ref); - /* destroy the object if there's no more reference on it */ + /* destroy the object if there are no more references to it */ if (ref == 0) FileMonikerImpl_Destroy(This); return ref; @@ -918,11 +918,12 @@ static HRESULT WINAPI FileMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix) { - LPOLESTR pathThis,pathOther,*stringTable1,*stringTable2,commonPath; - IBindCtx *pbind; + LPOLESTR pathThis = NULL, pathOther = NULL,*stringTable1,*stringTable2,commonPath = NULL; + IBindCtx *bindctx; DWORD mkSys; ULONG nb1,nb2,i,sameIdx; - BOOL machimeNameCase=FALSE; + BOOL machineNameCase = FALSE; + HRESULT ret; if (ppmkPrefix==NULL) return E_POINTER; @@ -934,81 +935,81 @@ FileMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** p /* check if we have the same type of moniker */ IMoniker_IsSystemMoniker(pmkOther,&mkSys); + if (mkSys != MKSYS_FILEMONIKER) + return MonikerCommonPrefixWith(iface, pmkOther, ppmkPrefix); - if(mkSys==MKSYS_FILEMONIKER){ - HRESULT ret; - - ret = CreateBindCtx(0,&pbind); - if (FAILED(ret)) - return ret; - - /* create a string based on common part of the two paths */ - - ret = IMoniker_GetDisplayName(iface,pbind,NULL,&pathThis); - if (FAILED(ret)) - return ret; - ret = IMoniker_GetDisplayName(pmkOther,pbind,NULL,&pathOther); - if (FAILED(ret)) - return ret; - - nb1=FileMonikerImpl_DecomposePath(pathThis,&stringTable1); - if (FAILED(nb1)) - return nb1; - nb2=FileMonikerImpl_DecomposePath(pathOther,&stringTable2); - if (FAILED(nb2)) - { - free_stringtable(stringTable1); - return nb2; - } - - if (nb1==0 || nb2==0) - { - free_stringtable(stringTable1); - free_stringtable(stringTable2); - return MK_E_NOPREFIX; - } - - commonPath=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(min(lstrlenW(pathThis),lstrlenW(pathOther))+1)); - if (!commonPath) - return E_OUTOFMEMORY; - - *commonPath=0; - - for(sameIdx=0; ( (stringTable1[sameIdx]!=NULL) && - (stringTable2[sameIdx]!=NULL) && - (lstrcmpiW(stringTable1[sameIdx],stringTable2[sameIdx])==0)); sameIdx++); - - if (sameIdx > 1 && *stringTable1[0]=='\\' && *stringTable2[1]=='\\'){ - - machimeNameCase=TRUE; - - for(i=2;i 3 || nb2 > 3) ) - ret = MK_E_NOPREFIX; - else - { - for(i=0;i 1 && *stringTable1[0]=='\\' && *stringTable2[1]=='\\'){ + machineNameCase = TRUE; + + for(i=2;i 3 || nb2 > 3) ) + ret = MK_E_NOPREFIX; else - return MonikerCommonPrefixWith(iface,pmkOther,ppmkPrefix); + { + for (i = 0; i < sameIdx; i++) + strcatW(commonPath,stringTable1[i]); + ret = CreateFileMoniker(commonPath, ppmkPrefix); + } + +failed: + IBindCtx_Release(bindctx); + CoTaskMemFree(pathThis); + CoTaskMemFree(pathOther); + CoTaskMemFree(commonPath); + free_stringtable(stringTable1); + free_stringtable(stringTable2); + + return ret; } /****************************************************************************** @@ -1088,8 +1089,7 @@ lend: CoTaskMemFree(strgtable); } - if (word) - CoTaskMemFree(word); + CoTaskMemFree(word); return ret; } @@ -1343,7 +1343,7 @@ static HRESULT FileMonikerImpl_Construct(FileMonikerImpl* This, LPCOLESTR lpszPa LPOLESTR *tabStr=0; static const WCHAR twoPoint[]={'.','.',0}; static const WCHAR bkSlash[]={'\\',0}; - BYTE addBkSlash; + BOOL addBkSlash; TRACE("(%p,%s)\n",This,debugstr_w(lpszPathName)); @@ -1364,14 +1364,14 @@ static HRESULT FileMonikerImpl_Construct(FileMonikerImpl* This, LPCOLESTR lpszPa if (nb > 0 ){ - addBkSlash=1; + addBkSlash = TRUE; if (lstrcmpW(tabStr[0],twoPoint)!=0) - addBkSlash=0; + addBkSlash = FALSE; else for(i=0;ifilePathName=HeapReAlloc(GetProcessHeap(),0,This->filePathName,(sizeStr+1)*sizeof(WCHAR)); diff --git a/dll/win32/ole32/ifs.c b/dll/win32/ole32/ifs.c index b11d5dac83c..09e95c55958 100644 --- a/dll/win32/ole32/ifs.c +++ b/dll/win32/ole32/ifs.c @@ -57,7 +57,7 @@ static CRITICAL_SECTION_DEBUG critsect_debug = static CRITICAL_SECTION IMalloc32_SpyCS = { &critsect_debug, -1, 0, 0, 0, 0 }; /* resize the old table */ -static int SetSpyedBlockTableLength ( DWORD NewLength ) +static BOOL SetSpyedBlockTableLength ( DWORD NewLength ) { LPVOID *NewSpyedBlocks; @@ -72,14 +72,13 @@ static int SetSpyedBlockTableLength ( DWORD NewLength ) } /* add a location to the table */ -static int AddMemoryLocation(LPVOID * pMem) +static BOOL AddMemoryLocation(LPVOID * pMem) { LPVOID * Current; /* allocate the table if not already allocated */ - if (!Malloc32.SpyedBlockTableLength) { - if (!SetSpyedBlockTableLength(0x1000)) return 0; - } + if (!Malloc32.SpyedBlockTableLength && !SetSpyedBlockTableLength(0x1000)) + return FALSE; /* find a free location */ Current = Malloc32.SpyedBlocks; @@ -88,7 +87,8 @@ static int AddMemoryLocation(LPVOID * pMem) if (Current >= Malloc32.SpyedBlocks + Malloc32.SpyedBlockTableLength) { /* no more space in table, grow it */ DWORD old_length = Malloc32.SpyedBlockTableLength; - if (!SetSpyedBlockTableLength( Malloc32.SpyedBlockTableLength + 0x1000 )) return 0; + if (!SetSpyedBlockTableLength( Malloc32.SpyedBlockTableLength + 0x1000)) + return FALSE; Current = Malloc32.SpyedBlocks + old_length; } }; @@ -97,31 +97,31 @@ static int AddMemoryLocation(LPVOID * pMem) *Current = pMem; Malloc32.SpyedAllocationsLeft++; /*TRACE("%lu\n",Malloc32.SpyedAllocationsLeft);*/ - return 1; + return TRUE; } -static int RemoveMemoryLocation(LPCVOID pMem) +static BOOL RemoveMemoryLocation(LPCVOID pMem) { LPVOID * Current; /* allocate the table if not already allocated */ - if (!Malloc32.SpyedBlockTableLength) { - if (!SetSpyedBlockTableLength(0x1000)) return 0; - } + if (!Malloc32.SpyedBlockTableLength && !SetSpyedBlockTableLength(0x1000)) + return FALSE; Current = Malloc32.SpyedBlocks; /* find the location */ while (*Current != pMem) { Current++; - if (Current >= Malloc32.SpyedBlocks + Malloc32.SpyedBlockTableLength) return 0; /* not found */ + if (Current >= Malloc32.SpyedBlocks + Malloc32.SpyedBlockTableLength) + return FALSE; /* not found */ } /* location found */ Malloc32.SpyedAllocationsLeft--; /*TRACE("%lu\n",Malloc32.SpyedAllocationsLeft);*/ *Current = NULL; - return 1; + return TRUE; } /****************************************************************************** @@ -236,7 +236,7 @@ static LPVOID WINAPI IMalloc_fnRealloc(LPMALLOC iface,LPVOID pv,DWORD cb) { */ static VOID WINAPI IMalloc_fnFree(LPMALLOC iface,LPVOID pv) { - BOOL fSpyed = 0; + BOOL fSpyed = FALSE; TRACE("(%p)\n",pv); @@ -273,7 +273,7 @@ static VOID WINAPI IMalloc_fnFree(LPMALLOC iface,LPVOID pv) { static DWORD WINAPI IMalloc_fnGetSize(LPMALLOC iface,LPVOID pv) { DWORD cb; - BOOL fSpyed = 0; + BOOL fSpyed = FALSE; TRACE("(%p)\n",pv); @@ -297,7 +297,7 @@ static DWORD WINAPI IMalloc_fnGetSize(LPMALLOC iface,LPVOID pv) { */ static INT WINAPI IMalloc_fnDidAlloc(LPMALLOC iface,LPVOID pv) { - BOOL fSpyed = 0; + BOOL fSpyed = FALSE; int didAlloc; TRACE("(%p)\n",pv); diff --git a/dll/win32/ole32/irot.idl b/dll/win32/ole32/irot.idl index 95236db6e44..ca730fdd3dc 100644 --- a/dll/win32/ole32/irot.idl +++ b/dll/win32/ole32/irot.idl @@ -16,4 +16,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep client + #include "wine/irot.idl" diff --git a/dll/win32/ole32/itemmoniker.c b/dll/win32/ole32/itemmoniker.c index 055b69563e5..c88b4dec311 100644 --- a/dll/win32/ole32/itemmoniker.c +++ b/dll/win32/ole32/itemmoniker.c @@ -107,7 +107,7 @@ static ULONG WINAPI ItemMonikerImpl_Release(IMoniker* iface) ref = InterlockedDecrement(&This->ref); - /* destroy the object if there's no more reference on it */ + /* destroy the object if there are no more references to it */ if (ref == 0) ItemMonikerImpl_Destroy(This); return ref; diff --git a/dll/win32/ole32/marshal.c b/dll/win32/ole32/marshal.c index 11cceda74c2..411f508d98b 100644 --- a/dll/win32/ole32/marshal.c +++ b/dll/win32/ole32/marshal.c @@ -92,7 +92,8 @@ static inline HRESULT get_facbuf_for_iid(REFIID riid, IPSFactoryBuffer **facbuf) HRESULT hr; CLSID clsid; - if ((hr = CoGetPSClsid(riid, &clsid))) + hr = CoGetPSClsid(riid, &clsid); + if (hr != S_OK) return hr; return CoGetClassObject(&clsid, CLSCTX_INPROC_SERVER | WINE_CLSCTX_DONT_HOST, NULL, &IID_IPSFactoryBuffer, (LPVOID*)facbuf); @@ -1150,15 +1151,17 @@ HRESULT apartment_disconnectproxies(struct apartment *apt) /********************** StdMarshal implementation ****************************/ typedef struct _StdMarshalImpl { - const IMarshalVtbl *lpvtbl; - LONG ref; - - IID iid; - DWORD dwDestContext; - LPVOID pvDestContext; - DWORD mshlflags; + IMarshal IMarshal_iface; + LONG ref; + DWORD dest_context; + void *dest_context_data; } StdMarshalImpl; +static inline StdMarshalImpl *impl_from_StdMarshal(IMarshal *iface) +{ + return CONTAINING_RECORD(iface, StdMarshalImpl, IMarshal_iface); +} + static HRESULT WINAPI StdMarshalImpl_QueryInterface(IMarshal *iface, REFIID riid, void **ppv) { @@ -1174,16 +1177,16 @@ StdMarshalImpl_QueryInterface(IMarshal *iface, REFIID riid, void **ppv) } static ULONG WINAPI -StdMarshalImpl_AddRef(LPMARSHAL iface) +StdMarshalImpl_AddRef(IMarshal *iface) { - StdMarshalImpl *This = (StdMarshalImpl *)iface; + StdMarshalImpl *This = impl_from_StdMarshal(iface); return InterlockedIncrement(&This->ref); } static ULONG WINAPI -StdMarshalImpl_Release(LPMARSHAL iface) +StdMarshalImpl_Release(IMarshal *iface) { - StdMarshalImpl *This = (StdMarshalImpl *)iface; + StdMarshalImpl *This = impl_from_StdMarshal(iface); ULONG ref = InterlockedDecrement(&This->ref); if (!ref) HeapFree(GetProcessHeap(),0,This); @@ -1192,7 +1195,7 @@ StdMarshalImpl_Release(LPMARSHAL iface) static HRESULT WINAPI StdMarshalImpl_GetUnmarshalClass( - LPMARSHAL iface, REFIID riid, void* pv, DWORD dwDestContext, + IMarshal *iface, REFIID riid, void* pv, DWORD dwDestContext, void* pvDestContext, DWORD mshlflags, CLSID* pCid) { *pCid = CLSID_DfMarshal; @@ -1201,7 +1204,7 @@ StdMarshalImpl_GetUnmarshalClass( static HRESULT WINAPI StdMarshalImpl_GetMarshalSizeMax( - LPMARSHAL iface, REFIID riid, void* pv, DWORD dwDestContext, + IMarshal *iface, REFIID riid, void* pv, DWORD dwDestContext, void* pvDestContext, DWORD mshlflags, DWORD* pSize) { *pSize = sizeof(STDOBJREF); @@ -1210,7 +1213,7 @@ StdMarshalImpl_GetMarshalSizeMax( static HRESULT WINAPI StdMarshalImpl_MarshalInterface( - LPMARSHAL iface, IStream *pStm,REFIID riid, void* pv, DWORD dest_context, + IMarshal *iface, IStream *pStm,REFIID riid, void* pv, DWORD dest_context, void* dest_context_data, DWORD mshlflags) { STDOBJREF stdobjref; @@ -1312,9 +1315,9 @@ static HRESULT unmarshal_object(const STDOBJREF *stdobjref, APARTMENT *apt, } static HRESULT WINAPI -StdMarshalImpl_UnmarshalInterface(LPMARSHAL iface, IStream *pStm, REFIID riid, void **ppv) +StdMarshalImpl_UnmarshalInterface(IMarshal *iface, IStream *pStm, REFIID riid, void **ppv) { - StdMarshalImpl *This = (StdMarshalImpl *)iface; + StdMarshalImpl *This = impl_from_StdMarshal(iface); struct stub_manager *stubmgr = NULL; STDOBJREF stdobjref; ULONG res; @@ -1380,8 +1383,8 @@ StdMarshalImpl_UnmarshalInterface(LPMARSHAL iface, IStream *pStm, REFIID riid, v wine_dbgstr_longlong(stdobjref.oxid)); if (hres == S_OK) - hres = unmarshal_object(&stdobjref, apt, This->dwDestContext, - This->pvDestContext, riid, + hres = unmarshal_object(&stdobjref, apt, This->dest_context, + This->dest_context_data, riid, stubmgr ? &stubmgr->oxid_info : NULL, ppv); if (stubmgr) stub_manager_int_release(stubmgr); @@ -1394,7 +1397,7 @@ StdMarshalImpl_UnmarshalInterface(LPMARSHAL iface, IStream *pStm, REFIID riid, v } static HRESULT WINAPI -StdMarshalImpl_ReleaseMarshalData(LPMARSHAL iface, IStream *pStm) +StdMarshalImpl_ReleaseMarshalData(IMarshal *iface, IStream *pStm) { STDOBJREF stdobjref; ULONG res; @@ -1436,13 +1439,13 @@ StdMarshalImpl_ReleaseMarshalData(LPMARSHAL iface, IStream *pStm) } static HRESULT WINAPI -StdMarshalImpl_DisconnectObject(LPMARSHAL iface, DWORD dwReserved) +StdMarshalImpl_DisconnectObject(IMarshal *iface, DWORD dwReserved) { FIXME("(), stub!\n"); return S_OK; } -static const IMarshalVtbl VT_StdMarshal = +static const IMarshalVtbl StdMarshalVtbl = { StdMarshalImpl_QueryInterface, StdMarshalImpl_AddRef, @@ -1455,15 +1458,24 @@ static const IMarshalVtbl VT_StdMarshal = StdMarshalImpl_DisconnectObject }; -static HRESULT StdMarshalImpl_Construct(REFIID riid, void** ppvObject) +static HRESULT StdMarshalImpl_Construct(REFIID riid, DWORD dest_context, void *dest_context_data, void** ppvObject) { - StdMarshalImpl * pStdMarshal = - HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(StdMarshalImpl)); + HRESULT hr; + + StdMarshalImpl *pStdMarshal = HeapAlloc(GetProcessHeap(), 0, sizeof(StdMarshalImpl)); if (!pStdMarshal) return E_OUTOFMEMORY; - pStdMarshal->lpvtbl = &VT_StdMarshal; + + pStdMarshal->IMarshal_iface.lpVtbl = &StdMarshalVtbl; pStdMarshal->ref = 0; - return IMarshal_QueryInterface((IMarshal*)pStdMarshal, riid, ppvObject); + pStdMarshal->dest_context = dest_context; + pStdMarshal->dest_context_data = dest_context_data; + + hr = IMarshal_QueryInterface(&pStdMarshal->IMarshal_iface, riid, ppvObject); + if (FAILED(hr)) + HeapFree(GetProcessHeap(), 0, pStdMarshal); + + return hr; } /*********************************************************************** @@ -1493,8 +1505,6 @@ HRESULT WINAPI CoGetStandardMarshal(REFIID riid, IUnknown *pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags, LPMARSHAL *ppMarshal) { - StdMarshalImpl *dm; - if (pUnk == NULL) { FIXME("(%s,NULL,%x,%p,%x,%p), unimplemented yet.\n", @@ -1503,17 +1513,8 @@ HRESULT WINAPI CoGetStandardMarshal(REFIID riid, IUnknown *pUnk, } TRACE("(%s,%p,%x,%p,%x,%p)\n", debugstr_guid(riid),pUnk,dwDestContext,pvDestContext,mshlflags,ppMarshal); - *ppMarshal = HeapAlloc(GetProcessHeap(),0,sizeof(StdMarshalImpl)); - dm = (StdMarshalImpl*) *ppMarshal; - if (!dm) return E_FAIL; - dm->lpvtbl = &VT_StdMarshal; - dm->ref = 1; - dm->iid = *riid; - dm->dwDestContext = dwDestContext; - dm->pvDestContext = pvDestContext; - dm->mshlflags = mshlflags; - return S_OK; + return StdMarshalImpl_Construct(&IID_IMarshal, dwDestContext, pvDestContext, (void**)ppMarshal); } /*********************************************************************** @@ -1570,7 +1571,7 @@ static HRESULT get_unmarshaler_from_stream(IStream *stream, IMarshal **marshal, if (objref.flags & OBJREF_STANDARD) { TRACE("Using standard unmarshaling\n"); - hr = StdMarshalImpl_Construct(&IID_IMarshal, (LPVOID*)marshal); + hr = StdMarshalImpl_Construct(&IID_IMarshal, 0, NULL, (LPVOID*)marshal); } else if (objref.flags & OBJREF_CUSTOM) { @@ -2007,7 +2008,7 @@ static HRESULT WINAPI StdMarshalCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv) { if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IMarshal)) - return StdMarshalImpl_Construct(riid, ppv); + return StdMarshalImpl_Construct(riid, 0, NULL, ppv); FIXME("(%s), not supported.\n",debugstr_guid(riid)); return E_NOINTERFACE; diff --git a/dll/win32/ole32/moniker.c b/dll/win32/ole32/moniker.c index 23650d14ecd..369a50b1758 100644 --- a/dll/win32/ole32/moniker.c +++ b/dll/win32/ole32/moniker.c @@ -371,7 +371,7 @@ RunningObjectTableImpl_Release(IRunningObjectTable* iface) ref = InterlockedDecrement(&This->ref); - /* uninitialize ROT structure if there's no more references to it */ + /* uninitialize ROT structure if there are no more references to it */ if (ref == 0) { struct list *cursor, *cursor2; @@ -1230,8 +1230,10 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid) absFile=pathDec[nbElm-1]; /* failed if the path represents a directory and not an absolute file name*/ - if (!lstrcmpW(absFile, bkslashW)) + if (!lstrcmpW(absFile, bkslashW)) { + CoTaskMemFree(pathDec); return MK_E_INVALIDEXTENSION; + } /* get the extension of the file */ extension = NULL; @@ -1239,8 +1241,10 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid) for(i = length-1; (i >= 0) && *(extension = &absFile[i]) != '.'; i--) /* nothing */; - if (!extension || !lstrcmpW(extension, dotW)) + if (!extension || !lstrcmpW(extension, dotW)) { + CoTaskMemFree(pathDec); return MK_E_INVALIDEXTENSION; + } res=RegQueryValueW(HKEY_CLASSES_ROOT, extension, NULL, &sizeProgId); @@ -1317,7 +1321,7 @@ static ULONG WINAPI EnumMonikerImpl_Release(IEnumMoniker* iface) ref = InterlockedDecrement(&This->ref); - /* uninitialize rot structure if there's no more reference to it*/ + /* uninitialize ROT structure if there are no more references to it */ if (ref == 0) { ULONG i; diff --git a/dll/win32/ole32/ole2.c b/dll/win32/ole32/ole2.c index 4620dbacee9..363dfc845be 100644 --- a/dll/win32/ole32/ole2.c +++ b/dll/win32/ole32/ole2.c @@ -30,7 +30,7 @@ WINE_DECLARE_DEBUG_CHANNEL(accel); /****************************************************************************** * These are static/global variables and internal data structures that the - * OLE module uses to maintain it's state. + * OLE module uses to maintain its state. */ typedef struct tagTrackerWindowInfo { @@ -43,7 +43,7 @@ typedef struct tagTrackerWindowInfo BOOL escPressed; HWND curTargetHWND; /* window the mouse is hovering over */ - HWND curDragTargetHWND; /* might be a ancestor of curTargetHWND */ + HWND curDragTargetHWND; /* might be an ancestor of curTargetHWND */ IDropTarget* curDragTarget; POINTL curMousePos; /* current position of the mouse in screen coordinates */ DWORD dwKeyState; /* current state of the shift and ctrl keys and the mouse buttons */ @@ -131,7 +131,6 @@ extern void OLEClipbrd_Initialize(void); */ static void OLEDD_Initialize(void); static LRESULT WINAPI OLEDD_DragTrackerWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); -static void OLEDD_TrackMouseMove(TrackerWindowInfo* trackerInfo); static void OLEDD_TrackStateChange(TrackerWindowInfo* trackerInfo); static DWORD OLEDD_GetButtonState(void); @@ -869,6 +868,8 @@ HRESULT WINAPI OleRegGetMiscStatus( *pdwStatus = 0; + if (actctx_get_miscstatus(clsid, dwAspect, pdwStatus)) return S_OK; + /* * Open the class id Key */ @@ -1304,7 +1305,7 @@ HRESULT WINAPI OleLoad( if (SUCCEEDED(hres) && pClientSite) /* - * Inform the new object of it's client site. + * Inform the new object of its client site. */ hres = IOleObject_SetClientSite(pOleObject, pClientSite); @@ -2171,10 +2172,6 @@ static LRESULT WINAPI OLEDD_DragTrackerWindowProc( } case WM_TIMER: case WM_MOUSEMOVE: - { - OLEDD_TrackMouseMove((TrackerWindowInfo*)GetWindowLongPtrA(hwnd, 0)); - break; - } case WM_LBUTTONUP: case WM_MBUTTONUP: case WM_RBUTTONUP: @@ -2199,19 +2196,16 @@ static LRESULT WINAPI OLEDD_DragTrackerWindowProc( } /*** - * OLEDD_TrackMouseMove() + * OLEDD_TrackStateChange() * * This method is invoked while a drag and drop operation is in effect. - * it will generate the appropriate callbacks in the drop source - * and drop target. It will also provide the expected feedback to - * the user. * * params: * trackerInfo - Pointer to the structure identifying the * drag & drop operation that is currently * active. */ -static void OLEDD_TrackMouseMove(TrackerWindowInfo* trackerInfo) +static void OLEDD_TrackStateChange(TrackerWindowInfo* trackerInfo) { HWND hwndNewTarget = 0; HRESULT hr = S_OK; @@ -2224,6 +2218,10 @@ static void OLEDD_TrackMouseMove(TrackerWindowInfo* trackerInfo) pt.y = trackerInfo->curMousePos.y; hwndNewTarget = WindowFromPoint(pt); + trackerInfo->returnValue = IDropSource_QueryContinueDrag(trackerInfo->dropSource, + trackerInfo->escPressed, + trackerInfo->dwKeyState); + /* * Every time, we re-initialize the effects passed to the * IDropTarget to the effects allowed by the source. @@ -2240,7 +2238,8 @@ static void OLEDD_TrackMouseMove(TrackerWindowInfo* trackerInfo) IDropTarget_DragOver(trackerInfo->curDragTarget, trackerInfo->dwKeyState, trackerInfo->curMousePos, - trackerInfo->pdwEffect); + trackerInfo->pdwEffect); + *trackerInfo->pdwEffect &= trackerInfo->dwOKEffect; } else { @@ -2282,6 +2281,7 @@ static void OLEDD_TrackMouseMove(TrackerWindowInfo* trackerInfo) trackerInfo->dwKeyState, trackerInfo->curMousePos, trackerInfo->pdwEffect); + *trackerInfo->pdwEffect &= trackerInfo->dwOKEffect; /* failed DragEnter() means invalid target */ if (hr != S_OK) @@ -2347,29 +2347,6 @@ static void OLEDD_TrackMouseMove(TrackerWindowInfo* trackerInfo) SetCursor(hCur); } -} - -/*** - * OLEDD_TrackStateChange() - * - * This method is invoked while a drag and drop operation is in effect. - * It is used to notify the drop target/drop source callbacks when - * the state of the keyboard or mouse button change. - * - * params: - * trackerInfo - Pointer to the structure identifying the - * drag & drop operation that is currently - * active. - */ -static void OLEDD_TrackStateChange(TrackerWindowInfo* trackerInfo) -{ - /* - * Ask the drop source what to do with the operation. - */ - trackerInfo->returnValue = IDropSource_QueryContinueDrag( - trackerInfo->dropSource, - trackerInfo->escPressed, - trackerInfo->dwKeyState); /* * All the return valued will stop the operation except the S_OK @@ -2402,18 +2379,18 @@ static void OLEDD_TrackStateChange(TrackerWindowInfo* trackerInfo) */ case DRAGDROP_S_DROP: if (*trackerInfo->pdwEffect != DROPEFFECT_NONE) - IDropTarget_Drop(trackerInfo->curDragTarget, - trackerInfo->dataObject, - trackerInfo->dwKeyState, - trackerInfo->curMousePos, - trackerInfo->pdwEffect); + trackerInfo->returnValue = IDropTarget_Drop(trackerInfo->curDragTarget, + trackerInfo->dataObject, + trackerInfo->dwKeyState, + trackerInfo->curMousePos, + trackerInfo->pdwEffect); else IDropTarget_DragLeave(trackerInfo->curDragTarget); break; /* * If the source told us that we should cancel, fool the drop - * target by telling it that the mouse left it's window. + * target by telling it that the mouse left its window. * Also set the drop effect to "NONE" in case the application * ignores the result of DoDragDrop. */ @@ -2715,8 +2692,59 @@ done: */ HRESULT WINAPI OleDoAutoConvert(LPSTORAGE pStg, LPCLSID pClsidNew) { - FIXME("(%p,%p) : stub\n",pStg,pClsidNew); - return E_NOTIMPL; + WCHAR *user_type_old, *user_type_new; + CLIPFORMAT cf; + STATSTG stat; + CLSID clsid; + HRESULT hr; + + TRACE("(%p, %p)\n", pStg, pClsidNew); + + *pClsidNew = CLSID_NULL; + if(!pStg) + return E_INVALIDARG; + hr = IStorage_Stat(pStg, &stat, STATFLAG_NONAME); + if(FAILED(hr)) + return hr; + + *pClsidNew = stat.clsid; + hr = OleGetAutoConvert(&stat.clsid, &clsid); + if(FAILED(hr)) + return hr; + + hr = IStorage_SetClass(pStg, &clsid); + if(FAILED(hr)) + return hr; + + hr = ReadFmtUserTypeStg(pStg, &cf, &user_type_old); + if(FAILED(hr)) { + cf = 0; + user_type_new = NULL; + } + + hr = OleRegGetUserType(&clsid, USERCLASSTYPE_FULL, &user_type_new); + if(FAILED(hr)) + user_type_new = NULL; + + hr = WriteFmtUserTypeStg(pStg, cf, user_type_new); + CoTaskMemFree(user_type_new); + if(FAILED(hr)) + { + CoTaskMemFree(user_type_old); + IStorage_SetClass(pStg, &stat.clsid); + return hr; + } + + hr = SetConvertStg(pStg, TRUE); + if(FAILED(hr)) + { + WriteFmtUserTypeStg(pStg, cf, user_type_old); + IStorage_SetClass(pStg, &stat.clsid); + } + else + *pClsidNew = clsid; + CoTaskMemFree(user_type_old); + return hr; } /****************************************************************************** @@ -2809,6 +2837,8 @@ static inline HRESULT PROPVARIANT_ValidateType(VARTYPE vt) case VT_UI2: case VT_UI4: case VT_UI8: + case VT_INT: + case VT_UINT: case VT_LPSTR: case VT_LPWSTR: case VT_FILETIME: @@ -2861,7 +2891,10 @@ HRESULT WINAPI PropVariantClear(PROPVARIANT * pvar) /* [in/out] */ hr = PROPVARIANT_ValidateType(pvar->vt); if (FAILED(hr)) + { + memset(pvar, 0, sizeof(*pvar)); return hr; + } switch(pvar->vt) { @@ -2882,6 +2915,8 @@ HRESULT WINAPI PropVariantClear(PROPVARIANT * pvar) /* [in/out] */ case VT_UI2: case VT_UI4: case VT_UI8: + case VT_INT: + case VT_UINT: case VT_FILETIME: break; case VT_STREAM: @@ -2946,12 +2981,14 @@ HRESULT WINAPI PropVariantClear(PROPVARIANT * pvar) /* [in/out] */ } } else + { WARN("Invalid/unsupported type %d\n", pvar->vt); + hr = STG_E_INVALIDPARAMETER; + } } - ZeroMemory(pvar, sizeof(*pvar)); - - return S_OK; + memset(pvar, 0, sizeof(*pvar)); + return hr; } /*********************************************************************** @@ -2988,6 +3025,8 @@ HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, /* [out] */ case VT_ERROR: case VT_I8: case VT_UI8: + case VT_INT: + case VT_UINT: case VT_R8: case VT_CY: case VT_DATE: @@ -2997,21 +3036,28 @@ HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, /* [out] */ case VT_STREAMED_OBJECT: case VT_STORAGE: case VT_STORED_OBJECT: - IUnknown_AddRef((LPUNKNOWN)pvarDest->u.pStream); + if (pvarDest->u.pStream) + IStream_AddRef(pvarDest->u.pStream); break; case VT_CLSID: pvarDest->u.puuid = CoTaskMemAlloc(sizeof(CLSID)); *pvarDest->u.puuid = *pvarSrc->u.puuid; break; case VT_LPSTR: - len = strlen(pvarSrc->u.pszVal); - pvarDest->u.pszVal = CoTaskMemAlloc((len+1)*sizeof(CHAR)); - CopyMemory(pvarDest->u.pszVal, pvarSrc->u.pszVal, (len+1)*sizeof(CHAR)); + if (pvarSrc->u.pszVal) + { + len = strlen(pvarSrc->u.pszVal); + pvarDest->u.pszVal = CoTaskMemAlloc((len+1)*sizeof(CHAR)); + CopyMemory(pvarDest->u.pszVal, pvarSrc->u.pszVal, (len+1)*sizeof(CHAR)); + } break; case VT_LPWSTR: - len = lstrlenW(pvarSrc->u.pwszVal); - pvarDest->u.pwszVal = CoTaskMemAlloc((len+1)*sizeof(WCHAR)); - CopyMemory(pvarDest->u.pwszVal, pvarSrc->u.pwszVal, (len+1)*sizeof(WCHAR)); + if (pvarSrc->u.pwszVal) + { + len = lstrlenW(pvarSrc->u.pwszVal); + pvarDest->u.pwszVal = CoTaskMemAlloc((len+1)*sizeof(WCHAR)); + CopyMemory(pvarDest->u.pwszVal, pvarSrc->u.pwszVal, (len+1)*sizeof(WCHAR)); + } break; case VT_BLOB: case VT_BLOB_OBJECT: @@ -3071,7 +3117,7 @@ HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, /* [out] */ return E_INVALIDARG; } len = pvarSrc->u.capropvar.cElems; - pvarDest->u.capropvar.pElems = CoTaskMemAlloc(len * elemSize); + pvarDest->u.capropvar.pElems = len ? CoTaskMemAlloc(len * elemSize) : NULL; if (pvarSrc->vt == (VT_VECTOR | VT_VARIANT)) { for (i = 0; i < len; i++) diff --git a/dll/win32/ole32/ole32.spec b/dll/win32/ole32/ole32.spec index aef85c8e614..a12c2c4a19f 100644 --- a/dll/win32/ole32/ole32.spec +++ b/dll/win32/ole32/ole32.spec @@ -29,8 +29,8 @@ @ stdcall CoGetCurrentLogicalThreadId(ptr) @ stdcall CoGetCurrentProcess() @ stdcall CoGetDefaultContext(long ptr ptr) -@ stub CoGetInstanceFromFile #@ stdcall (ptr ptr ptr long wstr long ptr) return 0,ERR_NOTIMPLEMENTED -@ stub CoGetInstanceFromIStorage #@ stdcall (ptr ptr ptr long ptr long ptr) return 0,ERR_NOTIMPLEMENTED +@ stdcall CoGetInstanceFromFile(ptr ptr ptr long long wstr long ptr) +@ stdcall CoGetInstanceFromIStorage(ptr ptr ptr long ptr long ptr) @ stdcall CoGetInterfaceAndReleaseStream(ptr ptr ptr) @ stdcall CoGetMalloc(long ptr) @ stdcall CoGetMarshalSizeMax(ptr ptr ptr long ptr long) @@ -70,7 +70,7 @@ @ stdcall CoResumeClassObjects() @ stdcall CoRevertToSelf() @ stdcall CoRevokeClassObject(long) -@ stdcall CoRevokeInitializeSpy(double) +@ stdcall CoRevokeInitializeSpy(int64) @ stdcall CoRevokeMallocSpy() @ stdcall CoSetProxyBlanket(ptr long long ptr long long ptr long) @ stdcall CoSetState(ptr) @@ -164,7 +164,7 @@ @ stdcall HWND_UserMarshal(ptr ptr ptr) @ stdcall HWND_UserSize(ptr long ptr) @ stdcall HWND_UserUnmarshal(ptr ptr ptr) -@ stdcall IIDFromString(wstr ptr) CLSIDFromString +@ stdcall IIDFromString(wstr ptr) @ stub I_RemoteMain @ stdcall IsAccelerator(long long ptr long) @ stdcall IsEqualGUID(ptr ptr) diff --git a/dll/win32/ole32/ole32_objidl.idl b/dll/win32/ole32/ole32_objidl.idl index 057a3e3681d..d2c1a9999e6 100644 --- a/dll/win32/ole32/ole32_objidl.idl +++ b/dll/win32/ole32/ole32_objidl.idl @@ -20,6 +20,9 @@ including objidl.h at some point. This will cause all sorts of errors so the easiest thing to do is just comment out our entire header. */ +#pragma makedep proxy +#pragma makedep register + cpp_quote("#if 0 /* ole32_objidl.idl hack */") #include "objidl.idl" cpp_quote("#endif /* ole32_objidl.idl hack */") diff --git a/dll/win32/ole32/ole32_oleidl.idl b/dll/win32/ole32/ole32_oleidl.idl index a3bd8810129..0f4fabc512a 100644 --- a/dll/win32/ole32/ole32_oleidl.idl +++ b/dll/win32/ole32/ole32_oleidl.idl @@ -16,6 +16,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep proxy +#pragma makedep register + #include "oleidl.idl" [ diff --git a/dll/win32/ole32/ole32_ros.diff b/dll/win32/ole32/ole32_ros.diff new file mode 100644 index 00000000000..0a97fc9b381 --- /dev/null +++ b/dll/win32/ole32/ole32_ros.diff @@ -0,0 +1,187 @@ +diff -prudN e:\Wine\dlls\ole32/compobj.c e:\reactos\dll\win32\ole32/compobj.c +--- e:\Wine\dlls\ole32/compobj.c 2014-04-04 14:12:42.091208400 +0100 ++++ e:\reactos\dll\win32\ole32/compobj.c 2014-04-24 12:30:07.466625200 +0100 +@@ -331,8 +303,12 @@ static NTSTATUS create_key( HKEY *retkey + return status; + } + ++#ifdef __REACTOS__ ++static const WCHAR classes_rootW[] = L"\\REGISTRY\\Machine\\Software\\Classes"; ++#else + static const WCHAR classes_rootW[] = + {'M','a','c','h','i','n','e','\\','S','o','f','t','w','a','r','e','\\','C','l','a','s','s','e','s',0}; ++#endif + + static HKEY classes_root_hkey; + +@@ -1635,6 +1611,7 @@ static HRESULT apartment_hostobject_in_h + return hr; + } + ++#ifndef __REACTOS__ + static BOOL WINAPI register_class( INIT_ONCE *once, void *param, void **context ) + { + WNDCLASSW wclass; +@@ -1655,24 +1632,20 @@ static BOOL WINAPI register_class( INIT_ + RegisterClassW(&wclass); + return TRUE; + } ++#endif + + /* create a window for the apartment or return the current one if one has + * already been created */ + HRESULT apartment_createwindowifneeded(struct apartment *apt) + { +- static INIT_ONCE class_init_once = INIT_ONCE_STATIC_INIT; +- + if (apt->multi_threaded) + return S_OK; + + if (!apt->win) + { +- HWND hwnd; +- +- InitOnceExecuteOnce( &class_init_once, register_class, NULL, NULL ); +- +- hwnd = CreateWindowW(wszAptWinClass, NULL, 0, 0, 0, 0, 0, +- HWND_MESSAGE, 0, hProxyDll, NULL); ++ HWND hwnd = CreateWindowW(wszAptWinClass, NULL, 0, ++ 0, 0, 0, 0, ++ HWND_MESSAGE, 0, hProxyDll, NULL); + if (!hwnd) + { + ERR("CreateWindow failed with error %d\n", GetLastError()); +@@ -1699,6 +1672,35 @@ void apartment_joinmta(void) + COM_CurrentInfo()->apt = MTA; + } + ++#ifdef __REACTOS__ ++ ++static void COMPOBJ_InitProcess( void ) ++{ ++ WNDCLASSW wclass; ++ ++ /* Dispatching to the correct thread in an apartment is done through ++ * window messages rather than RPC transports. When an interface is ++ * marshalled into another apartment in the same process, a window of the ++ * following class is created. The *caller* of CoMarshalInterface (i.e., the ++ * application) is responsible for pumping the message loop in that thread. ++ * The WM_USER messages which point to the RPCs are then dispatched to ++ * apartment_wndproc by the user's code from the apartment in which the ++ * interface was unmarshalled. ++ */ ++ memset(&wclass, 0, sizeof(wclass)); ++ wclass.lpfnWndProc = apartment_wndproc; ++ wclass.hInstance = hProxyDll; ++ wclass.lpszClassName = wszAptWinClass; ++ RegisterClassW(&wclass); ++} ++ ++static void COMPOBJ_UninitProcess( void ) ++{ ++ UnregisterClassW(wszAptWinClass, hProxyDll); ++} ++ ++#endif ++ + static void COM_TlsDestroy(void) + { + struct oletls *info = NtCurrentTeb()->ReservedForOle; +@@ -4984,12 +4986,13 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, + switch(fdwReason) { + case DLL_PROCESS_ATTACH: + hProxyDll = hinstDLL; ++ COMPOBJ_InitProcess(); + break; + + case DLL_PROCESS_DETACH: + if (reserved) break; + release_std_git(); +- UnregisterClassW( wszAptWinClass, hProxyDll ); ++ COMPOBJ_UninitProcess(); + RPC_UnregisterAllChannelHooks(); + COMPOBJ_DllList_Free(); + DeleteCriticalSection(&csRegisteredClassList); +diff -prudN e:\Wine\dlls\ole32/stg_prop.c e:\reactos\dll\win32\ole32/stg_prop.c +--- e:\Wine\dlls\ole32/stg_prop.c 2014-04-04 14:12:42.103216400 +0100 ++++ e:\reactos\dll\win32\ole32/stg_prop.c 2014-04-08 19:21:32.097336500 +0100 +@@ -36,32 +36,15 @@ + * PropertyStorage_ReadFromStream + */ + +-#include "config.h" +-#include "wine/port.h" +- +-#include +-#include +-#include +-#include +-#include +- +-#define COBJMACROS +-#define NONAMELESSUNION +-#define NONAMELESSSTRUCT +- +-#include "windef.h" +-#include "winbase.h" +-#include "winnls.h" +-#include "winuser.h" +-#include "wine/unicode.h" +-#include "wine/debug.h" +-#include "dictionary.h" ++#include "precomp.h" + #include "storage32.h" +-#include "enumx.h" +-#include "oleauto.h" + + WINE_DEFAULT_DEBUG_CHANNEL(storage); + ++#ifdef _MSC_VER ++#define __ASM_STDCALL_FUNC(name,args,code) ++#endif ++ + static inline StorageImpl *impl_from_IPropertySetStorage( IPropertySetStorage *iface ) + { + return CONTAINING_RECORD(iface, StorageImpl, base.IPropertySetStorage_iface); +@@ -1035,12 +1018,12 @@ static HRESULT PropertyStorage_ReadDicti + } + + #ifdef __i386__ +-#define __thiscall __stdcall ++#define __thiscall_wrapper __stdcall + #else +-#define __thiscall __cdecl ++#define __thiscall_wrapper __cdecl + #endif + +-static __thiscall void* Allocate_CoTaskMemAlloc(void *userdata, ULONG size) ++static void* __thiscall_wrapper Allocate_CoTaskMemAlloc(void *userdata, ULONG size) + { + return CoTaskMemAlloc(size); + } +@@ -1049,7 +1032,7 @@ static __thiscall void* Allocate_CoTaskM + * end of the buffer. + */ + static HRESULT PropertyStorage_ReadProperty(PROPVARIANT *prop, const BYTE *data, +- UINT codepage, void* (__thiscall *allocate)(void *userdata, ULONG size), void *allocate_data) ++ UINT codepage, void* (__thiscall_wrapper *allocate)(void *userdata, ULONG size), void *allocate_data) + { + HRESULT hr = S_OK; + +@@ -2738,13 +2721,13 @@ end: + "jmp *(4*(" #num "))(%eax)" ) + + DEFINE_STDCALL_WRAPPER(0,Allocate_PMemoryAllocator,8) +-extern void* __thiscall Allocate_PMemoryAllocator(void *this, ULONG cbSize); ++extern void* __stdcall Allocate_PMemoryAllocator(void *this, ULONG cbSize); + + #else + +-static void* __thiscall Allocate_PMemoryAllocator(void *this, ULONG cbSize) ++static void* __cdecl Allocate_PMemoryAllocator(void *this, ULONG cbSize) + { +- void* (__thiscall *fn)(void*,ULONG) = **(void***)this; ++ void* (__cdecl *fn)(void*,ULONG) = **(void***)this; + return fn(this, cbSize); + } + diff --git a/dll/win32/ole32/ole32_unknwn.idl b/dll/win32/ole32/ole32_unknwn.idl index 9be195f4d76..f3176a0d18a 100644 --- a/dll/win32/ole32/ole32_unknwn.idl +++ b/dll/win32/ole32/ole32_unknwn.idl @@ -20,6 +20,9 @@ including unknwn.h at some point. This will cause all sorts of errors so the easiest thing to do is just comment out our entire header. */ +#pragma makedep proxy +#pragma makedep register + cpp_quote("#if 0 /* oleaut32_unknwn.idl hack */") #include "unknwn.idl" cpp_quote("#endif /* oleaut32_unknwn.idl hack */") diff --git a/dll/win32/ole32/stg_prop.c b/dll/win32/ole32/stg_prop.c index 499bc7bbe0e..6eea4f9a4f5 100644 --- a/dll/win32/ole32/stg_prop.c +++ b/dll/win32/ole32/stg_prop.c @@ -1375,8 +1375,8 @@ static HRESULT PropertyStorage_ReadFromStream(PropertyStorage_impl *This) goto end; } /* wackiness alert: if the format ID is FMTID_DocSummaryInformation, there - * follow not one, but two sections. The first is the standard properties - * for the document summary information, and the second is user-defined + * follows not one, but two sections. The first contains the standard properties + * for the document summary information, and the second consists of user-defined * properties. This is the only case in which multiple sections are * allowed. * Reading the second stream isn't implemented yet. @@ -2746,7 +2746,7 @@ BOOLEAN WINAPI StgConvertPropertyToVariant(const SERIALIZEDPROPERTYVALUE* prop, PropVariantInit(pvar); } - return 0; + return FALSE; } SERIALIZEDPROPERTYVALUE* WINAPI StgConvertVariantToProperty(const PROPVARIANT *pvar, diff --git a/dll/win32/ole32/storage32.c b/dll/win32/ole32/storage32.c index 57a7fef1eda..fd59674acf6 100644 --- a/dll/win32/ole32/storage32.c +++ b/dll/win32/ole32/storage32.c @@ -119,20 +119,20 @@ typedef struct TransactedDirEntry DirRef transactedParentEntry; /* True if this entry is being used. */ - int inuse; + BOOL inuse; /* True if data is up to date. */ - int read; + BOOL read; /* True if this entry has been modified. */ - int dirty; + BOOL dirty; /* True if this entry's stream has been modified. */ - int stream_dirty; + BOOL stream_dirty; /* True if this entry has been deleted in the transacted storage, but the * delete has not yet been committed. */ - int deleted; + BOOL deleted; /* If this entry's stream has been modified, a reference to where the stream * is stored in the snapshot file. */ @@ -1404,7 +1404,7 @@ static HRESULT insertIntoTree( * The root storage contains some element, therefore, start the research * for the appropriate location. */ - BOOL found = 0; + BOOL found = FALSE; DirRef current, next, previous, currentEntryId; /* @@ -1423,7 +1423,7 @@ static HRESULT insertIntoTree( next = currentEntry.rightChild; current = currentEntryId; - while (found == 0) + while (!found) { LONG diff = entryNameCmp( newEntry.name, currentEntry.name); @@ -1442,7 +1442,7 @@ static HRESULT insertIntoTree( StorageBaseImpl_WriteDirEntry(This, current, ¤tEntry); - found = 1; + found = TRUE; } } else if (diff > 0) @@ -1460,7 +1460,7 @@ static HRESULT insertIntoTree( StorageBaseImpl_WriteDirEntry(This, current, ¤tEntry); - found = 1; + found = TRUE; } } else @@ -2767,7 +2767,7 @@ static HRESULT StorageImpl_Construct( else This->base.lockingrole = SWMR_None; - This->base.reverted = 0; + This->base.reverted = FALSE; /* * Initialize the big block cache. @@ -2997,7 +2997,7 @@ static void StorageImpl_Invalidate(StorageBaseImpl* iface) StorageBaseImpl_DeleteAll(&This->base); - This->base.reverted = 1; + This->base.reverted = TRUE; } static void StorageImpl_Destroy(StorageBaseImpl* iface) @@ -4364,7 +4364,7 @@ static DirRef TransactedSnapshotImpl_FindFreeEntry(TransactedSnapshotImpl *This) This->entries_size = new_size; } - This->entries[result].inuse = 1; + This->entries[result].inuse = TRUE; This->firstFreeEntry = result+1; @@ -4385,7 +4385,7 @@ static DirRef TransactedSnapshotImpl_CreateStubEntry( entry->newTransactedParentEntry = entry->transactedParentEntry = parentEntryRef; - entry->read = 0; + entry->read = FALSE; } return stubEntryRef; @@ -4430,7 +4430,7 @@ static HRESULT TransactedSnapshotImpl_EnsureReadEntry( if (SUCCEEDED(hr)) { memcpy(&This->entries[entry].data, &data, sizeof(DirEntry)); - This->entries[entry].read = 1; + This->entries[entry].read = TRUE; } } @@ -4469,7 +4469,7 @@ static HRESULT TransactedSnapshotImpl_MakeStreamDirty( } if (SUCCEEDED(hr)) - This->entries[entry].stream_dirty = 1; + This->entries[entry].stream_dirty = TRUE; if (This->entries[entry].transactedParentEntry != DIRENTRY_NULL) { @@ -4479,7 +4479,7 @@ static HRESULT TransactedSnapshotImpl_MakeStreamDirty( delete_ref = TransactedSnapshotImpl_CreateStubEntry(This, This->entries[entry].transactedParentEntry); if (delete_ref != DIRENTRY_NULL) - This->entries[delete_ref].deleted = 1; + This->entries[delete_ref].deleted = TRUE; This->entries[entry].transactedParentEntry = This->entries[entry].newTransactedParentEntry = DIRENTRY_NULL; } @@ -4773,9 +4773,9 @@ static HRESULT WINAPI TransactedSnapshotImpl_Commit( { StorageBaseImpl_StreamSetSize(This->scratch, entry->stream_entry, zero); StorageBaseImpl_DestroyDirEntry(This->scratch, entry->stream_entry); - entry->stream_dirty = 0; + entry->stream_dirty = FALSE; } - entry->dirty = 0; + entry->dirty = FALSE; entry->transactedParentEntry = entry->newTransactedParentEntry; } } @@ -4831,7 +4831,7 @@ static void TransactedSnapshotImpl_Invalidate(StorageBaseImpl* This) { TRACE("Storage invalidated (stg=%p)\n", This); - This->reverted = 1; + This->reverted = TRUE; StorageBaseImpl_DeleteAll(This); } @@ -4875,8 +4875,8 @@ static HRESULT TransactedSnapshotImpl_CreateDirEntry(StorageBaseImpl *base, new_entry = &This->entries[new_ref]; new_entry->newTransactedParentEntry = new_entry->transactedParentEntry = DIRENTRY_NULL; - new_entry->read = 1; - new_entry->dirty = 1; + new_entry->read = TRUE; + new_entry->dirty = TRUE; memcpy(&new_entry->data, newData, sizeof(DirEntry)); *index = new_ref; @@ -4901,7 +4901,7 @@ static HRESULT TransactedSnapshotImpl_WriteDirEntry(StorageBaseImpl *base, if (index != This->base.storageDirEntry) { - This->entries[index].dirty = 1; + This->entries[index].dirty = TRUE; if (data->size.QuadPart == 0 && This->entries[index].transactedParentEntry != DIRENTRY_NULL) @@ -4912,7 +4912,7 @@ static HRESULT TransactedSnapshotImpl_WriteDirEntry(StorageBaseImpl *base, delete_ref = TransactedSnapshotImpl_CreateStubEntry(This, This->entries[index].transactedParentEntry); if (delete_ref != DIRENTRY_NULL) - This->entries[delete_ref].deleted = 1; + This->entries[delete_ref].deleted = TRUE; This->entries[index].transactedParentEntry = This->entries[index].newTransactedParentEntry = DIRENTRY_NULL; } @@ -4953,7 +4953,7 @@ static HRESULT TransactedSnapshotImpl_DestroyDirEntry(StorageBaseImpl *base, } else { - This->entries[index].deleted = 1; + This->entries[index].deleted = TRUE; } return S_OK; @@ -5029,7 +5029,7 @@ static HRESULT TransactedSnapshotImpl_StreamSetSize(StorageBaseImpl *base, This->entries[index].stream_entry, zero); StorageBaseImpl_DestroyDirEntry(This->scratch, This->entries[index].stream_entry); - This->entries[index].stream_dirty = 0; + This->entries[index].stream_dirty = FALSE; } else if (This->entries[index].transactedParentEntry != DIRENTRY_NULL) { @@ -5037,7 +5037,7 @@ static HRESULT TransactedSnapshotImpl_StreamSetSize(StorageBaseImpl *base, delete_ref = TransactedSnapshotImpl_CreateStubEntry(This, This->entries[index].transactedParentEntry); if (delete_ref != DIRENTRY_NULL) - This->entries[delete_ref].deleted = 1; + This->entries[delete_ref].deleted = TRUE; This->entries[index].transactedParentEntry = This->entries[index].newTransactedParentEntry = DIRENTRY_NULL; } @@ -5236,7 +5236,7 @@ static void StorageInternalImpl_Invalidate( StorageBaseImpl *base ) { TRACE("Storage invalidated (stg=%p)\n", This); - This->base.reverted = 1; + This->base.reverted = TRUE; This->parentStorage = NULL; @@ -5721,7 +5721,7 @@ static StorageInternalImpl* StorageInternalImpl_Construct( newStorage->base.baseVtbl = &StorageInternalImpl_BaseVtbl; newStorage->base.openFlags = (openFlags & ~STGM_CREATE); - newStorage->base.reverted = 0; + newStorage->base.reverted = FALSE; newStorage->base.ref = 1; @@ -5732,7 +5732,7 @@ static StorageInternalImpl* StorageInternalImpl_Construct( */ newStorage->base.storageDirEntry = storageDirEntry; - newStorage->base.create = 0; + newStorage->base.create = FALSE; return newStorage; } @@ -6019,10 +6019,10 @@ HRESULT BlockChainStream_GetBlockAtOffset(BlockChainStream *This, { if (!StorageImpl_WriteBigBlock(This->parentStorage, result->sector, result->data)) return STG_E_WRITEFAULT; - result->dirty = 0; + result->dirty = FALSE; } - result->read = 0; + result->read = FALSE; result->index = index; result->sector = *sector; } @@ -6047,9 +6047,9 @@ BlockChainStream* BlockChainStream_Construct( newStream->indexCacheLen = 0; newStream->indexCacheSize = 0; newStream->cachedBlocks[0].index = 0xffffffff; - newStream->cachedBlocks[0].dirty = 0; + newStream->cachedBlocks[0].dirty = FALSE; newStream->cachedBlocks[1].index = 0xffffffff; - newStream->cachedBlocks[1].dirty = 0; + newStream->cachedBlocks[1].dirty = FALSE; newStream->blockToEvict = 0; if (FAILED(BlockChainStream_UpdateIndexCache(newStream))) @@ -6071,7 +6071,7 @@ HRESULT BlockChainStream_Flush(BlockChainStream* This) if (This->cachedBlocks[i].dirty) { if (StorageImpl_WriteBigBlock(This->parentStorage, This->cachedBlocks[i].sector, This->cachedBlocks[i].data)) - This->cachedBlocks[i].dirty = 0; + This->cachedBlocks[i].dirty = FALSE; else return STG_E_WRITEFAULT; } @@ -6211,7 +6211,7 @@ HRESULT BlockChainStream_ReadAt(BlockChainStream* This, if (FAILED(StorageImpl_ReadBigBlock(This->parentStorage, cachedBlock->sector, cachedBlock->data, &read)) && !read) return STG_E_READFAULT; - cachedBlock->read = 1; + cachedBlock->read = TRUE; } memcpy(bufferWalker, cachedBlock->data+offsetInBlock, bytesToReadInBuffer); @@ -6299,8 +6299,8 @@ HRESULT BlockChainStream_WriteAt(BlockChainStream* This, memcpy(cachedBlock->data+offsetInBlock, bufferWalker, bytesToWrite); bytesWrittenAt = bytesToWrite; - cachedBlock->read = 1; - cachedBlock->dirty = 1; + cachedBlock->read = TRUE; + cachedBlock->dirty = TRUE; } blockNoInSequence++; @@ -6402,7 +6402,7 @@ static BOOL BlockChainStream_Shrink(BlockChainStream* This, if (This->cachedBlocks[i].index >= numBlocks) { This->cachedBlocks[i].index = 0xffffffff; - This->cachedBlocks[i].dirty = 0; + This->cachedBlocks[i].dirty = FALSE; } } @@ -7590,11 +7590,21 @@ HRESULT WINAPI StgOpenStorage( HANDLE hFile = 0; DWORD shareMode; DWORD accessMode; + LPWSTR temp_name = NULL; TRACE("(%s, %p, %x, %p, %d, %p)\n", debugstr_w(pwcsName), pstgPriority, grfMode, snbExclude, reserved, ppstgOpen); + if (pstgPriority) + { + /* FIXME: Copy ILockBytes instead? But currently for STGM_PRIORITY it'll be read-only. */ + hr = StorageBaseImpl_GetFilename((StorageBaseImpl*)pstgPriority, &temp_name); + if (FAILED(hr)) goto end; + pwcsName = temp_name; + TRACE("using filename %s\n", debugstr_w(temp_name)); + } + if (pwcsName == 0) { hr = STG_E_INVALIDNAME; @@ -7756,6 +7766,8 @@ HRESULT WINAPI StgOpenStorage( *ppstgOpen = &newStorage->IStorage_iface; end: + CoTaskMemFree(temp_name); + if (pstgPriority) IStorage_Release(pstgPriority); TRACE("<-- %08x, IStorage %p\n", hr, ppstgOpen ? *ppstgOpen : NULL); return hr; } @@ -8667,7 +8679,10 @@ static HRESULT STREAM_ReadString( IStream *stm, LPWSTR *string ) len = MultiByteToWideChar( CP_ACP, 0, str, count, NULL, 0 ); wstr = CoTaskMemAlloc( (len + 1)*sizeof (WCHAR) ); if( wstr ) + { MultiByteToWideChar( CP_ACP, 0, str, count, wstr, len ); + wstr[len] = 0; + } CoTaskMemFree( str ); *string = wstr; @@ -8726,32 +8741,37 @@ static HRESULT STORAGE_WriteCompObj( LPSTORAGE pstg, CLSID *clsid, HRESULT WINAPI WriteFmtUserTypeStg( LPSTORAGE pstg, CLIPFORMAT cf, LPOLESTR lpszUserType) { + STATSTG stat; HRESULT r; WCHAR szwClipName[0x40]; - CLSID clsid = CLSID_NULL; + CLSID clsid; LPWSTR wstrProgID = NULL; DWORD n; TRACE("(%p,%x,%s)\n",pstg,cf,debugstr_w(lpszUserType)); /* get the clipboard format name */ - n = GetClipboardFormatNameW( cf, szwClipName, sizeof(szwClipName)/sizeof(szwClipName[0]) ); - szwClipName[n]=0; + if( cf ) + { + n = GetClipboardFormatNameW( cf, szwClipName, + sizeof(szwClipName)/sizeof(szwClipName[0]) ); + szwClipName[n]=0; + } TRACE("Clipboard name is %s\n", debugstr_w(szwClipName)); - /* FIXME: There's room to save a CLSID and its ProgID, but - the CLSID is not looked up in the registry and in all the - tests I wrote it was CLSID_NULL. Where does it come from? - */ + r = IStorage_Stat(pstg, &stat, STATFLAG_NONAME); + if(SUCCEEDED(r)) + clsid = stat.clsid; + else + clsid = CLSID_NULL; - /* get the real program ID. This may fail, but that's fine */ ProgIDFromCLSID(&clsid, &wstrProgID); TRACE("progid is %s\n",debugstr_w(wstrProgID)); - r = STORAGE_WriteCompObj( pstg, &clsid, - lpszUserType, szwClipName, wstrProgID ); + r = STORAGE_WriteCompObj( pstg, &clsid, lpszUserType, + cf ? szwClipName : NULL, wstrProgID ); CoTaskMemFree(wstrProgID); @@ -9472,51 +9492,52 @@ HRESULT WINAPI GetConvertStg(IStorage *stg) */ HRESULT WINAPI SetConvertStg(IStorage *storage, BOOL convert) { + static const WCHAR stream_1oleW[] = {1,'O','l','e',0}; DWORD flags = convert ? OleStream_Convert : 0; + IStream *stream; + DWORD header[2]; HRESULT hr; TRACE("(%p, %d)\n", storage, convert); - hr = STORAGE_CreateOleStream(storage, flags); - if (hr == STG_E_FILEALREADYEXISTS) + hr = IStorage_OpenStream(storage, stream_1oleW, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stream); + if (FAILED(hr)) { - static const WCHAR stream_1oleW[] = {1,'O','l','e',0}; - IStream *stream; - DWORD header[2]; + if (hr != STG_E_FILENOTFOUND) + return hr; - hr = IStorage_OpenStream(storage, stream_1oleW, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stream); - if (FAILED(hr)) return hr; + return STORAGE_CreateOleStream(storage, flags); + } - hr = IStream_Read(stream, header, sizeof(header), NULL); + hr = IStream_Read(stream, header, sizeof(header), NULL); + if (FAILED(hr)) + { + IStream_Release(stream); + return hr; + } + + /* update flag if differs */ + if ((header[1] ^ flags) & OleStream_Convert) + { + LARGE_INTEGER pos = {{0}}; + + if (header[1] & OleStream_Convert) + flags = header[1] & ~OleStream_Convert; + else + flags = header[1] | OleStream_Convert; + + pos.QuadPart = sizeof(DWORD); + hr = IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL); if (FAILED(hr)) { IStream_Release(stream); return hr; } - /* update flag if differs */ - if ((header[1] ^ flags) & OleStream_Convert) - { - LARGE_INTEGER pos; - - if (header[1] & OleStream_Convert) - flags = header[1] & ~OleStream_Convert; - else - flags = header[1] | OleStream_Convert; - - pos.QuadPart = sizeof(DWORD); - hr = IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL); - if (FAILED(hr)) - { - IStream_Release(stream); - return hr; - } - - hr = IStream_Write(stream, &flags, sizeof(flags), NULL); - } - IStream_Release(stream); + hr = IStream_Write(stream, &flags, sizeof(flags), NULL); } + IStream_Release(stream); return hr; } diff --git a/dll/win32/ole32/storage32.h b/dll/win32/ole32/storage32.h index e8f1fb63e15..939a2e08f99 100644 --- a/dll/win32/ole32/storage32.h +++ b/dll/win32/ole32/storage32.h @@ -191,7 +191,7 @@ struct StorageBaseImpl /* * TRUE if this object has been invalidated */ - int reverted; + BOOL reverted; /* * Index of the directory entry of this storage @@ -213,8 +213,8 @@ struct StorageBaseImpl */ DWORD stateBits; - BOOL create; /* Was the storage created or opened. - The behaviour of STGM_SIMPLE depends on this */ + BOOL create; /* Was the storage created or opened. + The behaviour of STGM_SIMPLE depends on this */ /* * If this storage was opened in transacted mode, the object that implements * the transacted snapshot or cache. @@ -514,8 +514,8 @@ typedef struct BlockChainBlock { ULONG index; ULONG sector; - int read; - int dirty; + BOOL read; + BOOL dirty; BYTE data[MAX_BIG_BLOCK_SIZE]; } BlockChainBlock; diff --git a/dll/win32/ole32/stubmanager.c b/dll/win32/ole32/stubmanager.c index e1981e41954..9d96899cbaa 100644 --- a/dll/win32/ole32/stubmanager.c +++ b/dll/win32/ole32/stubmanager.c @@ -315,7 +315,7 @@ struct stub_manager *get_stub_manager_from_object(APARTMENT *apt, void *object) * threads have a reference to it */ void apartment_disconnectobject(struct apartment *apt, void *object) { - int found = FALSE; + BOOL found = FALSE; struct stub_manager *stubmgr; EnterCriticalSection(&apt->cs); @@ -421,10 +421,11 @@ ULONG stub_manager_ext_release(struct stub_manager *m, ULONG refs, BOOL tablewea TRACE("removed %u refs from %p (oid %s), rc is now %u\n", refs, m, wine_dbgstr_longlong(m->oid), rc); if (last_extern_ref && m->extern_conn) - IExternalConnection_ReleaseConnection(m->extern_conn, EXTCONN_STRONG, 0, TRUE /* FIXME: Use last_unlock releases? */); + IExternalConnection_ReleaseConnection(m->extern_conn, EXTCONN_STRONG, 0, last_unlock_releases); if (rc == 0) - stub_manager_int_release(m); + if (!(m->extern_conn && last_unlock_releases && m->weakrefs)) + stub_manager_int_release(m); return rc; } @@ -562,7 +563,7 @@ void stub_manager_release_marshal_data(struct stub_manager *m, ULONG refs, const else if (ifstub->flags & MSHLFLAGS_TABLESTRONG) refs = 1; - stub_manager_ext_release(m, refs, tableweak, FALSE); + stub_manager_ext_release(m, refs, tableweak, !tableweak); } /* is an ifstub table marshaled? */ diff --git a/dll/win32/oleacc/main.c b/dll/win32/oleacc/main.c index 6d88e7e9567..148dd87e642 100644 --- a/dll/win32/oleacc/main.c +++ b/dll/win32/oleacc/main.c @@ -85,6 +85,12 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, return TRUE; } +HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, void **ppv) +{ + FIXME("%s %s %p: stub\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv); + return E_NOTIMPL; +} + HRESULT WINAPI DllRegisterServer(void) { FIXME("\n"); diff --git a/dll/win32/oleacc/oleacc.spec b/dll/win32/oleacc/oleacc.spec index 6ace5424f1c..68514546fc3 100644 --- a/dll/win32/oleacc/oleacc.spec +++ b/dll/win32/oleacc/oleacc.spec @@ -1,10 +1,11 @@ @ stub AccessibleChildren @ stub AccessibleObjectFromEvent -@ stdcall AccessibleObjectFromPoint(double ptr ptr) +@ stdcall AccessibleObjectFromPoint(int64 ptr ptr) @ stdcall AccessibleObjectFromWindow(ptr long ptr ptr) @ stdcall CreateStdAccessibleObject(ptr long ptr ptr) @ stub CreateStdAccessibleProxyA @ stub CreateStdAccessibleProxyW +@ stdcall -private DllGetClassObject(ptr ptr ptr) @ stdcall -private DllRegisterServer() @ stdcall -private DllUnregisterServer() @ stdcall GetOleaccVersionInfo(ptr ptr) diff --git a/dll/win32/oleacc/oleacc_classes.idl b/dll/win32/oleacc/oleacc_classes.idl index 28cb93e319b..44b06935367 100644 --- a/dll/win32/oleacc/oleacc_classes.idl +++ b/dll/win32/oleacc/oleacc_classes.idl @@ -15,4 +15,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ + +#pragma makedep regtypelib + #include "oleacc.idl" diff --git a/dll/win32/oleaut32/connpt.c b/dll/win32/oleaut32/connpt.c index 487a0b8d40b..656aee47bbc 100644 --- a/dll/win32/oleaut32/connpt.c +++ b/dll/win32/oleaut32/connpt.c @@ -241,9 +241,7 @@ static HRESULT WINAPI ConnectionPointImpl_GetConnectionPointContainer( ConnectionPointImpl *This = impl_from_IConnectionPoint(iface); TRACE("(%p)->(%p)\n", This, ppCPC); - return IUnknown_QueryInterface(This->Obj, - &IID_IConnectionPointContainer, - (LPVOID)ppCPC); + return IUnknown_QueryInterface(This->Obj, &IID_IConnectionPointContainer, (void**)ppCPC); } /************************************************************************ @@ -260,7 +258,7 @@ static HRESULT WINAPI ConnectionPointImpl_Advise(IConnectionPoint *iface, TRACE("(%p)->(%p, %p)\n", This, lpUnk, pdwCookie); *pdwCookie = 0; - if(FAILED(IUnknown_QueryInterface(lpUnk, &This->iid, (LPVOID)&lpSink))) + if(FAILED(IUnknown_QueryInterface(lpUnk, &This->iid, (void**)&lpSink))) return CONNECT_E_CANNOTCONNECT; for(i = 0; i < This->maxSinks; i++) { @@ -336,7 +334,7 @@ static HRESULT WINAPI ConnectionPointImpl_EnumConnections( EnumObj = EnumConnectionsImpl_Construct((IUnknown*)This, This->nSinks, pCD); hr = IEnumConnections_QueryInterface(&EnumObj->IEnumConnections_iface, - &IID_IEnumConnections, (LPVOID)ppEnum); + &IID_IEnumConnections, (void**)ppEnum); IEnumConnections_Release(&EnumObj->IEnumConnections_iface); HeapFree(GetProcessHeap(), 0, pCD); @@ -610,7 +608,7 @@ HRESULT CreateConnectionPoint(IUnknown *pUnk, REFIID riid, if(!Obj) return E_OUTOFMEMORY; hr = IConnectionPoint_QueryInterface(&Obj->IConnectionPoint_iface, - &IID_IConnectionPoint, (LPVOID)pCP); + &IID_IConnectionPoint, (void**)pCP); IConnectionPoint_Release(&Obj->IConnectionPoint_iface); return hr; } diff --git a/dll/win32/oleaut32/dispatch.c b/dll/win32/oleaut32/dispatch.c index a3324178c04..1331d1c447d 100644 --- a/dll/win32/oleaut32/dispatch.c +++ b/dll/win32/oleaut32/dispatch.c @@ -23,8 +23,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole); -static IDispatch * StdDispatch_Construct(IUnknown * punkOuter, void * pvThis, ITypeInfo * pTypeInfo); - /****************************************************************************** * DispInvoke (OLEAUT32.30) * @@ -153,32 +151,6 @@ done: return hr; } -/****************************************************************************** - * CreateStdDispatch [OLEAUT32.32] - * - * Create and return a standard IDispatch object. - * - * RETURNS - * Success: S_OK. ppunkStdDisp contains the new object. - * Failure: An HRESULT error code. - * - * NOTES - * Outer unknown appears to be completely ignored. - */ -HRESULT WINAPI CreateStdDispatch( - IUnknown* punkOuter, - void* pvThis, - ITypeInfo* ptinfo, - IUnknown** ppunkStdDisp) -{ - TRACE("(%p, %p, %p, %p)\n", punkOuter, pvThis, ptinfo, ppunkStdDisp); - - *ppunkStdDisp = (LPUNKNOWN)StdDispatch_Construct(punkOuter, pvThis, ptinfo); - if (!*ppunkStdDisp) - return E_OUTOFMEMORY; - return S_OK; -} - /****************************************************************************** * IDispatch {OLEAUT32} @@ -238,13 +210,15 @@ static HRESULT WINAPI StdDispatch_QueryInterface( void** ppvObject) { StdDispatch *This = impl_from_IDispatch(iface); - TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppvObject); + TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObject); + + *ppvObject = NULL; if (IsEqualIID(riid, &IID_IDispatch) || IsEqualIID(riid, &IID_IUnknown)) { - *ppvObject = This; - IUnknown_AddRef((LPUNKNOWN)*ppvObject); + *ppvObject = iface; + IDispatch_AddRef(iface); return S_OK; } return E_NOINTERFACE; @@ -305,10 +279,8 @@ static ULONG WINAPI StdDispatch_Release(LPDISPATCH iface) */ static HRESULT WINAPI StdDispatch_GetTypeInfoCount(LPDISPATCH iface, UINT * pctinfo) { - StdDispatch *This = impl_from_IDispatch(iface); TRACE("(%p)\n", pctinfo); - - *pctinfo = This->pTypeInfo ? 1 : 0; + *pctinfo = 1; return S_OK; } @@ -339,11 +311,9 @@ static HRESULT WINAPI StdDispatch_GetTypeInfo(LPDISPATCH iface, UINT iTInfo, LCI if (iTInfo != 0) return DISP_E_BADINDEX; - if (This->pTypeInfo) - { - *ppTInfo = This->pTypeInfo; - ITypeInfo_AddRef(*ppTInfo); - } + *ppTInfo = This->pTypeInfo; + ITypeInfo_AddRef(*ppTInfo); + return S_OK; } @@ -435,25 +405,44 @@ static const IDispatchVtbl StdDispatch_VTable = StdDispatch_Invoke }; -static IDispatch * StdDispatch_Construct( - IUnknown * punkOuter, - void * pvThis, - ITypeInfo * pTypeInfo) +/****************************************************************************** + * CreateStdDispatch [OLEAUT32.32] + * + * Create and return a standard IDispatch object. + * + * RETURNS + * Success: S_OK. ppunkStdDisp contains the new object. + * Failure: An HRESULT error code. + * + * NOTES + * Outer unknown appears to be completely ignored. + */ +HRESULT WINAPI CreateStdDispatch( + IUnknown* punkOuter, + void* pvThis, + ITypeInfo* ptinfo, + IUnknown** stddisp) { - StdDispatch * pStdDispatch; + StdDispatch *pStdDispatch; + + TRACE("(%p, %p, %p, %p)\n", punkOuter, pvThis, ptinfo, stddisp); + + if (!pvThis || !ptinfo || !stddisp) + return E_INVALIDARG; pStdDispatch = CoTaskMemAlloc(sizeof(StdDispatch)); if (!pStdDispatch) - return &pStdDispatch->IDispatch_iface; + return E_OUTOFMEMORY; pStdDispatch->IDispatch_iface.lpVtbl = &StdDispatch_VTable; pStdDispatch->pvThis = pvThis; - pStdDispatch->pTypeInfo = pTypeInfo; + pStdDispatch->pTypeInfo = ptinfo; pStdDispatch->ref = 1; /* we keep a reference to the type info so prevent it from * being destroyed until we are done with it */ - ITypeInfo_AddRef(pTypeInfo); + ITypeInfo_AddRef(ptinfo); + *stddisp = (IUnknown*)&pStdDispatch->IDispatch_iface; - return &pStdDispatch->IDispatch_iface; + return S_OK; } diff --git a/dll/win32/oleaut32/oleaut.c b/dll/win32/oleaut32/oleaut.c index 8f77d18c8b7..961f40c856c 100644 --- a/dll/win32/oleaut32/oleaut.c +++ b/dll/win32/oleaut32/oleaut.c @@ -860,7 +860,8 @@ BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD fdwReason, LPVOID lpvReserved) { static const WCHAR oanocacheW[] = {'o','a','n','o','c','a','c','h','e',0}; - bstr_cache_enabled = !GetEnvironmentVariableW(oanocacheW, NULL, 0); + if(fdwReason == DLL_PROCESS_ATTACH) + bstr_cache_enabled = !GetEnvironmentVariableW(oanocacheW, NULL, 0); return OLEAUTPS_DllMain( hInstDll, fdwReason, lpvReserved ); } @@ -887,6 +888,6 @@ HRESULT WINAPI DllUnregisterServer(void) HCURSOR WINAPI OleIconToCursor( HINSTANCE hinstExe, HICON hIcon) { FIXME("(%p,%p), partially implemented.\n",hinstExe,hIcon); - /* FIXME: make a extended conversation from HICON to HCURSOR */ + /* FIXME: make an extended conversation from HICON to HCURSOR */ return CopyCursor(hIcon); } diff --git a/dll/win32/oleaut32/oleaut32.spec b/dll/win32/oleaut32/oleaut32.spec index a86486fecac..a68eb0c4eaf 100644 --- a/dll/win32/oleaut32/oleaut32.spec +++ b/dll/win32/oleaut32/oleaut32.spec @@ -46,9 +46,9 @@ 47 stdcall VarNumFromParseNum(ptr ptr long ptr) 48 stdcall VarI2FromUI1(long ptr) 49 stdcall VarI2FromI4(long ptr) -50 stdcall VarI2FromR4(long ptr) +50 stdcall VarI2FromR4(float ptr) 51 stdcall VarI2FromR8(double ptr) -52 stdcall VarI2FromCy(double ptr) +52 stdcall VarI2FromCy(int64 ptr) 53 stdcall VarI2FromDate(double ptr) 54 stdcall VarI2FromStr(wstr long long ptr) 55 stdcall VarI2FromDisp(ptr long ptr) @@ -56,9 +56,9 @@ 57 stdcall SafeArraySetIID(ptr ptr) 58 stdcall VarI4FromUI1(long ptr) 59 stdcall VarI4FromI2(long ptr) -60 stdcall VarI4FromR4(long ptr) +60 stdcall VarI4FromR4(float ptr) 61 stdcall VarI4FromR8(double ptr) -62 stdcall VarI4FromCy(double ptr) +62 stdcall VarI4FromCy(int64 ptr) 63 stdcall VarI4FromDate(double ptr) 64 stdcall VarI4FromStr(wstr long long ptr) 65 stdcall VarI4FromDisp(ptr long ptr) @@ -68,7 +68,7 @@ 69 stdcall VarR4FromI2(long ptr) 70 stdcall VarR4FromI4(long ptr) 71 stdcall VarR4FromR8(double ptr) -72 stdcall VarR4FromCy(double ptr) +72 stdcall VarR4FromCy(int64 ptr) 73 stdcall VarR4FromDate(double ptr) 74 stdcall VarR4FromStr(wstr long long ptr) 75 stdcall VarR4FromDisp(ptr long ptr) @@ -77,8 +77,8 @@ 78 stdcall VarR8FromUI1(long ptr) 79 stdcall VarR8FromI2(long ptr) 80 stdcall VarR8FromI4(long ptr) -81 stdcall VarR8FromR4(long ptr) -82 stdcall VarR8FromCy(double ptr) +81 stdcall VarR8FromR4(float ptr) +82 stdcall VarR8FromCy(int64 ptr) 83 stdcall VarR8FromDate(double ptr) 84 stdcall VarR8FromStr(wstr long long ptr) 85 stdcall VarR8FromDisp(ptr long ptr) @@ -87,9 +87,9 @@ 88 stdcall VarDateFromUI1(long ptr) 89 stdcall VarDateFromI2(long ptr) 90 stdcall VarDateFromI4(long ptr) -91 stdcall VarDateFromR4(long ptr) +91 stdcall VarDateFromR4(float ptr) 92 stdcall VarDateFromR8(double ptr) -93 stdcall VarDateFromCy(double ptr) +93 stdcall VarDateFromCy(int64 ptr) 94 stdcall VarDateFromStr(wstr long long ptr) 95 stdcall VarDateFromDisp(ptr long ptr) 96 stdcall VarDateFromBool(long ptr) @@ -97,7 +97,7 @@ 98 stdcall VarCyFromUI1(long ptr) 99 stdcall VarCyFromI2(long ptr) 100 stdcall VarCyFromI4(long ptr) -101 stdcall VarCyFromR4(long ptr) +101 stdcall VarCyFromR4(float ptr) 102 stdcall VarCyFromR8(double ptr) 103 stdcall VarCyFromDate(double ptr) 104 stdcall VarCyFromStr(wstr long long ptr) @@ -107,9 +107,9 @@ 108 stdcall VarBstrFromUI1(long long long ptr) 109 stdcall VarBstrFromI2(long long long ptr) 110 stdcall VarBstrFromI4(long long long ptr) -111 stdcall VarBstrFromR4(long long long ptr) +111 stdcall VarBstrFromR4(float long long ptr) 112 stdcall VarBstrFromR8(double long long ptr) -113 stdcall VarBstrFromCy(double long long ptr) +113 stdcall VarBstrFromCy(int64 long long ptr) 114 stdcall VarBstrFromDate(double long long ptr) 115 stdcall VarBstrFromDisp(ptr long long ptr) 116 stdcall VarBstrFromBool(long long long ptr) @@ -117,10 +117,10 @@ 118 stdcall VarBoolFromUI1(long ptr) 119 stdcall VarBoolFromI2(long ptr) 120 stdcall VarBoolFromI4(long ptr) -121 stdcall VarBoolFromR4(long ptr) +121 stdcall VarBoolFromR4(float ptr) 122 stdcall VarBoolFromR8(double ptr) 123 stdcall VarBoolFromDate(double ptr) -124 stdcall VarBoolFromCy(double ptr) +124 stdcall VarBoolFromCy(int64 ptr) 125 stdcall VarBoolFromStr(wstr long long ptr) 126 stdcall VarBoolFromDisp(ptr long ptr) 127 stdcall VarFormatCurrency(ptr long long long long long ptr) @@ -128,9 +128,9 @@ 129 stdcall VarMonthName(long long long ptr) 130 stdcall VarUI1FromI2(long ptr) 131 stdcall VarUI1FromI4(long ptr) -132 stdcall VarUI1FromR4(long ptr) +132 stdcall VarUI1FromR4(float ptr) 133 stdcall VarUI1FromR8(double ptr) -134 stdcall VarUI1FromCy(double ptr) +134 stdcall VarUI1FromCy(int64 ptr) 135 stdcall VarUI1FromDate(double ptr) 136 stdcall VarUI1FromStr(wstr long long ptr) 137 stdcall VarUI1FromDisp(ptr long ptr) @@ -187,10 +187,10 @@ 190 stdcall VarDecFromUI1(long ptr) 191 stdcall VarDecFromI2(long ptr) 192 stdcall VarDecFromI4(long ptr) -193 stdcall VarDecFromR4(long ptr) +193 stdcall VarDecFromR4(float ptr) 194 stdcall VarDecFromR8(double ptr) 195 stdcall VarDecFromDate(double ptr) -196 stdcall VarDecFromCy(double ptr) +196 stdcall VarDecFromCy(int64 ptr) 197 stdcall VarDecFromStr(wstr long long ptr) 198 stdcall VarDecFromDisp(ptr long ptr) 199 stdcall VarDecFromBool(long ptr) @@ -241,10 +241,10 @@ 244 stdcall VarI1FromUI1(long ptr) 245 stdcall VarI1FromI2(long ptr) 246 stdcall VarI1FromI4(long ptr) -247 stdcall VarI1FromR4(long ptr) +247 stdcall VarI1FromR4(float ptr) 248 stdcall VarI1FromR8(double ptr) 249 stdcall VarI1FromDate(double ptr) -250 stdcall VarI1FromCy(double ptr) +250 stdcall VarI1FromCy(int64 ptr) 251 stdcall VarI1FromStr(wstr long long ptr) 252 stdcall VarI1FromDisp(ptr long ptr) 253 stdcall VarI1FromBool(long ptr) @@ -254,10 +254,10 @@ 257 stdcall VarUI2FromUI1(long ptr) 258 stdcall VarUI2FromI2(long ptr) 259 stdcall VarUI2FromI4(long ptr) -260 stdcall VarUI2FromR4(long ptr) +260 stdcall VarUI2FromR4(float ptr) 261 stdcall VarUI2FromR8(double ptr) 262 stdcall VarUI2FromDate(double ptr) -263 stdcall VarUI2FromCy(double ptr) +263 stdcall VarUI2FromCy(int64 ptr) 264 stdcall VarUI2FromStr(wstr long long ptr) 265 stdcall VarUI2FromDisp(ptr long ptr) 266 stdcall VarUI2FromBool(long ptr) @@ -267,10 +267,10 @@ 270 stdcall VarUI4FromUI1(long ptr) 271 stdcall VarUI4FromI2(long ptr) 272 stdcall VarUI4FromI4(long ptr) -273 stdcall VarUI4FromR4(long ptr) +273 stdcall VarUI4FromR4(float ptr) 274 stdcall VarUI4FromR8(double ptr) 275 stdcall VarUI4FromDate(double ptr) -276 stdcall VarUI4FromCy(double ptr) +276 stdcall VarUI4FromCy(int64 ptr) 277 stdcall VarUI4FromStr(wstr long long ptr) 278 stdcall VarUI4FromDisp(ptr long ptr) 279 stdcall VarUI4FromBool(long ptr) @@ -293,21 +293,21 @@ 296 stub LPSAFEARRAY_Marshal 297 stub LPSAFEARRAY_Unmarshal 298 stdcall VarDecCmpR8(ptr double) -299 stdcall VarCyAdd(double double ptr) -303 stdcall VarCyMul(double double ptr) -304 stdcall VarCyMulI4(double long ptr) -305 stdcall VarCySub(double double ptr) -306 stdcall VarCyAbs(double ptr) -307 stdcall VarCyFix(double ptr) -308 stdcall VarCyInt(double ptr) -309 stdcall VarCyNeg(double ptr) -310 stdcall VarCyRound(double long ptr) -311 stdcall VarCyCmp(double double) -312 stdcall VarCyCmpR8(double double) +299 stdcall VarCyAdd(int64 int64 ptr) +303 stdcall VarCyMul(int64 int64 ptr) +304 stdcall VarCyMulI4(int64 long ptr) +305 stdcall VarCySub(int64 int64 ptr) +306 stdcall VarCyAbs(int64 ptr) +307 stdcall VarCyFix(int64 ptr) +308 stdcall VarCyInt(int64 ptr) +309 stdcall VarCyNeg(int64 ptr) +310 stdcall VarCyRound(int64 long ptr) +311 stdcall VarCyCmp(int64 int64) +312 stdcall VarCyCmpR8(int64 double) 313 stdcall VarBstrCat(wstr wstr ptr) 314 stdcall VarBstrCmp(wstr wstr long long) 315 stdcall VarR8Pow(double double ptr) -316 stdcall VarR4CmpR8(long double) +316 stdcall VarR4CmpR8(float double) 317 stdcall VarR8Round(double long ptr) 318 stdcall VarCat(ptr ptr ptr) 319 stdcall VarDateFromUdateEx(ptr long long ptr) @@ -316,15 +316,15 @@ 325 stub SetVarConversionLocaleSetting 326 stub GetVarConversionLocaleSetting 327 stdcall SetOaNoCache() -329 stdcall VarCyMulI8(double double ptr) +329 stdcall VarCyMulI8(int64 int64 ptr) 330 stdcall VarDateFromUdate(ptr long ptr) 331 stdcall VarUdateFromDate(double long ptr) 332 stub GetAltMonthNames 333 stdcall VarI8FromUI1(long long) 334 stdcall VarI8FromI2(long long) -335 stdcall VarI8FromR4(long long) +335 stdcall VarI8FromR4(float long) 336 stdcall VarI8FromR8(double long) -337 stdcall VarI8FromCy(double ptr) +337 stdcall VarI8FromCy(int64 ptr) 338 stdcall VarI8FromDate(double long) 339 stdcall VarI8FromStr(wstr long long ptr) 340 stdcall VarI8FromDisp(ptr long ptr) @@ -333,30 +333,30 @@ 343 stdcall VarI8FromUI2(long long) 344 stdcall VarI8FromUI4(long long) 345 stdcall VarI8FromDec(ptr ptr) -346 stdcall VarI2FromI8(double ptr) -347 stdcall VarI2FromUI8(double ptr) -348 stdcall VarI4FromI8(double ptr) -349 stdcall VarI4FromUI8(double ptr) -360 stdcall VarR4FromI8(double ptr) -361 stdcall VarR4FromUI8(double ptr) -362 stdcall VarR8FromI8(double ptr) -363 stdcall VarR8FromUI8(double ptr) -364 stdcall VarDateFromI8(double ptr) -365 stdcall VarDateFromUI8(double ptr) -366 stdcall VarCyFromI8(double ptr) -367 stdcall VarCyFromUI8(double ptr) -368 stdcall VarBstrFromI8(double long long ptr) -369 stdcall VarBstrFromUI8(double long long ptr) -370 stdcall VarBoolFromI8(double ptr) -371 stdcall VarBoolFromUI8(double ptr) -372 stdcall VarUI1FromI8(double ptr) -373 stdcall VarUI1FromUI8(double ptr) -374 stdcall VarDecFromI8(double ptr) -375 stdcall VarDecFromUI8(double ptr) -376 stdcall VarI1FromI8(double ptr) -377 stdcall VarI1FromUI8(double ptr) -378 stdcall VarUI2FromI8(double ptr) -379 stdcall VarUI2FromUI8(double ptr) +346 stdcall VarI2FromI8(int64 ptr) +347 stdcall VarI2FromUI8(int64 ptr) +348 stdcall VarI4FromI8(int64 ptr) +349 stdcall VarI4FromUI8(int64 ptr) +360 stdcall VarR4FromI8(int64 ptr) +361 stdcall VarR4FromUI8(int64 ptr) +362 stdcall VarR8FromI8(int64 ptr) +363 stdcall VarR8FromUI8(int64 ptr) +364 stdcall VarDateFromI8(int64 ptr) +365 stdcall VarDateFromUI8(int64 ptr) +366 stdcall VarCyFromI8(int64 ptr) +367 stdcall VarCyFromUI8(int64 ptr) +368 stdcall VarBstrFromI8(int64 long long ptr) +369 stdcall VarBstrFromUI8(int64 long long ptr) +370 stdcall VarBoolFromI8(int64 ptr) +371 stdcall VarBoolFromUI8(int64 ptr) +372 stdcall VarUI1FromI8(int64 ptr) +373 stdcall VarUI1FromUI8(int64 ptr) +374 stdcall VarDecFromI8(int64 ptr) +375 stdcall VarDecFromUI8(int64 ptr) +376 stdcall VarI1FromI8(int64 ptr) +377 stdcall VarI1FromUI8(int64 ptr) +378 stdcall VarUI2FromI8(int64 ptr) +379 stdcall VarUI2FromUI8(int64 ptr) 380 stub UserHWND_from_local 381 stub UserHWND_to_local 382 stub UserHWND_free_inst @@ -393,15 +393,15 @@ 422 stub OleLoadPictureFile 423 stub OleSavePictureFile 424 stdcall OleLoadPicturePath(wstr ptr long long ptr ptr) -425 stdcall VarUI4FromI8(double ptr) -426 stdcall VarUI4FromUI8(double ptr) -427 stdcall VarI8FromUI8(double ptr) -428 stdcall VarUI8FromI8(double ptr) +425 stdcall VarUI4FromI8(int64 ptr) +426 stdcall VarUI4FromUI8(int64 ptr) +427 stdcall VarI8FromUI8(int64 ptr) +428 stdcall VarUI8FromI8(int64 ptr) 429 stdcall VarUI8FromUI1(long ptr) 430 stdcall VarUI8FromI2(long ptr) -431 stdcall VarUI8FromR4(long ptr) +431 stdcall VarUI8FromR4(float ptr) 432 stdcall VarUI8FromR8(double ptr) -433 stdcall VarUI8FromCy(double ptr) +433 stdcall VarUI8FromCy(int64 ptr) 434 stdcall VarUI8FromDate(double ptr) 435 stdcall VarUI8FromStr(wstr long long ptr) 436 stdcall VarUI8FromDisp(ptr long ptr) diff --git a/dll/win32/oleaut32/oleaut32_oaidl.idl b/dll/win32/oleaut32/oleaut32_oaidl.idl index 3574d081ab2..2874be0603f 100644 --- a/dll/win32/oleaut32/oleaut32_oaidl.idl +++ b/dll/win32/oleaut32/oleaut32_oaidl.idl @@ -20,6 +20,9 @@ including oaidl.h at some point. This will cause all sorts of errors so the easiest thing to do is just comment out our entire header. */ +#pragma makedep proxy +#pragma makedep register + cpp_quote("#if 0 /* oleaut32_oaidl.idl hack */") #include "oaidl.idl" cpp_quote("#endif /* oleaut32_oaidl.idl hack */") diff --git a/dll/win32/oleaut32/oleaut32_ocidl.idl b/dll/win32/oleaut32/oleaut32_ocidl.idl index fad374183e2..5f7664e0fb3 100644 --- a/dll/win32/oleaut32/oleaut32_ocidl.idl +++ b/dll/win32/oleaut32/oleaut32_ocidl.idl @@ -16,6 +16,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep proxy +#pragma makedep register + #include "ocidl.idl" [ diff --git a/dll/win32/oleaut32/olefont.c b/dll/win32/oleaut32/olefont.c index e6102195aec..ad9351d1d25 100644 --- a/dll/win32/oleaut32/olefont.c +++ b/dll/win32/oleaut32/olefont.c @@ -333,9 +333,9 @@ HRESULT WINAPI OleCreateFontIndirect( fd.cySize.s.Hi = 0; fd.sWeight = 0; fd.sCharset = 0; - fd.fItalic = 0; - fd.fUnderline = 0; - fd.fStrikethrough = 0; + fd.fItalic = FALSE; + fd.fUnderline = FALSE; + fd.fStrikethrough = FALSE; lpFontDesc = &fd; } @@ -368,7 +368,7 @@ static void OLEFont_SendNotify(OLEFontImpl* this, DISPID dispID) static const WCHAR wszUnder[] = {'U','n','d','e','r','l','i','n','e',0}; static const WCHAR wszStrike[] = {'S','t','r','i','k','e','t','h','r','o','u','g','h',0}; static const WCHAR wszWeight[] = {'W','e','i','g','h','t',0}; - static const WCHAR wszCharset[] = {'C','h','a','r','s','s','e','t',0}; + static const WCHAR wszCharset[] = {'C','h','a','r','s','e','t',0}; static const LPCWSTR dispid_mapping[] = { wszName, @@ -394,7 +394,7 @@ static void OLEFont_SendNotify(OLEFontImpl* this, DISPID dispID) while(IEnumConnections_Next(pEnum, 1, &CD, NULL) == S_OK) { IPropertyNotifySink *sink; - IUnknown_QueryInterface(CD.pUnk, &IID_IPropertyNotifySink, (LPVOID)&sink); + IUnknown_QueryInterface(CD.pUnk, &IID_IPropertyNotifySink, (void**)&sink); IPropertyNotifySink_OnChanged(sink, dispID); IPropertyNotifySink_Release(sink); IUnknown_Release(CD.pUnk); @@ -420,7 +420,7 @@ static void OLEFont_SendNotify(OLEFontImpl* this, DISPID dispID) while(IEnumConnections_Next(pEnum, 1, &CD, NULL) == S_OK) { IFontEventsDisp *disp; - IUnknown_QueryInterface(CD.pUnk, &IID_IFontEventsDisp, (LPVOID)&disp); + IUnknown_QueryInterface(CD.pUnk, &IID_IFontEventsDisp, (void**)&disp); IFontEventsDisp_Invoke(disp, DISPID_FONT_CHANGED, &IID_NULL, LOCALE_NEUTRAL, INVOKE_FUNC, &dispparams, NULL, NULL, NULL); @@ -1063,7 +1063,12 @@ static HRESULT WINAPI OLEFontImpl_SetRatio( TRACE("(%p)->(%d, %d)\n", this, cyLogical, cyHimetric); if(cyLogical == 0 || cyHimetric == 0) - return E_INVALIDARG; + return E_FAIL; + + /* cyLogical and cyHimetric both set to 1 is a special case that + does not change the scaling but also does not fail */ + if(cyLogical == 1 && cyHimetric == 1) + return S_OK; this->cyLogical = cyLogical; this->cyHimetric = cyHimetric; @@ -1280,9 +1285,6 @@ static HRESULT WINAPI OLEFontImpl_GetIDsOfNames( /************************************************************************ * OLEFontImpl_Invoke (IDispatch) * - * Note: Do not call _put_Xxx methods, since setting things here - * should not call notify functions as I found out debugging the generic - * MS VB5 installer. */ static HRESULT WINAPI OLEFontImpl_Invoke( IDispatch* iface, @@ -1828,13 +1830,11 @@ static HRESULT WINAPI OLEFontImpl_FindConnectionPoint( TRACE("(%p)->(%s, %p)\n", this, debugstr_guid(riid), ppCp); if(IsEqualIID(riid, &IID_IPropertyNotifySink)) { - return IConnectionPoint_QueryInterface(this->pPropertyNotifyCP, - &IID_IConnectionPoint, - (LPVOID)ppCp); + return IConnectionPoint_QueryInterface(this->pPropertyNotifyCP, &IID_IConnectionPoint, + (void**)ppCp); } else if(IsEqualIID(riid, &IID_IFontEventsDisp)) { - return IConnectionPoint_QueryInterface(this->pFontEventsCP, - &IID_IConnectionPoint, - (LPVOID)ppCp); + return IConnectionPoint_QueryInterface(this->pFontEventsCP, &IID_IConnectionPoint, + (void**)ppCp); } else { FIXME("no connection point for %s\n", debugstr_guid(riid)); return CONNECT_E_NOCONNECTION; diff --git a/dll/win32/oleaut32/olepicture.c b/dll/win32/oleaut32/olepicture.c index 47667bf6480..4b4bb307614 100644 --- a/dll/win32/oleaut32/olepicture.c +++ b/dll/win32/oleaut32/olepicture.c @@ -902,7 +902,7 @@ static HRESULT WINAPI OLEPictureImpl_FindConnectionPoint( return E_POINTER; *ppCP = NULL; if (IsEqualGUID(riid,&IID_IPropertyNotifySink)) - return IConnectionPoint_QueryInterface(This->pCP,&IID_IConnectionPoint,(LPVOID)ppCP); + return IConnectionPoint_QueryInterface(This->pCP, &IID_IConnectionPoint, (void**)ppCP); FIXME("no connection point for %s\n",debugstr_guid(riid)); return CONNECT_E_NOCONNECTION; } @@ -1369,12 +1369,17 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface, IStream *pStm) } headerread += xread; xread = 0; - + if (!memcmp(&(header[0]),"lt\0\0", 4) && (statfailed || (header[1] + headerread <= statstg.cbSize.QuadPart))) { if (toread != 0 && toread != header[1]) FIXME("varying lengths of image data (prev=%u curr=%u), only last one will be used\n", toread, header[1]); toread = header[1]; + if (statfailed) + { + statstg.cbSize.QuadPart = header[1] + 8; + statfailed = FALSE; + } if (toread == 0) break; } else { if (!memcmp(&(header[0]), "GIF8", 4) || /* GIF header */ @@ -1506,9 +1511,9 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface, IStream *pStm) return hr; } -static int serializeBMP(HBITMAP hBitmap, void ** ppBuffer, unsigned int * pLength) +static BOOL serializeBMP(HBITMAP hBitmap, void ** ppBuffer, unsigned int * pLength) { - int iSuccess = 0; + BOOL success = FALSE; HDC hDC; BITMAPINFO * pInfoBitmap; int iNumPaletteEntries; @@ -1564,17 +1569,17 @@ static int serializeBMP(HBITMAP hBitmap, void ** ppBuffer, unsigned int * pLengt sizeof(BITMAPINFOHEADER) + iNumPaletteEntries * sizeof(RGBQUAD), pPixelData, pInfoBitmap->bmiHeader.biSizeImage); - iSuccess = 1; + success = TRUE; HeapFree(GetProcessHeap(), 0, pPixelData); HeapFree(GetProcessHeap(), 0, pInfoBitmap); - return iSuccess; + return success; } -static int serializeIcon(HICON hIcon, void ** ppBuffer, unsigned int * pLength) +static BOOL serializeIcon(HICON hIcon, void ** ppBuffer, unsigned int * pLength) { ICONINFO infoIcon; - int iSuccess = 0; + BOOL success = FALSE; *ppBuffer = NULL; *pLength = 0; if (GetIconInfo(hIcon, &infoIcon)) { @@ -1696,7 +1701,7 @@ static int serializeIcon(HICON hIcon, void ** ppBuffer, unsigned int * pLength) /* Write out everything produced so far to the stream */ *ppBuffer = pIconData; *pLength = iDataSize; - iSuccess = 1; + success = TRUE; } else { /* printf("ERROR: unable to get bitmap information via GetDIBits() (error %u)\n", @@ -1719,7 +1724,7 @@ static int serializeIcon(HICON hIcon, void ** ppBuffer, unsigned int * pLength) printf("ERROR: Unable to get icon information (error %u)\n", GetLastError()); } - return iSuccess; + return success; } static HRESULT WINAPI OLEPictureImpl_Save( @@ -1730,7 +1735,7 @@ static HRESULT WINAPI OLEPictureImpl_Save( unsigned int iDataSize; DWORD header[2]; ULONG dummy; - int iSerializeResult = 0; + BOOL serializeResult = FALSE; OLEPictureImpl *This = impl_from_IPersistStream(iface); TRACE("%p %p %d\n", This, pStm, fClearDirty); @@ -1764,7 +1769,7 @@ static HRESULT WINAPI OLEPictureImpl_Save( if (This->bIsDirty || !This->data) { switch (This->keepOrigFormat ? This->loadtime_format : BITMAP_FORMAT_BMP) { case BITMAP_FORMAT_BMP: - iSerializeResult = serializeBMP(This->desc.u.bmp.hbitmap, &pIconData, &iDataSize); + serializeResult = serializeBMP(This->desc.u.bmp.hbitmap, &pIconData, &iDataSize); break; case BITMAP_FORMAT_JPEG: FIXME("(%p,%p,%d), PICTYPE_BITMAP (format JPEG) not implemented!\n",This,pStm,fClearDirty); @@ -1780,7 +1785,7 @@ static HRESULT WINAPI OLEPictureImpl_Save( break; } - if (!iSerializeResult) + if (!serializeResult) { hResult = E_FAIL; break; @@ -1974,6 +1979,7 @@ static HRESULT WINAPI OLEPictureImpl_Invoke( UINT* puArgErr) { OLEPictureImpl *This = impl_from_IDispatch(iface); + HRESULT hr; /* validate parameters */ @@ -2031,7 +2037,7 @@ static HRESULT WINAPI OLEPictureImpl_Invoke( else if (wFlags & DISPATCH_PROPERTYPUT) { VARIANTARG vararg; - HRESULT hr; + TRACE("DISPID_PICT_HPAL\n"); VariantInit(&vararg); @@ -2069,6 +2075,40 @@ static HRESULT WINAPI OLEPictureImpl_Invoke( return IPicture_get_Height(&This->IPicture_iface, &V_I4(pVarResult)); } break; + case DISPID_PICT_RENDER: + if (wFlags & DISPATCH_METHOD) + { + VARIANTARG *args = pDispParams->rgvarg; + int i; + + TRACE("DISPID_PICT_RENDER\n"); + + if (pDispParams->cArgs != 10) + return DISP_E_BADPARAMCOUNT; + + /* All parameters are supposed to be VT_I4 (on 64 bits too). */ + for (i = 0; i < pDispParams->cArgs; i++) + if (V_VT(&args[i]) != VT_I4) + { + ERR("DISPID_PICT_RENDER: wrong argument type %d:%d\n", i, V_VT(&args[i])); + return DISP_E_TYPEMISMATCH; + } + + /* FIXME: rectangle pointer argument handling seems broken on 64 bits, + currently Render() doesn't use it at all so for now NULL is passed. */ + return IPicture_Render(&This->IPicture_iface, + LongToHandle(V_I4(&args[9])), + V_I4(&args[8]), + V_I4(&args[7]), + V_I4(&args[6]), + V_I4(&args[5]), + V_I4(&args[4]), + V_I4(&args[3]), + V_I4(&args[2]), + V_I4(&args[1]), + NULL); + } + break; } ERR("invalid dispid 0x%x or wFlags 0x%x\n", dispIdMember, wFlags); @@ -2252,7 +2292,7 @@ HRESULT WINAPI OleLoadPicturePath( LPOLESTR szURLorPath, LPUNKNOWN punkCaller, HANDLE hFile; DWORD dwFileSize; HGLOBAL hGlobal = NULL; - DWORD dwBytesRead = 0; + DWORD dwBytesRead; IStream *stream; BOOL bRead; IPersistStream *pStream; @@ -2296,7 +2336,7 @@ HRESULT WINAPI OleLoadPicturePath( LPOLESTR szURLorPath, LPUNKNOWN punkCaller, hGlobal = GlobalAlloc(GMEM_FIXED,dwFileSize); if ( hGlobal) { - bRead = ReadFile(hFile, hGlobal, dwFileSize, &dwBytesRead, NULL); + bRead = ReadFile(hFile, hGlobal, dwFileSize, &dwBytesRead, NULL) && dwBytesRead == dwFileSize; if (!bRead) { GlobalFree(hGlobal); diff --git a/dll/win32/oleaut32/recinfo.c b/dll/win32/oleaut32/recinfo.c index 22a889ba0b4..f10755eff2d 100644 --- a/dll/win32/oleaut32/recinfo.c +++ b/dll/win32/oleaut32/recinfo.c @@ -135,6 +135,8 @@ static HRESULT WINAPI IRecordInfoImpl_QueryInterface(IRecordInfo *iface, REFIID { TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject); + *ppvObject = NULL; + if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IRecordInfo, riid)) { *ppvObject = iface; IRecordInfo_AddRef(iface); @@ -223,6 +225,7 @@ static HRESULT WINAPI IRecordInfoImpl_RecordClear(IRecordInfo *iface, PVOID pvEx case VT_UI8: case VT_INT: case VT_UINT: + case VT_HRESULT: break; case VT_INT_PTR: case VT_UINT_PTR: @@ -231,6 +234,15 @@ static HRESULT WINAPI IRecordInfoImpl_RecordClear(IRecordInfo *iface, PVOID pvEx case VT_SAFEARRAY: SafeArrayDestroy(var); break; + case VT_UNKNOWN: + case VT_DISPATCH: + { + IUnknown *unk = *(IUnknown**)var; + if (unk) + IUnknown_Release(unk); + *(void**)var = NULL; + break; + } default: FIXME("Not supported vt = %d\n", This->fields[i].vt); break; @@ -240,18 +252,75 @@ static HRESULT WINAPI IRecordInfoImpl_RecordClear(IRecordInfo *iface, PVOID pvEx return S_OK; } -static HRESULT WINAPI IRecordInfoImpl_RecordCopy(IRecordInfo *iface, PVOID pvExisting, - PVOID pvNew) +static HRESULT WINAPI IRecordInfoImpl_RecordCopy(IRecordInfo *iface, void *src_rec, void *dest_rec) { IRecordInfoImpl *This = impl_from_IRecordInfo(iface); + HRESULT hr = S_OK; + int i; - TRACE("(%p)->(%p %p)\n", This, pvExisting, pvNew); - - if(!pvExisting || !pvNew) + TRACE("(%p)->(%p %p)\n", This, src_rec, dest_rec); + + if(!src_rec || !dest_rec) return E_INVALIDARG; - memcpy(pvExisting, pvNew, This->size); - return S_OK; + /* release already stored data */ + IRecordInfo_RecordClear(iface, dest_rec); + + for (i = 0; i < This->n_vars; i++) + { + void *src, *dest; + + if (This->fields[i].varkind != VAR_PERINSTANCE) { + ERR("varkind != VAR_PERINSTANCE\n"); + continue; + } + + src = ((BYTE*)src_rec) + This->fields[i].offset; + dest = ((BYTE*)dest_rec) + This->fields[i].offset; + switch (This->fields[i].vt) + { + case VT_BSTR: + { + BSTR src_str = *(BSTR*)src; + + if (src_str) + { + BSTR str = SysAllocString(*(BSTR*)src); + if (!str) hr = E_OUTOFMEMORY; + + *(BSTR*)dest = str; + } + else + *(BSTR*)dest = NULL; + break; + } + case VT_UNKNOWN: + case VT_DISPATCH: + { + IUnknown *unk = *(IUnknown**)src; + *(IUnknown**)dest = unk; + if (unk) IUnknown_AddRef(unk); + break; + } + case VT_SAFEARRAY: + hr = SafeArrayCopy(src, dest); + break; + default: + { + /* copy directly for types that don't need deep copy */ + int len = get_type_size(NULL, This->fields[i].vt); + memcpy(dest, src, len); + break; + } + } + + if (FAILED(hr)) break; + } + + if (FAILED(hr)) + IRecordInfo_RecordClear(iface, dest_rec); + + return hr; } static HRESULT WINAPI IRecordInfoImpl_GetGuid(IRecordInfo *iface, GUID *pguid) @@ -445,10 +514,14 @@ static BOOL WINAPI IRecordInfoImpl_IsMatchingType(IRecordInfo *iface, IRecordInf static PVOID WINAPI IRecordInfoImpl_RecordCreate(IRecordInfo *iface) { IRecordInfoImpl *This = impl_from_IRecordInfo(iface); + void *record; TRACE("(%p)\n", This); - return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->size); + record = HeapAlloc(GetProcessHeap(), 0, This->size); + IRecordInfo_RecordInit(iface, record); + TRACE("created record at %p\n", record); + return record; } static HRESULT WINAPI IRecordInfoImpl_RecordCreateCopy(IRecordInfo *iface, PVOID pvSource, @@ -518,8 +591,8 @@ HRESULT WINAPI GetRecordInfoFromGuids(REFGUID rGuidTypeLib, ULONG uVerMajor, ITypeLib *pTypeLib; HRESULT hres; - TRACE("(%p,%d,%d,%d,%p,%p)\n", rGuidTypeLib, uVerMajor, uVerMinor, - lcid, rGuidTypeInfo, ppRecInfo); + TRACE("(%p,%d,%d,%d,%s,%p)\n", rGuidTypeLib, uVerMajor, uVerMinor, + lcid, debugstr_guid(rGuidTypeInfo), ppRecInfo); hres = LoadRegTypeLib(rGuidTypeLib, uVerMajor, uVerMinor, lcid, &pTypeLib); if(FAILED(hres)) { @@ -618,6 +691,7 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo NULL, NULL, NULL); if(FAILED(hres)) WARN("GetDocumentation failed: %08x\n", hres); + TRACE("field=%s, offset=%d\n", debugstr_w(ret->fields[i].name), ret->fields[i].offset); ITypeInfo_ReleaseVarDesc(pTypeInfo, vardesc); } diff --git a/dll/win32/oleaut32/safearray.c b/dll/win32/oleaut32/safearray.c index 88a7e13f3b2..14eb269a439 100644 --- a/dll/win32/oleaut32/safearray.c +++ b/dll/win32/oleaut32/safearray.c @@ -73,6 +73,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(variant); /* Undocumented hidden space before the start of a SafeArray descriptor */ #define SAFEARRAY_HIDDEN_SIZE sizeof(GUID) +/* features listed here are not propagated to newly created array or data copy + created with SafeArrayCopy()/SafeArrayCopyData() */ +static const USHORT ignored_copy_features = + FADF_AUTO | + FADF_STATIC | + FADF_EMBEDDED | + FADF_FIXEDSIZE | + FADF_CREATEVECTOR; + /* Allocate memory */ static inline LPVOID SAFEARRAY_Malloc(ULONG ulSize) { @@ -165,7 +174,7 @@ static HRESULT SAFEARRAY_AllocDescriptor(ULONG ulSize, SAFEARRAY **ppsaOut) if (!ptr) { *ppsaOut = NULL; - return E_UNEXPECTED; + return E_OUTOFMEMORY; } *ppsaOut = (SAFEARRAY*)(ptr + SAFEARRAY_HIDDEN_SIZE); @@ -285,7 +294,7 @@ static HRESULT SAFEARRAY_DestroyData(SAFEARRAY *psa, ULONG ulStartCell) lpUnknown++; } } - else if (psa->fFeatures & (FADF_RECORD)) + else if (psa->fFeatures & FADF_RECORD) { IRecordInfo *lpRecInfo; @@ -326,86 +335,104 @@ static HRESULT SAFEARRAY_DestroyData(SAFEARRAY *psa, ULONG ulStartCell) return S_OK; } -/* Copy data items from one array to another */ +/* Copy data items from one array to another. Destination data is freed before copy. */ static HRESULT SAFEARRAY_CopyData(SAFEARRAY *psa, SAFEARRAY *dest) { + HRESULT hr = S_OK; + if (!psa->pvData) return S_OK; - else if (!dest->pvData || psa->fFeatures & FADF_DATADELETED) + + if (!dest->pvData || psa->fFeatures & FADF_DATADELETED) return E_INVALIDARG; else { ULONG ulCellCount = SAFEARRAY_GetCellCount(psa); - dest->fFeatures = (dest->fFeatures & FADF_CREATEVECTOR) | - (psa->fFeatures & ~(FADF_CREATEVECTOR|FADF_DATADELETED)); + dest->fFeatures = (dest->fFeatures & FADF_CREATEVECTOR) | (psa->fFeatures & ~ignored_copy_features); if (psa->fFeatures & FADF_VARIANT) { - VARIANT* lpVariant = psa->pvData; - VARIANT* lpDest = dest->pvData; + VARIANT *src_var = psa->pvData; + VARIANT *dest_var = dest->pvData; while(ulCellCount--) { HRESULT hRet; - hRet = VariantCopy(lpDest, lpVariant); - if (FAILED(hRet)) FIXME("VariantCopy failed with 0x%x\n", hRet); - lpVariant++; - lpDest++; + /* destination is cleared automatically */ + hRet = VariantCopy(dest_var, src_var); + if (FAILED(hRet)) FIXME("VariantCopy failed with 0x%08x, element %u\n", hRet, ulCellCount); + src_var++; + dest_var++; } } else if (psa->fFeatures & FADF_BSTR) { - BSTR* lpBstr = psa->pvData; - BSTR* lpDest = dest->pvData; + BSTR *src_bstr = psa->pvData; + BSTR *dest_bstr = dest->pvData; while(ulCellCount--) { - if (*lpBstr) + SysFreeString(*dest_bstr); + if (*src_bstr) { - *lpDest = SysAllocStringByteLen((char*)*lpBstr, SysStringByteLen(*lpBstr)); - if (!*lpDest) + *dest_bstr = SysAllocStringByteLen((char*)*src_bstr, SysStringByteLen(*src_bstr)); + if (!*dest_bstr) return E_OUTOFMEMORY; } else - *lpDest = NULL; - lpBstr++; - lpDest++; + *dest_bstr = NULL; + src_bstr++; + dest_bstr++; + } + } + else if (psa->fFeatures & FADF_RECORD) + { + BYTE *dest_data = dest->pvData; + BYTE *src_data = psa->pvData; + IRecordInfo *record; + + SafeArrayGetRecordInfo(psa, &record); + while (ulCellCount--) + { + /* RecordCopy() clears destination record */ + hr = IRecordInfo_RecordCopy(record, src_data, dest_data); + if (FAILED(hr)) break; + src_data += psa->cbElements; + dest_data += psa->cbElements; + } + + SafeArraySetRecordInfo(dest, record); + /* This value is set to 32 bytes by default on descriptor creation, + update with actual structure size. */ + dest->cbElements = psa->cbElements; + IRecordInfo_Release(record); + } + else if (psa->fFeatures & (FADF_UNKNOWN|FADF_DISPATCH)) + { + IUnknown **dest_unk = dest->pvData; + IUnknown **src_unk = psa->pvData; + + /* release old iface, addref new one */ + while (ulCellCount--) + { + if (*dest_unk) + IUnknown_Release(*dest_unk); + *dest_unk = *src_unk; + if (*dest_unk) + IUnknown_AddRef(*dest_unk); + src_unk++; + dest_unk++; } } else { /* Copy the data over */ memcpy(dest->pvData, psa->pvData, ulCellCount * psa->cbElements); - - if (psa->fFeatures & (FADF_UNKNOWN|FADF_DISPATCH)) - { - LPUNKNOWN *lpUnknown = dest->pvData; - - while(ulCellCount--) - { - if (*lpUnknown) - IUnknown_AddRef(*lpUnknown); - lpUnknown++; - } - } } - if (psa->fFeatures & FADF_RECORD) - { - IRecordInfo* pRecInfo = NULL; - - SafeArrayGetRecordInfo(psa, &pRecInfo); - SafeArraySetRecordInfo(dest, pRecInfo); - - if (pRecInfo) - { - /* Release because Get() adds a reference */ - IRecordInfo_Release(pRecInfo); - } - } - else if (psa->fFeatures & FADF_HAVEIID) + if (psa->fFeatures & FADF_HAVEIID) { GUID guid; SafeArrayGetIID(psa, &guid); @@ -416,7 +443,8 @@ static HRESULT SAFEARRAY_CopyData(SAFEARRAY *psa, SAFEARRAY *dest) SAFEARRAY_SetHiddenDWORD(dest, SAFEARRAY_GetHiddenDWORD(psa)); } } - return S_OK; + + return hr; } /************************************************************************* @@ -438,6 +466,7 @@ static HRESULT SAFEARRAY_CopyData(SAFEARRAY *psa, SAFEARRAY *dest) HRESULT WINAPI SafeArrayAllocDescriptor(UINT cDims, SAFEARRAY **ppsaOut) { LONG allocSize; + HRESULT hr; TRACE("(%d,%p)\n", cDims, ppsaOut); @@ -450,8 +479,9 @@ HRESULT WINAPI SafeArrayAllocDescriptor(UINT cDims, SAFEARRAY **ppsaOut) /* We need enough space for the header and its bounds */ allocSize = sizeof(SAFEARRAY) + sizeof(SAFEARRAYBOUND) * (cDims - 1); - if (FAILED(SAFEARRAY_AllocDescriptor(allocSize, ppsaOut))) - return E_UNEXPECTED; + hr = SAFEARRAY_AllocDescriptor(allocSize, ppsaOut); + if (FAILED(hr)) + return hr; (*ppsaOut)->cDims = cDims; @@ -481,7 +511,7 @@ HRESULT WINAPI SafeArrayAllocDescriptor(UINT cDims, SAFEARRAY **ppsaOut) HRESULT WINAPI SafeArrayAllocDescriptorEx(VARTYPE vt, UINT cDims, SAFEARRAY **ppsaOut) { ULONG cbElements; - HRESULT hRet = E_UNEXPECTED; + HRESULT hRet; TRACE("(%d->%s,%d,%p)\n", vt, debugstr_vt(vt), cDims, ppsaOut); @@ -846,8 +876,6 @@ HRESULT WINAPI SafeArrayPutElement(SAFEARRAY *psa, LONG *rgIndices, void *pvData VARIANT* lpVariant = pvData; VARIANT* lpDest = lpvDest; - hRet = VariantClear(lpDest); - if (FAILED(hRet)) FIXME("VariantClear failed with 0x%x\n", hRet); hRet = VariantCopy(lpDest, lpVariant); if (FAILED(hRet)) FIXME("VariantCopy failed with 0x%x\n", hRet); } @@ -862,23 +890,27 @@ HRESULT WINAPI SafeArrayPutElement(SAFEARRAY *psa, LONG *rgIndices, void *pvData if (!*lpDest) hRet = E_OUTOFMEMORY; } - else + else if (psa->fFeatures & (FADF_UNKNOWN|FADF_DISPATCH)) { - if (psa->fFeatures & (FADF_UNKNOWN|FADF_DISPATCH)) - { - LPUNKNOWN lpUnknown = pvData; - LPUNKNOWN *lpDest = lpvDest; + IUnknown *lpUnknown = pvData; + IUnknown **lpDest = lpvDest; - if (lpUnknown) - IUnknown_AddRef(lpUnknown); - if (*lpDest) - IUnknown_Release(*lpDest); - *lpDest = lpUnknown; - } else { - /* Copy the data over */ - memcpy(lpvDest, pvData, psa->cbElements); - } + if (lpUnknown) + IUnknown_AddRef(lpUnknown); + if (*lpDest) + IUnknown_Release(*lpDest); + *lpDest = lpUnknown; } + else if (psa->fFeatures & FADF_RECORD) + { + IRecordInfo *record; + + SafeArrayGetRecordInfo(psa, &record); + hRet = IRecordInfo_RecordCopy(record, pvData, lpvDest); + IRecordInfo_Release(record); + } else + /* Copy the data over */ + memcpy(lpvDest, pvData, psa->cbElements); } SafeArrayUnlock(psa); } @@ -946,18 +978,26 @@ HRESULT WINAPI SafeArrayGetElement(SAFEARRAY *psa, LONG *rgIndices, void *pvData else *lpDest = NULL; } - else + else if (psa->fFeatures & (FADF_UNKNOWN|FADF_DISPATCH)) { - if (psa->fFeatures & (FADF_UNKNOWN|FADF_DISPATCH)) - { - LPUNKNOWN *lpUnknown = lpvSrc; + IUnknown **src_unk = lpvSrc; + IUnknown **dest_unk = pvData; - if (*lpUnknown) - IUnknown_AddRef(*lpUnknown); - } + if (*src_unk) + IUnknown_AddRef(*src_unk); + *dest_unk = *src_unk; + } + else if (psa->fFeatures & FADF_RECORD) + { + IRecordInfo *record; + + SafeArrayGetRecordInfo(psa, &record); + hRet = IRecordInfo_RecordCopy(record, lpvSrc, pvData); + IRecordInfo_Release(record); + } + else /* Copy the data over */ memcpy(pvData, lpvSrc, psa->cbElements); - } } SafeArrayUnlock(psa); } @@ -1087,18 +1127,17 @@ UINT WINAPI SafeArrayGetElemsize(SAFEARRAY *psa) */ HRESULT WINAPI SafeArrayAccessData(SAFEARRAY *psa, void **ppvData) { + HRESULT hr; + TRACE("(%p,%p)\n", psa, ppvData); if(!psa || !ppvData) return E_INVALIDARG; - if (SUCCEEDED(SafeArrayLock(psa))) - { - *ppvData = psa->pvData; - return S_OK; - } - *ppvData = NULL; - return E_UNEXPECTED; + hr = SafeArrayLock(psa); + *ppvData = SUCCEEDED(hr) ? psa->pvData : NULL; + + return hr; } @@ -1207,6 +1246,8 @@ HRESULT WINAPI SafeArrayPtrOfIndex(SAFEARRAY *psa, LONG *rgIndices, void **ppvDa */ HRESULT WINAPI SafeArrayDestroyData(SAFEARRAY *psa) { + HRESULT hr; + TRACE("(%p)\n", psa); if (!psa) @@ -1216,8 +1257,9 @@ HRESULT WINAPI SafeArrayDestroyData(SAFEARRAY *psa) return DISP_E_ARRAYISLOCKED; /* Can't delete a locked array */ /* Delete the actual item data */ - if (FAILED(SAFEARRAY_DestroyData(psa, 0))) - return E_UNEXPECTED; + hr = SAFEARRAY_DestroyData(psa, 0); + if (FAILED(hr)) + return hr; if (psa->pvData) { @@ -1276,10 +1318,7 @@ HRESULT WINAPI SafeArrayCopyData(SAFEARRAY *psaSource, SAFEARRAY *psaTarget) psaTarget->rgsabound[dim].cElements) return E_INVALIDARG; - if (SUCCEEDED(SAFEARRAY_DestroyData(psaTarget, 0)) && - SUCCEEDED(SAFEARRAY_CopyData(psaSource, psaTarget))) - return S_OK; - return E_UNEXPECTED; + return SAFEARRAY_CopyData(psaSource, psaTarget); } /************************************************************************ @@ -1349,9 +1388,9 @@ HRESULT WINAPI SafeArrayCopy(SAFEARRAY *psa, SAFEARRAY **ppsaOut) if (psa->fFeatures & (FADF_RECORD|FADF_HAVEIID|FADF_HAVEVARTYPE)) { VARTYPE vt; - if (FAILED(SafeArrayGetVartype(psa, &vt))) - hRet = E_UNEXPECTED; - else + + hRet = SafeArrayGetVartype(psa, &vt); + if (SUCCEEDED(hRet)) hRet = SafeArrayAllocDescriptorEx(vt, psa->cDims, ppsaOut); } else @@ -1359,7 +1398,7 @@ HRESULT WINAPI SafeArrayCopy(SAFEARRAY *psa, SAFEARRAY **ppsaOut) hRet = SafeArrayAllocDescriptor(psa->cDims, ppsaOut); if (SUCCEEDED(hRet)) { - (*ppsaOut)->fFeatures = psa->fFeatures & ~FADF_CREATEVECTOR; + (*ppsaOut)->fFeatures = psa->fFeatures & ~ignored_copy_features; (*ppsaOut)->cbElements = psa->cbElements; } } @@ -1370,19 +1409,23 @@ HRESULT WINAPI SafeArrayCopy(SAFEARRAY *psa, SAFEARRAY **ppsaOut) memcpy((*ppsaOut)->rgsabound, psa->rgsabound, psa->cDims * sizeof(SAFEARRAYBOUND)); (*ppsaOut)->pvData = SAFEARRAY_Malloc(SAFEARRAY_GetCellCount(psa) * psa->cbElements); - - if ((*ppsaOut)->pvData) + if (!(*ppsaOut)->pvData) { - hRet = SAFEARRAY_CopyData(psa, *ppsaOut); - - if (SUCCEEDED(hRet)) - return hRet; - - SAFEARRAY_Free((*ppsaOut)->pvData); + SafeArrayDestroyDescriptor(*ppsaOut); + *ppsaOut = NULL; + return E_OUTOFMEMORY; + } + + hRet = SAFEARRAY_CopyData(psa, *ppsaOut); + if (FAILED(hRet)) + { + SAFEARRAY_Free((*ppsaOut)->pvData); + SafeArrayDestroyDescriptor(*ppsaOut); + *ppsaOut = NULL; + return hRet; } - SafeArrayDestroyDescriptor(*ppsaOut); } - *ppsaOut = NULL; + return hRet; } @@ -1405,6 +1448,7 @@ HRESULT WINAPI SafeArrayCopy(SAFEARRAY *psa, SAFEARRAY **ppsaOut) HRESULT WINAPI SafeArrayRedim(SAFEARRAY *psa, SAFEARRAYBOUND *psabound) { SAFEARRAYBOUND *oldBounds; + HRESULT hr; TRACE("(%p,%p)\n", psa, psabound); @@ -1414,8 +1458,9 @@ HRESULT WINAPI SafeArrayRedim(SAFEARRAY *psa, SAFEARRAYBOUND *psabound) if (psa->cLocks > 0) return DISP_E_ARRAYISLOCKED; - if (FAILED(SafeArrayLock(psa))) - return E_UNEXPECTED; + hr = SafeArrayLock(psa); + if (FAILED(hr)) + return hr; oldBounds = psa->rgsabound; oldBounds->lLbound = psabound->lLbound; @@ -1448,7 +1493,7 @@ HRESULT WINAPI SafeArrayRedim(SAFEARRAY *psa, SAFEARRAYBOUND *psabound) if (!(pvNewData = SAFEARRAY_Malloc(ulNewSize))) { SafeArrayUnlock(psa); - return E_UNEXPECTED; + return E_OUTOFMEMORY; } memcpy(pvNewData, psa->pvData, ulOldSize); diff --git a/dll/win32/oleaut32/tmarshal.c b/dll/win32/oleaut32/tmarshal.c index efeeb25aec2..40647964801 100644 --- a/dll/win32/oleaut32/tmarshal.c +++ b/dll/win32/oleaut32/tmarshal.c @@ -281,8 +281,16 @@ _get_typeinfo_for_iid(REFIID riid, ITypeInfo**ti) { sprintf(typelibkey,"Typelib\\%s\\%s\\0\\win%u",tlguid,ver,(sizeof(void*) == 8) ? 64 : 32); tlfnlen = sizeof(tlfn); if (RegQueryValueA(HKEY_CLASSES_ROOT,typelibkey,tlfn,&tlfnlen)) { - ERR("Could not get typelib fn?\n"); - return E_FAIL; +#ifdef _WIN64 + sprintf(typelibkey,"Typelib\\%s\\%s\\0\\win32",tlguid,ver); + tlfnlen = sizeof(tlfn); + if (RegQueryValueA(HKEY_CLASSES_ROOT,typelibkey,tlfn,&tlfnlen)) { +#endif + ERR("Could not get typelib fn?\n"); + return E_FAIL; +#ifdef _WIN64 + } +#endif } MultiByteToWideChar(CP_ACP, 0, tlfn, -1, tlfnW, sizeof(tlfnW) / sizeof(tlfnW[0])); hres = LoadTypeLib(tlfnW,&tl); @@ -622,14 +630,11 @@ _xsize(const TYPEDESC *td, ITypeInfo *tinfo) { } /* Whether we pass this type by reference or by value */ -static int +static BOOL _passbyref(const TYPEDESC *td, ITypeInfo *tinfo) { - if (td->vt == VT_USERDEFINED || - td->vt == VT_VARIANT || - td->vt == VT_PTR) - return 1; - - return 0; + return (td->vt == VT_USERDEFINED || + td->vt == VT_VARIANT || + td->vt == VT_PTR); } static HRESULT diff --git a/dll/win32/oleaut32/typelib.c b/dll/win32/oleaut32/typelib.c index 451c43f16da..95d29864545 100644 --- a/dll/win32/oleaut32/typelib.c +++ b/dll/win32/oleaut32/typelib.c @@ -325,10 +325,23 @@ static WCHAR *get_lcid_subkey( LCID lcid, SYSKIND syskind, WCHAR *buffer ) static HRESULT TLB_ReadTypeLib(LPCWSTR pszFileName, LPWSTR pszPath, UINT cchPath, ITypeLib2 **ppTypeLib); +struct tlibredirect_data +{ + ULONG size; + DWORD res; + ULONG name_len; + ULONG name_offset; + LANGID langid; + WORD flags; + ULONG help_len; + ULONG help_offset; + WORD major_version; + WORD minor_version; +}; /* Get the path to a registered type library. Helper for QueryPathOfRegTypeLib. */ static HRESULT query_typelib_path( REFGUID guid, WORD wMaj, WORD wMin, - SYSKIND syskind, LCID lcid, LPBSTR path ) + SYSKIND syskind, LCID lcid, BSTR *path, BOOL redir ) { HRESULT hr = TYPE_E_LIBNOTREGISTERED; LCID myLCID = lcid; @@ -339,6 +352,30 @@ static HRESULT query_typelib_path( REFGUID guid, WORD wMaj, WORD wMin, TRACE_(typelib)("(%s, %x.%x, 0x%x, %p)\n", debugstr_guid(guid), wMaj, wMin, lcid, path); + if (redir) + { + ACTCTX_SECTION_KEYED_DATA data; + + data.cbSize = sizeof(data); + if (FindActCtxSectionGuid( 0, NULL, ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION, guid, &data )) + { + struct tlibredirect_data *tlib = (struct tlibredirect_data*)data.lpData; + WCHAR *nameW; + DWORD len; + + if (tlib->major_version != wMaj || tlib->minor_version < wMin) + return TYPE_E_LIBNOTREGISTERED; + + nameW = (WCHAR*)((BYTE*)data.lpSectionBase + tlib->name_offset); + len = SearchPathW( NULL, nameW, NULL, sizeof(Path)/sizeof(WCHAR), Path, NULL ); + if (!len) return TYPE_E_LIBNOTREGISTERED; + + TRACE_(typelib)("got path from context %s\n", debugstr_w(Path)); + *path = SysAllocString( Path ); + return S_OK; + } + } + if (!find_typelib_key( guid, &wMaj, &wMin )) return TYPE_E_LIBNOTREGISTERED; get_typelib_key( guid, wMaj, wMin, buffer ); @@ -410,12 +447,14 @@ static HRESULT query_typelib_path( REFGUID guid, WORD wMaj, WORD wMin, */ HRESULT WINAPI QueryPathOfRegTypeLib( REFGUID guid, WORD wMaj, WORD wMin, LCID lcid, LPBSTR path ) { + BOOL redir = TRUE; #ifdef _WIN64 - HRESULT hres = query_typelib_path( guid, wMaj, wMin, SYS_WIN64, lcid, path ); + HRESULT hres = query_typelib_path( guid, wMaj, wMin, SYS_WIN64, lcid, path, TRUE ); if(SUCCEEDED(hres)) return hres; + redir = FALSE; #endif - return query_typelib_path( guid, wMaj, wMin, SYS_WIN32, lcid, path ); + return query_typelib_path( guid, wMaj, wMin, SYS_WIN32, lcid, path, redir ); } /****************************************************************************** @@ -536,6 +575,20 @@ HRESULT WINAPI LoadRegTypeLib( { res= LoadTypeLib(bstr, ppTLib); SysFreeString(bstr); + + if (*ppTLib) + { + TLIBATTR *attr; + + res = ITypeLib_GetLibAttr(*ppTLib, &attr); + if (res == S_OK && (attr->wMajorVerNum != wVerMajor || attr->wMinorVerNum < wVerMinor)) + { + ITypeLib_ReleaseTLibAttr(*ppTLib, attr); + ITypeLib_Release(*ppTLib); + *ppTLib = NULL; + res = TYPE_E_LIBNOTREGISTERED; + } + } } TRACE("(IID: %s) load %s (%p)\n",debugstr_guid(rguid), SUCCEEDED(res)? "SUCCESS":"FAILED", *ppTLib); @@ -551,6 +604,57 @@ static const WCHAR HELPDIRW[] = {'H','E','L','P','D','I','R',0}; static const WCHAR ProxyStubClsidW[] = {'P','r','o','x','y','S','t','u','b','C','l','s','i','d',0}; static const WCHAR ProxyStubClsid32W[] = {'P','r','o','x','y','S','t','u','b','C','l','s','i','d','3','2',0}; +static void TLB_register_interface(TLIBATTR *libattr, LPOLESTR name, TYPEATTR *tattr, DWORD flag) +{ + WCHAR keyName[60]; + HKEY key, subKey; + + static const WCHAR PSOA[] = {'{','0','0','0','2','0','4','2','4','-', + '0','0','0','0','-','0','0','0','0','-','C','0','0','0','-', + '0','0','0','0','0','0','0','0','0','0','4','6','}',0}; + + get_interface_key( &tattr->guid, keyName ); + if (RegCreateKeyExW(HKEY_CLASSES_ROOT, keyName, 0, NULL, 0, + KEY_WRITE | flag, NULL, &key, NULL) == ERROR_SUCCESS) + { + if (name) + RegSetValueExW(key, NULL, 0, REG_SZ, + (BYTE *)name, (strlenW(name)+1) * sizeof(OLECHAR)); + + if (RegCreateKeyExW(key, ProxyStubClsidW, 0, NULL, 0, + KEY_WRITE | flag, NULL, &subKey, NULL) == ERROR_SUCCESS) { + RegSetValueExW(subKey, NULL, 0, REG_SZ, + (const BYTE *)PSOA, sizeof PSOA); + RegCloseKey(subKey); + } + + if (RegCreateKeyExW(key, ProxyStubClsid32W, 0, NULL, 0, + KEY_WRITE | flag, NULL, &subKey, NULL) == ERROR_SUCCESS) { + RegSetValueExW(subKey, NULL, 0, REG_SZ, + (const BYTE *)PSOA, sizeof PSOA); + RegCloseKey(subKey); + } + + if (RegCreateKeyExW(key, TypeLibW, 0, NULL, 0, + KEY_WRITE | flag, NULL, &subKey, NULL) == ERROR_SUCCESS) + { + WCHAR buffer[40]; + static const WCHAR fmtver[] = {'%','x','.','%','x',0 }; + static const WCHAR VersionW[] = {'V','e','r','s','i','o','n',0}; + + StringFromGUID2(&libattr->guid, buffer, 40); + RegSetValueExW(subKey, NULL, 0, REG_SZ, + (BYTE *)buffer, (strlenW(buffer)+1) * sizeof(WCHAR)); + sprintfW(buffer, fmtver, libattr->wMajorVerNum, libattr->wMinorVerNum); + RegSetValueExW(subKey, VersionW, 0, REG_SZ, + (BYTE*)buffer, (strlenW(buffer)+1) * sizeof(WCHAR)); + RegCloseKey(subKey); + } + + RegCloseKey(key); + } +} + /****************************************************************************** * RegisterTypeLib [OLEAUT32.163] * Adds information about a type library to the System Registry @@ -569,9 +673,6 @@ HRESULT WINAPI RegisterTypeLib( OLECHAR * szHelpDir) /* [in] dir to the helpfile for the library, may be NULL*/ { - static const WCHAR PSOA[] = {'{','0','0','0','2','0','4','2','4','-', - '0','0','0','0','-','0','0','0','0','-','C','0','0','0','-', - '0','0','0','0','0','0','0','0','0','0','4','6','}',0}; HRESULT res; TLIBATTR *attr; WCHAR keyName[60]; @@ -744,47 +845,16 @@ HRESULT WINAPI RegisterTypeLib( if ((kind == TKIND_INTERFACE && (tattr->wTypeFlags & TYPEFLAG_FOLEAUTOMATION)) || kind == TKIND_DISPATCH) { - /* register interface<->typelib coupling */ - get_interface_key( &tattr->guid, keyName ); - if (RegCreateKeyExW(HKEY_CLASSES_ROOT, keyName, 0, NULL, 0, - KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS) - { - if (name) - RegSetValueExW(key, NULL, 0, REG_SZ, - (BYTE *)name, (strlenW(name)+1) * sizeof(OLECHAR)); + BOOL is_wow64; + DWORD opposite = (sizeof(void*) == 8 ? KEY_WOW64_32KEY : KEY_WOW64_64KEY); - if (RegCreateKeyExW(key, ProxyStubClsidW, 0, NULL, 0, - KEY_WRITE, NULL, &subKey, NULL) == ERROR_SUCCESS) { - RegSetValueExW(subKey, NULL, 0, REG_SZ, - (const BYTE *)PSOA, sizeof PSOA); - RegCloseKey(subKey); - } + /* register interface<->typelib coupling */ + TLB_register_interface(attr, name, tattr, 0); - if (RegCreateKeyExW(key, ProxyStubClsid32W, 0, NULL, 0, - KEY_WRITE, NULL, &subKey, NULL) == ERROR_SUCCESS) { - RegSetValueExW(subKey, NULL, 0, REG_SZ, - (const BYTE *)PSOA, sizeof PSOA); - RegCloseKey(subKey); - } - - if (RegCreateKeyExW(key, TypeLibW, 0, NULL, 0, - KEY_WRITE, NULL, &subKey, NULL) == ERROR_SUCCESS) - { - WCHAR buffer[40]; - static const WCHAR fmtver[] = {'%','x','.','%','x',0 }; - static const WCHAR VersionW[] = {'V','e','r','s','i','o','n',0}; - - StringFromGUID2(&attr->guid, buffer, 40); - RegSetValueExW(subKey, NULL, 0, REG_SZ, - (BYTE *)buffer, (strlenW(buffer)+1) * sizeof(WCHAR)); - sprintfW(buffer, fmtver, attr->wMajorVerNum, attr->wMinorVerNum); - RegSetValueExW(subKey, VersionW, 0, REG_SZ, - (BYTE*)buffer, (strlenW(buffer)+1) * sizeof(WCHAR)); - RegCloseKey(subKey); - } - - RegCloseKey(key); - } + /* register TLBs into the opposite registry view, too */ + if(opposite == KEY_WOW64_32KEY || + (IsWow64Process(GetCurrentProcess(), &is_wow64) && is_wow64)) + TLB_register_interface(attr, name, tattr, opposite); } ITypeInfo_ReleaseTypeAttr(tinfo, tattr); @@ -847,7 +917,7 @@ HRESULT WINAPI UnRegisterTypeLib( } /* get the path to the typelib on disk */ - if (query_typelib_path(libid, wVerMajor, wVerMinor, syskind, lcid, &tlibPath) != S_OK) { + if (query_typelib_path(libid, wVerMajor, wVerMinor, syskind, lcid, &tlibPath, FALSE) != S_OK) { result = E_INVALIDARG; goto end; } @@ -1928,6 +1998,9 @@ static TLBString *TLB_append_str(struct list *string_list, BSTR new_str) { TLBString *str; + if(!new_str) + return NULL; + LIST_FOR_EACH_ENTRY(str, string_list, TLBString, entry) { if (strcmpW(str->str, new_str) == 0) return str; @@ -2297,24 +2370,17 @@ static void MSFT_ReadValue( VARIANT * pVar, int offset, TLBContext *pcx ) case VT_BSTR :{ char * ptr; MSFT_ReadLEDWords(&size, sizeof(INT), pcx, DO_NOT_SEEK ); - if(size < 0) { - char next; - DWORD origPos = MSFT_Tell(pcx), nullPos; - - do { - MSFT_Read(&next, 1, pcx, DO_NOT_SEEK); - } while (next); - nullPos = MSFT_Tell(pcx); - size = nullPos - origPos; - MSFT_Seek(pcx, origPos); - } - ptr = heap_alloc_zero(size);/* allocate temp buffer */ - MSFT_Read(ptr, size, pcx, DO_NOT_SEEK);/* read string (ANSI) */ - V_BSTR(pVar)=SysAllocStringLen(NULL,size); - /* FIXME: do we need a AtoW conversion here? */ - V_UNION(pVar, bstrVal[size])='\0'; - while(size--) V_UNION(pVar, bstrVal[size])=ptr[size]; - heap_free(ptr); + if(size == -1){ + V_BSTR(pVar) = NULL; + }else{ + ptr = heap_alloc_zero(size); + MSFT_Read(ptr, size, pcx, DO_NOT_SEEK); + V_BSTR(pVar)=SysAllocStringLen(NULL,size); + /* FIXME: do we need a AtoW conversion here? */ + V_UNION(pVar, bstrVal[size])='\0'; + while(size--) V_UNION(pVar, bstrVal[size])=ptr[size]; + heap_free(ptr); + } } size=-4; break; /* FIXME: this will not work AT ALL when the variant contains a pointer */ @@ -2380,7 +2446,7 @@ static void MSFT_GetTdesc(TLBContext *pcx, INT type, TYPEDESC *pTd) TRACE_(typelib)("vt type = %X\n", pTd->vt); } -static int TLB_is_propgetput(INVOKEKIND invkind) +static BOOL TLB_is_propgetput(INVOKEKIND invkind) { return (invkind == INVOKE_PROPERTYGET || invkind == INVOKE_PROPERTYPUT || @@ -3110,7 +3176,7 @@ static BOOL find_ne_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid, /* Read in NE header */ nehdoffset = LZSeek( lzfd, 0, SEEK_CUR ); - if ( sizeof(nehd) != LZRead( lzfd, (LPSTR)&nehd, sizeof(nehd) ) ) return 0; + if ( sizeof(nehd) != LZRead( lzfd, (LPSTR)&nehd, sizeof(nehd) ) ) return FALSE; resTabSize = nehd.ne_restab - nehd.ne_rsrctab; if ( !resTabSize ) @@ -3378,8 +3444,7 @@ static HRESULT TLB_ReadTypeLib(LPCWSTR pszFileName, LPWSTR pszPath, UINT cchPath if(file != pszFileName) heap_free(file); - h = CreateFileW(pszPath, GENERIC_READ, 0, NULL, OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, NULL); + h = CreateFileW(pszPath, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if(h != INVALID_HANDLE_VALUE){ FILE_NAME_INFORMATION *info; char data[MAX_PATH * sizeof(WCHAR) + sizeof(info->FileNameLength)]; @@ -3519,7 +3584,7 @@ static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength) cx.length = dwTLBLength; /* read header */ - MSFT_ReadLEDWords((void*)&tlbHeader, sizeof(tlbHeader), &cx, 0); + MSFT_ReadLEDWords(&tlbHeader, sizeof(tlbHeader), &cx, 0); TRACE_(typelib)("header:\n"); TRACE_(typelib)("\tmagic1=0x%08x ,magic2=0x%08x\n",tlbHeader.magic1,tlbHeader.magic2 ); if (tlbHeader.magic1 != MSFT_SIGNATURE) { @@ -3558,7 +3623,7 @@ static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength) pTypeLibImpl->ptr_size = get_ptr_size(pTypeLibImpl->syskind); pTypeLibImpl->ver_major = LOWORD(tlbHeader.version); pTypeLibImpl->ver_minor = HIWORD(tlbHeader.version); - pTypeLibImpl->libflags = (WORD) tlbHeader.flags & 0xffff;/* check mask */ + pTypeLibImpl->libflags = ((WORD) tlbHeader.flags & 0xffff) /* check mask */ | LIBFLAG_FHASDISKIMAGE; pTypeLibImpl->set_lcid = tlbHeader.lcid2; pTypeLibImpl->lcid = tlbHeader.lcid; @@ -4514,7 +4579,7 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength) len = SLTG_ReadLibBlk(pLibBlk, pTypeLibImpl); - /* Now there's 0x40 bytes of 0xffff with the numbers 0 to TypeInfoCount + /* Now there are 0x40 bytes of 0xffff with the numbers 0 to TypeInfoCount interspersed */ len += 0x40; @@ -5119,8 +5184,8 @@ static HRESULT WINAPI ITypeLib2_fnIsName( *pfName=FALSE; ITypeLib2_fnIsName_exit: - TRACE("(%p)slow! search for %s: %s found!\n", This, - debugstr_w(szNameBuf), *pfName?"NOT":""); + TRACE("(%p)slow! search for %s: %sfound!\n", This, + debugstr_w(szNameBuf), *pfName ? "" : "NOT "); return S_OK; } @@ -5150,26 +5215,30 @@ static HRESULT WINAPI ITypeLib2_fnFindName( return E_INVALIDARG; len = (lstrlenW(name) + 1)*sizeof(WCHAR); - for(tic = 0; tic < This->TypeInfoCount; ++tic) { + for(tic = 0; count < *found && tic < This->TypeInfoCount; ++tic) { ITypeInfoImpl *pTInfo = This->typeinfos[tic]; TLBVarDesc *var; UINT fdc; - if(!TLB_str_memcmp(name, pTInfo->Name, len)) goto ITypeLib2_fnFindName_exit; + if(!TLB_str_memcmp(name, pTInfo->Name, len)) { + memid[count] = MEMBERID_NIL; + goto ITypeLib2_fnFindName_exit; + } + for(fdc = 0; fdc < pTInfo->cFuncs; ++fdc) { TLBFuncDesc *func = &pTInfo->funcdescs[fdc]; - int pc; - if(!TLB_str_memcmp(name, func->Name, len)) goto ITypeLib2_fnFindName_exit; - for(pc = 0; pc < func->funcdesc.cParams; pc++) { - if(!TLB_str_memcmp(name, func->pParamDesc[pc].Name, len)) - goto ITypeLib2_fnFindName_exit; + if(!TLB_str_memcmp(name, func->Name, len)) { + memid[count] = func->funcdesc.memid; + goto ITypeLib2_fnFindName_exit; } } var = TLB_get_vardesc_by_name(pTInfo->vardescs, pTInfo->cVars, name); - if (var) + if (var) { + memid[count] = var->vardesc.memid; goto ITypeLib2_fnFindName_exit; + } continue; ITypeLib2_fnFindName_exit: @@ -5317,7 +5386,7 @@ static HRESULT TLB_copy_all_custdata(struct list *custdata_list, CUSTDATA *pCust ct = list_count(custdata_list); - pCustData->prgCustData = heap_alloc_zero(ct * sizeof(CUSTDATAITEM)); + pCustData->prgCustData = CoTaskMemAlloc(ct * sizeof(CUSTDATAITEM)); if(!pCustData->prgCustData) return E_OUTOFMEMORY; @@ -5401,9 +5470,10 @@ static HRESULT WINAPI ITypeLibComp_fnBind( BINDPTR * pBindPtr) { ITypeLibImpl *This = impl_from_ITypeComp(iface); - int typemismatch=0, i; + BOOL typemismatch = FALSE; + int i; - TRACE("(%s, 0x%x, 0x%x, %p, %p, %p)\n", debugstr_w(szName), lHash, wFlags, ppTInfo, pDescKind, pBindPtr); + TRACE("(%p)->(%s, 0x%x, 0x%x, %p, %p, %p)\n", This, debugstr_w(szName), lHash, wFlags, ppTInfo, pDescKind, pBindPtr); *pDescKind = DESCKIND_NONE; pBindPtr->lptcomp = NULL; @@ -5442,7 +5512,7 @@ static HRESULT WINAPI ITypeLibComp_fnBind( return S_OK; } else if (hr == TYPE_E_TYPEMISMATCH) - typemismatch = 1; + typemismatch = TRUE; } if ((pTypeInfo->typekind == TKIND_COCLASS) && @@ -5513,7 +5583,7 @@ static HRESULT WINAPI ITypeLibComp_fnBind( return S_OK; } else if (hr == TYPE_E_TYPEMISMATCH) - typemismatch = 1; + typemismatch = TRUE; } } @@ -7687,7 +7757,7 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeInfo( ref_type->pImpTLInfo->wVersionMajor, ref_type->pImpTLInfo->wVersionMinor, This->pTypeLib->syskind, - ref_type->pImpTLInfo->lcid, &libnam); + ref_type->pImpTLInfo->lcid, &libnam, TRUE); if(FAILED(result)) libnam = SysAllocString(ref_type->pImpTLInfo->name); @@ -8514,7 +8584,7 @@ static HRESULT WINAPI ITypeComp_fnBind( for(fdc = 0; fdc < This->cFuncs; ++fdc){ pFDesc = &This->funcdescs[fdc]; - if (!strcmpiW(TLB_get_bstr(pFDesc->Name), szName)) { + if (!lstrcmpiW(TLB_get_bstr(pFDesc->Name), szName)) { if (!wFlags || (pFDesc->funcdesc.invkind & wFlags)) break; else @@ -8547,7 +8617,7 @@ static HRESULT WINAPI ITypeComp_fnBind( return S_OK; } } - /* FIXME: search each inherited interface, not just the first */ + if (hr == DISP_E_MEMBERNOTFOUND && This->impltypes) { /* recursive search */ ITypeInfo *pTInfo; @@ -8563,6 +8633,13 @@ static HRESULT WINAPI ITypeComp_fnBind( { hr = ITypeComp_Bind(pTComp, szName, lHash, wFlags, ppTInfo, pDescKind, pBindPtr); ITypeComp_Release(pTComp); + if (SUCCEEDED(hr) && *pDescKind == DESCKIND_FUNCDESC && + This->typekind == TKIND_DISPATCH) + { + FUNCDESC *tmp = pBindPtr->lpfuncdesc; + hr = TLB_AllocAndInitFuncDesc(tmp, &pBindPtr->lpfuncdesc, TRUE); + SysFreeString((BSTR)tmp); + } return hr; } WARN("Could not search inherited interface!\n"); @@ -9181,41 +9258,6 @@ static DWORD WMSFT_append_typedesc(TYPEDESC *desc, WMSFT_TLBFile *file, DWORD *o out_size = &junk2; vt = desc->vt & VT_TYPEMASK; - switch(vt){ - case VT_INT: - subtype = VT_I4; - break; - case VT_UINT: - subtype = VT_UI4; - break; - case VT_VOID: - subtype = VT_EMPTY; - break; - default: - subtype = vt; - break; - } - - switch(vt){ - case VT_INT: - case VT_UINT: - case VT_I1: - case VT_UI1: - case VT_I2: - case VT_UI2: - case VT_I4: - case VT_UI4: - case VT_BOOL: - case VT_R4: - case VT_ERROR: - case VT_BSTR: - case VT_HRESULT: - case VT_CY: - case VT_VOID: - case VT_VARIANT: - *out_mix = subtype; - return 0x80000000 | (subtype << 16) | desc->vt; - } if(vt == VT_PTR || vt == VT_SAFEARRAY){ DWORD mix; @@ -9232,9 +9274,25 @@ static DWORD WMSFT_append_typedesc(TYPEDESC *desc, WMSFT_TLBFile *file, DWORD *o encoded[1] = desc->u.hreftype; *out_mix = 0x7FFF; /* FIXME: Should get TYPEKIND of the hreftype, e.g. TKIND_ENUM => VT_I4 */ }else{ - FIXME("Don't know what to do! VT: 0x%x\n", desc->vt); - *out_mix = desc->vt; - return 0x80000000 | (desc->vt << 16) | desc->vt; + TRACE("Mixing in-place, VT: 0x%x\n", desc->vt); + + switch(vt){ + case VT_INT: + subtype = VT_I4; + break; + case VT_UINT: + subtype = VT_UI4; + break; + case VT_VOID: + subtype = VT_EMPTY; + break; + default: + subtype = vt; + break; + } + + *out_mix = subtype; + return 0x80000000 | (subtype << 16) | desc->vt; } data = file->typdesc_seg.data; @@ -9626,7 +9684,7 @@ static DWORD WMSFT_compile_typeinfo(ITypeInfoImpl *info, INT16 index, WMSFT_TLBF size = sizeof(MSFT_TypeInfoBase); if(data){ - MSFT_TypeInfoBase *base = (void*)data; + MSFT_TypeInfoBase *base = (MSFT_TypeInfoBase*)data; if(info->wTypeFlags & TYPEFLAG_FDUAL) base->typekind = TKIND_DISPATCH; else @@ -10727,8 +10785,17 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetVarName(ICreateTypeInfo2 *iface, UINT index, LPOLESTR name) { ITypeInfoImpl *This = info_impl_from_ICreateTypeInfo2(iface); - FIXME("%p %u %s - stub\n", This, index, wine_dbgstr_w(name)); - return E_NOTIMPL; + + TRACE("%p %u %s\n", This, index, wine_dbgstr_w(name)); + + if(!name) + return E_INVALIDARG; + + if(index >= This->cVars) + return TYPE_E_ELEMENTNOTFOUND; + + This->vardescs[index].Name = TLB_append_str(&This->pTypeLib->name_list, name); + return S_OK; } static HRESULT WINAPI ICreateTypeInfo2_fnSetTypeDescAlias(ICreateTypeInfo2 *iface, @@ -10768,8 +10835,19 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetFuncDocString(ICreateTypeInfo2 *ifac UINT index, LPOLESTR docString) { ITypeInfoImpl *This = info_impl_from_ICreateTypeInfo2(iface); - FIXME("%p %u %s - stub\n", This, index, wine_dbgstr_w(docString)); - return E_NOTIMPL; + TLBFuncDesc *func_desc = &This->funcdescs[index]; + + TRACE("%p %u %s\n", This, index, wine_dbgstr_w(docString)); + + if(!docString) + return E_INVALIDARG; + + if(index >= This->cFuncs) + return TYPE_E_ELEMENTNOTFOUND; + + func_desc->HelpString = TLB_append_str(&This->pTypeLib->string_list, docString); + + return S_OK; } static HRESULT WINAPI ICreateTypeInfo2_fnSetVarDocString(ICreateTypeInfo2 *iface, @@ -11195,8 +11273,7 @@ void WINAPI ClearCustData(CUSTDATA *lpCust) for (i = 0; i < lpCust->cCustData; i++) VariantClear(&lpCust->prgCustData[i].varValue); - /* FIXME - Should be using a per-thread IMalloc */ - heap_free(lpCust->prgCustData); + CoTaskMemFree(lpCust->prgCustData); lpCust->prgCustData = NULL; } lpCust->cCustData = 0; diff --git a/dll/win32/oleaut32/usrmarshal.c b/dll/win32/oleaut32/usrmarshal.c index 37e6e617c62..48c9625120c 100644 --- a/dll/win32/oleaut32/usrmarshal.c +++ b/dll/win32/oleaut32/usrmarshal.c @@ -181,7 +181,7 @@ typedef struct DWORD switch_is; } variant_wire_t; -static unsigned int get_type_size(ULONG *pFlags, VARTYPE vt) +unsigned int get_type_size(ULONG *pFlags, VARTYPE vt) { if (vt & VT_ARRAY) return 4; @@ -197,6 +197,7 @@ static unsigned int get_type_size(ULONG *pFlags, VARTYPE vt) return sizeof(SHORT); case VT_I4: case VT_UI4: + case VT_HRESULT: return sizeof(LONG); case VT_INT: case VT_UINT: diff --git a/dll/win32/oleaut32/varformat.c b/dll/win32/oleaut32/varformat.c index 18279093c93..7d092ee9050 100644 --- a/dll/win32/oleaut32/varformat.c +++ b/dll/win32/oleaut32/varformat.c @@ -2397,7 +2397,7 @@ HRESULT WINAPI VarFormatPercent(LPVARIANT pVarIn, INT nDigits, INT nLeading, INT if (SUCCEEDED(hRet)) { DWORD dwLen = strlenW(*pbstrOut); - BOOL bBracket = (*pbstrOut)[dwLen] == ')' ? TRUE : FALSE; + BOOL bBracket = (*pbstrOut)[dwLen] == ')'; dwLen -= bBracket; memcpy(buff, *pbstrOut, dwLen * sizeof(WCHAR)); diff --git a/dll/win32/oleaut32/variant.c b/dll/win32/oleaut32/variant.c index 189840dbdeb..e6f6372102a 100644 --- a/dll/win32/oleaut32/variant.c +++ b/dll/win32/oleaut32/variant.c @@ -559,7 +559,8 @@ void WINAPI VariantInit(VARIANTARG* pVarg) { TRACE("(%p)\n", pVarg); - V_VT(pVarg) = VT_EMPTY; /* Native doesn't set any other fields */ + /* Win8.1 zeroes whole struct. Previous implementations don't set any other fields. */ + V_VT(pVarg) = VT_EMPTY; } HRESULT VARIANT_ClearInd(VARIANTARG *pVarg) @@ -678,34 +679,32 @@ HRESULT WINAPI VariantClear(VARIANTARG* pVarg) /****************************************************************************** * Copy an IRecordInfo object contained in a variant. */ -static HRESULT VARIANT_CopyIRecordInfo(struct __tagBRECORD* pBr) +static HRESULT VARIANT_CopyIRecordInfo(VARIANT *dest, VARIANT *src) { - HRESULT hres = S_OK; + struct __tagBRECORD *dest_rec = &V_UNION(dest, brecVal); + struct __tagBRECORD *src_rec = &V_UNION(src, brecVal); + HRESULT hr = S_OK; + ULONG size; - if (pBr->pRecInfo) + if (!src_rec->pRecInfo) { - ULONG ulSize; - - hres = IRecordInfo_GetSize(pBr->pRecInfo, &ulSize); - if (SUCCEEDED(hres)) - { - PVOID pvRecord = HeapAlloc(GetProcessHeap(), 0, ulSize); - if (!pvRecord) - hres = E_OUTOFMEMORY; - else - { - memcpy(pvRecord, pBr->pvRecord, ulSize); - pBr->pvRecord = pvRecord; - - hres = IRecordInfo_RecordCopy(pBr->pRecInfo, pvRecord, pvRecord); - if (SUCCEEDED(hres)) - IRecordInfo_AddRef(pBr->pRecInfo); - } - } + if (src_rec->pvRecord) return E_INVALIDARG; + return S_OK; } - else if (pBr->pvRecord) - hres = E_INVALIDARG; - return hres; + + hr = IRecordInfo_GetSize(src_rec->pRecInfo, &size); + if (FAILED(hr)) return hr; + + /* This could look cleaner if only RecordCreate() was used, but native doesn't use it. + Memory should be allocated in a same way as RecordCreate() does, so RecordDestroy() + could free it later. */ + dest_rec->pvRecord = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); + if (!dest_rec->pvRecord) return E_OUTOFMEMORY; + + dest_rec->pRecInfo = src_rec->pRecInfo; + IRecordInfo_AddRef(src_rec->pRecInfo); + + return IRecordInfo_RecordCopy(src_rec->pRecInfo, src_rec->pvRecord, dest_rec->pvRecord); } /****************************************************************************** @@ -755,29 +754,25 @@ HRESULT WINAPI VariantCopy(VARIANTARG* pvargDest, VARIANTARG* pvargSrc) if (!V_ISBYREF(pvargSrc)) { - if (V_ISARRAY(pvargSrc)) - { - if (V_ARRAY(pvargSrc)) - hres = SafeArrayCopy(V_ARRAY(pvargSrc), &V_ARRAY(pvargDest)); - } - else if (V_VT(pvargSrc) == VT_BSTR) + switch (V_VT(pvargSrc)) { + case VT_BSTR: V_BSTR(pvargDest) = SysAllocStringByteLen((char*)V_BSTR(pvargSrc), SysStringByteLen(V_BSTR(pvargSrc))); if (!V_BSTR(pvargDest)) - { - TRACE("!V_BSTR(pvargDest), SysAllocStringByteLen() failed to allocate %d bytes\n", SysStringByteLen(V_BSTR(pvargSrc))); hres = E_OUTOFMEMORY; - } - } - else if (V_VT(pvargSrc) == VT_RECORD) - { - hres = VARIANT_CopyIRecordInfo(&V_UNION(pvargDest,brecVal)); - } - else if (V_VT(pvargSrc) == VT_DISPATCH || - V_VT(pvargSrc) == VT_UNKNOWN) - { + break; + case VT_RECORD: + hres = VARIANT_CopyIRecordInfo(pvargDest, pvargSrc); + break; + case VT_DISPATCH: + case VT_UNKNOWN: + V_UNKNOWN(pvargDest) = V_UNKNOWN(pvargSrc); if (V_UNKNOWN(pvargSrc)) IUnknown_AddRef(V_UNKNOWN(pvargSrc)); + break; + default: + if (V_ISARRAY(pvargSrc)) + hres = SafeArrayCopy(V_ARRAY(pvargSrc), &V_ARRAY(pvargDest)); } } } @@ -896,8 +891,7 @@ HRESULT WINAPI VariantCopyInd(VARIANT* pvargDest, VARIANTARG* pvargSrc) } else if (V_VT(pSrc) == (VT_RECORD|VT_BYREF)) { - V_UNION(pvargDest,brecVal) = V_UNION(pvargSrc,brecVal); - hres = VARIANT_CopyIRecordInfo(&V_UNION(pvargDest,brecVal)); + hres = VARIANT_CopyIRecordInfo(pvargDest, pvargSrc); } else if (V_VT(pSrc) == (VT_DISPATCH|VT_BYREF) || V_VT(pSrc) == (VT_UNKNOWN|VT_BYREF)) @@ -1296,6 +1290,10 @@ INT WINAPI SystemTimeToVariantTime(LPSYSTEMTIME lpSt, double *pDateOut) if (lpSt->wMonth > 12) return FALSE; + if (lpSt->wDay > 31) + return FALSE; + if ((short)lpSt->wYear < 0) + return FALSE; ud.st = *lpSt; return VarDateFromUdate(&ud, 0, pDateOut) == S_OK; diff --git a/dll/win32/oleaut32/variant.h b/dll/win32/oleaut32/variant.h index b2c0d614e41..dceac5c7e56 100644 --- a/dll/win32/oleaut32/variant.h +++ b/dll/win32/oleaut32/variant.h @@ -121,7 +121,7 @@ typedef struct tagVARIANT_NUMBER_CHARS WCHAR cCurrencyDigitSeparator; } VARIANT_NUMBER_CHARS; - +unsigned int get_type_size(ULONG*, VARTYPE); BOOL VARIANT_GetLocalisedText(LANGID, DWORD, WCHAR *) DECLSPEC_HIDDEN; HRESULT VARIANT_ClearInd(VARIANTARG *) DECLSPEC_HIDDEN; BOOL get_date_format(LCID, DWORD, const SYSTEMTIME *, diff --git a/dll/win32/oleaut32/vartype.c b/dll/win32/oleaut32/vartype.c index 78cd6e32f82..a3103872844 100644 --- a/dll/win32/oleaut32/vartype.c +++ b/dll/win32/oleaut32/vartype.c @@ -112,6 +112,7 @@ static HRESULT VARIANT_FromDisp(IDispatch* pdispIn, LCID lcid, void* pOut, return DISP_E_BADVARTYPE; /* Get the default 'value' property from the IDispatch */ + VariantInit(&srcVar); hRet = IDispatch_Invoke(pdispIn, DISPID_VALUE, &IID_NULL, lcid, DISPATCH_PROPERTYGET, &emptyParams, &srcVar, NULL, NULL); @@ -351,7 +352,7 @@ HRESULT WINAPI VarI1FromR4(FLOAT fltIn, signed char* pcOut) */ HRESULT WINAPI VarI1FromR8(double dblIn, signed char* pcOut) { - if (dblIn < (double)I1_MIN || dblIn > (double)I1_MAX) + if (dblIn < I1_MIN - 0.5 || dblIn >= I1_MAX + 0.5) return DISP_E_OVERFLOW; VARIANT_DutchRound(CHAR, dblIn, *pcOut); return S_OK; @@ -641,7 +642,7 @@ HRESULT WINAPI VarUI1FromR4(FLOAT fltIn, BYTE* pbOut) */ HRESULT WINAPI VarUI1FromR8(double dblIn, BYTE* pbOut) { - if (dblIn < -0.5 || dblIn > (double)UI1_MAX) + if (dblIn < -0.5 || dblIn >= UI1_MAX + 0.5) return DISP_E_OVERFLOW; VARIANT_DutchRound(BYTE, dblIn, *pbOut); return S_OK; @@ -947,7 +948,7 @@ HRESULT WINAPI VarI2FromR4(FLOAT fltIn, SHORT* psOut) */ HRESULT WINAPI VarI2FromR8(double dblIn, SHORT* psOut) { - if (dblIn < (double)I2_MIN || dblIn > (double)I2_MAX) + if (dblIn < I2_MIN - 0.5 || dblIn >= I2_MAX + 0.5) return DISP_E_OVERFLOW; VARIANT_DutchRound(SHORT, dblIn, *psOut); return S_OK; @@ -1259,7 +1260,7 @@ HRESULT WINAPI VarUI2FromR4(FLOAT fltIn, USHORT* pusOut) */ HRESULT WINAPI VarUI2FromR8(double dblIn, USHORT* pusOut) { - if (dblIn < -0.5 || dblIn > (double)UI2_MAX) + if (dblIn < -0.5 || dblIn >= UI2_MAX + 0.5) return DISP_E_OVERFLOW; VARIANT_DutchRound(USHORT, dblIn, *pusOut); return S_OK; @@ -1539,7 +1540,7 @@ HRESULT WINAPI VarI4FromR4(FLOAT fltIn, LONG *piOut) */ HRESULT WINAPI VarI4FromR8(double dblIn, LONG *piOut) { - if (dblIn < (double)I4_MIN || dblIn > (double)I4_MAX) + if (dblIn < I4_MIN - 0.5 || dblIn >= I4_MAX + 0.5) return DISP_E_OVERFLOW; VARIANT_DutchRound(LONG, dblIn, *piOut); return S_OK; @@ -1848,7 +1849,7 @@ HRESULT WINAPI VarUI4FromR4(FLOAT fltIn, ULONG *pulOut) */ HRESULT WINAPI VarUI4FromR8(double dblIn, ULONG *pulOut) { - if (dblIn < -0.5 || dblIn > (double)UI4_MAX) + if (dblIn < -0.5 || dblIn >= UI4_MAX + 0.5) return DISP_E_OVERFLOW; VARIANT_DutchRound(ULONG, dblIn, *pulOut); return S_OK; @@ -4484,19 +4485,19 @@ static ULONG VARIANT_Add(ULONG ulLeft, ULONG ulRight, ULONG* pulHigh) /* Subtract two unsigned 32 bit values with underflow */ static ULONG VARIANT_Sub(ULONG ulLeft, ULONG ulRight, ULONG* pulHigh) { - int invert = 0; + BOOL invert = FALSE; ULARGE_INTEGER ul64; ul64.QuadPart = (LONG64)ulLeft - (ULONG64)ulRight; if (ulLeft < ulRight) - invert = 1; + invert = TRUE; if (ul64.QuadPart > (ULONG64)*pulHigh) ul64.QuadPart -= (ULONG64)*pulHigh; else { ul64.QuadPart -= (ULONG64)*pulHigh; - invert = 1; + invert = TRUE; } if (invert) ul64.u.HighPart = -ul64.u.HighPart ; @@ -4672,10 +4673,10 @@ static unsigned char VARIANT_int_divbychar(DWORD * p, unsigned int n, unsigned c } /* check to test if encoded number is a zero. Returns 1 if zero, 0 for nonzero */ -static int VARIANT_int_iszero(const DWORD * p, unsigned int n) +static BOOL VARIANT_int_iszero(const DWORD * p, unsigned int n) { - for (; n > 0; n--) if (*p++ != 0) return 0; - return 1; + for (; n > 0; n--) if (*p++ != 0) return FALSE; + return TRUE; } /* multiply two DECIMALS, without changing either one, and place result in third @@ -4685,7 +4686,7 @@ static int VARIANT_int_iszero(const DWORD * p, unsigned int n) */ static int VARIANT_DI_mul(const VARIANT_DI * a, const VARIANT_DI * b, VARIANT_DI * result) { - int r_overflow = 0; + BOOL r_overflow = FALSE; DWORD running[6]; signed int mulstart; @@ -4776,12 +4777,12 @@ static int VARIANT_DI_mul(const VARIANT_DI * a, const VARIANT_DI * b, VARIANT_DI } /* cast DECIMAL into string. Any scale should be handled properly. en_US locale is - hardcoded (period for decimal separator, dash as negative sign). Returns 0 for - success, nonzero if insufficient space in output buffer. + hardcoded (period for decimal separator, dash as negative sign). Returns TRUE for + success, FALSE if insufficient space in output buffer. */ -static int VARIANT_DI_tostringW(const VARIANT_DI * a, WCHAR * s, unsigned int n) +static BOOL VARIANT_DI_tostringW(const VARIANT_DI * a, WCHAR * s, unsigned int n) { - int overflow = 0; + BOOL overflow = FALSE; DWORD quotient[3]; unsigned char remainder; unsigned int i; @@ -4792,7 +4793,7 @@ static int VARIANT_DI_tostringW(const VARIANT_DI * a, WCHAR * s, unsigned int n) *s++ = '-'; n--; } - else overflow = 1; + else overflow = TRUE; } /* prepare initial 0 */ @@ -4800,7 +4801,7 @@ static int VARIANT_DI_tostringW(const VARIANT_DI * a, WCHAR * s, unsigned int n) if (n >= 2) { s[0] = '0'; s[1] = '\0'; - } else overflow = 1; + } else overflow = TRUE; } i = 0; @@ -4808,7 +4809,7 @@ static int VARIANT_DI_tostringW(const VARIANT_DI * a, WCHAR * s, unsigned int n) while (!overflow && !VARIANT_int_iszero(quotient, sizeof(quotient) / sizeof(DWORD))) { remainder = VARIANT_int_divbychar(quotient, sizeof(quotient) / sizeof(DWORD), 10); if (i + 2 > n) { - overflow = 1; + overflow = TRUE; } else { s[i++] = '0' + remainder; s[i] = '\0'; @@ -4829,7 +4830,7 @@ static int VARIANT_DI_tostringW(const VARIANT_DI * a, WCHAR * s, unsigned int n) if (i <= a->scale) { unsigned int numzeroes = a->scale + 1 - i; if (i + 1 + numzeroes >= n) { - overflow = 1; + overflow = TRUE; } else { memmove(s + numzeroes, s, (i + 1) * sizeof(WCHAR)); i += numzeroes; @@ -4843,7 +4844,7 @@ static int VARIANT_DI_tostringW(const VARIANT_DI * a, WCHAR * s, unsigned int n) if (a->scale > 0) { unsigned int periodpos = i - a->scale; if (i + 2 >= n) { - overflow = 1; + overflow = TRUE; } else { memmove(s + periodpos + 1, s + periodpos, (i + 1 - periodpos) * sizeof(WCHAR)); s[periodpos] = '.'; i++; @@ -4855,7 +4856,7 @@ static int VARIANT_DI_tostringW(const VARIANT_DI * a, WCHAR * s, unsigned int n) } } - return overflow; + return !overflow; } /* shift the bits of a DWORD array to the left. p[0] is assumed LSB */ @@ -5127,7 +5128,7 @@ static int VARIANT_int_addlossy( in case of quotient overflow. */ static HRESULT VARIANT_DI_div(const VARIANT_DI * dividend, const VARIANT_DI * divisor, - VARIANT_DI * quotient) + VARIANT_DI * quotient, BOOL round_remainder) { HRESULT r_overflow = S_OK; @@ -5170,8 +5171,21 @@ static HRESULT VARIANT_DI_div(const VARIANT_DI * dividend, const VARIANT_DI * di underflow = VARIANT_int_addlossy( quotient->bitsnum, "ientscale, sizeof(quotient->bitsnum) / sizeof(DWORD), remainderplusquotient, &tempquotientscale, 4); - VARIANT_int_mulbychar(remainderplusquotient + 4, 4, 10); - memcpy(remainderplusquotient, remainderplusquotient + 4, 4 * sizeof(DWORD)); + if (round_remainder) { + if(remainderplusquotient[4] >= 5){ + unsigned int i; + unsigned char remainder = 1; + for (i = 0; i < sizeof(quotient->bitsnum) / sizeof(DWORD) && remainder; i++) { + ULONGLONG digit = quotient->bitsnum[i] + 1; + remainder = (digit > 0xFFFFFFFF) ? 1 : 0; + quotient->bitsnum[i] = digit & 0xFFFFFFFF; + } + } + memset(remainderplusquotient, 0, sizeof(remainderplusquotient)); + } else { + VARIANT_int_mulbychar(remainderplusquotient + 4, 4, 10); + memcpy(remainderplusquotient, remainderplusquotient + 4, 4 * sizeof(DWORD)); + } tempquotientscale = ++remainderscale; } while (!underflow && !VARIANT_int_iszero(remainderplusquotient + 4, 4)); @@ -5204,7 +5218,7 @@ static HRESULT VARIANT_DI_div(const VARIANT_DI * dividend, const VARIANT_DI * di into the VARIANT_DI and is therefore no longer necessary. Returns S_OK if successful, or DISP_E_OVERFLOW if the represented value is too big to fit into a DECIMAL. */ -static HRESULT VARIANT_DI_normalize(VARIANT_DI * val, int exponent2, int isDouble) +static HRESULT VARIANT_DI_normalize(VARIANT_DI * val, int exponent2, BOOL isDouble) { HRESULT hres = S_OK; int exponent5, exponent10; @@ -5408,7 +5422,7 @@ static HRESULT VARIANT_DI_FromR4(float source, VARIANT_DI * dest) compensate. */ exponent2 -= 23; - hres = VARIANT_DI_normalize(dest, exponent2, 0); + hres = VARIANT_DI_normalize(dest, exponent2, FALSE); } return hres; @@ -5469,37 +5483,22 @@ static HRESULT VARIANT_DI_FromR8(double source, VARIANT_DI * dest) compensate. */ exponent2 -= 52; - hres = VARIANT_DI_normalize(dest, exponent2, 1); + hres = VARIANT_DI_normalize(dest, exponent2, TRUE); } return hres; } -/************************************************************************ - * VarDecDiv (OLEAUT32.178) - * - * Divide one DECIMAL by another. - * - * PARAMS - * pDecLeft [I] Source - * pDecRight [I] Value to divide by - * pDecOut [O] Destination - * - * RETURNS - * Success: S_OK. - * Failure: DISP_E_OVERFLOW, if the value will not fit in the destination - */ -HRESULT WINAPI VarDecDiv(const DECIMAL* pDecLeft, const DECIMAL* pDecRight, DECIMAL* pDecOut) +static HRESULT VARIANT_do_division(const DECIMAL *pDecLeft, const DECIMAL *pDecRight, DECIMAL *pDecOut, + BOOL round) { HRESULT hRet = S_OK; VARIANT_DI di_left, di_right, di_result; HRESULT divresult; - if (!pDecLeft || !pDecRight || !pDecOut) return E_INVALIDARG; - VARIANT_DIFromDec(pDecLeft, &di_left); VARIANT_DIFromDec(pDecRight, &di_right); - divresult = VARIANT_DI_div(&di_left, &di_right, &di_result); + divresult = VARIANT_DI_div(&di_left, &di_right, &di_result, round); if (divresult != S_OK) { /* division actually overflowed */ @@ -5546,6 +5545,27 @@ HRESULT WINAPI VarDecDiv(const DECIMAL* pDecLeft, const DECIMAL* pDecRight, DECI return hRet; } +/************************************************************************ + * VarDecDiv (OLEAUT32.178) + * + * Divide one DECIMAL by another. + * + * PARAMS + * pDecLeft [I] Source + * pDecRight [I] Value to divide by + * pDecOut [O] Destination + * + * RETURNS + * Success: S_OK. + * Failure: DISP_E_OVERFLOW, if the value will not fit in the destination + */ +HRESULT WINAPI VarDecDiv(const DECIMAL* pDecLeft, const DECIMAL* pDecRight, DECIMAL* pDecOut) +{ + if (!pDecLeft || !pDecRight || !pDecOut) return E_INVALIDARG; + + return VARIANT_do_division(pDecLeft, pDecRight, pDecOut, FALSE); +} + /************************************************************************ * VarDecMul (OLEAUT32.179) * @@ -5755,6 +5775,10 @@ HRESULT WINAPI VarDecNeg(const DECIMAL* pDecIn, DECIMAL* pDecOut) */ HRESULT WINAPI VarDecRound(const DECIMAL* pDecIn, int cDecimals, DECIMAL* pDecOut) { + DECIMAL divisor, tmp; + HRESULT hr; + unsigned int i; + if (cDecimals < 0 || (DEC_SIGN(pDecIn) & ~DECIMAL_NEG) || DEC_SCALE(pDecIn) > DEC_MAX_SCALE) return E_INVALIDARG; @@ -5764,9 +5788,26 @@ HRESULT WINAPI VarDecRound(const DECIMAL* pDecIn, int cDecimals, DECIMAL* pDecOu return S_OK; } - FIXME("semi-stub!\n"); + /* truncate significant digits and rescale */ + memset(&divisor, 0, sizeof(divisor)); + DEC_LO64(&divisor) = 1; - return DISP_E_OVERFLOW; + memset(&tmp, 0, sizeof(tmp)); + DEC_LO64(&tmp) = 10; + for (i = 0; i < DEC_SCALE(pDecIn) - cDecimals; ++i) + { + hr = VarDecMul(&divisor, &tmp, &divisor); + if (FAILED(hr)) + return hr; + } + + hr = VARIANT_do_division(pDecIn, &divisor, pDecOut, TRUE); + if (FAILED(hr)) + return hr; + + DEC_SCALE(pDecOut) = cDecimals; + + return S_OK; } /************************************************************************ diff --git a/dll/win32/rsaenh/handle.c b/dll/win32/rsaenh/handle.c index 0812dccc7f0..86d8c0cd9d5 100644 --- a/dll/win32/rsaenh/handle.c +++ b/dll/win32/rsaenh/handle.c @@ -90,13 +90,13 @@ void destroy_handle_table(struct handle_table *lpTable) * dwType [I] A magic value that identifies the referenced object's type. * * RETURNS - * non zero, if handle is valid. - * zero, if handle is not valid. + * TRUE, if handle is valid. + * FALSE, if handle is not valid. */ -int is_valid_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType) +BOOL is_valid_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType) { unsigned int index = HANDLE2INDEX(handle); - int ret = 0; + BOOL ret = FALSE; TRACE("(lpTable=%p, handle=%ld)\n", lpTable, handle); @@ -113,8 +113,8 @@ int is_valid_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType /* Check if this handle references an object of the correct type. */ if (lpTable->paEntries[index].pObject->dwType != dwType) goto exit; - - ret = 1; + + ret = TRUE; exit: LeaveCriticalSection(&lpTable->mutex); return ret; @@ -129,13 +129,13 @@ exit: * lpTable [I] Pointer to the table, which is to be grown * * RETURNS - * non zero, if successful - * zero, if not successful (out of memory on process heap) + * TRUE, if successful + * FALSE, if not successful (out of memory on process heap) * * NOTES * This is a support function for alloc_handle. Do not call! */ -static int grow_handle_table(struct handle_table *lpTable) +static BOOL grow_handle_table(struct handle_table *lpTable) { struct handle_table_entry *newEntries; unsigned int i, newIEntries; @@ -143,8 +143,8 @@ static int grow_handle_table(struct handle_table *lpTable) newIEntries = lpTable->iEntries + TABLE_SIZE_INCREMENT; newEntries = HeapAlloc(GetProcessHeap(), 0, sizeof(struct handle_table_entry)*newIEntries); - if (!newEntries) - return 0; + if (!newEntries) + return FALSE; if (lpTable->paEntries) { @@ -161,7 +161,7 @@ static int grow_handle_table(struct handle_table *lpTable) lpTable->paEntries = newEntries; lpTable->iEntries = newIEntries; - return 1; + return TRUE; } /****************************************************************************** @@ -177,12 +177,12 @@ static int grow_handle_table(struct handle_table *lpTable) * be stored. If not successful, this will be * INVALID_HANDLE_VALUE * RETURNS - * non zero, if successful - * zero, if not successful (no free handle) + * TRUE, if successful + * FALSE, if not successful (no free handle) */ -static int alloc_handle(struct handle_table *lpTable, OBJECTHDR *lpObject, HCRYPTKEY *lpHandle) +static BOOL alloc_handle(struct handle_table *lpTable, OBJECTHDR *lpObject, HCRYPTKEY *lpHandle) { - int ret = 0; + BOOL ret = FALSE; TRACE("(lpTable=%p, lpObject=%p, lpHandle=%p)\n", lpTable, lpObject, lpHandle); @@ -200,7 +200,7 @@ static int alloc_handle(struct handle_table *lpTable, OBJECTHDR *lpObject, HCRYP lpTable->iFirstFree = lpTable->paEntries[lpTable->iFirstFree].iNextFree; InterlockedIncrement(&lpObject->refcount); - ret = 1; + ret = TRUE; exit: LeaveCriticalSection(&lpTable->mutex); return ret; @@ -224,14 +224,14 @@ exit: * to be released. * * RETURNS - * non zero, if successful - * zero, if not successful (invalid handle) + * TRUE, if successful + * FALSE, if not successful (invalid handle) */ -int release_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType) +BOOL release_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType) { unsigned int index = HANDLE2INDEX(handle); OBJECTHDR *pObject; - int ret = 0; + BOOL ret = FALSE; TRACE("(lpTable=%p, handle=%ld)\n", lpTable, handle); @@ -251,8 +251,8 @@ int release_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType) lpTable->paEntries[index].pObject = NULL; lpTable->paEntries[index].iNextFree = lpTable->iFirstFree; lpTable->iFirstFree = index; - - ret = 1; + + ret = TRUE; exit: LeaveCriticalSection(&lpTable->mutex); return ret; @@ -266,16 +266,16 @@ exit: * PARAMS * lpTable [I] Pointer to the handle table, in which the handle is looked up. * handle [I] The handle, which is to be looked up - * lplpObject [O] Pointer to the variable, into which the pointer to the - * object looked up is copied. + * lplpObject [O] Pointer to the variable, into which the pointer to the + * object looked up is copied. * RETURNS - * non zero, if successful - * zero, if not successful (invalid handle) + * TRUE, if successful + * FALSE, if not successful (invalid handle) */ -int lookup_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, OBJECTHDR **lplpObject) +BOOL lookup_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, OBJECTHDR **lplpObject) { - int ret = 0; - + BOOL ret = FALSE; + TRACE("(lpTable=%p, handle=%ld, lplpObject=%p)\n", lpTable, handle, lplpObject); EnterCriticalSection(&lpTable->mutex); @@ -286,7 +286,7 @@ int lookup_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, } *lplpObject = lpTable->paEntries[HANDLE2INDEX(handle)].pObject; - ret = 1; + ret = TRUE; exit: LeaveCriticalSection(&lpTable->mutex); return ret; @@ -304,14 +304,14 @@ exit: * copy [O] Pointer to a handle variable, where the copied handle is put. * * RETURNS - * non zero, if successful - * zero, if not successful (invalid handle or out of memory) + * TRUE, if successful + * FALSE, if not successful (invalid handle or out of memory) */ -int copy_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, HCRYPTKEY *copy) +BOOL copy_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, HCRYPTKEY *copy) { OBJECTHDR *pObject; - int ret; - + BOOL ret; + TRACE("(lpTable=%p, handle=%ld, copy=%p)\n", lpTable, handle, copy); EnterCriticalSection(&lpTable->mutex); @@ -319,7 +319,7 @@ int copy_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, HC { *copy = (HCRYPTKEY)INVALID_HANDLE_VALUE; LeaveCriticalSection(&lpTable->mutex); - return 0; + return FALSE; } ret = alloc_handle(lpTable, pObject, copy); diff --git a/dll/win32/rsaenh/handle.h b/dll/win32/rsaenh/handle.h index 7dc70206c43..d3207a59e47 100644 --- a/dll/win32/rsaenh/handle.h +++ b/dll/win32/rsaenh/handle.h @@ -58,10 +58,10 @@ struct handle_table void init_handle_table (struct handle_table *lpTable) DECLSPEC_HIDDEN; void destroy_handle_table(struct handle_table *lpTable) DECLSPEC_HIDDEN; -int release_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType) DECLSPEC_HIDDEN; -int copy_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, HCRYPTKEY *copy) DECLSPEC_HIDDEN; -int lookup_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, OBJECTHDR **lplpObject) DECLSPEC_HIDDEN; -int is_valid_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType) DECLSPEC_HIDDEN; +BOOL release_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType) DECLSPEC_HIDDEN; +BOOL copy_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, HCRYPTKEY *copy) DECLSPEC_HIDDEN; +BOOL lookup_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, OBJECTHDR **lplpObject) DECLSPEC_HIDDEN; +BOOL is_valid_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType) DECLSPEC_HIDDEN; HCRYPTKEY new_object (struct handle_table *lpTable, size_t cbSize, DWORD dwType, DESTRUCTOR destructor, OBJECTHDR **ppObject) DECLSPEC_HIDDEN; diff --git a/dll/win32/rsaenh/implglue.c b/dll/win32/rsaenh/implglue.c index 2084b1f8ca6..3115973028a 100644 --- a/dll/win32/rsaenh/implglue.c +++ b/dll/win32/rsaenh/implglue.c @@ -87,7 +87,7 @@ BOOL init_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext) return TRUE; } -BOOL update_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, CONST BYTE *pbData, +BOOL update_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, const BYTE *pbData, DWORD dwDataLen) { switch (aiAlgid) @@ -170,7 +170,7 @@ BOOL finalize_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, BYTE *pbHash return TRUE; } -BOOL duplicate_hash_impl(ALG_ID aiAlgid, CONST HASH_CONTEXT *pSrcHashContext, +BOOL duplicate_hash_impl(ALG_ID aiAlgid, const HASH_CONTEXT *pSrcHashContext, HASH_CONTEXT *pDestHashContext) { *pDestHashContext = *pSrcHashContext; @@ -252,7 +252,7 @@ BOOL setup_key_impl(ALG_ID aiAlgid, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen, return TRUE; } -BOOL duplicate_key_impl(ALG_ID aiAlgid, CONST KEY_CONTEXT *pSrcKeyContext, +BOOL duplicate_key_impl(ALG_ID aiAlgid, const KEY_CONTEXT *pSrcKeyContext, KEY_CONTEXT *pDestKeyContext) { switch (aiAlgid) @@ -300,8 +300,8 @@ static inline void reverse_bytes(BYTE *pbData, DWORD dwLen) { } } -BOOL encrypt_block_impl(ALG_ID aiAlgid, DWORD dwKeySpec, KEY_CONTEXT *pKeyContext, CONST BYTE *in, BYTE *out, - DWORD enc) +BOOL encrypt_block_impl(ALG_ID aiAlgid, DWORD dwKeySpec, KEY_CONTEXT *pKeyContext, const BYTE *in, + BYTE *out, DWORD enc) { unsigned long inlen, outlen; BYTE *in_reversed = NULL; @@ -409,7 +409,7 @@ BOOL export_public_key_impl(BYTE *pbDest, const KEY_CONTEXT *pKeyContext, DWORD return TRUE; } -BOOL import_public_key_impl(CONST BYTE *pbSrc, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen, +BOOL import_public_key_impl(const BYTE *pbSrc, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen, DWORD dwPubExp) { BYTE *pbTemp; @@ -484,7 +484,7 @@ BOOL export_private_key_impl(BYTE *pbDest, const KEY_CONTEXT *pKeyContext, DWORD return TRUE; } -BOOL import_private_key_impl(CONST BYTE *pbSrc, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen, +BOOL import_private_key_impl(const BYTE *pbSrc, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen, DWORD dwDataLen, DWORD dwPubExp) { BYTE *pbTemp, *pbBigNum; diff --git a/dll/win32/rsaenh/implglue.h b/dll/win32/rsaenh/implglue.h index efb58918bc7..3ac7eef62a1 100644 --- a/dll/win32/rsaenh/implglue.h +++ b/dll/win32/rsaenh/implglue.h @@ -73,31 +73,31 @@ typedef union tagKEY_CONTEXT { } KEY_CONTEXT; BOOL init_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext) DECLSPEC_HIDDEN; -BOOL update_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, CONST BYTE *pbData, +BOOL update_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, const BYTE *pbData, DWORD dwDataLen) DECLSPEC_HIDDEN; BOOL finalize_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, BYTE *pbHashValue) DECLSPEC_HIDDEN; -BOOL duplicate_hash_impl(ALG_ID aiAlgid, CONST HASH_CONTEXT *pSrcHashContext, +BOOL duplicate_hash_impl(ALG_ID aiAlgid, const HASH_CONTEXT *pSrcHashContext, HASH_CONTEXT *pDestHashContext) DECLSPEC_HIDDEN; BOOL new_key_impl(ALG_ID aiAlgid, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen) DECLSPEC_HIDDEN; BOOL free_key_impl(ALG_ID aiAlgid, KEY_CONTEXT *pKeyContext) DECLSPEC_HIDDEN; BOOL setup_key_impl(ALG_ID aiAlgid, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen, DWORD dwEffectiveKeyLen, DWORD dwSaltLen, BYTE *abKeyValue) DECLSPEC_HIDDEN; -BOOL duplicate_key_impl(ALG_ID aiAlgid, CONST KEY_CONTEXT *pSrcKeyContext, +BOOL duplicate_key_impl(ALG_ID aiAlgid, const KEY_CONTEXT *pSrcKeyContext, KEY_CONTEXT *pDestKeyContext) DECLSPEC_HIDDEN; /* dwKeySpec is optional for symmetric key algorithms */ -BOOL encrypt_block_impl(ALG_ID aiAlgid, DWORD dwKeySpec, KEY_CONTEXT *pKeyContext, CONST BYTE *pbIn, BYTE *pbOut, - DWORD enc) DECLSPEC_HIDDEN; +BOOL encrypt_block_impl(ALG_ID aiAlgid, DWORD dwKeySpec, KEY_CONTEXT *pKeyContext, const BYTE *pbIn, + BYTE *pbOut, DWORD enc) DECLSPEC_HIDDEN; BOOL encrypt_stream_impl(ALG_ID aiAlgid, KEY_CONTEXT *pKeyContext, BYTE *pbInOut, DWORD dwLen) DECLSPEC_HIDDEN; BOOL export_public_key_impl(BYTE *pbDest, const KEY_CONTEXT *pKeyContext, DWORD dwKeyLen, DWORD *pdwPubExp) DECLSPEC_HIDDEN; -BOOL import_public_key_impl(CONST BYTE *pbSrc, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen, +BOOL import_public_key_impl(const BYTE *pbSrc, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen, DWORD dwPubExp) DECLSPEC_HIDDEN; BOOL export_private_key_impl(BYTE *pbDest, const KEY_CONTEXT *pKeyContext, DWORD dwKeyLen, DWORD *pdwPubExp) DECLSPEC_HIDDEN; -BOOL import_private_key_impl(CONST BYTE* pbSrc, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen, +BOOL import_private_key_impl(const BYTE* pbSrc, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen, DWORD dwDataLen, DWORD dwPubExp) DECLSPEC_HIDDEN; BOOL gen_rand_impl(BYTE *pbBuffer, DWORD dwLen) DECLSPEC_HIDDEN; diff --git a/dll/win32/rsaenh/mpi.c b/dll/win32/rsaenh/mpi.c index 8feefa3c2b6..73bdf5f6ce9 100644 --- a/dll/win32/rsaenh/mpi.c +++ b/dll/win32/rsaenh/mpi.c @@ -1387,7 +1387,7 @@ static int mp_lshd (mp_int * a, int b) { int x, res; - /* if its less than zero return */ + /* if it's less than zero return */ if (b <= 0) { return MP_OKAY; } @@ -1624,7 +1624,7 @@ static int mp_div (const mp_int * a, const mp_int * b, mp_int * c, mp_int * d) norm = 0; } - /* note hac does 0 based, so if used==5 then its 0,1,2,3,4, e.g. use 4 */ + /* note hac does 0 based, so if used==5 then it's 0,1,2,3,4, e.g. use 4 */ n = x.used - 1; t = y.used - 1; @@ -1745,17 +1745,17 @@ __Q:mp_clear (&q); return res; } -static int s_is_power_of_two(mp_digit b, int *p) +static BOOL s_is_power_of_two(mp_digit b, int *p) { int x; for (x = 1; x < DIGIT_BIT; x++) { if (b == (((mp_digit)1)< //#include "winbase.h" #include -//#include "wincrypt.h" +#include #include "handle.h" #include "implglue.h" #include #include +#include WINE_DEFAULT_DEBUG_CHANNEL(crypt); @@ -335,7 +336,7 @@ static BOOL crypt_export_key( static BOOL import_key( HCRYPTPROV hProv, - CONST BYTE *pbData, + const BYTE *pbData, DWORD dwDataLen, HCRYPTKEY hPubKey, DWORD dwFlags, @@ -347,7 +348,7 @@ BOOL WINAPI RSAENH_CPHashData( HCRYPTPROV hProv, HCRYPTHASH hHash, - CONST BYTE *pbData, + const BYTE *pbData, DWORD dwDataLen, DWORD dwFlags ); @@ -398,8 +399,8 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID reserved) * Success: TRUE (pbParam was copied into pbBuffer or pbBuffer is NULL) * Failure: FALSE (pbBuffer is not large enough to hold pbParam). Last error: ERROR_MORE_DATA */ -static inline BOOL copy_param( - BYTE *pbBuffer, DWORD *pdwBufferSize, CONST BYTE *pbParam, DWORD dwParamSize) +static inline BOOL copy_param(BYTE *pbBuffer, DWORD *pdwBufferSize, const BYTE *pbParam, + DWORD dwParamSize) { if (pbBuffer) { @@ -461,7 +462,8 @@ static inline const PROV_ENUMALGS_EX* get_algid_info(HCRYPTPROV hProv, ALG_ID al * NOTES * Use free_data_blob to release resources occupied by copy_data_blob. */ -static inline BOOL copy_data_blob(PCRYPT_DATA_BLOB dst, CONST PCRYPT_DATA_BLOB src) { +static inline BOOL copy_data_blob(PCRYPT_DATA_BLOB dst, const PCRYPT_DATA_BLOB src) +{ dst->pbData = HeapAlloc(GetProcessHeap(), 0, src->cbData); if (!dst->pbData) { SetLastError(NTE_NO_MEMORY); @@ -489,8 +491,8 @@ static inline BOOL copy_data_blob(PCRYPT_DATA_BLOB dst, CONST PCRYPT_DATA_BLOB s * NOTES * Release resources occupied by concat_data_blobs with free_data_blobs */ -static inline BOOL concat_data_blobs(PCRYPT_DATA_BLOB dst, CONST PCRYPT_DATA_BLOB src1, - CONST PCRYPT_DATA_BLOB src2) +static inline BOOL concat_data_blobs(PCRYPT_DATA_BLOB dst, const PCRYPT_DATA_BLOB src1, + const PCRYPT_DATA_BLOB src2) { dst->cbData = src1->cbData + src2->cbData; dst->pbData = HeapAlloc(GetProcessHeap(), 0, dst->cbData); @@ -655,7 +657,8 @@ static inline BOOL init_hash(CRYPTHASH *pCryptHash) { * pbData [I] Pointer to data stream to be hashed. * dwDataLen [I] Length of data stream. */ -static inline void update_hash(CRYPTHASH *pCryptHash, CONST BYTE *pbData, DWORD dwDataLen) { +static inline void update_hash(CRYPTHASH *pCryptHash, const BYTE *pbData, DWORD dwDataLen) +{ BYTE *pbTemp; switch (pCryptHash->aiAlgid) @@ -1099,7 +1102,7 @@ static BOOL create_container_key(KEYCONTAINER *pKeyContainer, REGSAM sam, HKEY * * dwFlags [I] Flags indicating which keyset to be opened. * phKey [O] Returned key */ -static BOOL open_container_key(LPCSTR pszContainerName, DWORD dwFlags, HKEY *phKey) +static BOOL open_container_key(LPCSTR pszContainerName, DWORD dwFlags, REGSAM access, HKEY *phKey) { CHAR szRSABase[MAX_PATH]; HKEY hRootKey; @@ -1113,7 +1116,7 @@ static BOOL open_container_key(LPCSTR pszContainerName, DWORD dwFlags, HKEY *phK /* @@ Wine registry key: HKLM\Software\Wine\Crypto\RSA */ /* @@ Wine registry key: HKCU\Software\Wine\Crypto\RSA */ - return RegOpenKeyExA(hRootKey, szRSABase, 0, KEY_READ, phKey) == + return RegOpenKeyExA(hRootKey, szRSABase, 0, access, phKey) == ERROR_SUCCESS; } @@ -1383,7 +1386,7 @@ static HCRYPTPROV read_key_container(PCHAR pszContainerName, DWORD dwFlags, cons HCRYPTPROV hKeyContainer; HCRYPTKEY hCryptKey; - if (!open_container_key(pszContainerName, dwFlags, &hKey)) + if (!open_container_key(pszContainerName, dwFlags, KEY_READ, &hKey)) { SetLastError(NTE_BAD_KEYSET); return (HCRYPTPROV)INVALID_HANDLE_VALUE; @@ -1434,14 +1437,14 @@ static HCRYPTPROV read_key_container(PCHAR pszContainerName, DWORD dwFlags, cons * Failure: FALSE (NTE_BAD_ALGID) */ static BOOL build_hash_signature(BYTE *pbSignature, DWORD dwLen, ALG_ID aiAlgid, - CONST BYTE *abHashValue, DWORD dwHashLen, DWORD dwFlags) + const BYTE *abHashValue, DWORD dwHashLen, DWORD dwFlags) { /* These prefixes are meant to be concatenated with hash values of the * respective kind to form a PKCS #7 DigestInfo. */ static const struct tagOIDDescriptor { ALG_ID aiAlgid; DWORD dwLen; - CONST BYTE abOID[19]; + const BYTE abOID[19]; } aOIDDescriptor[] = { { CALG_MD2, 18, { 0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, 0x02, 0x05, 0x00, 0x04, 0x10 } }, @@ -1529,7 +1532,8 @@ static BOOL build_hash_signature(BYTE *pbSignature, DWORD dwLen, ALG_ID aiAlgid, * Success: TRUE * Failure: FALSE */ -static BOOL tls1_p(HCRYPTHASH hHMAC, CONST PCRYPT_DATA_BLOB pblobSeed, PBYTE pbBuffer, DWORD dwBufferLen) +static BOOL tls1_p(HCRYPTHASH hHMAC, const PCRYPT_DATA_BLOB pblobSeed, BYTE *pbBuffer, + DWORD dwBufferLen) { CRYPTHASH *pHMAC; BYTE abAi[RSAENH_MAX_HASH_SIZE]; @@ -1587,8 +1591,8 @@ static BOOL tls1_p(HCRYPTHASH hHMAC, CONST PCRYPT_DATA_BLOB pblobSeed, PBYTE pbB * Success: TRUE * Failure: FALSE */ -static BOOL tls1_prf(HCRYPTPROV hProv, HCRYPTPROV hSecret, CONST PCRYPT_DATA_BLOB pblobLabel, - CONST PCRYPT_DATA_BLOB pblobSeed, PBYTE pbBuffer, DWORD dwBufferLen) +static BOOL tls1_prf(HCRYPTPROV hProv, HCRYPTPROV hSecret, const PCRYPT_DATA_BLOB pblobLabel, + const PCRYPT_DATA_BLOB pblobSeed, BYTE *pbBuffer, DWORD dwBufferLen) { HMAC_INFO hmacInfo = { 0, NULL, 0, NULL, 0 }; HCRYPTHASH hHMAC = (HCRYPTHASH)INVALID_HANDLE_VALUE; @@ -1656,7 +1660,7 @@ exit: * Success: TRUE * Failure: FALSE (NTE_BAD_LEN, too much data to pad) */ -static BOOL pad_data(CONST BYTE *abData, DWORD dwDataLen, BYTE *abBuffer, DWORD dwBufferLen, +static BOOL pad_data(const BYTE *abData, DWORD dwDataLen, BYTE *abBuffer, DWORD dwBufferLen, DWORD dwFlags) { DWORD i; @@ -1697,7 +1701,7 @@ static BOOL pad_data(CONST BYTE *abData, DWORD dwDataLen, BYTE *abBuffer, DWORD * Success: TRUE * Failure: FALSE, (NTE_BAD_DATA, no valid PKCS1 padding or buffer too small) */ -static BOOL unpad_data(CONST BYTE *abData, DWORD dwDataLen, BYTE *abBuffer, DWORD *dwBufferLen, +static BOOL unpad_data(const BYTE *abData, DWORD dwDataLen, BYTE *abBuffer, DWORD *dwBufferLen, DWORD dwFlags) { DWORD i; @@ -2721,13 +2725,13 @@ static void release_and_install_key(HCRYPTPROV hProv, HCRYPTKEY src, * Success: TRUE. * Failure: FALSE. */ -static BOOL import_private_key(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDataLen, +static BOOL import_private_key(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDataLen, DWORD dwFlags, BOOL fStoreKey, HCRYPTKEY *phKey) { KEYCONTAINER *pKeyContainer; CRYPTKEY *pCryptKey; - CONST BLOBHEADER *pBlobHeader = (CONST BLOBHEADER*)pbData; - CONST RSAPUBKEY *pRSAPubKey = (CONST RSAPUBKEY*)(pBlobHeader+1); + const BLOBHEADER *pBlobHeader = (const BLOBHEADER*)pbData; + const RSAPUBKEY *pRSAPubKey = (const RSAPUBKEY*)(pBlobHeader+1); BOOL ret; if (dwFlags & CRYPT_IPSEC_HMAC_KEY) @@ -2771,7 +2775,7 @@ static BOOL import_private_key(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDat *phKey = new_key(hProv, pBlobHeader->aiKeyAlg, MAKELONG(0,pRSAPubKey->bitlen), &pCryptKey); if (*phKey == (HCRYPTKEY)INVALID_HANDLE_VALUE) return FALSE; setup_key(pCryptKey); - ret = import_private_key_impl((CONST BYTE*)(pRSAPubKey+1), &pCryptKey->context, + ret = import_private_key_impl((const BYTE*)(pRSAPubKey+1), &pCryptKey->context, pRSAPubKey->bitlen/8, dwDataLen, pRSAPubKey->pubexp); if (ret) { if (dwFlags & CRYPT_EXPORTABLE) @@ -2818,13 +2822,13 @@ static BOOL import_private_key(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDat * Success: TRUE. * Failure: FALSE. */ -static BOOL import_public_key(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDataLen, +static BOOL import_public_key(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDataLen, DWORD dwFlags, BOOL fStoreKey, HCRYPTKEY *phKey) { KEYCONTAINER *pKeyContainer; CRYPTKEY *pCryptKey; - CONST BLOBHEADER *pBlobHeader = (CONST BLOBHEADER*)pbData; - CONST RSAPUBKEY *pRSAPubKey = (CONST RSAPUBKEY*)(pBlobHeader+1); + const BLOBHEADER *pBlobHeader = (const BLOBHEADER*)pbData; + const RSAPUBKEY *pRSAPubKey = (const RSAPUBKEY*)(pBlobHeader+1); ALG_ID algID; BOOL ret; @@ -2856,7 +2860,7 @@ static BOOL import_public_key(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwData *phKey = new_key(hProv, algID, MAKELONG(0,pRSAPubKey->bitlen), &pCryptKey); if (*phKey == (HCRYPTKEY)INVALID_HANDLE_VALUE) return FALSE; setup_key(pCryptKey); - ret = import_public_key_impl((CONST BYTE*)(pRSAPubKey+1), &pCryptKey->context, + ret = import_public_key_impl((const BYTE*)(pRSAPubKey+1), &pCryptKey->context, pRSAPubKey->bitlen >> 3, pRSAPubKey->pubexp); if (ret) { if (dwFlags & CRYPT_EXPORTABLE) @@ -2897,14 +2901,13 @@ static BOOL import_public_key(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwData * Success: TRUE. * Failure: FALSE. */ -static BOOL import_symmetric_key(HCRYPTPROV hProv, CONST BYTE *pbData, - DWORD dwDataLen, HCRYPTKEY hPubKey, - DWORD dwFlags, HCRYPTKEY *phKey) +static BOOL import_symmetric_key(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDataLen, + HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey) { CRYPTKEY *pCryptKey, *pPubKey; - CONST BLOBHEADER *pBlobHeader = (CONST BLOBHEADER*)pbData; - CONST ALG_ID *pAlgid = (CONST ALG_ID*)(pBlobHeader+1); - CONST BYTE *pbKeyStream = (CONST BYTE*)(pAlgid + 1); + const BLOBHEADER *pBlobHeader = (const BLOBHEADER*)pbData; + const ALG_ID *pAlgid = (const ALG_ID*)(pBlobHeader+1); + const BYTE *pbKeyStream = (const BYTE*)(pAlgid + 1); BYTE *pbDecrypted; DWORD dwKeyLen; @@ -2974,14 +2977,13 @@ static BOOL import_symmetric_key(HCRYPTPROV hProv, CONST BYTE *pbData, * Success: TRUE. * Failure: FALSE. */ -static BOOL import_plaintext_key(HCRYPTPROV hProv, CONST BYTE *pbData, - DWORD dwDataLen, DWORD dwFlags, - HCRYPTKEY *phKey) +static BOOL import_plaintext_key(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDataLen, + DWORD dwFlags, HCRYPTKEY *phKey) { CRYPTKEY *pCryptKey; - CONST BLOBHEADER *pBlobHeader = (CONST BLOBHEADER*)pbData; - CONST DWORD *pKeyLen = (CONST DWORD *)(pBlobHeader + 1); - CONST BYTE *pbKeyStream = (CONST BYTE*)(pKeyLen + 1); + const BLOBHEADER *pBlobHeader = (const BLOBHEADER*)pbData; + const DWORD *pKeyLen = (const DWORD *)(pBlobHeader + 1); + const BYTE *pbKeyStream = (const BYTE*)(pKeyLen + 1); if (dwDataLen < sizeof(BLOBHEADER)+sizeof(DWORD)+*pKeyLen) { @@ -3053,12 +3055,11 @@ static BOOL import_plaintext_key(HCRYPTPROV hProv, CONST BYTE *pbData, * Success: TRUE. * Failure: FALSE. */ -static BOOL import_key(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDataLen, - HCRYPTKEY hPubKey, DWORD dwFlags, BOOL fStoreKey, - HCRYPTKEY *phKey) +static BOOL import_key(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDataLen, HCRYPTKEY hPubKey, + DWORD dwFlags, BOOL fStoreKey, HCRYPTKEY *phKey) { KEYCONTAINER *pKeyContainer; - CONST BLOBHEADER *pBlobHeader = (CONST BLOBHEADER*)pbData; + const BLOBHEADER *pBlobHeader = (const BLOBHEADER*)pbData; if (!lookup_handle(&handle_table, hProv, RSAENH_MAGIC_CONTAINER, (OBJECTHDR**)&pKeyContainer)) @@ -3124,7 +3125,7 @@ static BOOL import_key(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDataLen, * Success: TRUE. * Failure: FALSE. */ -BOOL WINAPI RSAENH_CPImportKey(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDataLen, +BOOL WINAPI RSAENH_CPImportKey(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDataLen, HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey) { TRACE("(hProv=%08lx, pbData=%p, dwDataLen=%d, hPubKey=%08lx, dwFlags=%08x, phKey=%p)\n", @@ -3321,11 +3322,11 @@ BOOL WINAPI RSAENH_CPGetHashParam(HCRYPTPROV hProv, HCRYPTHASH hHash, DWORD dwPa switch (dwParam) { case HP_ALGID: - return copy_param(pbData, pdwDataLen, (CONST BYTE*)&pCryptHash->aiAlgid, + return copy_param(pbData, pdwDataLen, (const BYTE*)&pCryptHash->aiAlgid, sizeof(ALG_ID)); case HP_HASHSIZE: - return copy_param(pbData, pdwDataLen, (CONST BYTE*)&pCryptHash->dwHashSize, + return copy_param(pbData, pdwDataLen, (const BYTE*)&pCryptHash->dwHashSize, sizeof(DWORD)); case HP_HASHVAL: @@ -3619,37 +3620,37 @@ BOOL WINAPI RSAENH_CPGetKeyParam(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam case KP_PADDING: dwValue = PKCS5_PADDING; - return copy_param(pbData, pdwDataLen, (CONST BYTE*)&dwValue, sizeof(DWORD)); + return copy_param(pbData, pdwDataLen, (const BYTE*)&dwValue, sizeof(DWORD)); case KP_KEYLEN: dwValue = pCryptKey->dwKeyLen << 3; - return copy_param(pbData, pdwDataLen, (CONST BYTE*)&dwValue, sizeof(DWORD)); - + return copy_param(pbData, pdwDataLen, (const BYTE*)&dwValue, sizeof(DWORD)); + case KP_EFFECTIVE_KEYLEN: if (pCryptKey->dwEffectiveKeyLen) dwValue = pCryptKey->dwEffectiveKeyLen; else dwValue = pCryptKey->dwKeyLen << 3; - return copy_param(pbData, pdwDataLen, (CONST BYTE*)&dwValue, sizeof(DWORD)); + return copy_param(pbData, pdwDataLen, (const BYTE*)&dwValue, sizeof(DWORD)); case KP_BLOCKLEN: dwValue = pCryptKey->dwBlockLen << 3; - return copy_param(pbData, pdwDataLen, (CONST BYTE*)&dwValue, sizeof(DWORD)); - + return copy_param(pbData, pdwDataLen, (const BYTE*)&dwValue, sizeof(DWORD)); + case KP_MODE: - return copy_param(pbData, pdwDataLen, (CONST BYTE*)&pCryptKey->dwMode, sizeof(DWORD)); + return copy_param(pbData, pdwDataLen, (const BYTE*)&pCryptKey->dwMode, sizeof(DWORD)); case KP_MODE_BITS: - return copy_param(pbData, pdwDataLen, (CONST BYTE*)&pCryptKey->dwModeBits, + return copy_param(pbData, pdwDataLen, (const BYTE*)&pCryptKey->dwModeBits, sizeof(DWORD)); - + case KP_PERMISSIONS: - return copy_param(pbData, pdwDataLen, (CONST BYTE*)&pCryptKey->dwPermissions, + return copy_param(pbData, pdwDataLen, (const BYTE*)&pCryptKey->dwPermissions, sizeof(DWORD)); case KP_ALGID: - return copy_param(pbData, pdwDataLen, (CONST BYTE*)&pCryptKey->aiAlgid, sizeof(DWORD)); - + return copy_param(pbData, pdwDataLen, (const BYTE*)&pCryptKey->aiAlgid, sizeof(DWORD)); + default: SetLastError(NTE_BAD_TYPE); return FALSE; @@ -3678,6 +3679,7 @@ BOOL WINAPI RSAENH_CPGetKeyParam(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam * - PP_SIG_KEYSIZE_INC: RSA signature keywidth granularity in bits. * - PP_KEYX_KEYSIZE_INC: RSA key-exchange keywidth granularity in bits. * - PP_ENUMALGS{_EX}: Query provider capabilities. + * - PP_KEYSET_SEC_DESCR: Retrieve security descriptor on container. */ BOOL WINAPI RSAENH_CPGetProvParam(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags) @@ -3692,7 +3694,7 @@ BOOL WINAPI RSAENH_CPGetProvParam(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, * Returning this BLOB seems to satisfy IE. The marked 0x00 seem * to be 'don't care's. If you know anything more specific about * this provider parameter, please report to wine-devel@winehq.org */ - static CONST BYTE abWTF[96] = { + static const BYTE abWTF[96] = { 0xb0, 0x25, 0x63, 0x86, 0x9c, 0xab, 0xb6, 0x37, 0xe8, 0x82, /**/0x00,/**/ 0x72, 0x06, 0xb2, /**/0x00,/**/ 0x3b, 0x60, 0x35, /**/0x00,/**/ 0x3b, 0x88, 0xce, /**/0x00,/**/ 0x82, @@ -3727,42 +3729,42 @@ BOOL WINAPI RSAENH_CPGetProvParam(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, { case PP_CONTAINER: case PP_UNIQUE_CONTAINER:/* MSDN says we can return the same value as PP_CONTAINER */ - return copy_param(pbData, pdwDataLen, (CONST BYTE*)pKeyContainer->szName, + return copy_param(pbData, pdwDataLen, (const BYTE*)pKeyContainer->szName, strlen(pKeyContainer->szName)+1); case PP_NAME: - return copy_param(pbData, pdwDataLen, (CONST BYTE*)pKeyContainer->szProvName, + return copy_param(pbData, pdwDataLen, (const BYTE*)pKeyContainer->szProvName, strlen(pKeyContainer->szProvName)+1); case PP_PROVTYPE: dwTemp = PROV_RSA_FULL; - return copy_param(pbData, pdwDataLen, (CONST BYTE*)&dwTemp, sizeof(dwTemp)); + return copy_param(pbData, pdwDataLen, (const BYTE*)&dwTemp, sizeof(dwTemp)); case PP_KEYSPEC: dwTemp = AT_SIGNATURE | AT_KEYEXCHANGE; - return copy_param(pbData, pdwDataLen, (CONST BYTE*)&dwTemp, sizeof(dwTemp)); + return copy_param(pbData, pdwDataLen, (const BYTE*)&dwTemp, sizeof(dwTemp)); case PP_KEYSET_TYPE: dwTemp = pKeyContainer->dwFlags & CRYPT_MACHINE_KEYSET; - return copy_param(pbData, pdwDataLen, (CONST BYTE*)&dwTemp, sizeof(dwTemp)); + return copy_param(pbData, pdwDataLen, (const BYTE*)&dwTemp, sizeof(dwTemp)); case PP_KEYSTORAGE: dwTemp = CRYPT_SEC_DESCR; - return copy_param(pbData, pdwDataLen, (CONST BYTE*)&dwTemp, sizeof(dwTemp)); + return copy_param(pbData, pdwDataLen, (const BYTE*)&dwTemp, sizeof(dwTemp)); case PP_SIG_KEYSIZE_INC: case PP_KEYX_KEYSIZE_INC: dwTemp = 8; - return copy_param(pbData, pdwDataLen, (CONST BYTE*)&dwTemp, sizeof(dwTemp)); + return copy_param(pbData, pdwDataLen, (const BYTE*)&dwTemp, sizeof(dwTemp)); case PP_IMPTYPE: dwTemp = CRYPT_IMPL_SOFTWARE; - return copy_param(pbData, pdwDataLen, (CONST BYTE*)&dwTemp, sizeof(dwTemp)); + return copy_param(pbData, pdwDataLen, (const BYTE*)&dwTemp, sizeof(dwTemp)); case PP_VERSION: dwTemp = 0x00000200; - return copy_param(pbData, pdwDataLen, (CONST BYTE*)&dwTemp, sizeof(dwTemp)); - + return copy_param(pbData, pdwDataLen, (const BYTE*)&dwTemp, sizeof(dwTemp)); + case PP_ENUMCONTAINERS: if ((dwFlags & CRYPT_FIRST) == CRYPT_FIRST) pKeyContainer->dwEnumContainersCtr = 0; @@ -3771,7 +3773,7 @@ BOOL WINAPI RSAENH_CPGetProvParam(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, return TRUE; } - if (!open_container_key("", dwFlags, &hKey)) + if (!open_container_key("", dwFlags, KEY_READ, &hKey)) { SetLastError(ERROR_NO_MORE_ITEMS); return FALSE; @@ -3821,16 +3823,16 @@ BOOL WINAPI RSAENH_CPGetProvParam(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, memcpy(provEnumalgs.szName, aProvEnumAlgsEx [pKeyContainer->dwPersonality][pKeyContainer->dwEnumAlgsCtr].szName, 20*sizeof(CHAR)); - - return copy_param(pbData, pdwDataLen, (CONST BYTE*)&provEnumalgs, + + return copy_param(pbData, pdwDataLen, (const BYTE*)&provEnumalgs, sizeof(PROV_ENUMALGS)); } else { if (pbData && (*pdwDataLen >= sizeof(PROV_ENUMALGS_EX))) pKeyContainer->dwEnumAlgsCtr = ((dwFlags & CRYPT_FIRST) == CRYPT_FIRST) ? 0 : pKeyContainer->dwEnumAlgsCtr+1; - + return copy_param(pbData, pdwDataLen, - (CONST BYTE*)&aProvEnumAlgsEx + (const BYTE*)&aProvEnumAlgsEx [pKeyContainer->dwPersonality][pKeyContainer->dwEnumAlgsCtr], sizeof(PROV_ENUMALGS_EX)); } @@ -3838,6 +3840,34 @@ BOOL WINAPI RSAENH_CPGetProvParam(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, case PP_CRYPT_COUNT_KEY_USE: /* Asked for by IE About dialog */ return copy_param(pbData, pdwDataLen, abWTF, sizeof(abWTF)); + case PP_KEYSET_SEC_DESCR: + { + SECURITY_DESCRIPTOR *sd; + DWORD err, len, flags = (pKeyContainer->dwFlags & CRYPT_MACHINE_KEYSET); + + if (!open_container_key(pKeyContainer->szName, flags, KEY_READ, &hKey)) + { + SetLastError(NTE_BAD_KEYSET); + return FALSE; + } + + err = GetSecurityInfo(hKey, SE_REGISTRY_KEY, dwFlags, NULL, NULL, NULL, NULL, (void **)&sd); + RegCloseKey(hKey); + if (err) + { + SetLastError(err); + return FALSE; + } + + len = GetSecurityDescriptorLength(sd); + if (*pdwDataLen >= len) memcpy(pbData, sd, len); + else SetLastError(ERROR_INSUFFICIENT_BUFFER); + *pdwDataLen = len; + + LocalFree(sd); + return TRUE; + } + default: /* MSDN: Unknown parameter number in dwParam */ SetLastError(NTE_BAD_TYPE); @@ -4080,7 +4110,7 @@ BOOL WINAPI RSAENH_CPGetUserKey(HCRYPTPROV hProv, DWORD dwKeySpec, HCRYPTKEY *ph * The actual hash value is queried with CPGetHashParam, which will finalize * the hash. Updating a finalized hash will fail with a last error NTE_BAD_HASH_STATE. */ -BOOL WINAPI RSAENH_CPHashData(HCRYPTPROV hProv, HCRYPTHASH hHash, CONST BYTE *pbData, +BOOL WINAPI RSAENH_CPHashData(HCRYPTPROV hProv, HCRYPTHASH hHash, const BYTE *pbData, DWORD dwDataLen, DWORD dwFlags) { CRYPTHASH *pCryptHash; @@ -4088,7 +4118,7 @@ BOOL WINAPI RSAENH_CPHashData(HCRYPTPROV hProv, HCRYPTHASH hHash, CONST BYTE *pb TRACE("(hProv=%08lx, hHash=%08lx, pbData=%p, dwDataLen=%d, dwFlags=%08x)\n", hProv, hHash, pbData, dwDataLen, dwFlags); - if (dwFlags) + if (dwFlags & ~CRYPT_USERDATA) { SetLastError(NTE_BAD_FLAGS); return FALSE; @@ -4313,8 +4343,56 @@ BOOL WINAPI RSAENH_CPSetHashParam(HCRYPTPROV hProv, HCRYPTHASH hHash, DWORD dwPa */ BOOL WINAPI RSAENH_CPSetProvParam(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, DWORD dwFlags) { - FIXME("(stub)\n"); - return FALSE; + KEYCONTAINER *pKeyContainer; + HKEY hKey; + + TRACE("(hProv=%08lx, dwParam=%08x, pbData=%p, dwFlags=%08x)\n", hProv, dwParam, pbData, dwFlags); + + if (!lookup_handle(&handle_table, hProv, RSAENH_MAGIC_CONTAINER, (OBJECTHDR **)&pKeyContainer)) + { + SetLastError(NTE_BAD_UID); + return FALSE; + } + + switch (dwParam) + { + case PP_KEYSET_SEC_DESCR: + { + SECURITY_DESCRIPTOR *sd = (SECURITY_DESCRIPTOR *)pbData; + DWORD err, flags = (pKeyContainer->dwFlags & CRYPT_MACHINE_KEYSET); + BOOL def, present; + REGSAM access = WRITE_DAC | WRITE_OWNER | ACCESS_SYSTEM_SECURITY; + PSID owner = NULL, group = NULL; + PACL dacl = NULL, sacl = NULL; + + if (!open_container_key(pKeyContainer->szName, flags, access, &hKey)) + { + SetLastError(NTE_BAD_KEYSET); + return FALSE; + } + + if ((dwFlags & OWNER_SECURITY_INFORMATION && !GetSecurityDescriptorOwner(sd, &owner, &def)) || + (dwFlags & GROUP_SECURITY_INFORMATION && !GetSecurityDescriptorGroup(sd, &group, &def)) || + (dwFlags & DACL_SECURITY_INFORMATION && !GetSecurityDescriptorDacl(sd, &present, &dacl, &def)) || + (dwFlags & SACL_SECURITY_INFORMATION && !GetSecurityDescriptorSacl(sd, &present, &sacl, &def))) + { + RegCloseKey(hKey); + return FALSE; + } + + err = SetSecurityInfo(hKey, SE_REGISTRY_KEY, dwFlags, owner, group, dacl, sacl); + RegCloseKey(hKey); + if (err) + { + SetLastError(err); + return FALSE; + } + return TRUE; + } + default: + FIXME("unimplemented parameter %08x\n", dwParam); + return FALSE; + } } /****************************************************************************** @@ -4378,7 +4456,7 @@ BOOL WINAPI RSAENH_CPSignHash(HCRYPTPROV hProv, HCRYPTHASH hHash, DWORD dwKeySpe *pdwSigLen = pCryptKey->dwKeyLen; if (sDescription) { - if (!RSAENH_CPHashData(hProv, hHash, (CONST BYTE*)sDescription, + if (!RSAENH_CPHashData(hProv, hHash, (const BYTE*)sDescription, (DWORD)lstrlenW(sDescription)*sizeof(WCHAR), 0)) { goto out; @@ -4420,7 +4498,7 @@ out: * Success: TRUE (Signature is valid) * Failure: FALSE (GetLastError() == NTE_BAD_SIGNATURE, if signature is invalid) */ -BOOL WINAPI RSAENH_CPVerifySignature(HCRYPTPROV hProv, HCRYPTHASH hHash, CONST BYTE *pbSignature, +BOOL WINAPI RSAENH_CPVerifySignature(HCRYPTPROV hProv, HCRYPTHASH hHash, const BYTE *pbSignature, DWORD dwSigLen, HCRYPTKEY hPubKey, LPCWSTR sDescription, DWORD dwFlags) { @@ -4469,7 +4547,7 @@ BOOL WINAPI RSAENH_CPVerifySignature(HCRYPTPROV hProv, HCRYPTHASH hHash, CONST B } if (sDescription) { - if (!RSAENH_CPHashData(hProv, hHash, (CONST BYTE*)sDescription, + if (!RSAENH_CPHashData(hProv, hHash, (const BYTE*)sDescription, (DWORD)lstrlenW(sDescription)*sizeof(WCHAR), 0)) { return FALSE; diff --git a/dll/win32/scrrun/filesystem.c b/dll/win32/scrrun/filesystem.c index 9dcace63540..d22bb1fe003 100644 --- a/dll/win32/scrrun/filesystem.c +++ b/dll/win32/scrrun/filesystem.c @@ -23,9 +23,66 @@ #include #include +static const WCHAR bsW[] = {'\\',0}; +static const WCHAR utf16bom = 0xfeff; + +struct foldercollection { + IFolderCollection IFolderCollection_iface; + LONG ref; + BSTR path; +}; + +struct filecollection { + IFileCollection IFileCollection_iface; + LONG ref; + BSTR path; +}; + +struct drivecollection { + IDriveCollection IDriveCollection_iface; + LONG ref; + DWORD drives; + LONG count; +}; + +struct enumdata { + union + { + struct + { + struct foldercollection *coll; + HANDLE find; + } foldercoll; + struct + { + struct filecollection *coll; + HANDLE find; + } filecoll; + struct + { + struct drivecollection *coll; + INT cur; + } drivecoll; + } u; +}; + +struct enumvariant { + IEnumVARIANT IEnumVARIANT_iface; + LONG ref; + + struct enumdata data; +}; + +struct drive { + IDrive IDrive_iface; + LONG ref; + BSTR root; +}; + struct folder { IFolder IFolder_iface; LONG ref; + BSTR path; }; struct file { @@ -40,6 +97,10 @@ struct textstream { LONG ref; IOMode mode; + BOOL unicode; + BOOL first_read; + LARGE_INTEGER size; + HANDLE file; }; enum iotype { @@ -47,6 +108,11 @@ enum iotype { IOWrite }; +static inline struct drive *impl_from_IDrive(IDrive *iface) +{ + return CONTAINING_RECORD(iface, struct drive, IDrive_iface); +} + static inline struct folder *impl_from_IFolder(IFolder *iface) { return CONTAINING_RECORD(iface, struct folder, IFolder_iface); @@ -62,6 +128,26 @@ static inline struct textstream *impl_from_ITextStream(ITextStream *iface) return CONTAINING_RECORD(iface, struct textstream, ITextStream_iface); } +static inline struct foldercollection *impl_from_IFolderCollection(IFolderCollection *iface) +{ + return CONTAINING_RECORD(iface, struct foldercollection, IFolderCollection_iface); +} + +static inline struct filecollection *impl_from_IFileCollection(IFileCollection *iface) +{ + return CONTAINING_RECORD(iface, struct filecollection, IFileCollection_iface); +} + +static inline struct drivecollection *impl_from_IDriveCollection(IDriveCollection *iface) +{ + return CONTAINING_RECORD(iface, struct drivecollection, IDriveCollection_iface); +} + +static inline struct enumvariant *impl_from_IEnumVARIANT(IEnumVARIANT *iface) +{ + return CONTAINING_RECORD(iface, struct enumvariant, IEnumVARIANT_iface); +} + static inline HRESULT create_error(DWORD err) { switch(err) { @@ -76,12 +162,45 @@ static inline HRESULT create_error(DWORD err) } } -static int textstream_check_iomode(struct textstream *This, enum iotype type) +static HRESULT create_folder(const WCHAR*, IFolder**); +static HRESULT create_file(BSTR, IFile**); +static HRESULT create_foldercoll_enum(struct foldercollection*, IUnknown**); +static HRESULT create_filecoll_enum(struct filecollection*, IUnknown**); + +static inline BOOL is_dir_data(const WIN32_FIND_DATAW *data) +{ + static const WCHAR dotdotW[] = {'.','.',0}; + static const WCHAR dotW[] = {'.',0}; + + return (data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && + strcmpW(data->cFileName, dotdotW) && + strcmpW(data->cFileName, dotW); +} + +static inline BOOL is_file_data(const WIN32_FIND_DATAW *data) +{ + return !(data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); +} + +static BSTR get_full_path(BSTR path, const WIN32_FIND_DATAW *data) +{ + int len = SysStringLen(path); + WCHAR buffW[MAX_PATH]; + + strcpyW(buffW, path); + if (path[len-1] != '\\') + strcatW(buffW, bsW); + strcatW(buffW, data->cFileName); + + return SysAllocString(buffW); +} + +static BOOL textstream_check_iomode(struct textstream *This, enum iotype type) { if (type == IORead) return This->mode == ForWriting || This->mode == ForAppending; else - return 1; + return This->mode == ForReading; } static HRESULT WINAPI textstream_QueryInterface(ITextStream *iface, REFIID riid, void **obj) @@ -118,7 +237,10 @@ static ULONG WINAPI textstream_Release(ITextStream *iface) TRACE("(%p)->(%d)\n", This, ref); if (!ref) + { + CloseHandle(This->file); heap_free(This); + } return ref; } @@ -199,8 +321,24 @@ static HRESULT WINAPI textstream_get_Column(ITextStream *iface, LONG *column) static HRESULT WINAPI textstream_get_AtEndOfStream(ITextStream *iface, VARIANT_BOOL *eos) { struct textstream *This = impl_from_ITextStream(iface); - FIXME("(%p)->(%p): stub\n", This, eos); - return E_NOTIMPL; + LARGE_INTEGER pos, dist; + + TRACE("(%p)->(%p)\n", This, eos); + + if (!eos) + return E_POINTER; + + if (textstream_check_iomode(This, IORead)) { + *eos = VARIANT_TRUE; + return CTL_E_BADFILEMODE; + } + + dist.QuadPart = 0; + if (!SetFilePointerEx(This->file, dist, &pos, FILE_CURRENT)) + return E_FAIL; + + *eos = This->size.QuadPart == pos.QuadPart ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; } static HRESULT WINAPI textstream_get_AtEndOfLine(ITextStream *iface, VARIANT_BOOL *eol) @@ -210,51 +348,252 @@ static HRESULT WINAPI textstream_get_AtEndOfLine(ITextStream *iface, VARIANT_BOO return E_NOTIMPL; } +/* + Reads 'toread' bytes from a file, converts if needed + BOM is skipped if 'bof' is set. + */ +static HRESULT textstream_read(struct textstream *stream, LONG toread, BOOL bof, BSTR *text) +{ + HRESULT hr = S_OK; + DWORD read; + char *buff; + BOOL ret; + + if (toread == 0) { + *text = SysAllocStringLen(NULL, 0); + return *text ? S_FALSE : E_OUTOFMEMORY; + } + + if (toread < sizeof(WCHAR)) + return CTL_E_ENDOFFILE; + + buff = heap_alloc(toread); + if (!buff) + return E_OUTOFMEMORY; + + ret = ReadFile(stream->file, buff, toread, &read, NULL); + if (!ret || toread != read) { + WARN("failed to read from file %d, %d, error %d\n", read, toread, GetLastError()); + heap_free(buff); + return E_FAIL; + } + + if (stream->unicode) { + int i = 0; + + /* skip BOM */ + if (bof && *(WCHAR*)buff == utf16bom) { + read -= sizeof(WCHAR); + i += sizeof(WCHAR); + } + + *text = SysAllocStringLen(read ? (WCHAR*)&buff[i] : NULL, read/sizeof(WCHAR)); + if (!*text) hr = E_OUTOFMEMORY; + } + else { + INT len = MultiByteToWideChar(CP_ACP, 0, buff, read, NULL, 0); + *text = SysAllocStringLen(NULL, len); + if (*text) + MultiByteToWideChar(CP_ACP, 0, buff, read, *text, len); + else + hr = E_OUTOFMEMORY; + } + heap_free(buff); + + return hr; +} + static HRESULT WINAPI textstream_Read(ITextStream *iface, LONG len, BSTR *text) { struct textstream *This = impl_from_ITextStream(iface); - FIXME("(%p)->(%p): stub\n", This, text); + LARGE_INTEGER start, end, dist; + DWORD toread; + HRESULT hr; + + TRACE("(%p)->(%d %p)\n", This, len, text); + + if (!text) + return E_POINTER; + + *text = NULL; + if (len <= 0) + return len == 0 ? S_OK : E_INVALIDARG; if (textstream_check_iomode(This, IORead)) return CTL_E_BADFILEMODE; - return E_NOTIMPL; + if (!This->first_read) { + VARIANT_BOOL eos; + + /* check for EOF */ + hr = ITextStream_get_AtEndOfStream(iface, &eos); + if (FAILED(hr)) + return hr; + + if (eos == VARIANT_TRUE) + return CTL_E_ENDOFFILE; + } + + /* read everything from current position */ + dist.QuadPart = 0; + SetFilePointerEx(This->file, dist, &start, FILE_CURRENT); + SetFilePointerEx(This->file, dist, &end, FILE_END); + toread = end.QuadPart - start.QuadPart; + /* rewind back */ + dist.QuadPart = start.QuadPart; + SetFilePointerEx(This->file, dist, NULL, FILE_BEGIN); + + This->first_read = FALSE; + if (This->unicode) len *= sizeof(WCHAR); + + hr = textstream_read(This, min(toread, len), start.QuadPart == 0, text); + if (FAILED(hr)) + return hr; + else + return toread <= len ? S_FALSE : S_OK; } static HRESULT WINAPI textstream_ReadLine(ITextStream *iface, BSTR *text) { struct textstream *This = impl_from_ITextStream(iface); + VARIANT_BOOL eos; + HRESULT hr; + FIXME("(%p)->(%p): stub\n", This, text); + if (!text) + return E_POINTER; + + *text = NULL; if (textstream_check_iomode(This, IORead)) return CTL_E_BADFILEMODE; + /* check for EOF */ + hr = ITextStream_get_AtEndOfStream(iface, &eos); + if (FAILED(hr)) + return hr; + + if (eos == VARIANT_TRUE) + return CTL_E_ENDOFFILE; + return E_NOTIMPL; } static HRESULT WINAPI textstream_ReadAll(ITextStream *iface, BSTR *text) { struct textstream *This = impl_from_ITextStream(iface); - FIXME("(%p)->(%p): stub\n", This, text); + LARGE_INTEGER start, end, dist; + DWORD toread; + HRESULT hr; + TRACE("(%p)->(%p)\n", This, text); + + if (!text) + return E_POINTER; + + *text = NULL; if (textstream_check_iomode(This, IORead)) return CTL_E_BADFILEMODE; - return E_NOTIMPL; + if (!This->first_read) { + VARIANT_BOOL eos; + + /* check for EOF */ + hr = ITextStream_get_AtEndOfStream(iface, &eos); + if (FAILED(hr)) + return hr; + + if (eos == VARIANT_TRUE) + return CTL_E_ENDOFFILE; + } + + /* read everything from current position */ + dist.QuadPart = 0; + SetFilePointerEx(This->file, dist, &start, FILE_CURRENT); + SetFilePointerEx(This->file, dist, &end, FILE_END); + toread = end.QuadPart - start.QuadPart; + /* rewind back */ + dist.QuadPart = start.QuadPart; + SetFilePointerEx(This->file, dist, NULL, FILE_BEGIN); + + This->first_read = FALSE; + + hr = textstream_read(This, toread, start.QuadPart == 0, text); + return FAILED(hr) ? hr : S_FALSE; +} + +static HRESULT textstream_writestr(struct textstream *stream, BSTR text) +{ + DWORD written = 0; + BOOL ret; + + if (stream->unicode) { + ret = WriteFile(stream->file, text, SysStringByteLen(text), &written, NULL); + return (ret && written == SysStringByteLen(text)) ? S_OK : create_error(GetLastError()); + } else { + DWORD len = WideCharToMultiByte(CP_ACP, 0, text, SysStringLen(text), NULL, 0, NULL, NULL); + char *buffA; + HRESULT hr; + + buffA = heap_alloc(len); + if (!buffA) + return E_OUTOFMEMORY; + + WideCharToMultiByte(CP_ACP, 0, text, SysStringLen(text), buffA, len, NULL, NULL); + ret = WriteFile(stream->file, buffA, len, &written, NULL); + hr = (ret && written == len) ? S_OK : create_error(GetLastError()); + heap_free(buffA); + return hr; + } } static HRESULT WINAPI textstream_Write(ITextStream *iface, BSTR text) { struct textstream *This = impl_from_ITextStream(iface); - FIXME("(%p)->(%s): stub\n", This, debugstr_w(text)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_w(text)); + + if (textstream_check_iomode(This, IOWrite)) + return CTL_E_BADFILEMODE; + + return textstream_writestr(This, text); +} + +static HRESULT textstream_writecrlf(struct textstream *stream) +{ + static const WCHAR crlfW[] = {'\r','\n'}; + static const char crlfA[] = {'\r','\n'}; + DWORD written = 0, len; + const void *ptr; + BOOL ret; + + if (stream->unicode) { + ptr = crlfW; + len = sizeof(crlfW); + } + else { + ptr = crlfA; + len = sizeof(crlfA); + } + + ret = WriteFile(stream->file, ptr, len, &written, NULL); + return (ret && written == len) ? S_OK : create_error(GetLastError()); } static HRESULT WINAPI textstream_WriteLine(ITextStream *iface, BSTR text) { struct textstream *This = impl_from_ITextStream(iface); - FIXME("(%p)->(%s): stub\n", This, debugstr_w(text)); - return E_NOTIMPL; + HRESULT hr; + + TRACE("(%p)->(%s)\n", This, debugstr_w(text)); + + if (textstream_check_iomode(This, IOWrite)) + return CTL_E_BADFILEMODE; + + hr = textstream_writestr(This, text); + if (SUCCEEDED(hr)) + hr = textstream_writecrlf(This); + return hr; } static HRESULT WINAPI textstream_WriteBlankLines(ITextStream *iface, LONG lines) @@ -308,9 +647,26 @@ static const ITextStreamVtbl textstreamvtbl = { textstream_Close }; -static HRESULT create_textstream(IOMode mode, ITextStream **ret) +static HRESULT create_textstream(const WCHAR *filename, DWORD disposition, IOMode mode, BOOL unicode, ITextStream **ret) { struct textstream *stream; + DWORD access = 0; + + /* map access mode */ + switch (mode) + { + case ForReading: + access = GENERIC_READ; + break; + case ForWriting: + access = GENERIC_WRITE; + break; + case ForAppending: + access = FILE_APPEND_DATA; + break; + default: + return E_INVALIDARG; + } stream = heap_alloc(sizeof(struct textstream)); if (!stream) return E_OUTOFMEMORY; @@ -318,11 +674,1354 @@ static HRESULT create_textstream(IOMode mode, ITextStream **ret) stream->ITextStream_iface.lpVtbl = &textstreamvtbl; stream->ref = 1; stream->mode = mode; + stream->unicode = unicode; + stream->first_read = TRUE; + + stream->file = CreateFileW(filename, access, 0, NULL, disposition, FILE_ATTRIBUTE_NORMAL, NULL); + if (stream->file == INVALID_HANDLE_VALUE) + { + HRESULT hr = create_error(GetLastError()); + heap_free(stream); + return hr; + } + + if (mode == ForReading) + GetFileSizeEx(stream->file, &stream->size); + else + stream->size.QuadPart = 0; + + /* Write Unicode BOM */ + if (unicode && mode == ForWriting && (disposition == CREATE_ALWAYS || disposition == CREATE_NEW)) { + DWORD written = 0; + BOOL ret = WriteFile(stream->file, &utf16bom, sizeof(utf16bom), &written, NULL); + if (!ret || written != sizeof(utf16bom)) { + ITextStream_Release(&stream->ITextStream_iface); + return create_error(GetLastError()); + } + } *ret = &stream->ITextStream_iface; return S_OK; } +static HRESULT WINAPI drive_QueryInterface(IDrive *iface, REFIID riid, void **obj) +{ + struct drive *This = impl_from_IDrive(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + *obj = NULL; + + if (IsEqualIID( riid, &IID_IDrive ) || + IsEqualIID( riid, &IID_IDispatch ) || + IsEqualIID( riid, &IID_IUnknown)) + { + *obj = iface; + IDrive_AddRef(iface); + } + else + return E_NOINTERFACE; + + return S_OK; +} + +static ULONG WINAPI drive_AddRef(IDrive *iface) +{ + struct drive *This = impl_from_IDrive(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + return ref; +} + +static ULONG WINAPI drive_Release(IDrive *iface) +{ + struct drive *This = impl_from_IDrive(iface); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + { + SysFreeString(This->root); + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI drive_GetTypeInfoCount(IDrive *iface, UINT *pctinfo) +{ + struct drive *This = impl_from_IDrive(iface); + TRACE("(%p)->(%p)\n", This, pctinfo); + *pctinfo = 1; + return S_OK; +} + +static HRESULT WINAPI drive_GetTypeInfo(IDrive *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + struct drive *This = impl_from_IDrive(iface); + TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); + return get_typeinfo(IDrive_tid, ppTInfo); +} + +static HRESULT WINAPI drive_GetIDsOfNames(IDrive *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + struct drive *This = impl_from_IDrive(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); + + hr = get_typeinfo(IDrive_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI drive_Invoke(IDrive *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, + DISPPARAMS *pDispParams, VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + struct drive *This = impl_from_IDrive(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); + + hr = get_typeinfo(IDrive_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI drive_get_Path(IDrive *iface, BSTR *path) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%p): stub\n", This, path); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_get_DriveLetter(IDrive *iface, BSTR *letter) +{ + struct drive *This = impl_from_IDrive(iface); + + TRACE("(%p)->(%p)\n", This, letter); + + if (!letter) + return E_POINTER; + + *letter = SysAllocStringLen(This->root, 1); + if (!*letter) + return E_OUTOFMEMORY; + + return S_OK; +} + +static HRESULT WINAPI drive_get_ShareName(IDrive *iface, BSTR *share_name) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%p): stub\n", This, share_name); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_get_DriveType(IDrive *iface, DriveTypeConst *type) +{ + struct drive *This = impl_from_IDrive(iface); + + TRACE("(%p)->(%p)\n", This, type); + + switch (GetDriveTypeW(This->root)) + { + case DRIVE_REMOVABLE: + *type = Removable; + break; + case DRIVE_FIXED: + *type = Fixed; + break; + case DRIVE_REMOTE: + *type = Remote; + break; + case DRIVE_CDROM: + *type = CDRom; + break; + case DRIVE_RAMDISK: + *type = RamDisk; + break; + default: + *type = UnknownType; + break; + } + + return S_OK; +} + +static HRESULT WINAPI drive_get_RootFolder(IDrive *iface, IFolder **folder) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%p): stub\n", This, folder); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_get_AvailableSpace(IDrive *iface, VARIANT *v) +{ + struct drive *This = impl_from_IDrive(iface); + ULARGE_INTEGER avail; + + TRACE("(%p)->(%p)\n", This, v); + + if (!v) + return E_POINTER; + + if (!GetDiskFreeSpaceExW(This->root, &avail, NULL, NULL)) + return E_FAIL; + + V_VT(v) = VT_R8; + return VarR8FromUI8(avail.QuadPart, &V_R8(v)); +} + +static HRESULT WINAPI drive_get_FreeSpace(IDrive *iface, VARIANT *v) +{ + struct drive *This = impl_from_IDrive(iface); + ULARGE_INTEGER freespace; + + TRACE("(%p)->(%p)\n", This, v); + + if (!v) + return E_POINTER; + + if (!GetDiskFreeSpaceExW(This->root, &freespace, NULL, NULL)) + return E_FAIL; + + V_VT(v) = VT_R8; + return VarR8FromUI8(freespace.QuadPart, &V_R8(v)); +} + +static HRESULT WINAPI drive_get_TotalSize(IDrive *iface, VARIANT *v) +{ + struct drive *This = impl_from_IDrive(iface); + ULARGE_INTEGER total; + + TRACE("(%p)->(%p)\n", This, v); + + if (!v) + return E_POINTER; + + if (!GetDiskFreeSpaceExW(This->root, NULL, &total, NULL)) + return E_FAIL; + + V_VT(v) = VT_R8; + return VarR8FromUI8(total.QuadPart, &V_R8(v)); +} + +static HRESULT WINAPI drive_get_VolumeName(IDrive *iface, BSTR *name) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%p): stub\n", This, name); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_put_VolumeName(IDrive *iface, BSTR name) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%s): stub\n", This, debugstr_w(name)); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_get_FileSystem(IDrive *iface, BSTR *fs) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%p): stub\n", This, fs); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_get_SerialNumber(IDrive *iface, LONG *serial) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%p): stub\n", This, serial); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_get_IsReady(IDrive *iface, VARIANT_BOOL *ready) +{ + struct drive *This = impl_from_IDrive(iface); + ULARGE_INTEGER freespace; + BOOL ret; + + TRACE("(%p)->(%p)\n", This, ready); + + if (!ready) + return E_POINTER; + + ret = GetDiskFreeSpaceExW(This->root, &freespace, NULL, NULL); + *ready = ret ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; +} + +static const IDriveVtbl drivevtbl = { + drive_QueryInterface, + drive_AddRef, + drive_Release, + drive_GetTypeInfoCount, + drive_GetTypeInfo, + drive_GetIDsOfNames, + drive_Invoke, + drive_get_Path, + drive_get_DriveLetter, + drive_get_ShareName, + drive_get_DriveType, + drive_get_RootFolder, + drive_get_AvailableSpace, + drive_get_FreeSpace, + drive_get_TotalSize, + drive_get_VolumeName, + drive_put_VolumeName, + drive_get_FileSystem, + drive_get_SerialNumber, + drive_get_IsReady +}; + +static HRESULT create_drive(WCHAR letter, IDrive **drive) +{ + struct drive *This; + + *drive = NULL; + + This = heap_alloc(sizeof(*This)); + if (!This) return E_OUTOFMEMORY; + + This->IDrive_iface.lpVtbl = &drivevtbl; + This->ref = 1; + This->root = SysAllocStringLen(NULL, 3); + if (!This->root) + { + heap_free(This); + return E_OUTOFMEMORY; + } + This->root[0] = letter; + This->root[1] = ':'; + This->root[2] = '\\'; + This->root[3] = 0; + + *drive = &This->IDrive_iface; + return S_OK; +} + +static HRESULT WINAPI enumvariant_QueryInterface(IEnumVARIANT *iface, REFIID riid, void **obj) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + *obj = NULL; + + if (IsEqualIID( riid, &IID_IEnumVARIANT ) || + IsEqualIID( riid, &IID_IUnknown )) + { + *obj = iface; + IEnumVARIANT_AddRef(iface); + } + else + return E_NOINTERFACE; + + return S_OK; +} + +static ULONG WINAPI enumvariant_AddRef(IEnumVARIANT *iface) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + return ref; +} + +static ULONG WINAPI foldercoll_enumvariant_Release(IEnumVARIANT *iface) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + { + IFolderCollection_Release(&This->data.u.foldercoll.coll->IFolderCollection_iface); + FindClose(This->data.u.foldercoll.find); + heap_free(This); + } + + return ref; +} + +static HANDLE start_enumeration(const WCHAR *path, WIN32_FIND_DATAW *data, BOOL file) +{ + static const WCHAR allW[] = {'*',0}; + WCHAR pathW[MAX_PATH]; + int len; + HANDLE handle; + + strcpyW(pathW, path); + len = strlenW(pathW); + if (pathW[len-1] != '\\') + strcatW(pathW, bsW); + strcatW(pathW, allW); + handle = FindFirstFileW(pathW, data); + if (handle == INVALID_HANDLE_VALUE) return 0; + + /* find first dir/file */ + while (1) + { + if (file ? is_file_data(data) : is_dir_data(data)) + break; + + if (!FindNextFileW(handle, data)) + { + FindClose(handle); + return 0; + } + } + return handle; +} + +static HRESULT WINAPI foldercoll_enumvariant_Next(IEnumVARIANT *iface, ULONG celt, VARIANT *var, ULONG *fetched) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + HANDLE handle = This->data.u.foldercoll.find; + WIN32_FIND_DATAW data; + ULONG count = 0; + + TRACE("(%p)->(%d %p %p)\n", This, celt, var, fetched); + + if (fetched) + *fetched = 0; + + if (!celt) return S_OK; + + if (!handle) + { + handle = start_enumeration(This->data.u.foldercoll.coll->path, &data, FALSE); + if (!handle) return S_FALSE; + + This->data.u.foldercoll.find = handle; + } + else + { + if (!FindNextFileW(handle, &data)) + return S_FALSE; + } + + do + { + if (is_dir_data(&data)) + { + IFolder *folder; + HRESULT hr; + BSTR str; + + str = get_full_path(This->data.u.foldercoll.coll->path, &data); + hr = create_folder(str, &folder); + SysFreeString(str); + if (FAILED(hr)) return hr; + + V_VT(&var[count]) = VT_DISPATCH; + V_DISPATCH(&var[count]) = (IDispatch*)folder; + count++; + + if (count >= celt) break; + } + } while (FindNextFileW(handle, &data)); + + if (fetched) + *fetched = count; + + return (count < celt) ? S_FALSE : S_OK; +} + +static HRESULT WINAPI foldercoll_enumvariant_Skip(IEnumVARIANT *iface, ULONG celt) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + HANDLE handle = This->data.u.foldercoll.find; + WIN32_FIND_DATAW data; + + TRACE("(%p)->(%d)\n", This, celt); + + if (!celt) return S_OK; + + if (!handle) + { + handle = start_enumeration(This->data.u.foldercoll.coll->path, &data, FALSE); + if (!handle) return S_FALSE; + + This->data.u.foldercoll.find = handle; + } + else + { + if (!FindNextFileW(handle, &data)) + return S_FALSE; + } + + do + { + if (is_dir_data(&data)) + --celt; + + if (!celt) break; + } while (FindNextFileW(handle, &data)); + + return celt ? S_FALSE : S_OK; +} + +static HRESULT WINAPI foldercoll_enumvariant_Reset(IEnumVARIANT *iface) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + + TRACE("(%p)\n", This); + + FindClose(This->data.u.foldercoll.find); + This->data.u.foldercoll.find = NULL; + + return S_OK; +} + +static HRESULT WINAPI foldercoll_enumvariant_Clone(IEnumVARIANT *iface, IEnumVARIANT **pclone) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + TRACE("(%p)->(%p)\n", This, pclone); + return create_foldercoll_enum(This->data.u.foldercoll.coll, (IUnknown**)pclone); +} + +static const IEnumVARIANTVtbl foldercollenumvariantvtbl = { + enumvariant_QueryInterface, + enumvariant_AddRef, + foldercoll_enumvariant_Release, + foldercoll_enumvariant_Next, + foldercoll_enumvariant_Skip, + foldercoll_enumvariant_Reset, + foldercoll_enumvariant_Clone +}; + +static HRESULT create_foldercoll_enum(struct foldercollection *collection, IUnknown **newenum) +{ + struct enumvariant *This; + + *newenum = NULL; + + This = heap_alloc(sizeof(*This)); + if (!This) return E_OUTOFMEMORY; + + This->IEnumVARIANT_iface.lpVtbl = &foldercollenumvariantvtbl; + This->ref = 1; + This->data.u.foldercoll.find = NULL; + This->data.u.foldercoll.coll = collection; + IFolderCollection_AddRef(&collection->IFolderCollection_iface); + + *newenum = (IUnknown*)&This->IEnumVARIANT_iface; + + return S_OK; +} + +static ULONG WINAPI filecoll_enumvariant_Release(IEnumVARIANT *iface) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + { + IFileCollection_Release(&This->data.u.filecoll.coll->IFileCollection_iface); + FindClose(This->data.u.filecoll.find); + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI filecoll_enumvariant_Next(IEnumVARIANT *iface, ULONG celt, VARIANT *var, ULONG *fetched) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + HANDLE handle = This->data.u.filecoll.find; + WIN32_FIND_DATAW data; + ULONG count = 0; + + TRACE("(%p)->(%d %p %p)\n", This, celt, var, fetched); + + if (fetched) + *fetched = 0; + + if (!celt) return S_OK; + + if (!handle) + { + handle = start_enumeration(This->data.u.filecoll.coll->path, &data, TRUE); + if (!handle) return S_FALSE; + This->data.u.filecoll.find = handle; + } + else if (!FindNextFileW(handle, &data)) + return S_FALSE; + + do + { + if (is_file_data(&data)) + { + IFile *file; + HRESULT hr; + BSTR str; + + str = get_full_path(This->data.u.filecoll.coll->path, &data); + hr = create_file(str, &file); + SysFreeString(str); + if (FAILED(hr)) return hr; + + V_VT(&var[count]) = VT_DISPATCH; + V_DISPATCH(&var[count]) = (IDispatch*)file; + if (++count >= celt) break; + } + } while (FindNextFileW(handle, &data)); + + if (fetched) + *fetched = count; + + return (count < celt) ? S_FALSE : S_OK; +} + +static HRESULT WINAPI filecoll_enumvariant_Skip(IEnumVARIANT *iface, ULONG celt) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + HANDLE handle = This->data.u.filecoll.find; + WIN32_FIND_DATAW data; + + TRACE("(%p)->(%d)\n", This, celt); + + if (!celt) return S_OK; + + if (!handle) + { + handle = start_enumeration(This->data.u.filecoll.coll->path, &data, TRUE); + if (!handle) return S_FALSE; + This->data.u.filecoll.find = handle; + } + else if (!FindNextFileW(handle, &data)) + return S_FALSE; + + do + { + if (is_file_data(&data)) + --celt; + } while (celt && FindNextFileW(handle, &data)); + + return celt ? S_FALSE : S_OK; +} + +static HRESULT WINAPI filecoll_enumvariant_Reset(IEnumVARIANT *iface) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + + TRACE("(%p)\n", This); + + FindClose(This->data.u.filecoll.find); + This->data.u.filecoll.find = NULL; + + return S_OK; +} + +static HRESULT WINAPI filecoll_enumvariant_Clone(IEnumVARIANT *iface, IEnumVARIANT **pclone) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + TRACE("(%p)->(%p)\n", This, pclone); + return create_filecoll_enum(This->data.u.filecoll.coll, (IUnknown**)pclone); +} + +static const IEnumVARIANTVtbl filecollenumvariantvtbl = { + enumvariant_QueryInterface, + enumvariant_AddRef, + filecoll_enumvariant_Release, + filecoll_enumvariant_Next, + filecoll_enumvariant_Skip, + filecoll_enumvariant_Reset, + filecoll_enumvariant_Clone +}; + +static HRESULT create_filecoll_enum(struct filecollection *collection, IUnknown **newenum) +{ + struct enumvariant *This; + + *newenum = NULL; + + This = heap_alloc(sizeof(*This)); + if (!This) return E_OUTOFMEMORY; + + This->IEnumVARIANT_iface.lpVtbl = &filecollenumvariantvtbl; + This->ref = 1; + This->data.u.filecoll.find = NULL; + This->data.u.filecoll.coll = collection; + IFileCollection_AddRef(&collection->IFileCollection_iface); + + *newenum = (IUnknown*)&This->IEnumVARIANT_iface; + + return S_OK; +} + +static ULONG WINAPI drivecoll_enumvariant_Release(IEnumVARIANT *iface) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + { + IDriveCollection_Release(&This->data.u.drivecoll.coll->IDriveCollection_iface); + heap_free(This); + } + + return ref; +} + +static HRESULT find_next_drive(struct enumvariant *penum) +{ + int i = penum->data.u.drivecoll.cur == -1 ? 0 : penum->data.u.drivecoll.cur + 1; + + for (; i < 32; i++) + if (penum->data.u.drivecoll.coll->drives & (1 << i)) + { + penum->data.u.drivecoll.cur = i; + return S_OK; + } + + return S_FALSE; +} + +static HRESULT WINAPI drivecoll_enumvariant_Next(IEnumVARIANT *iface, ULONG celt, VARIANT *var, ULONG *fetched) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + ULONG count = 0; + + TRACE("(%p)->(%d %p %p)\n", This, celt, var, fetched); + + if (fetched) + *fetched = 0; + + if (!celt) return S_OK; + + while (find_next_drive(This) == S_OK) + { + IDrive *drive; + HRESULT hr; + + hr = create_drive('A' + This->data.u.drivecoll.cur, &drive); + if (FAILED(hr)) return hr; + + V_VT(&var[count]) = VT_DISPATCH; + V_DISPATCH(&var[count]) = (IDispatch*)drive; + + if (++count >= celt) break; + } + + if (fetched) + *fetched = count; + + return (count < celt) ? S_FALSE : S_OK; +} + +static HRESULT WINAPI drivecoll_enumvariant_Skip(IEnumVARIANT *iface, ULONG celt) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + + TRACE("(%p)->(%d)\n", This, celt); + + if (!celt) return S_OK; + + while (celt && find_next_drive(This) == S_OK) + celt--; + + return celt ? S_FALSE : S_OK; +} + +static HRESULT WINAPI drivecoll_enumvariant_Reset(IEnumVARIANT *iface) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + + TRACE("(%p)\n", This); + + This->data.u.drivecoll.cur = -1; + return S_OK; +} + +static HRESULT WINAPI drivecoll_enumvariant_Clone(IEnumVARIANT *iface, IEnumVARIANT **pclone) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + FIXME("(%p)->(%p): stub\n", This, pclone); + return E_NOTIMPL; +} + +static const IEnumVARIANTVtbl drivecollenumvariantvtbl = { + enumvariant_QueryInterface, + enumvariant_AddRef, + drivecoll_enumvariant_Release, + drivecoll_enumvariant_Next, + drivecoll_enumvariant_Skip, + drivecoll_enumvariant_Reset, + drivecoll_enumvariant_Clone +}; + +static HRESULT create_drivecoll_enum(struct drivecollection *collection, IUnknown **newenum) +{ + struct enumvariant *This; + + *newenum = NULL; + + This = heap_alloc(sizeof(*This)); + if (!This) return E_OUTOFMEMORY; + + This->IEnumVARIANT_iface.lpVtbl = &drivecollenumvariantvtbl; + This->ref = 1; + This->data.u.drivecoll.coll = collection; + This->data.u.drivecoll.cur = -1; + IDriveCollection_AddRef(&collection->IDriveCollection_iface); + + *newenum = (IUnknown*)&This->IEnumVARIANT_iface; + + return S_OK; +} + +static HRESULT WINAPI foldercoll_QueryInterface(IFolderCollection *iface, REFIID riid, void **obj) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + *obj = NULL; + + if (IsEqualIID( riid, &IID_IFolderCollection ) || + IsEqualIID( riid, &IID_IDispatch ) || + IsEqualIID( riid, &IID_IUnknown )) + { + *obj = iface; + IFolderCollection_AddRef(iface); + } + else + return E_NOINTERFACE; + + return S_OK; +} + +static ULONG WINAPI foldercoll_AddRef(IFolderCollection *iface) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + return ref; +} + +static ULONG WINAPI foldercoll_Release(IFolderCollection *iface) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + { + SysFreeString(This->path); + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI foldercoll_GetTypeInfoCount(IFolderCollection *iface, UINT *pctinfo) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + TRACE("(%p)->(%p)\n", This, pctinfo); + *pctinfo = 1; + return S_OK; +} + +static HRESULT WINAPI foldercoll_GetTypeInfo(IFolderCollection *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); + return get_typeinfo(IFolderCollection_tid, ppTInfo); +} + +static HRESULT WINAPI foldercoll_GetIDsOfNames(IFolderCollection *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); + + hr = get_typeinfo(IFolderCollection_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI foldercoll_Invoke(IFolderCollection *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, + DISPPARAMS *pDispParams, VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); + + hr = get_typeinfo(IFolderCollection_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI foldercoll_Add(IFolderCollection *iface, BSTR name, IFolder **folder) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + FIXME("(%p)->(%s %p): stub\n", This, debugstr_w(name), folder); + return E_NOTIMPL; +} + +static HRESULT WINAPI foldercoll_get_Item(IFolderCollection *iface, VARIANT key, IFolder **folder) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + FIXME("(%p)->(%p): stub\n", This, folder); + return E_NOTIMPL; +} + +static HRESULT WINAPI foldercoll_get__NewEnum(IFolderCollection *iface, IUnknown **newenum) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + + TRACE("(%p)->(%p)\n", This, newenum); + + if(!newenum) + return E_POINTER; + + return create_foldercoll_enum(This, newenum); +} + +static HRESULT WINAPI foldercoll_get_Count(IFolderCollection *iface, LONG *count) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + static const WCHAR allW[] = {'\\','*',0}; + WIN32_FIND_DATAW data; + WCHAR pathW[MAX_PATH]; + HANDLE handle; + + TRACE("(%p)->(%p)\n", This, count); + + if(!count) + return E_POINTER; + + *count = 0; + + strcpyW(pathW, This->path); + strcatW(pathW, allW); + handle = FindFirstFileW(pathW, &data); + if (handle == INVALID_HANDLE_VALUE) + return HRESULT_FROM_WIN32(GetLastError()); + + do + { + if (is_dir_data(&data)) + *count += 1; + } while (FindNextFileW(handle, &data)); + FindClose(handle); + + return S_OK; +} + +static const IFolderCollectionVtbl foldercollvtbl = { + foldercoll_QueryInterface, + foldercoll_AddRef, + foldercoll_Release, + foldercoll_GetTypeInfoCount, + foldercoll_GetTypeInfo, + foldercoll_GetIDsOfNames, + foldercoll_Invoke, + foldercoll_Add, + foldercoll_get_Item, + foldercoll_get__NewEnum, + foldercoll_get_Count +}; + +static HRESULT create_foldercoll(BSTR path, IFolderCollection **folders) +{ + struct foldercollection *This; + + *folders = NULL; + + This = heap_alloc(sizeof(struct foldercollection)); + if (!This) return E_OUTOFMEMORY; + + This->IFolderCollection_iface.lpVtbl = &foldercollvtbl; + This->ref = 1; + This->path = SysAllocString(path); + if (!This->path) + { + heap_free(This); + return E_OUTOFMEMORY; + } + + *folders = &This->IFolderCollection_iface; + + return S_OK; +} + +static HRESULT WINAPI filecoll_QueryInterface(IFileCollection *iface, REFIID riid, void **obj) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + *obj = NULL; + + if (IsEqualIID( riid, &IID_IFileCollection ) || + IsEqualIID( riid, &IID_IDispatch ) || + IsEqualIID( riid, &IID_IUnknown )) + { + *obj = iface; + IFileCollection_AddRef(iface); + } + else + return E_NOINTERFACE; + + return S_OK; +} + +static ULONG WINAPI filecoll_AddRef(IFileCollection *iface) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + return ref; +} + +static ULONG WINAPI filecoll_Release(IFileCollection *iface) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + { + SysFreeString(This->path); + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI filecoll_GetTypeInfoCount(IFileCollection *iface, UINT *pctinfo) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + TRACE("(%p)->(%p)\n", This, pctinfo); + *pctinfo = 1; + return S_OK; +} + +static HRESULT WINAPI filecoll_GetTypeInfo(IFileCollection *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); + return get_typeinfo(IFileCollection_tid, ppTInfo); +} + +static HRESULT WINAPI filecoll_GetIDsOfNames(IFileCollection *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); + + hr = get_typeinfo(IFileCollection_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI filecoll_Invoke(IFileCollection *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, + DISPPARAMS *pDispParams, VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); + + hr = get_typeinfo(IFileCollection_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI filecoll_get_Item(IFileCollection *iface, VARIANT Key, IFile **file) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + FIXME("(%p)->(%p)\n", This, file); + return E_NOTIMPL; +} + +static HRESULT WINAPI filecoll_get__NewEnum(IFileCollection *iface, IUnknown **ppenum) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + + TRACE("(%p)->(%p)\n", This, ppenum); + + if(!ppenum) + return E_POINTER; + + return create_filecoll_enum(This, ppenum); +} + +static HRESULT WINAPI filecoll_get_Count(IFileCollection *iface, LONG *count) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + FIXME("(%p)->(%p)\n", This, count); + return E_NOTIMPL; +} + +static const IFileCollectionVtbl filecollectionvtbl = { + filecoll_QueryInterface, + filecoll_AddRef, + filecoll_Release, + filecoll_GetTypeInfoCount, + filecoll_GetTypeInfo, + filecoll_GetIDsOfNames, + filecoll_Invoke, + filecoll_get_Item, + filecoll_get__NewEnum, + filecoll_get_Count +}; + +static HRESULT create_filecoll(BSTR path, IFileCollection **files) +{ + struct filecollection *This; + + *files = NULL; + + This = heap_alloc(sizeof(*This)); + if (!This) return E_OUTOFMEMORY; + + This->IFileCollection_iface.lpVtbl = &filecollectionvtbl; + This->ref = 1; + This->path = SysAllocString(path); + if (!This->path) + { + heap_free(This); + return E_OUTOFMEMORY; + } + + *files = &This->IFileCollection_iface; + return S_OK; +} + +static HRESULT WINAPI drivecoll_QueryInterface(IDriveCollection *iface, REFIID riid, void **obj) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + *obj = NULL; + + if (IsEqualIID( riid, &IID_IDriveCollection ) || + IsEqualIID( riid, &IID_IDispatch ) || + IsEqualIID( riid, &IID_IUnknown )) + { + *obj = iface; + IDriveCollection_AddRef(iface); + } + else + return E_NOINTERFACE; + + return S_OK; +} + +static ULONG WINAPI drivecoll_AddRef(IDriveCollection *iface) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + return ref; +} + +static ULONG WINAPI drivecoll_Release(IDriveCollection *iface) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + heap_free(This); + + return ref; +} + +static HRESULT WINAPI drivecoll_GetTypeInfoCount(IDriveCollection *iface, UINT *pctinfo) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + TRACE("(%p)->(%p)\n", This, pctinfo); + *pctinfo = 1; + return S_OK; +} + +static HRESULT WINAPI drivecoll_GetTypeInfo(IDriveCollection *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); + return get_typeinfo(IDriveCollection_tid, ppTInfo); +} + +static HRESULT WINAPI drivecoll_GetIDsOfNames(IDriveCollection *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); + + hr = get_typeinfo(IDriveCollection_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI drivecoll_Invoke(IDriveCollection *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, + DISPPARAMS *pDispParams, VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); + + hr = get_typeinfo(IDriveCollection_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI drivecoll_get_Item(IDriveCollection *iface, VARIANT key, IDrive **drive) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + FIXME("(%p)->(%p): stub\n", This, drive); + return E_NOTIMPL; +} + +static HRESULT WINAPI drivecoll_get__NewEnum(IDriveCollection *iface, IUnknown **ppenum) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + + TRACE("(%p)->(%p)\n", This, ppenum); + + if(!ppenum) + return E_POINTER; + + return create_drivecoll_enum(This, ppenum); +} + +static HRESULT WINAPI drivecoll_get_Count(IDriveCollection *iface, LONG *count) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + + TRACE("(%p)->(%p)\n", This, count); + + if (!count) return E_POINTER; + + *count = This->count; + return S_OK; +} + +static const IDriveCollectionVtbl drivecollectionvtbl = { + drivecoll_QueryInterface, + drivecoll_AddRef, + drivecoll_Release, + drivecoll_GetTypeInfoCount, + drivecoll_GetTypeInfo, + drivecoll_GetIDsOfNames, + drivecoll_Invoke, + drivecoll_get_Item, + drivecoll_get__NewEnum, + drivecoll_get_Count +}; + +static HRESULT create_drivecoll(IDriveCollection **drives) +{ + struct drivecollection *This; + DWORD mask; + + *drives = NULL; + + This = heap_alloc(sizeof(*This)); + if (!This) return E_OUTOFMEMORY; + + This->IDriveCollection_iface.lpVtbl = &drivecollectionvtbl; + This->ref = 1; + This->drives = mask = GetLogicalDrives(); + /* count set bits */ + for (This->count = 0; mask; This->count++) + mask &= mask - 1; + + *drives = &This->IDriveCollection_iface; + return S_OK; +} + static HRESULT WINAPI folder_QueryInterface(IFolder *iface, REFIID riid, void **obj) { struct folder *This = impl_from_IFolder(iface); @@ -331,8 +2030,9 @@ static HRESULT WINAPI folder_QueryInterface(IFolder *iface, REFIID riid, void ** *obj = NULL; - if (IsEqualGUID( riid, &IID_IFolder ) || - IsEqualGUID( riid, &IID_IUnknown)) + if (IsEqualIID( riid, &IID_IFolder ) || + IsEqualIID( riid, &IID_IDispatch ) || + IsEqualIID( riid, &IID_IUnknown)) { *obj = iface; IFolder_AddRef(iface); @@ -358,7 +2058,10 @@ static ULONG WINAPI folder_Release(IFolder *iface) TRACE("(%p)->(%d)\n", This, ref); if (!ref) + { + SysFreeString(This->path); heap_free(This); + } return ref; } @@ -425,15 +2128,39 @@ static HRESULT WINAPI folder_Invoke(IFolder *iface, DISPID dispIdMember, static HRESULT WINAPI folder_get_Path(IFolder *iface, BSTR *path) { struct folder *This = impl_from_IFolder(iface); - FIXME("(%p)->(%p): stub\n", This, path); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, path); + + if(!path) + return E_POINTER; + + *path = SysAllocString(This->path); + return *path ? S_OK : E_OUTOFMEMORY; } static HRESULT WINAPI folder_get_Name(IFolder *iface, BSTR *name) { struct folder *This = impl_from_IFolder(iface); - FIXME("(%p)->(%p): stub\n", This, name); - return E_NOTIMPL; + WCHAR *ptr; + + TRACE("(%p)->(%p)\n", This, name); + + if(!name) + return E_POINTER; + + *name = NULL; + + ptr = strrchrW(This->path, '\\'); + if (ptr) + { + *name = SysAllocString(ptr+1); + TRACE("%s\n", debugstr_w(*name)); + if (!*name) return E_OUTOFMEMORY; + } + else + return E_FAIL; + + return S_OK; } static HRESULT WINAPI folder_put_Name(IFolder *iface, BSTR name) @@ -551,15 +2278,25 @@ static HRESULT WINAPI folder_get_Size(IFolder *iface, VARIANT *size) static HRESULT WINAPI folder_get_SubFolders(IFolder *iface, IFolderCollection **folders) { struct folder *This = impl_from_IFolder(iface); - FIXME("(%p)->(%p): stub\n", This, folders); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, folders); + + if(!folders) + return E_POINTER; + + return create_foldercoll(This->path, folders); } static HRESULT WINAPI folder_get_Files(IFolder *iface, IFileCollection **files) { struct folder *This = impl_from_IFolder(iface); - FIXME("(%p)->(%p): stub\n", This, files); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, files); + + if(!files) + return E_POINTER; + + return create_filecoll(This->path, files); } static HRESULT WINAPI folder_CreateTextFile(IFolder *iface, BSTR filename, VARIANT_BOOL overwrite, @@ -601,15 +2338,25 @@ static const IFolderVtbl foldervtbl = { folder_CreateTextFile }; -static HRESULT create_folder(IFolder **folder) +HRESULT create_folder(const WCHAR *path, IFolder **folder) { struct folder *This; + *folder = NULL; + + TRACE("%s\n", debugstr_w(path)); + This = heap_alloc(sizeof(struct folder)); if (!This) return E_OUTOFMEMORY; This->IFolder_iface.lpVtbl = &foldervtbl; This->ref = 1; + This->path = SysAllocString(path); + if (!This->path) + { + heap_free(This); + return E_OUTOFMEMORY; + } *folder = &This->IFolder_iface; @@ -653,7 +2400,10 @@ static ULONG WINAPI file_Release(IFile *iface) TRACE("(%p) ref=%d\n", This, ref); if(!ref) + { heap_free(This->path); + heap_free(This); + } return ref; } @@ -722,11 +2472,29 @@ static HRESULT WINAPI file_get_Path(IFile *iface, BSTR *pbstrPath) return E_NOTIMPL; } -static HRESULT WINAPI file_get_Name(IFile *iface, BSTR *pbstrName) +static HRESULT WINAPI file_get_Name(IFile *iface, BSTR *name) { struct file *This = impl_from_IFile(iface); - FIXME("(%p)->(%p)\n", This, pbstrName); - return E_NOTIMPL; + WCHAR *ptr; + + TRACE("(%p)->(%p)\n", This, name); + + if(!name) + return E_POINTER; + + *name = NULL; + + ptr = strrchrW(This->path, '\\'); + if (ptr) + { + *name = SysAllocString(ptr+1); + TRACE("%s\n", debugstr_w(*name)); + if (!*name) return E_OUTOFMEMORY; + } + else + return E_FAIL; + + return S_OK; } static HRESULT WINAPI file_put_Name(IFile *iface, BSTR pbstrName) @@ -866,11 +2634,18 @@ static HRESULT WINAPI file_Move(IFile *iface, BSTR Destination) return E_NOTIMPL; } -static HRESULT WINAPI file_OpenAsTextStream(IFile *iface, IOMode IOMode, Tristate Format, ITextStream **ppts) +static HRESULT WINAPI file_OpenAsTextStream(IFile *iface, IOMode mode, Tristate format, ITextStream **stream) { struct file *This = impl_from_IFile(iface); - FIXME("(%p)->(%x %x %p)\n", This, IOMode, Format, ppts); - return E_NOTIMPL; + + TRACE("(%p)->(%d %d %p)\n", This, mode, format, stream); + + if (format == TristateUseDefault) { + FIXME("default format not handled, defaulting to unicode\n"); + format = TristateTrue; + } + + return create_textstream(This->path, OPEN_EXISTING, mode, format == TristateTrue, stream); } static const IFileVtbl file_vtbl = { @@ -1054,17 +2829,66 @@ static HRESULT WINAPI filesys_Invoke(IFileSystem3 *iface, DISPID dispIdMember, static HRESULT WINAPI filesys_get_Drives(IFileSystem3 *iface, IDriveCollection **ppdrives) { - FIXME("%p %p\n", iface, ppdrives); - - return E_NOTIMPL; + TRACE("%p %p\n", iface, ppdrives); + return create_drivecoll(ppdrives); } static HRESULT WINAPI filesys_BuildPath(IFileSystem3 *iface, BSTR Path, - BSTR Name, BSTR *pbstrResult) + BSTR Name, BSTR *Result) { - FIXME("%p %s %s %p\n", iface, debugstr_w(Path), debugstr_w(Name), pbstrResult); + BSTR ret; - return E_NOTIMPL; + TRACE("%p %s %s %p\n", iface, debugstr_w(Path), debugstr_w(Name), Result); + + if (!Result) return E_POINTER; + + if (Path && Name) + { + int path_len = SysStringLen(Path), name_len = SysStringLen(Name); + + /* if both parts have backslashes strip one from Path */ + if (Path[path_len-1] == '\\' && Name[0] == '\\') + { + path_len -= 1; + + ret = SysAllocStringLen(NULL, path_len + name_len); + if (ret) + { + strcpyW(ret, Path); + ret[path_len] = 0; + strcatW(ret, Name); + } + } + else if (Path[path_len-1] != '\\' && Name[0] != '\\') + { + ret = SysAllocStringLen(NULL, path_len + name_len + 1); + if (ret) + { + strcpyW(ret, Path); + if (Path[path_len-1] != ':') + strcatW(ret, bsW); + strcatW(ret, Name); + } + } + else + { + ret = SysAllocStringLen(NULL, path_len + name_len); + if (ret) + { + strcpyW(ret, Path); + strcatW(ret, Name); + } + } + } + else if (Path || Name) + ret = SysAllocString(Path ? Path : Name); + else + ret = SysAllocStringLen(NULL, 0); + + if (!ret) return E_OUTOFMEMORY; + *Result = ret; + + return S_OK; } static HRESULT WINAPI filesys_GetDriveName(IFileSystem3 *iface, BSTR Path, @@ -1334,11 +3158,24 @@ static HRESULT WINAPI filesys_GetFile(IFileSystem3 *iface, BSTR FilePath, } static HRESULT WINAPI filesys_GetFolder(IFileSystem3 *iface, BSTR FolderPath, - IFolder **ppfolder) + IFolder **folder) { - FIXME("%p %s %p\n", iface, debugstr_w(FolderPath), ppfolder); + DWORD attrs; - return E_NOTIMPL; + TRACE("%p %s %p\n", iface, debugstr_w(FolderPath), folder); + + if(!folder) + return E_POINTER; + + *folder = NULL; + if(!FolderPath) + return E_INVALIDARG; + + attrs = GetFileAttributesW(FolderPath); + if((attrs == INVALID_FILE_ATTRIBUTES) || !(attrs & FILE_ATTRIBUTE_DIRECTORY)) + return CTL_E_PATHNOTFOUND; + + return create_folder(FolderPath, folder); } static HRESULT WINAPI filesys_GetSpecialFolder(IFileSystem3 *iface, @@ -1530,8 +3367,10 @@ static inline HRESULT copy_file(const WCHAR *source, DWORD source_len, return CTL_E_FILENOTFOUND; src_len = get_parent_folder_name(source, source_len); - if(src_len+1 >= MAX_PATH) + if(src_len+1 >= MAX_PATH) { + FindClose(f); return E_FAIL; + } if(src_len) { memcpy(src_path, source, src_len*sizeof(WCHAR)); src_path[src_len++] = '\\'; @@ -1674,10 +3513,9 @@ static HRESULT copy_folder(const WCHAR *source, DWORD source_len, const WCHAR *d FindClose(f); return CTL_E_FILEALREADYEXISTS; } - }else { - FindClose(f); - return create_error(GetLastError()); } + + FindClose(f); return create_error(GetLastError()); } copied = TRUE; @@ -1726,24 +3564,36 @@ static HRESULT WINAPI filesys_CreateFolder(IFileSystem3 *iface, BSTR path, return HRESULT_FROM_WIN32(GetLastError()); } - return create_folder(folder); + return create_folder(path, folder); } -static HRESULT WINAPI filesys_CreateTextFile(IFileSystem3 *iface, BSTR FileName, - VARIANT_BOOL Overwrite, VARIANT_BOOL Unicode, - ITextStream **ppts) +static HRESULT WINAPI filesys_CreateTextFile(IFileSystem3 *iface, BSTR filename, + VARIANT_BOOL overwrite, VARIANT_BOOL unicode, + ITextStream **stream) { - FIXME("%p %s %d %d %p\n", iface, debugstr_w(FileName), Overwrite, Unicode, ppts); + DWORD disposition; - return E_NOTIMPL; + TRACE("%p %s %d %d %p\n", iface, debugstr_w(filename), overwrite, unicode, stream); + + disposition = overwrite == VARIANT_TRUE ? CREATE_ALWAYS : CREATE_NEW; + return create_textstream(filename, disposition, ForWriting, !!unicode, stream); } static HRESULT WINAPI filesys_OpenTextFile(IFileSystem3 *iface, BSTR filename, IOMode mode, VARIANT_BOOL create, Tristate format, ITextStream **stream) { - FIXME("(%p)->(%s %d %d %d %p)\n", iface, debugstr_w(filename), mode, create, format, stream); - return create_textstream(mode, stream); + DWORD disposition; + + TRACE("(%p)->(%s %d %d %d %p)\n", iface, debugstr_w(filename), mode, create, format, stream); + disposition = create == VARIANT_TRUE ? OPEN_ALWAYS : OPEN_EXISTING; + + if (format == TristateUseDefault) { + FIXME("default format not handled, defaulting to unicode\n"); + format = TristateTrue; + } + + return create_textstream(filename, disposition, mode, format == TristateTrue, stream); } static HRESULT WINAPI filesys_GetStandardStream(IFileSystem3 *iface, @@ -1758,7 +3608,7 @@ static HRESULT WINAPI filesys_GetStandardStream(IFileSystem3 *iface, static void get_versionstring(VS_FIXEDFILEINFO *info, WCHAR *ver) { - static WCHAR fmtW[] = {'%','d','.','%','d','.','%','d','.','%','d',0}; + static const WCHAR fmtW[] = {'%','d','.','%','d','.','%','d','.','%','d',0}; DWORDLONG version; WORD a, b, c, d; diff --git a/dll/win32/scrrun/scrrun.c b/dll/win32/scrrun/scrrun.c index 23b39753d71..3891ac83817 100644 --- a/dll/win32/scrrun/scrrun.c +++ b/dll/win32/scrrun/scrrun.c @@ -90,9 +90,14 @@ static ITypeInfo *typeinfos[LAST_tid]; static REFIID tid_ids[] = { &IID_NULL, &IID_IDictionary, + &IID_IDrive, + &IID_IDriveCollection, + &IID_IFile, + &IID_IFileCollection, &IID_IFileSystem3, &IID_IFolder, - &IID_IFile + &IID_IFolderCollection, + &IID_ITextStream }; static HRESULT load_typelib(void) diff --git a/dll/win32/scrrun/scrrun.idl b/dll/win32/scrrun/scrrun.idl index 4b18af140d7..53125ee619a 100644 --- a/dll/win32/scrrun/scrrun.idl +++ b/dll/win32/scrrun/scrrun.idl @@ -15,6 +15,9 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ + +#pragma makedep regtypelib + import "unknwn.idl"; import "objidl.idl"; import "oaidl.idl"; @@ -24,6 +27,7 @@ cpp_quote("#undef CopyFile") cpp_quote("#undef DeleteFile") cpp_quote("#undef MoveFile") cpp_quote("#endif") +cpp_quote("#define CTL_E_ENDOFFILE STD_CTL_SCODE(62)") /* this is not defined in public headers */ [ uuid(420B2830-E718-11CF-893D-00A0C9054228), @@ -33,23 +37,13 @@ library Scripting { importlib("stdole2.tlb"); - interface IDictionary; - interface IDrive; - interface IDriveCollection; - interface IFile; - interface IFileCollection; - interface IFileSystem; - interface IFileSystem3; interface IFolder; - interface IFolderCollection; - interface IScriptEncoder; - interface ITextStream; typedef enum CompareMethod { - BinaryCompare = 0, - TextCompare = 1, - DatabaseCompare = 2 + BinaryCompare, + TextCompare, + DatabaseCompare } CompareMethod; typedef enum IOMode @@ -61,10 +55,10 @@ library Scripting typedef enum Tristate { - TristateTrue = 0xffffffff, - TristateFalse = 0, - TristateUseDefault = 0xfffffffe, - TristateMixed = 0xfffffffe + TristateTrue = -1, + TristateFalse = 0, + TristateUseDefault = -2, + TristateMixed = -2 } Tristate; typedef enum FileAttribute @@ -82,26 +76,26 @@ library Scripting typedef enum SpecialFolderConst { - WindowsFolder = 0, - SystemFolder = 1, - TemporaryFolder = 2 + WindowsFolder, + SystemFolder, + TemporaryFolder } SpecialFolderConst; typedef enum DriveTypeConst { - UnknownType = 0, - Removable = 1, - Fixed = 2, - Remote = 3, - CDRom = 4, - RamDisk = 5 + UnknownType, + Removable, + Fixed, + Remote, + CDRom, + RamDisk } DriveTypeConst; typedef enum StandardStreamTypes { - StdIn = 0, - StdOut = 1, - StdErr = 2 + StdIn, + StdOut, + StdErr } StandardStreamTypes; [ @@ -113,13 +107,13 @@ library Scripting ] interface IDictionary : IDispatch { - [id(00000000), propputref] + [id(DISPID_VALUE), propputref] HRESULT Item([in] VARIANT* Key, [in] VARIANT* pRetItem); - [id(00000000), propput] + [id(DISPID_VALUE), propput] HRESULT Item([in] VARIANT* Key, [in] VARIANT* pRetItem); - [id(00000000), propget] + [id(DISPID_VALUE), propget] HRESULT Item([in] VARIANT* Key, [out, retval] VARIANT* pRetItem); [id(0x00000001)] @@ -159,6 +153,191 @@ library Scripting HRESULT HashVal([in] VARIANT* Key, [out, retval] VARIANT* HashVal); } + [ + odl, + uuid(C7C3F5A0-88A3-11D0-ABCB-00A0C90FFFC0), + hidden, + dual, + nonextensible, + oleautomation + ] + interface IDrive : IDispatch + { + [id(DISPID_VALUE), propget] + HRESULT Path([out, retval] BSTR* pbstrPath); + + [id(0x00002710), propget] + HRESULT DriveLetter([out, retval] BSTR* pbstrLetter); + + [id(0x00002711), propget] + HRESULT ShareName([out, retval] BSTR* pbstrShareName); + + [id(0x00002712), propget] + HRESULT DriveType([out, retval] DriveTypeConst* pdt); + + [id(0x00002713), propget] + HRESULT RootFolder([out, retval] IFolder** ppfolder); + + [id(0x00002715), propget] + HRESULT AvailableSpace([out, retval] VARIANT* pvarAvail); + + [id(0x00002714), propget] + HRESULT FreeSpace([out, retval] VARIANT* pvarFree); + + [id(0x00002716), propget] + HRESULT TotalSize([out, retval] VARIANT* pvarTotal); + + [id(0x00002717), propget] + HRESULT VolumeName([out, retval] BSTR* pbstrName); + + [id(0x00002717), propput] + HRESULT VolumeName([in] BSTR pbstrName); + + [id(0x00002718), propget] + HRESULT FileSystem([out, retval] BSTR* pbstrFileSystem); + + [id(0x00002719), propget] + HRESULT SerialNumber([out, retval] long* pulSerialNumber); + + [id(0x0000271a), propget] + HRESULT IsReady([out, retval] VARIANT_BOOL* pfReady); + } + + [ + odl, + uuid(C7C3F5A1-88A3-11D0-ABCB-00A0C90FFFC0), + hidden, + dual, + nonextensible, + oleautomation + ] + interface IDriveCollection : IDispatch { + [id(DISPID_VALUE), propget] + HRESULT Item([in] VARIANT Key, [out, retval] IDrive** ppdrive); + + [id(DISPID_NEWENUM), propget, restricted, hidden] + HRESULT _NewEnum([out, retval] IUnknown** ppenum); + + [id(0x00000001), propget] + HRESULT Count([out, retval] long* plCount); + } + + [ + odl, + uuid(53BAD8C1-E718-11CF-893D-00A0C9054228), + hidden, + dual, + nonextensible, + oleautomation + ] + interface ITextStream : IDispatch + { + [id(0x00002710), propget] + HRESULT Line([out, retval] long* Line); + + [id(0xfffffdef), propget] + HRESULT Column([out, retval] long* Column); + + [id(0x00002712), propget] + HRESULT AtEndOfStream([out, retval] VARIANT_BOOL* EOS); + + [id(0x00002713), propget] + HRESULT AtEndOfLine([out, retval] VARIANT_BOOL* EOL); + + [id(0x00002714)] + HRESULT Read([in] long Characters, [out, retval] BSTR* Text); + + [id(0x00002715)] + HRESULT ReadLine([out, retval] BSTR* Text); + + [id(0x00002716)] + HRESULT ReadAll([out, retval] BSTR* Text); + + [id(0x00002717)] + HRESULT Write([in] BSTR Text); + + [id(0x00002718)] + HRESULT WriteLine([in, defaultvalue("")] BSTR Text); + + [id(0x00002719)] + HRESULT WriteBlankLines([in] long Lines); + + [id(0x0000271a)] + HRESULT Skip([in] long Characters); + + [id(0x0000271b)] + HRESULT SkipLine(); + + [id(0x0000271c)] + HRESULT Close(); + } + + [ + odl, + uuid(C7C3F5A4-88A3-11D0-ABCB-00A0C90FFFC0), + hidden, + dual, + nonextensible, + oleautomation + ] + interface IFile : IDispatch + { + [id(DISPID_VALUE), propget] + HRESULT Path([out, retval] BSTR* pbstrPath); + + [id(0x000003e8), propget] + HRESULT Name([out, retval] BSTR* pbstrName); + + [id(0x000003e8), propput] + HRESULT Name([in] BSTR pbstrName); + + [id(0x000003ea), propget] + HRESULT ShortPath([out, retval] BSTR* pbstrPath); + + [id(0x000003e9), propget] + HRESULT ShortName([out, retval] BSTR* pbstrName); + + [id(0x000003ec), propget] + HRESULT Drive([out, retval] IDrive** ppdrive); + + [id(0x000003ed), propget] + HRESULT ParentFolder([out, retval] IFolder** ppfolder); + + [id(0x000003eb), propget] + HRESULT Attributes([out, retval] FileAttribute* pfa); + + [id(0x000003eb), propput] + HRESULT Attributes([in] FileAttribute pfa); + + [id(0x000003ee), propget] + HRESULT DateCreated([out, retval] DATE* pdate); + + [id(0x000003ef), propget] + HRESULT DateLastModified([out, retval] DATE* pdate); + + [id(0x000003f0), propget] + HRESULT DateLastAccessed([out, retval] DATE* pdate); + + [id(0x000003f1), propget] + HRESULT Size([out, retval] VARIANT* pvarSize); + + [id(0x000003f2), propget] + HRESULT Type([out, retval] BSTR* pbstrType); + + [id(0x000004b0)] + HRESULT Delete([in, defaultvalue(0)] VARIANT_BOOL Force); + + [id(0x000004b2)] + HRESULT Copy([in] BSTR Destination, [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + + [id(0x000004b4)] + HRESULT Move([in] BSTR Destination); + + [id(0x0000044c)] + HRESULT OpenAsTextStream([in, defaultvalue(1)] IOMode IOMode, + [in, defaultvalue(0)] Tristate Format, [out, retval] ITextStream** ppts); + } + [ odl, uuid(0AB5A3D0-E5B6-11D0-ABF5-00A0C90FFFC0), @@ -218,10 +397,10 @@ library Scripting HRESULT GetSpecialFolder([in] SpecialFolderConst SpecialFolder, [out, retval] IFolder** ppfolder); [id(0x000004b0)] - HRESULT DeleteFile([in] BSTR FileSpec, [in, optional, defaultvalue(0)] VARIANT_BOOL Force); + HRESULT DeleteFile([in] BSTR FileSpec, [in, defaultvalue(0)] VARIANT_BOOL Force); [id(0x000004b1)] - HRESULT DeleteFolder([in] BSTR FolderSpec, [in, optional, defaultvalue(0)] VARIANT_BOOL Force); + HRESULT DeleteFolder([in] BSTR FolderSpec, [in, defaultvalue(0)] VARIANT_BOOL Force); [id(0x000004b4), helpstring("Move a file"), helpcontext(0x00214bab)] HRESULT MoveFile([in] BSTR Source, [in] BSTR Destination); @@ -231,37 +410,38 @@ library Scripting [id(0x000004b2)] HRESULT CopyFile([in] BSTR Source, [in] BSTR Destination, - [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); [id(0x000004b3)] HRESULT CopyFolder([in] BSTR Source, [in] BSTR Destination, - [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); [id(0x00000460)] HRESULT CreateFolder([in] BSTR Path, [out, retval] IFolder** ppfolder); [id(0x0000044d)] - HRESULT CreateTextFile([in] BSTR FileName, [in, optional, defaultvalue(-1)] VARIANT_BOOL Overwrite, - [in, optional, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); + HRESULT CreateTextFile([in] BSTR FileName, [in, defaultvalue(-1)] VARIANT_BOOL Overwrite, + [in, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); [id(0x0000044c)] - HRESULT OpenTextFile([in] BSTR FileName, [in, optional, defaultvalue(1)] IOMode IOMode, - [in, optional, defaultvalue(0)] VARIANT_BOOL Create, - [in, optional, defaultvalue(0)] Tristate Format, + HRESULT OpenTextFile([in] BSTR FileName, [in, defaultvalue(1)] IOMode IOMode, + [in, defaultvalue(0)] VARIANT_BOOL Create, + [in, defaultvalue(0)] Tristate Format, [out, retval] ITextStream** ppts); } [ odl, - uuid(C7C3F5A1-88A3-11D0-ABCB-00A0C90FFFC0), + uuid(C7C3F5A5-88A3-11D0-ABCB-00A0C90FFFC0), hidden, dual, nonextensible, oleautomation ] - interface IDriveCollection : IDispatch { - [id(00000000)] - HRESULT Item([in] VARIANT Key, [out, retval] IDrive** ppdrive); + interface IFileCollection : IDispatch + { + [id(DISPID_VALUE), propget] + HRESULT Item([in] VARIANT Key, [out, retval] IFile** ppfile); [id(DISPID_NEWENUM), propget, restricted, hidden] HRESULT _NewEnum([out, retval] IUnknown** ppenum); @@ -272,52 +452,25 @@ library Scripting [ odl, - uuid(C7C3F5A0-88A3-11D0-ABCB-00A0C90FFFC0), + uuid(C7C3F5A3-88A3-11D0-ABCB-00A0C90FFFC0), hidden, dual, nonextensible, oleautomation ] - interface IDrive : IDispatch + interface IFolderCollection : IDispatch { - [id(00000000), propget] - HRESULT Path([out, retval] BSTR* pbstrPath); + [id(0x00000002)] + HRESULT Add([in] BSTR Name, [out, retval] IFolder** ppfolder); - [id(0x00002710), propget] - HRESULT DriveLetter([out, retval] BSTR* pbstrLetter) -; - [id(0x00002711), propget] - HRESULT ShareName([out, retval] BSTR* pbstrShareName); + [id(DISPID_VALUE), propget] + HRESULT Item([in] VARIANT Key, [out, retval] IFolder** ppfolder); - [id(0x00002712), propget] - HRESULT DriveType([out, retval] DriveTypeConst* pdt); + [id(DISPID_NEWENUM), propget, restricted, hidden] + HRESULT _NewEnum([out, retval] IUnknown** ppenum); - [id(0x00002713), propget] - HRESULT RootFolder([out, retval] IFolder** ppfolder); - - [id(0x00002715), propget] - HRESULT AvailableSpace([out, retval] VARIANT* pvarAvail); - - [id(0x00002714), propget] - HRESULT FreeSpace([out, retval] VARIANT* pvarFree); - - [id(0x00002716), propget] - HRESULT TotalSize([out, retval] VARIANT* pvarTotal); - - [id(0x00002717), propget] - HRESULT VolumeName([out, retval] BSTR* pbstrName); - - [id(0x00002717), propput] - HRESULT VolumeName([in] BSTR pbstrName); - - [id(0x00002718), propget] - HRESULT FileSystem([out, retval] BSTR* pbstrFileSystem); - - [id(0x00002719), propget] - HRESULT SerialNumber([out, retval] long* pulSerialNumber); - - [id(0x0000271a), propget] - HRESULT IsReady([out, retval] VARIANT_BOOL* pfReady); + [id(0x00000001), propget] + HRESULT Count([out, retval] long* plCount); } [ @@ -330,7 +483,7 @@ library Scripting ] interface IFolder : IDispatch { - [id(00000000), propget] + [id(DISPID_VALUE), propget] HRESULT Path([out, retval] BSTR* pbstrPath); [id(0x000003e8), propget] @@ -370,10 +523,10 @@ library Scripting HRESULT Type([out, retval] BSTR* pbstrType); [id(0x000004b1)] - HRESULT Delete([in, optional, defaultvalue(0)] VARIANT_BOOL Force); + HRESULT Delete([in, defaultvalue(0)] VARIANT_BOOL Force); [id(0x000004b3)] - HRESULT Copy([in] BSTR Destination, [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + HRESULT Copy([in] BSTR Destination, [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); [id(0x000004b5)] HRESULT Move([in] BSTR Destination); @@ -391,167 +544,8 @@ library Scripting HRESULT Files([out, retval] IFileCollection** ppfiles); [id(0x0000044d)] - HRESULT CreateTextFile([in] BSTR FileName, [in, optional, defaultvalue(-1)] VARIANT_BOOL Overwrite, - [in, optional, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); - } - - [ - odl, - uuid(C7C3F5A3-88A3-11D0-ABCB-00A0C90FFFC0), - hidden, - dual, - nonextensible, - oleautomation - ] - interface IFolderCollection : IDispatch - { - [id(0x00000002)] - HRESULT Add([in] BSTR Name, [out, retval] IFolder** ppfolder); - - [id(00000000), propget] - HRESULT Item([in] VARIANT Key, [out, retval] IFolder** ppfolder); - - [id(DISPID_NEWENUM), propget, restricted, hidden] - HRESULT _NewEnum([out, retval] IUnknown** ppenum); - - [id(0x00000001), propget] - HRESULT Count([out, retval] long* plCount); - } - - [ - odl, - uuid(C7C3F5A5-88A3-11D0-ABCB-00A0C90FFFC0), - hidden, - dual, - nonextensible, - oleautomation - ] - interface IFileCollection : IDispatch - { - [id(00000000), propget] - HRESULT Item([in] VARIANT Key, [out, retval] IFile** ppfile); - - [id(DISPID_NEWENUM), propget, restricted, hidden] - HRESULT _NewEnum([out, retval] IUnknown** ppenum); - - [id(0x00000001), propget] - HRESULT Count([out, retval] long* plCount); - } - - [ - odl, - uuid(C7C3F5A4-88A3-11D0-ABCB-00A0C90FFFC0), - hidden, - dual, - nonextensible, - oleautomation - ] - interface IFile : IDispatch - { - [id(00000000), propget] - HRESULT Path([out, retval] BSTR* pbstrPath); - - [id(0x000003e8), propget] - HRESULT Name([out, retval] BSTR* pbstrName); - - [id(0x000003e8), propput] - HRESULT Name([in] BSTR pbstrName); - - [id(0x000003ea), propget] - HRESULT ShortPath([out, retval] BSTR* pbstrPath); - - [id(0x000003e9), propget] - HRESULT ShortName([out, retval] BSTR* pbstrName); - - [id(0x000003ec), propget] - HRESULT Drive([out, retval] IDrive** ppdrive); - - [id(0x000003ed), propget] - HRESULT ParentFolder([out, retval] IFolder** ppfolder); - - [id(0x000003eb), propget] - HRESULT Attributes([out, retval] FileAttribute* pfa); - - [id(0x000003eb), propput] - HRESULT Attributes([in] FileAttribute pfa); - - [id(0x000003ee), propget] - HRESULT DateCreated([out, retval] DATE* pdate); - - [id(0x000003ef), propget] - HRESULT DateLastModified([out, retval] DATE* pdate); - - [id(0x000003f0), propget] - HRESULT DateLastAccessed([out, retval] DATE* pdate); - - [id(0x000003f1), propget] - HRESULT Size([out, retval] VARIANT* pvarSize); - - [id(0x000003f2), propget] - HRESULT Type([out, retval] BSTR* pbstrType); - - [id(0x000004b0)] - HRESULT Delete([in, optional, defaultvalue(0)] VARIANT_BOOL Force); - - [id(0x000004b2)] - HRESULT Copy([in] BSTR Destination, [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); - - [id(0x000004b4)] - HRESULT Move([in] BSTR Destination); - - [id(0x0000044c)] - HRESULT OpenAsTextStream([in, optional, defaultvalue(1)] IOMode IOMode, - [in, optional, defaultvalue(0)] Tristate Format, [out, retval] ITextStream** ppts); - } - - [ - odl, - uuid(53BAD8C1-E718-11CF-893D-00A0C9054228), - hidden, - dual, - nonextensible, - oleautomation - ] - interface ITextStream : IDispatch - { - [id(0x00002710), propget] - HRESULT Line([out, retval] long* Line); - - [id(0xfffffdef), propget] - HRESULT Column([out, retval] long* Column); - - [id(0x00002712), propget] - HRESULT AtEndOfStream([out, retval] VARIANT_BOOL* EOS); - - [id(0x00002713), propget] - HRESULT AtEndOfLine([out, retval] VARIANT_BOOL* EOL); - - [id(0x00002714)] - HRESULT Read([in] long Characters, [out, retval] BSTR* Text); - - [id(0x00002715)] - HRESULT ReadLine([out, retval] BSTR* Text); - - [id(0x00002716)] - HRESULT ReadAll([out, retval] BSTR* Text); - - [id(0x00002717)] - HRESULT Write([in] BSTR Text); - - [id(0x00002718)] - HRESULT WriteLine([in, optional, defaultvalue("")] BSTR Text); - - [id(0x00002719)] - HRESULT WriteBlankLines([in] long Lines); - - [id(0x0000271a)] - HRESULT Skip([in] long Characters); - - [id(0x0000271b)] - HRESULT SkipLine(); - - [id(0x0000271c)] - HRESULT Close(); + HRESULT CreateTextFile([in] BSTR FileName, [in, defaultvalue(-1)] VARIANT_BOOL Overwrite, + [in, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); } [ @@ -565,7 +559,7 @@ library Scripting { [id(0x00004e20)] HRESULT GetStandardStream([in] StandardStreamTypes StandardStreamType, - [in, optional, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); + [in, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); [id(0x00004e2a)] HRESULT GetFileVersion([in] BSTR FileName, [out, retval] BSTR* FileVersion); @@ -579,7 +573,7 @@ library Scripting ] interface IScriptEncoder : IDispatch { - [id(00000000)] + [id(DISPID_VALUE)] HRESULT EncodeScriptFile([in] BSTR szExt, [in] BSTR bstrStreamIn, [in] long cFlags, [in] BSTR bstrDefaultLang, [out, retval] BSTR* pbstrStreamOut); } diff --git a/dll/win32/scrrun/scrrun_private.h b/dll/win32/scrrun/scrrun_private.h index 4fccf44d133..f3ba4aab81e 100644 --- a/dll/win32/scrrun/scrrun_private.h +++ b/dll/win32/scrrun/scrrun_private.h @@ -47,10 +47,14 @@ typedef enum tid_t { NULL_tid, IDictionary_tid, + IDrive_tid, + IDriveCollection_tid, + IFile_tid, + IFileCollection_tid, IFileSystem3_tid, IFolder_tid, + IFolderCollection_tid, ITextStream_tid, - IFile_tid, LAST_tid } tid_t; diff --git a/dll/win32/scrrun/scrrun_tlb.rgs b/dll/win32/scrrun/scrrun_tlb.rgs index beea9215524..ba6f9a7c77c 100644 --- a/dll/win32/scrrun/scrrun_tlb.rgs +++ b/dll/win32/scrrun/scrrun_tlb.rgs @@ -19,7 +19,7 @@ HKCR ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' TypeLib = s '{420B2830-E718-11CF-893D-00A0C9054228}' { val Version = s '1.0' } } - '{0AB5A3D0-E5B6-11D0-ABF5-00A0C90FFFC0}' = s 'IFileSystem' + '{C7C3F5A0-88A3-11D0-ABCB-00A0C90FFFC0}' = s 'IDrive' { ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' @@ -31,25 +31,7 @@ HKCR ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' TypeLib = s '{420B2830-E718-11CF-893D-00A0C9054228}' { val Version = s '1.0' } } - '{C7C3F5A0-88A3-11D0-ABCB-00A0C90FFFC0}' = s 'IDrive' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{420B2830-E718-11CF-893D-00A0C9054228}' { val Version = s '1.0' } - } - '{C7C3F5A2-88A3-11D0-ABCB-00A0C90FFFC0}' = s 'IFolder' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{420B2830-E718-11CF-893D-00A0C9054228}' { val Version = s '1.0' } - } - '{C7C3F5A3-88A3-11D0-ABCB-00A0C90FFFC0}' = s 'IFolderCollection' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{420B2830-E718-11CF-893D-00A0C9054228}' { val Version = s '1.0' } - } - '{C7C3F5A5-88A3-11D0-ABCB-00A0C90FFFC0}' = s 'IFileCollection' + '{53BAD8C1-E718-11CF-893D-00A0C9054228}' = s 'ITextStream' { ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' @@ -61,7 +43,25 @@ HKCR ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' TypeLib = s '{420B2830-E718-11CF-893D-00A0C9054228}' { val Version = s '1.0' } } - '{53BAD8C1-E718-11CF-893D-00A0C9054228}' = s 'ITextStream' + '{0AB5A3D0-E5B6-11D0-ABF5-00A0C90FFFC0}' = s 'IFileSystem' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{420B2830-E718-11CF-893D-00A0C9054228}' { val Version = s '1.0' } + } + '{C7C3F5A5-88A3-11D0-ABCB-00A0C90FFFC0}' = s 'IFileCollection' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{420B2830-E718-11CF-893D-00A0C9054228}' { val Version = s '1.0' } + } + '{C7C3F5A3-88A3-11D0-ABCB-00A0C90FFFC0}' = s 'IFolderCollection' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{420B2830-E718-11CF-893D-00A0C9054228}' { val Version = s '1.0' } + } + '{C7C3F5A2-88A3-11D0-ABCB-00A0C90FFFC0}' = s 'IFolder' { ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' diff --git a/dll/win32/shell32/shellole.cpp b/dll/win32/shell32/shellole.cpp index ef9e56b4126..f39d1b580fa 100644 --- a/dll/win32/shell32/shellole.cpp +++ b/dll/win32/shell32/shellole.cpp @@ -710,3 +710,14 @@ EXTERN_C HRESULT WINAPI SHPropStgWriteMultiple(IPropertyStorage *pps, UINT *uCod hres = pps->WriteMultiple(cpspec, rgpspec, rgvar, propidNameFirst); return hres; } + +/************************************************************************* + * SHCreateQueryCancelAutoPlayMoniker [SHELL32.@] + */ +HRESULT WINAPI SHCreateQueryCancelAutoPlayMoniker(IMoniker **moniker) +{ + TRACE("%p\n", moniker); + + if (!moniker) return E_INVALIDARG; + return CreateClassMoniker(CLSID_QueryCancelAutoPlay, moniker); +} diff --git a/dll/win32/shell32/stubs.cpp b/dll/win32/shell32/stubs.cpp index 037f4bafe8a..c1e0ae300e5 100644 --- a/dll/win32/shell32/stubs.cpp +++ b/dll/win32/shell32/stubs.cpp @@ -665,17 +665,6 @@ SHInvokePrinterCommandA(HWND hwnd, return FALSE; } -/* - * Unimplemented - */ -EXTERN_C HRESULT -WINAPI -SHCreateQueryCancelAutoPlayMoniker(IMoniker **ppmoniker) -{ - FIXME("SHCreateQueryCancelAutoPlayMoniker() stub\n"); - return E_FAIL; -} - /* * Unimplemented */ @@ -692,9 +681,9 @@ SHCreateProcessAsUserW(PSHCREATEPROCESSINFOW pscpi) */ EXTERN_C BOOL WINAPI -SHChangeNotifySuspendResume(BOOL bSuspend, - LPITEMIDLIST pidl, - BOOL bRecursive, +SHChangeNotifySuspendResume(BOOL bSuspend, + LPITEMIDLIST pidl, + BOOL bRecursive, DWORD dwReserved) { FIXME("SHChangeNotifySuspendResume() stub\n"); diff --git a/dll/win32/shlwapi/istream.c b/dll/win32/shlwapi/istream.c index 581871ece86..e02364546bb 100644 --- a/dll/win32/shlwapi/istream.c +++ b/dll/win32/shlwapi/istream.c @@ -58,8 +58,8 @@ static HRESULT WINAPI IStream_fnQueryInterface(IStream *iface, REFIID riid, LPVO if(IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IStream)) { - *ppvObj = This; IStream_AddRef(iface); + *ppvObj = iface; return S_OK; } return E_NOINTERFACE; @@ -216,22 +216,22 @@ static HRESULT WINAPI IStream_fnCopyTo(IStream *iface, IStream* pstm, ULARGE_INT ulSize = cb.QuadPart; while (ulSize) { - ULONG ulLeft, ulAmt; + ULONG ulLeft, ulRead, ulWritten; ulLeft = ulSize > sizeof(copyBuff) ? sizeof(copyBuff) : ulSize; /* Read */ - hRet = IStream_fnRead(iface, copyBuff, ulLeft, &ulAmt); - if (pcbRead) - pcbRead->QuadPart += ulAmt; - if (FAILED(hRet) || ulAmt != ulLeft) + hRet = IStream_fnRead(iface, copyBuff, ulLeft, &ulRead); + if (FAILED(hRet) || ulRead == 0) break; + if (pcbRead) + pcbRead->QuadPart += ulRead; /* Write */ - hRet = IStream_fnWrite(pstm, copyBuff, ulLeft, &ulAmt); + hRet = IStream_fnWrite(pstm, copyBuff, ulRead, &ulWritten); if (pcbWritten) - pcbWritten->QuadPart += ulAmt; - if (FAILED(hRet) || ulAmt != ulLeft) + pcbWritten->QuadPart += ulWritten; + if (FAILED(hRet) || ulWritten != ulLeft) break; ulSize -= ulLeft; @@ -279,16 +279,14 @@ static HRESULT WINAPI IStream_fnLockUnlockRegion(IStream *iface, ULARGE_INTEGER static HRESULT WINAPI IStream_fnStat(IStream *iface, STATSTG* lpStat, DWORD grfStatFlag) { - ISHFileStream *This = impl_from_IStream(iface); - BY_HANDLE_FILE_INFORMATION fi; - HRESULT hRet = S_OK; + ISHFileStream *This = impl_from_IStream(iface); + BY_HANDLE_FILE_INFORMATION fi; - TRACE("(%p,%p,%d)\n", This, lpStat, grfStatFlag); + TRACE("(%p,%p,%d)\n", This, lpStat, grfStatFlag); + + if (!grfStatFlag) + return STG_E_INVALIDPOINTER; - if (!grfStatFlag) - hRet = STG_E_INVALIDPOINTER; - else - { memset(&fi, 0, sizeof(fi)); GetFileInformationByHandle(This->hFile, &fi); @@ -307,8 +305,8 @@ static HRESULT WINAPI IStream_fnStat(IStream *iface, STATSTG* lpStat, memcpy(&lpStat->clsid, &IID_IStream, sizeof(CLSID)); lpStat->grfStateBits = This->grfStateBits; lpStat->reserved = 0; - } - return hRet; + + return S_OK; } /************************************************************************* @@ -349,22 +347,21 @@ static const IStreamVtbl SHLWAPI_fsVTable = */ static IStream *IStream_Create(LPCWSTR lpszPath, HANDLE hFile, DWORD dwMode) { - ISHFileStream* fileStream; + ISHFileStream *fileStream; - fileStream = HeapAlloc(GetProcessHeap(), 0, sizeof(ISHFileStream)); + fileStream = HeapAlloc(GetProcessHeap(), 0, sizeof(ISHFileStream)); + if (!fileStream) return NULL; - if (fileStream) - { - fileStream->IStream_iface.lpVtbl = &SHLWAPI_fsVTable; - fileStream->ref = 1; - fileStream->hFile = hFile; - fileStream->dwMode = dwMode; - fileStream->lpszPath = StrDupW(lpszPath); - fileStream->type = 0; /* FIXME */ - fileStream->grfStateBits = 0; /* FIXME */ - } - TRACE ("Returning %p\n", fileStream); - return &fileStream->IStream_iface; + fileStream->IStream_iface.lpVtbl = &SHLWAPI_fsVTable; + fileStream->ref = 1; + fileStream->hFile = hFile; + fileStream->dwMode = dwMode; + fileStream->lpszPath = StrDupW(lpszPath); + fileStream->type = 0; /* FIXME */ + fileStream->grfStateBits = 0; /* FIXME */ + + TRACE ("Returning %p\n", fileStream); + return &fileStream->IStream_iface; } /************************************************************************* @@ -405,12 +402,10 @@ HRESULT WINAPI SHCreateStreamOnFileEx(LPCWSTR lpszPath, DWORD dwMode, /* Access */ switch (STGM_ACCESS_MODE(dwMode)) { + case STGM_WRITE: case STGM_READWRITE: dwAccess = GENERIC_READ|GENERIC_WRITE; break; - case STGM_WRITE: - dwAccess = GENERIC_WRITE; - break; case STGM_READ: dwAccess = GENERIC_READ; break; @@ -422,6 +417,7 @@ HRESULT WINAPI SHCreateStreamOnFileEx(LPCWSTR lpszPath, DWORD dwMode, switch (STGM_SHARE_MODE(dwMode)) { case 0: + case STGM_SHARE_DENY_NONE: dwShare = FILE_SHARE_READ|FILE_SHARE_WRITE; break; case STGM_SHARE_DENY_READ: @@ -433,9 +429,6 @@ HRESULT WINAPI SHCreateStreamOnFileEx(LPCWSTR lpszPath, DWORD dwMode, case STGM_SHARE_EXCLUSIVE: dwShare = 0; break; - case STGM_SHARE_DENY_NONE: - dwShare = FILE_SHARE_READ|FILE_SHARE_WRITE; - break; default: return E_INVALIDARG; } diff --git a/dll/win32/shlwapi/path.c b/dll/win32/shlwapi/path.c index 383c6ec3bd8..46eb8d93279 100644 --- a/dll/win32/shlwapi/path.c +++ b/dll/win32/shlwapi/path.c @@ -40,6 +40,21 @@ static fnpIsNetDrive pIsNetDrive; HRESULT WINAPI SHGetWebFolderFilePathW(LPCWSTR,LPWSTR,DWORD); +static inline WCHAR* heap_strdupAtoW(LPCSTR str) +{ + WCHAR *ret = NULL; + + if (str) + { + DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); + ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); + if (ret) + MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); + } + + return ret; +} + /************************************************************************* * PathAppendA [SHLWAPI.@] * @@ -3852,16 +3867,14 @@ BOOL WINAPI PathIsDirectoryEmptyW(LPCWSTR lpszPath) strcpyW(szSearch + dwLen, szAllFiles); hfind = FindFirstFileW(szSearch, &find_data); - - if (hfind != INVALID_HANDLE_VALUE && - find_data.cFileName[0] == '.' && - find_data.cFileName[1] == '.') + if (hfind != INVALID_HANDLE_VALUE) { - /* The only directory entry should be the parent */ - if (!FindNextFileW(hfind, &find_data)) - retVal = TRUE; + if (find_data.cFileName[0] == '.' && find_data.cFileName[1] == '.') + /* The only directory entry should be the parent */ + retVal = !FindNextFileW(hfind, &find_data); FindClose(hfind); } + return retVal; } @@ -4022,18 +4035,61 @@ VOID WINAPI PathUndecorateW(LPWSTR lpszPath) * strings. * * PARAMS - * pszPath [I] Buffer containing the path to unexpand. - * pszBuf [O] Buffer to receive the unexpanded path. - * cchBuf [I] Size of pszBuf in characters. + * path [I] Buffer containing the path to unexpand. + * buffer [O] Buffer to receive the unexpanded path. + * buf_len [I] Size of pszBuf in characters. * * RETURNS * Success: TRUE * Failure: FALSE */ -BOOL WINAPI PathUnExpandEnvStringsA(LPCSTR pszPath, LPSTR pszBuf, UINT cchBuf) +BOOL WINAPI PathUnExpandEnvStringsA(LPCSTR path, LPSTR buffer, UINT buf_len) { - FIXME("(%s,%s,0x%08x)\n", debugstr_a(pszPath), debugstr_a(pszBuf), cchBuf); - return FALSE; + WCHAR bufferW[MAX_PATH], *pathW; + DWORD len; + BOOL ret; + + TRACE("(%s, %p, %d)\n", debugstr_a(path), buffer, buf_len); + + pathW = heap_strdupAtoW(path); + if (!pathW) return FALSE; + + ret = PathUnExpandEnvStringsW(pathW, bufferW, MAX_PATH); + HeapFree(GetProcessHeap(), 0, pathW); + if (!ret) return FALSE; + + len = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL); + if (buf_len < len + 1) return FALSE; + + WideCharToMultiByte(CP_ACP, 0, bufferW, -1, buffer, buf_len, NULL, NULL); + return TRUE; +} + +static const WCHAR allusersprofileW[] = {'%','A','L','L','U','S','E','R','S','P','R','O','F','I','L','E','%',0}; +static const WCHAR appdataW[] = {'%','A','P','P','D','A','T','A','%',0}; +static const WCHAR computernameW[] = {'%','C','O','M','P','U','T','E','R','N','A','M','E','%',0}; +static const WCHAR programfilesW[] = {'%','P','r','o','g','r','a','m','F','i','l','e','s','%',0}; +static const WCHAR systemrootW[] = {'%','S','y','s','t','e','m','R','o','o','t','%',0}; +static const WCHAR systemdriveW[] = {'%','S','y','s','t','e','m','D','r','i','v','e','%',0}; +static const WCHAR userprofileW[] = {'%','U','S','E','R','P','R','O','F','I','L','E','%',0}; + +struct envvars_map +{ + const WCHAR *var; + UINT varlen; + WCHAR path[MAX_PATH]; + DWORD len; +}; + +static void init_envvars_map(struct envvars_map *map) +{ + while (map->var) + { + map->len = ExpandEnvironmentStringsW(map->var, map->path, sizeof(map->path)/sizeof(WCHAR)); + /* exclude null from length */ + if (map->len) map->len--; + map++; + } } /************************************************************************* @@ -4041,10 +4097,51 @@ BOOL WINAPI PathUnExpandEnvStringsA(LPCSTR pszPath, LPSTR pszBuf, UINT cchBuf) * * Unicode version of PathUnExpandEnvStringsA. */ -BOOL WINAPI PathUnExpandEnvStringsW(LPCWSTR pszPath, LPWSTR pszBuf, UINT cchBuf) +BOOL WINAPI PathUnExpandEnvStringsW(LPCWSTR path, LPWSTR buffer, UINT buf_len) { - FIXME("(%s,%s,0x%08x)\n", debugstr_w(pszPath), debugstr_w(pszBuf), cchBuf); - return FALSE; + static struct envvars_map null_var = {NULL, 0, {0}, 0}; + struct envvars_map *match = &null_var, *cur; + struct envvars_map envvars[] = { + { allusersprofileW, sizeof(allusersprofileW)/sizeof(WCHAR) }, + { appdataW, sizeof(appdataW)/sizeof(WCHAR) }, + { computernameW, sizeof(computernameW)/sizeof(WCHAR) }, + { programfilesW, sizeof(programfilesW)/sizeof(WCHAR) }, + { systemrootW, sizeof(systemrootW)/sizeof(WCHAR) }, + { systemdriveW, sizeof(systemdriveW)/sizeof(WCHAR) }, + { userprofileW, sizeof(userprofileW)/sizeof(WCHAR) }, + { NULL } + }; + DWORD pathlen; + UINT needed; + + TRACE("(%s, %p, %d)\n", debugstr_w(path), buffer, buf_len); + + pathlen = strlenW(path); + init_envvars_map(envvars); + cur = envvars; + while (cur->var) + { + /* path can't contain expanded value or value wasn't retrieved */ + if (cur->len == 0 || cur->len > pathlen || strncmpiW(cur->path, path, cur->len)) + { + cur++; + continue; + } + + if (cur->len > match->len) + match = cur; + cur++; + } + + /* 'varlen' includes NULL termination char */ + needed = match->varlen + pathlen - match->len; + if (match->len == 0 || needed > buf_len) return FALSE; + + strcpyW(buffer, match->var); + strcatW(buffer, &path[match->len]); + TRACE("ret %s\n", debugstr_w(buffer)); + + return TRUE; } /************************************************************************* diff --git a/dll/win32/shlwapi/shlwapi.spec b/dll/win32/shlwapi/shlwapi.spec index e12eac0bd03..8d1ea6ddb74 100644 --- a/dll/win32/shlwapi/shlwapi.spec +++ b/dll/win32/shlwapi/shlwapi.spec @@ -216,7 +216,7 @@ 216 stdcall -noname SHAnsiToUnicodeCP(long str ptr long) 217 stdcall -ordinal SHUnicodeToAnsi(wstr ptr ptr) 218 stdcall -noname SHUnicodeToAnsiCP(long wstr ptr long) -219 stdcall -noname QISearch(long long long long) +219 stdcall QISearch(long long long long) 220 stdcall -noname SHSetDefaultDialogFont(ptr long) 221 stdcall -noname SHRemoveDefaultDialogFont(ptr) 222 stdcall -noname SHGlobalCounterCreate(long) @@ -546,7 +546,7 @@ 550 stub -noname GetTemplateInfoFromHandle 551 stub -noname IShellFolder_CompareIDs -@ stdcall AssocCreate(double double ptr ptr) +@ stdcall AssocCreate(int128 ptr ptr) @ stdcall AssocGetPerceivedType(wstr ptr ptr ptr) @ stdcall AssocIsDangerous(wstr) @ stdcall AssocQueryKeyA(long long str str ptr) diff --git a/dll/win32/shlwapi/string.c b/dll/win32/shlwapi/string.c index 1dcc1cc18f4..db7c353041d 100644 --- a/dll/win32/shlwapi/string.c +++ b/dll/win32/shlwapi/string.c @@ -2800,7 +2800,7 @@ HRESULT WINAPI SHLoadIndirectString(LPCWSTR src, LPWSTR dst, UINT dst_len, void TRACE("returning %s\n", debugstr_w(dst)); end: if(hmod) FreeLibrary(hmod); - HeapFree(GetProcessHeap(), 0, dllname); + LocalFree(dllname); return hr; } diff --git a/dll/win32/shlwapi/url.c b/dll/win32/shlwapi/url.c index b1da8281e67..371f0f7fbc6 100644 --- a/dll/win32/shlwapi/url.c +++ b/dll/win32/shlwapi/url.c @@ -650,6 +650,7 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative, DWORD i, len, res1, res2, process_case = 0; LPWSTR work, preliminary, mbase, mrelative; static const WCHAR myfilestr[] = {'f','i','l','e',':','/','/','/','\0'}; + static const WCHAR fragquerystr[] = {'#','?',0}; HRESULT ret; TRACE("(base %s, Relative %s, Combine size %d, flags %08x)\n", @@ -721,17 +722,19 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative, } } - /* If there is a '#' and the characters immediately preceding it are - * ".htm[l]", then begin looking for the last leaf starting from - * the '#'. Otherwise the '#' is not meaningful and just start - * looking from the end. */ - if ((work = strchrW(base.pszSuffix + sizeloc, '#'))) { + /* If there is a '?', then the remaining part can only contain a + * query string or fragment, so start looking for the last leaf + * from the '?'. Otherwise, if there is a '#' and the characters + * immediately preceding it are ".htm[l]", then begin looking for + * the last leaf starting from the '#'. Otherwise the '#' is not + * meaningful and just start looking from the end. */ + if ((work = strpbrkW(base.pszSuffix + sizeloc, fragquerystr))) { const WCHAR htmlW[] = {'.','h','t','m','l',0}; const int len_htmlW = 5; const WCHAR htmW[] = {'.','h','t','m',0}; const int len_htmW = 4; - if (base.nScheme == URL_SCHEME_HTTP || base.nScheme == URL_SCHEME_HTTPS) + if (*work == '?' || base.nScheme == URL_SCHEME_HTTP || base.nScheme == URL_SCHEME_HTTPS) manual_search = TRUE; else if (work - base.pszSuffix > len_htmW) { work -= len_htmW; @@ -968,57 +971,43 @@ HRESULT WINAPI UrlEscapeA( #define WINE_URL_STOP_ON_HASH 0x20 #define WINE_URL_STOP_ON_QUESTION 0x40 -static inline BOOL URL_NeedEscapeW(WCHAR ch, DWORD dwFlags, DWORD int_flags) +static inline BOOL URL_NeedEscapeW(WCHAR ch, DWORD flags, DWORD int_flags) { + if (flags & URL_ESCAPE_SPACES_ONLY) + return ch == ' '; + + if ((flags & URL_ESCAPE_PERCENT) && (ch == '%')) + return TRUE; + + if (ch <= 31 || (ch >= 127 && ch <= 255) ) + return TRUE; if (isalnumW(ch)) return FALSE; - if(dwFlags & URL_ESCAPE_SPACES_ONLY) { - if(ch == ' ') - return TRUE; - else - return FALSE; - } - - if ((dwFlags & URL_ESCAPE_PERCENT) && (ch == '%')) - return TRUE; - - if (ch <= 31 || ch >= 127) - return TRUE; - - else { - switch (ch) { - case ' ': - case '<': - case '>': - case '\"': - case '{': - case '}': - case '|': - case '\\': - case '^': - case ']': - case '[': - case '`': - case '&': - return TRUE; - - case '/': - if (int_flags & WINE_URL_ESCAPE_SLASH) return TRUE; - return FALSE; - - case '?': - if (int_flags & WINE_URL_ESCAPE_QUESTION) return TRUE; - return FALSE; - - case '#': - if (int_flags & WINE_URL_ESCAPE_HASH) return TRUE; - return FALSE; - - default: - return FALSE; - } + switch (ch) { + case ' ': + case '<': + case '>': + case '\"': + case '{': + case '}': + case '|': + case '\\': + case '^': + case ']': + case '[': + case '`': + case '&': + return TRUE; + case '/': + return !!(int_flags & WINE_URL_ESCAPE_SLASH); + case '?': + return !!(int_flags & WINE_URL_ESCAPE_QUESTION); + case '#': + return !!(int_flags & WINE_URL_ESCAPE_HASH); + default: + return FALSE; } } diff --git a/dll/win32/shlwapi/wsprintf.c b/dll/win32/shlwapi/wsprintf.c index aacca9f1e36..e37a8833c2b 100644 --- a/dll/win32/shlwapi/wsprintf.c +++ b/dll/win32/shlwapi/wsprintf.c @@ -27,6 +27,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(string); + #define WPRINTF_LEFTALIGN 0x0001 /* Align output on the left ('-' prefix) */ #define WPRINTF_PREFIX_HEX 0x0002 /* Prefix hex with 0x ('#' prefix) */ #define WPRINTF_ZEROPAD 0x0004 /* Pad with zeros ('0' prefix) */ diff --git a/dll/win32/tapi32/line.c b/dll/win32/tapi32/line.c index 4a141105733..f8e5aae776a 100644 --- a/dll/win32/tapi32/line.c +++ b/dll/win32/tapi32/line.c @@ -1252,6 +1252,15 @@ DWORD WINAPI lineNegotiateExtVersion(HLINEAPP hLineApp, DWORD dwDeviceID, DWORD return 0; } +/*********************************************************************** + * lineOpenW (TAPI32.@) + */ +DWORD WINAPI lineOpenW(HLINEAPP hLineApp, DWORD dwDeviceID, LPHLINE lphLine, DWORD dwAPIVersion, DWORD dwExtVersion, DWORD dwCallbackInstance, DWORD dwPrivileges, DWORD dwMediaModes, LPLINECALLPARAMS lpCallParams) +{ + FIXME("stub.\n"); + return 0; +} + /*********************************************************************** * lineOpen (TAPI32.@) */ diff --git a/dll/win32/tapi32/tapi32.spec b/dll/win32/tapi32/tapi32.spec index e377b9cd0d4..dafc6ff492d 100644 --- a/dll/win32/tapi32/tapi32.spec +++ b/dll/win32/tapi32/tapi32.spec @@ -150,7 +150,7 @@ @ stdcall lineNegotiateExtVersion(long long long long long ptr) @ stdcall lineOpen(long long ptr long long long long long ptr) lineOpenA @ stdcall lineOpenA(long long ptr long long long long long ptr) -@ stub lineOpenW +@ stdcall lineOpenW(long long ptr long long long long long ptr) @ stdcall linePark(long long str ptr) lineParkA @ stdcall lineParkA(long long str ptr) @ stub lineParkW diff --git a/dll/win32/twain_32/dsm_ctrl.c b/dll/win32/twain_32/dsm_ctrl.c index 6a17c6a2a2b..aa2a4c1188b 100644 --- a/dll/win32/twain_32/dsm_ctrl.c +++ b/dll/win32/twain_32/dsm_ctrl.c @@ -61,7 +61,7 @@ twain_add_onedriver(const char *dsname) { ret = dsEntry (&fakeOrigin, DG_CONTROL, DAT_IDENTITY, MSG_GET, &sourceId); if (ret != TWRC_SUCCESS) { ERR("Source->(DG_CONTROL,DAT_IDENTITY,MSG_GET) failed!\n"); - return; + break; } TRACE("Manufacturer: %s\n", debugstr_a(sourceId.Manufacturer)); TRACE("ProductFamily: %s\n", debugstr_a(sourceId.ProductFamily)); @@ -86,12 +86,12 @@ twain_add_onedriver(const char *dsname) { FreeLibrary (hmod); } -static int detectionrun = 0; +static BOOL detectionrun = FALSE; static void twain_autodetect(void) { if (detectionrun) return; - detectionrun = 1; + detectionrun = TRUE; twain_add_onedriver("sane.ds"); twain_add_onedriver("gphoto2.ds"); diff --git a/dll/win32/url/url_main.c b/dll/win32/url/url_main.c index 3c5df00cfba..79eaca148f8 100644 --- a/dll/win32/url/url_main.c +++ b/dll/win32/url/url_main.c @@ -92,8 +92,7 @@ BOOL WINAPI InetIsOffline(DWORD flags) * int nShowCmd - How to display the operation. */ -HRESULT WINAPI FileProtocolHandlerA(HWND hWnd, HINSTANCE hInst, LPCSTR pszUrl, - int nShowCmd) +void WINAPI FileProtocolHandlerA(HWND hWnd, HINSTANCE hInst, LPCSTR pszUrl, int nShowCmd) { CHAR pszPath[MAX_PATH]; DWORD size = MAX_PATH; @@ -101,12 +100,7 @@ HRESULT WINAPI FileProtocolHandlerA(HWND hWnd, HINSTANCE hInst, LPCSTR pszUrl, TRACE("(%p, %s, %d)\n",hWnd,debugstr_a(pszUrl),nShowCmd); - if(createpath != S_OK) - return E_FAIL; - - ShellExecuteA(hWnd,NULL,pszPath,NULL,NULL,nShowCmd); - - return S_OK; + ShellExecuteA(hWnd, NULL, createpath==S_OK ? pszPath : pszUrl, NULL, NULL, nShowCmd); } /*********************************************************************** diff --git a/dll/win32/urlmon/axinstall.c b/dll/win32/urlmon/axinstall.c index 28dec63da21..18f8fdb9bd3 100644 --- a/dll/win32/urlmon/axinstall.c +++ b/dll/win32/urlmon/axinstall.c @@ -439,7 +439,7 @@ static HRESULT install_file(install_ctx_t *ctx, const WCHAR *cache_file) if(!ext) ext = ptr; - if(!strcmpW(ext, cab_extW)) { + if(!strcmpiW(ext, cab_extW)) { hres = install_cab_file(ctx); }else { FIXME("Unsupported extension %s\n", debugstr_w(ext)); diff --git a/dll/win32/urlmon/bindprot.c b/dll/win32/urlmon/bindprot.c index 9bd5794765b..77a20bcdb74 100644 --- a/dll/win32/urlmon/bindprot.c +++ b/dll/win32/urlmon/bindprot.c @@ -204,7 +204,7 @@ static HRESULT handle_mime_filter(BindProtocol *This, IInternetProtocol *mime_fi return hres; } - /* NOTE: IE9 calls it on the new protocol_sink. It doesn't make sense to is seems to be a bug there. */ + /* NOTE: IE9 calls it on the new protocol_sink. It doesn't make sense so it seems to be a bug there. */ IInternetProtocolSink_ReportProgress(This->protocol_sink, BINDSTATUS_LOADINGMIMEHANDLER, NULL); return S_OK; diff --git a/dll/win32/urlmon/http.c b/dll/win32/urlmon/http.c index 014893f4264..24e23409daf 100644 --- a/dll/win32/urlmon/http.c +++ b/dll/win32/urlmon/http.c @@ -274,7 +274,7 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques HINTERNET internet_session, IInternetBindInfo *bind_info) { HttpProtocol *This = impl_from_Protocol(prot); - LPWSTR addl_header = NULL, post_cookie = NULL; + WCHAR *addl_header = NULL, *post_cookie = NULL, *rootdoc_url = NULL; IServiceProvider *service_provider = NULL; IHttpNegotiate2 *http_negotiate2 = NULL; BSTR url, host, user, pass, path; @@ -318,6 +318,13 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques return INET_E_CANNOT_CONNECT; } + num = 0; + hres = IInternetBindInfo_GetBindString(bind_info, BINDSTRING_ROOTDOC_URL, &rootdoc_url, 1, &num); + if(hres == S_OK && num) { + FIXME("Use root doc URL %s\n", debugstr_w(rootdoc_url)); + CoTaskMemFree(rootdoc_url); + } + num = sizeof(accept_mimes)/sizeof(accept_mimes[0])-1; hres = IInternetBindInfo_GetBindString(bind_info, BINDSTRING_ACCEPT_MIMES, accept_mimes, num, &num); if(hres == INET_E_USE_DEFAULT_SETTING) { diff --git a/dll/win32/urlmon/internet.c b/dll/win32/urlmon/internet.c index a1f42380b67..f779bd9b609 100644 --- a/dll/win32/urlmon/internet.c +++ b/dll/win32/urlmon/internet.c @@ -631,22 +631,17 @@ static HRESULT load_process_feature(INTERNETFEATURELIST feature) static HRESULT get_feature_from_process(INTERNETFEATURELIST feature) { - HRESULT hres; + HRESULT hres = S_OK; EnterCriticalSection(&process_features_cs); /* Try loading the feature from the registry, if it hasn't already * been done. */ - if(process_feature_controls[feature].check_registry) { + if(process_feature_controls[feature].check_registry) hres = load_process_feature(feature); - if(FAILED(hres)) { - LeaveCriticalSection(&process_features_cs); - return hres; - } - } - - hres = process_feature_controls[feature].enabled ? S_OK : S_FALSE; + if(SUCCEEDED(hres)) + hres = process_feature_controls[feature].enabled ? S_OK : S_FALSE; LeaveCriticalSection(&process_features_cs); diff --git a/dll/win32/urlmon/protocol.c b/dll/win32/urlmon/protocol.c index 1e3d0440db0..84b8448ae2d 100644 --- a/dll/win32/urlmon/protocol.c +++ b/dll/win32/urlmon/protocol.c @@ -512,6 +512,7 @@ HRESULT protocol_abort(Protocol *protocol, HRESULT reason) if(!protocol->protocol_sink) return S_OK; + /* NOTE: IE10 returns S_OK here */ if(protocol->flags & FLAG_RESULT_REPORTED) return INET_E_RESULT_DISPATCHED; diff --git a/dll/win32/urlmon/sec_mgr.c b/dll/win32/urlmon/sec_mgr.c index 13190d3f0f4..ba4980da44a 100644 --- a/dll/win32/urlmon/sec_mgr.c +++ b/dll/win32/urlmon/sec_mgr.c @@ -38,6 +38,12 @@ static const WCHAR wszZonesKey[] = {'S','o','f','t','w','a','r','e','\\', 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', 'I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s','\\', 'Z','o','n','e','s','\\',0}; +static const WCHAR zone_map_keyW[] = {'S','o','f','t','w','a','r','e','\\', + 'M','i','c','r','o','s','o','f','t','\\', + 'W','i','n','d','o','w','s','\\', + 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', + 'I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s','\\', + 'Z','o','n','e','M','a','p',0}; static const WCHAR wszZoneMapDomainsKey[] = {'S','o','f','t','w','a','r','e','\\', 'M','i','c','r','o','s','o','f','t','\\', 'W','i','n','d','o','w','s','\\', @@ -283,7 +289,7 @@ static BOOL get_zone_for_scheme(HKEY key, LPCWSTR schema, DWORD *zone) * search_domain_for_zone [internal] * * Searches the specified 'domain' registry key to see if 'host' maps into it, or any - * of it's subdomain registry keys. + * of its subdomain registry keys. * * Returns S_OK if a match is found, S_FALSE if no matches were found, or an error code. */ @@ -375,7 +381,7 @@ static HRESULT search_domain_for_zone(HKEY domains, LPCWSTR domain, DWORD domain /* There's a chance that 'host' implicitly mapped into 'domain', in * which case we check to see if 'domain' contains zone information. * - * This can only happen if 'domain' is it's own domain name. + * This can only happen if 'domain' is its own domain name. * Example: * "google.com" (domain name = "google.com") * @@ -384,7 +390,7 @@ static HRESULT search_domain_for_zone(HKEY domains, LPCWSTR domain, DWORD domain * * Then host would map directly into the "google.com" domain key. * - * If 'domain' has more than just it's domain name, or it does not + * If 'domain' has more than just its domain name, or it does not * have a domain name, then we don't perform the check. The reason * for this is that these domains don't allow implicit mappings. * Example: @@ -2056,3 +2062,32 @@ HRESULT WINAPI CompareSecurityIds(BYTE *secid1, DWORD size1, BYTE *secid2, DWORD FIXME("(%p %d %p %d %x)\n", secid1, size1, secid2, size2, reserved); return E_NOTIMPL; } + +/******************************************************************** + * IsInternetESCEnabledLocal (URLMON.108) + * + * Undocumented, returns if IE is running in Enhanced Security Configuration. + */ +BOOL WINAPI IsInternetESCEnabledLocal(void) +{ + static BOOL esc_initialized, esc_enabled; + + TRACE("()\n"); + + if(!esc_initialized) { + DWORD type, size, val; + HKEY zone_map; + + static const WCHAR iehardenW[] = {'I','E','H','a','r','d','e','n',0}; + + if(RegOpenKeyExW(HKEY_CURRENT_USER, zone_map_keyW, 0, KEY_QUERY_VALUE, &zone_map) == ERROR_SUCCESS) { + size = sizeof(DWORD); + if(RegQueryValueExW(zone_map, iehardenW, NULL, &type, (BYTE*)&val, &size) == ERROR_SUCCESS) + esc_enabled = type == REG_DWORD && val != 0; + RegCloseKey(zone_map); + } + esc_initialized = TRUE; + } + + return esc_enabled; +} diff --git a/dll/win32/urlmon/session.c b/dll/win32/urlmon/session.c index 6ccaa3bd51d..7c5a3bb931d 100644 --- a/dll/win32/urlmon/session.c +++ b/dll/win32/urlmon/session.c @@ -529,15 +529,26 @@ static void ensure_useragent(void) { OSVERSIONINFOW info = {sizeof(info)}; const WCHAR *os_type, *is_nt; - WCHAR buf[512]; + WCHAR buf[512], *ret, *tmp; + DWORD res, idx=0; + size_t len, size; BOOL is_wow; + HKEY key; static const WCHAR formatW[] = {'M','o','z','i','l','l','a','/','4','.','0', ' ','(','c','o','m','p','a','t','i','b','l','e',';', ' ','M','S','I','E',' ','8','.','0',';', ' ','W','i','n','d','o','w','s',' ','%','s','%','d','.','%','d',';', - ' ','%','s',';',' ','T','r','i','d','e','n','t','/','5','.','0',')',0}; + ' ','%','s',';',' ','T','r','i','d','e','n','t','/','5','.','0',0}; + static const WCHAR post_platform_keyW[] = + {'S','O','F','T','W','A','R','E', + '\\','M','i','c','r','o','s','o','f','t', + '\\','W','i','n','d','o','w','s', + '\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n', + '\\','I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s', + '\\','5','.','0','\\','U','s','e','r',' ','A','g','e','n','t', + '\\','P','o','s','t',' ','P','l','a','t','f','o','r','m',0}; static const WCHAR ntW[] = {'N','T',' ',0}; static const WCHAR win32W[] = {'W','i','n','3','2',0}; static const WCHAR win64W[] = {'W','i','n','6','4',0}; @@ -558,7 +569,48 @@ static void ensure_useragent(void) os_type = win32W; sprintfW(buf, formatW, is_nt, info.dwMajorVersion, info.dwMinorVersion, os_type); - user_agent = heap_strdupW(buf); + len = strlenW(buf); + + size = len+40; + ret = heap_alloc(size * sizeof(WCHAR)); + if(!ret) + return; + + memcpy(ret, buf, len*sizeof(WCHAR)); + + res = RegOpenKeyW(HKEY_LOCAL_MACHINE, post_platform_keyW, &key); + if(res == ERROR_SUCCESS) { + DWORD value_len; + + while(1) { + value_len = sizeof(buf)/sizeof(WCHAR); + res = RegEnumValueW(key, idx, buf, &value_len, NULL, NULL, NULL, NULL); + if(res != ERROR_SUCCESS) + break; + idx++; + + if(len + value_len + 2 /* strlen("; ") */ + 1 /* trailing ')' */ >= size) { + tmp = heap_realloc(ret, (size*2+value_len)*sizeof(WCHAR)); + if(!tmp) + break; + ret = tmp; + size = size*2+value_len; + } + + ret[len++] = ';'; + ret[len++] = ' '; + memcpy(ret+len, buf, value_len*sizeof(WCHAR)); + len += value_len; + } + + RegCloseKey(key); + } + + ret[len++] = ')'; + ret[len++] = 0; + + user_agent = ret; + TRACE("Using user agent %s\n", debugstr_w(user_agent)); } LPWSTR get_useragent(void) diff --git a/dll/win32/urlmon/uri.c b/dll/win32/urlmon/uri.c index dd9cc634611..052af22e708 100644 --- a/dll/win32/urlmon/uri.c +++ b/dll/win32/urlmon/uri.c @@ -566,7 +566,7 @@ void find_domain_name(const WCHAR *host, DWORD host_len, DWORD i; /* If the sec_last_tld is 3 characters long it HAS to be on the list of * recognized to still be considered part of the TLD name, otherwise - * its considered the domain name. + * it's considered the domain name. * Ex: www.google.com.uk -> google.com.uk as the domain name. * www.google.foo.uk -> foo.uk as the domain name. */ @@ -1610,7 +1610,7 @@ static BOOL parse_ipv6address(const WCHAR **ptr, parse_data *data, DWORD flags) /* An IPv6 address can have no more than 8 h16 components. */ if(ip.h16_count >= 8) { *ptr = start; - TRACE("(%p %p %x): Not a IPv6 address, to many h16 components.\n", + TRACE("(%p %p %x): Not a IPv6 address, too many h16 components.\n", ptr, data, flags); return FALSE; } @@ -1896,7 +1896,7 @@ static BOOL parse_path_hierarchical(const WCHAR **ptr, parse_data *data, DWORD f return TRUE; } -/* Parses the path of an opaque URI (much less strict then the parser +/* Parses the path of an opaque URI (much less strict than the parser * for a hierarchical URI). * * NOTE: @@ -4271,16 +4271,16 @@ static HRESULT WINAPI Uri_GetPropertyBSTR(IUri *iface, Uri_PROPERTY uriProp, BST return E_POINTER; if(uriProp > Uri_PROPERTY_STRING_LAST) { - /* Windows allocates an empty BSTR for invalid Uri_PROPERTY's. */ - *pbstrProperty = SysAllocStringLen(NULL, 0); - if(!(*pbstrProperty)) - return E_OUTOFMEMORY; - /* It only returns S_FALSE for the ZONE property... */ - if(uriProp == Uri_PROPERTY_ZONE) + if(uriProp == Uri_PROPERTY_ZONE) { + *pbstrProperty = SysAllocStringLen(NULL, 0); + if(!(*pbstrProperty)) + return E_OUTOFMEMORY; return S_FALSE; - else - return S_OK; + } + + *pbstrProperty = NULL; + return E_INVALIDARG; } /* Don't have support for flags yet. */ @@ -6031,7 +6031,7 @@ static HRESULT WINAPI UriBuilder_SetIUri(IUriBuilder *iface, IUri *pIUri) Uri *uri; if((uri = get_uri_obj(pIUri))) { - /* Only reset the builder if it's Uri isn't the same as + /* Only reset the builder if its Uri isn't the same as * the Uri passed to the function. */ if(This->uri != uri) { @@ -6048,7 +6048,7 @@ static HRESULT WINAPI UriBuilder_SetIUri(IUriBuilder *iface, IUri *pIUri) return E_NOTIMPL; } } else if(This->uri) - /* Only reset the builder if it's Uri isn't NULL. */ + /* Only reset the builder if its Uri isn't NULL. */ reset_builder(This); return S_OK; @@ -6534,7 +6534,7 @@ static HRESULT combine_uri(Uri *base, Uri *relative, DWORD flags, IUri **result, data.path_len = proc_uri->path_len; } else if(!data.is_opaque) { /* Just set the path as a '/' if the base didn't have - * one and if it's an hierarchical URI. + * one and if it's a hierarchical URI. */ static const WCHAR slashW[] = {'/',0}; data.path = slashW; diff --git a/dll/win32/urlmon/urlmon.spec b/dll/win32/urlmon/urlmon.spec index e66fff786f3..96ba40a9c24 100644 --- a/dll/win32/urlmon/urlmon.spec +++ b/dll/win32/urlmon/urlmon.spec @@ -95,6 +95,7 @@ @ stub WriteHitLogging @ stub ZonesReInit +108 stdcall @() IsInternetESCEnabledLocal 111 stdcall @(wstr) IsProtectedModeURL 328 stdcall @(ptr ptr) propsys.VariantCompare 329 stdcall @(ptr ptr) propsys.VariantToGUID diff --git a/dll/win32/urlmon/urlmon_ros.diff b/dll/win32/urlmon/urlmon_ros.diff new file mode 100644 index 00000000000..c04c5914a84 --- /dev/null +++ b/dll/win32/urlmon/urlmon_ros.diff @@ -0,0 +1,96 @@ +diff -prudN e:\Wine\dlls\urlmon/bindprot.c e:\reactos\dll\win32\urlmon/bindprot.c +--- e:\Wine\dlls\urlmon/bindprot.c 2014-04-04 14:12:42.439519600 +0100 ++++ e:\reactos\dll\win32\urlmon/bindprot.c 2014-04-11 16:18:48.958227500 +0100 +@@ -83,36 +80,14 @@ static LRESULT WINAPI notif_wnd_proc(HWN + return DefWindowProcW(hwnd, msg, wParam, lParam); + } + +-static const WCHAR wszURLMonikerNotificationWindow[] = +- {'U','R','L',' ','M','o','n','i','k','e','r',' ', +- 'N','o','t','i','f','i','c','a','t','i','o','n',' ','W','i','n','d','o','w',0}; +- +-static ATOM notif_wnd_class; +- +-static BOOL WINAPI register_notif_wnd_class(INIT_ONCE *once, void *param, void **context) +-{ +- static WNDCLASSEXW wndclass = { +- sizeof(wndclass), 0, notif_wnd_proc, 0, 0, +- NULL, NULL, NULL, NULL, NULL, +- wszURLMonikerNotificationWindow, NULL +- }; +- +- wndclass.hInstance = hProxyDll; +- notif_wnd_class = RegisterClassExW(&wndclass); +- return TRUE; +-} +- +-void unregister_notif_wnd_class(void) +-{ +- if(notif_wnd_class) +- UnregisterClassW(MAKEINTRESOURCEW(notif_wnd_class), hProxyDll); +-} +- + HWND get_notif_hwnd(void) + { ++ static ATOM wnd_class = 0; + tls_data_t *tls_data; + +- static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT; ++ static const WCHAR wszURLMonikerNotificationWindow[] = ++ {'U','R','L',' ','M','o','n','i','k','e','r',' ', ++ 'N','o','t','i','f','i','c','a','t','i','o','n',' ','W','i','n','d','o','w',0}; + + tls_data = get_tls_data(); + if(!tls_data) +@@ -123,11 +98,23 @@ HWND get_notif_hwnd(void) + return tls_data->notif_hwnd; + } + +- InitOnceExecuteOnce(&init_once, register_notif_wnd_class, NULL, NULL); +- if(!notif_wnd_class) +- return NULL; ++ if(!wnd_class) { ++ static WNDCLASSEXW wndclass = { ++ sizeof(wndclass), 0, ++ notif_wnd_proc, 0, 0, ++ NULL, NULL, NULL, NULL, NULL, ++ wszURLMonikerNotificationWindow, ++ NULL ++ }; + +- tls_data->notif_hwnd = CreateWindowExW(0, MAKEINTRESOURCEW(notif_wnd_class), ++ wndclass.hInstance = hProxyDll; ++ ++ wnd_class = RegisterClassExW(&wndclass); ++ if (!wnd_class && GetLastError() == ERROR_CLASS_ALREADY_EXISTS) ++ wnd_class = 1; ++ } ++ ++ tls_data->notif_hwnd = CreateWindowExW(0, wszURLMonikerNotificationWindow, + wszURLMonikerNotificationWindow, 0, 0, 0, 0, 0, HWND_MESSAGE, + NULL, hProxyDll, NULL); + if(tls_data->notif_hwnd) + +diff -prudN e:\Wine\dlls\urlmon/urlmon_main.c e:\reactos\dll\win32\urlmon/urlmon_main.c +--- e:\Wine\dlls\urlmon/urlmon_main.c 2014-04-04 14:12:42.460533100 +0100 ++++ e:\reactos\dll\win32\urlmon/urlmon_main.c 2014-04-11 16:19:12.473179000 +0100 +@@ -139,7 +127,6 @@ static void process_detach(void) + + free_session(); + free_tls_list(); +- unregister_notif_wnd_class(); + } + + /*********************************************************************** + +diff -prudN e:\Wine\dlls\urlmon/urlmon_main.h e:\reactos\dll\win32\urlmon/urlmon_main.h +--- e:\Wine\dlls\urlmon/urlmon_main.h 2014-04-04 14:12:42.461533700 +0100 ++++ e:\reactos\dll\win32\urlmon/urlmon_main.h 2014-04-11 16:19:21.822446700 +0100 +@@ -225,7 +236,6 @@ typedef struct { + + tls_data_t *get_tls_data(void) DECLSPEC_HIDDEN; + +-void unregister_notif_wnd_class(void) DECLSPEC_HIDDEN; + HWND get_notif_hwnd(void) DECLSPEC_HIDDEN; + void release_notif_hwnd(HWND) DECLSPEC_HIDDEN; + diff --git a/dll/win32/urlmon/urlmon_urlmon.idl b/dll/win32/urlmon/urlmon_urlmon.idl index 0ba5ce6d9e1..c25bd8f34ae 100644 --- a/dll/win32/urlmon/urlmon_urlmon.idl +++ b/dll/win32/urlmon/urlmon_urlmon.idl @@ -16,6 +16,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep proxy +#pragma makedep register + #include "urlmon.idl" [ diff --git a/dll/win32/usp10/mirror.c b/dll/win32/usp10/mirror.c index da7cc0d0dce..137d6535b1d 100644 --- a/dll/win32/usp10/mirror.c +++ b/dll/win32/usp10/mirror.c @@ -1,5 +1,5 @@ /* Unicode BiDi mirroring */ -/* generated from http://www.unicode.org/Public/6.2.0/ucd/BidiMirroring.txt */ +/* generated from http://www.unicode.org/Public/6.3.0/ucd/BidiMirroring.txt */ /* DO NOT EDIT!! */ #include diff --git a/dll/win32/vbscript/CMakeLists.txt b/dll/win32/vbscript/CMakeLists.txt index 83d355760fc..ace318663fd 100644 --- a/dll/win32/vbscript/CMakeLists.txt +++ b/dll/win32/vbscript/CMakeLists.txt @@ -5,7 +5,6 @@ spec2def(vbscript.dll vbscript.spec) list(APPEND SOURCE compile.c - error.c global.c interp.c lex.c diff --git a/dll/win32/vbscript/compile.c b/dll/win32/vbscript/compile.c index 8ee98315e63..d61c6491e85 100644 --- a/dll/win32/vbscript/compile.c +++ b/dll/win32/vbscript/compile.c @@ -47,6 +47,7 @@ typedef struct { unsigned prop_end_label; dim_decl_t *dim_decls; + dim_decl_t *dim_decls_tail; dynamic_var_t *global_vars; const_decl_t *const_decls; @@ -338,6 +339,35 @@ static inline void label_set_addr(compile_ctx_t *ctx, unsigned label) ctx->labels[label & ~LABEL_FLAG] = ctx->instr_cnt; } +static inline unsigned stack_offset(compile_ctx_t *ctx) +{ + statement_ctx_t *iter; + unsigned ret = 0; + + for(iter = ctx->stat_ctx; iter; iter = iter->next) + ret += iter->stack_use; + + return ret; +} + +static BOOL emit_catch_jmp(compile_ctx_t *ctx, unsigned stack_off, unsigned code_off) +{ + unsigned code; + + code = push_instr(ctx, OP_catch); + if(!code) + return FALSE; + + instr_ptr(ctx, code)->arg1.uint = code_off; + instr_ptr(ctx, code)->arg2.uint = stack_off + stack_offset(ctx); + return TRUE; +} + +static inline BOOL emit_catch(compile_ctx_t *ctx, unsigned off) +{ + return emit_catch_jmp(ctx, off, ctx->instr_cnt); +} + static expression_t *lookup_const_decls(compile_ctx_t *ctx, const WCHAR *name, BOOL lookup_global) { const_decl_t *decl; @@ -525,6 +555,9 @@ static HRESULT compile_if_statement(compile_ctx_t *ctx, if_statement_t *stat) if(!cnd_jmp) return E_OUTOFMEMORY; + if(!emit_catch(ctx, 0)) + return E_OUTOFMEMORY; + hres = compile_statement(ctx, NULL, stat->if_stat); if(FAILED(hres)) return hres; @@ -550,6 +583,9 @@ static HRESULT compile_if_statement(compile_ctx_t *ctx, if_statement_t *stat) if(!cnd_jmp) return E_OUTOFMEMORY; + if(!emit_catch(ctx, 0)) + return E_OUTOFMEMORY; + hres = compile_statement(ctx, NULL, elseif_decl->stat); if(FAILED(hres)) return hres; @@ -589,6 +625,9 @@ static HRESULT compile_while_statement(compile_ctx_t *ctx, while_statement_t *st if(!jmp_end) return E_OUTOFMEMORY; + if(!emit_catch(ctx, 0)) + return E_OUTOFMEMORY; + if(stat->stat.type == STAT_WHILE) { loop_ctx = NULL; }else { @@ -644,6 +683,10 @@ static HRESULT compile_dowhile_statement(compile_ctx_t *ctx, while_statement_t * return hres; label_set_addr(ctx, loop_ctx.while_end_label); + + if(!emit_catch(ctx, 0)) + return E_OUTOFMEMORY; + return S_OK; } @@ -653,6 +696,10 @@ static HRESULT compile_foreach_statement(compile_ctx_t *ctx, foreach_statement_t unsigned loop_start; HRESULT hres; + /* Preserve a place on the stack in case we throw before having proper enum collection. */ + if(!push_instr(ctx, OP_empty)) + return E_OUTOFMEMORY; + hres = compile_expression(ctx, stat->group_expr); if(FAILED(hres)) return hres; @@ -660,7 +707,6 @@ static HRESULT compile_foreach_statement(compile_ctx_t *ctx, foreach_statement_t if(!push_instr(ctx, OP_newenum)) return E_OUTOFMEMORY; - loop_start = ctx->instr_cnt; if(!(loop_ctx.for_end_label = alloc_label(ctx))) return E_OUTOFMEMORY; @@ -668,10 +714,19 @@ static HRESULT compile_foreach_statement(compile_ctx_t *ctx, foreach_statement_t if(FAILED(hres)) return hres; + if(!emit_catch(ctx, 1)) + return E_OUTOFMEMORY; + + loop_start = ctx->instr_cnt; hres = compile_statement(ctx, &loop_ctx, stat->body); if(FAILED(hres)) return hres; + /* We need a separated enumnext here, because we need to jump out of the loop on exception. */ + hres = push_instr_uint_bstr(ctx, OP_enumnext, loop_ctx.for_end_label, stat->identifier); + if(FAILED(hres)) + return hres; + hres = push_instr_addr(ctx, OP_jmp, loop_start); if(FAILED(hres)) return hres; @@ -695,6 +750,7 @@ static HRESULT compile_forto_statement(compile_ctx_t *ctx, forto_statement_t *st if(FAILED(hres)) return hres; + /* FIXME: Assign should happen after both expressions evaluation. */ instr = push_instr(ctx, OP_assign_ident); if(!instr) return E_OUTOFMEMORY; @@ -731,10 +787,14 @@ static HRESULT compile_forto_statement(compile_ctx_t *ctx, forto_statement_t *st instr_ptr(ctx, step_instr)->arg2.bstr = identifier; instr_ptr(ctx, step_instr)->arg1.uint = loop_ctx.for_end_label; + if(!emit_catch(ctx, 2)) + return E_OUTOFMEMORY; + hres = compile_statement(ctx, &loop_ctx, stat->body); if(FAILED(hres)) return hres; + /* FIXME: Error handling can't be done compatible with native using OP_incc here. */ instr = push_instr(ctx, OP_incc); if(!instr) return E_OUTOFMEMORY; @@ -749,6 +809,11 @@ static HRESULT compile_forto_statement(compile_ctx_t *ctx, forto_statement_t *st return hres; label_set_addr(ctx, loop_ctx.for_end_label); + + /* FIXME: reconsider after OP_incc fixup. */ + if(!emit_catch(ctx, 0)) + return E_OUTOFMEMORY; + return S_OK; } @@ -770,6 +835,9 @@ static HRESULT compile_select_statement(compile_ctx_t *ctx, select_statement_t * if(!end_label) return E_OUTOFMEMORY; + if(!emit_catch_jmp(ctx, 0, end_label)) + return E_OUTOFMEMORY; + for(case_iter = stat->case_clausules; case_iter; case_iter = case_iter->next) case_cnt++; @@ -797,6 +865,11 @@ static HRESULT compile_select_statement(compile_ctx_t *ctx, select_statement_t * hres = push_instr_addr(ctx, OP_case, case_labels[i]); if(FAILED(hres)) break; + + if(!emit_catch_jmp(ctx, 0, case_labels[i])) { + hres = E_OUTOFMEMORY; + break; + } } } @@ -863,7 +936,14 @@ static HRESULT compile_assignment(compile_ctx_t *ctx, member_expression_t *membe if(FAILED(hres)) return hres; - return push_instr_bstr_uint(ctx, op, member_expr->identifier, args_cnt); + hres = push_instr_bstr_uint(ctx, op, member_expr->identifier, args_cnt); + if(FAILED(hres)) + return hres; + + if(!emit_catch(ctx, 0)) + return E_OUTOFMEMORY; + + return S_OK; } static HRESULT compile_assign_statement(compile_ctx_t *ctx, assign_statement_t *stat, BOOL is_set) @@ -873,6 +953,8 @@ static HRESULT compile_assign_statement(compile_ctx_t *ctx, assign_statement_t * static HRESULT compile_call_statement(compile_ctx_t *ctx, call_statement_t *stat) { + HRESULT hres; + /* It's challenging for parser to distinguish parameterized assignment with one argument from call * with equality expression argument, so we do it in compiler. */ if(!stat->is_strict && stat->expr->args && !stat->expr->args->next && stat->expr->args->type == EXPR_EQUAL) { @@ -888,7 +970,14 @@ static HRESULT compile_call_statement(compile_ctx_t *ctx, call_statement_t *stat } } - return compile_member_expression(ctx, stat->expr, FALSE); + hres = compile_member_expression(ctx, stat->expr, FALSE); + if(FAILED(hres)) + return hres; + + if(!emit_catch(ctx, 0)) + return E_OUTOFMEMORY; + + return S_OK; } static BOOL lookup_dim_decls(compile_ctx_t *ctx, const WCHAR *name) @@ -927,13 +1016,26 @@ static HRESULT compile_dim_statement(compile_ctx_t *ctx, dim_statement_t *stat) } ctx->func->var_cnt++; + + if(dim_decl->is_array) { + HRESULT hres = push_instr_bstr_uint(ctx, OP_dim, dim_decl->name, ctx->func->array_cnt++); + if(FAILED(hres)) + return hres; + + if(!emit_catch(ctx, 0)) + return E_OUTOFMEMORY; + } + if(!dim_decl->next) break; dim_decl = dim_decl->next; } - dim_decl->next = ctx->dim_decls; - ctx->dim_decls = stat->dim_decls; + if(ctx->dim_decls_tail) + ctx->dim_decls_tail->next = stat->dim_decls; + else + ctx->dim_decls = stat->dim_decls; + ctx->dim_decls_tail = dim_decl; return S_OK; } @@ -960,6 +1062,9 @@ static HRESULT compile_const_statement(compile_ctx_t *ctx, const_statement_t *st hres = push_instr_bstr(ctx, OP_const, decl->name); if(FAILED(hres)) return hres; + + if(!emit_catch(ctx, 0)) + return E_OUTOFMEMORY; } next_decl = decl->next; @@ -1036,11 +1141,7 @@ static HRESULT compile_exitfor_statement(compile_ctx_t *ctx) static HRESULT exit_label(compile_ctx_t *ctx, unsigned jmp_label) { - statement_ctx_t *iter; - unsigned pop_cnt = 0; - - for(iter = ctx->stat_ctx; iter; iter = iter->next) - pop_cnt += iter->stack_use; + unsigned pop_cnt = stack_offset(ctx); if(pop_cnt) { HRESULT hres; @@ -1192,6 +1293,28 @@ static void resolve_labels(compile_ctx_t *ctx, unsigned off) ctx->labels_cnt = 0; } +static HRESULT fill_array_desc(compile_ctx_t *ctx, dim_decl_t *dim_decl, array_desc_t *array_desc) +{ + unsigned dim_cnt = 0, i; + dim_list_t *iter; + + for(iter = dim_decl->dims; iter; iter = iter->next) + dim_cnt++; + + array_desc->bounds = compiler_alloc(ctx->code, dim_cnt * sizeof(SAFEARRAYBOUND)); + if(!array_desc->bounds) + return E_OUTOFMEMORY; + + array_desc->dim_cnt = dim_cnt; + + for(iter = dim_decl->dims, i=0; iter; iter = iter->next, i++) { + array_desc->bounds[i].cElements = iter->val+1; + array_desc->bounds[i].lLbound = 0; + } + + return S_OK; +} + static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *func) { HRESULT hres; @@ -1226,7 +1349,7 @@ static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *f } ctx->func = func; - ctx->dim_decls = NULL; + ctx->dim_decls = ctx->dim_decls_tail = NULL; ctx->const_decls = NULL; hres = compile_statement(ctx, NULL, stat); ctx->func = NULL; @@ -1285,6 +1408,25 @@ static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *f } } + if(func->array_cnt) { + unsigned array_id = 0; + dim_decl_t *dim_decl; + + func->array_descs = compiler_alloc(ctx->code, func->array_cnt * sizeof(array_desc_t)); + if(!func->array_descs) + return E_OUTOFMEMORY; + + for(dim_decl = ctx->dim_decls; dim_decl; dim_decl = dim_decl->next) { + if(dim_decl->is_array) { + hres = fill_array_desc(ctx, dim_decl, func->array_descs + array_id++); + if(FAILED(hres)) + return hres; + } + } + + assert(array_id == func->array_cnt); + } + return S_OK; } @@ -1320,6 +1462,7 @@ static HRESULT create_function(compile_ctx_t *ctx, function_decl_t *decl, functi func->vars = NULL; func->var_cnt = 0; + func->array_cnt = 0; func->code_ctx = ctx->code; func->type = decl->type; func->is_public = decl->is_public; @@ -1421,8 +1564,8 @@ static BOOL lookup_class_funcs(class_desc_t *class_desc, const WCHAR *name) static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl) { function_decl_t *func_decl, *func_prop_decl; - class_prop_decl_t *prop_decl; class_desc_t *class_desc; + dim_decl_t *prop_decl; unsigned i; HRESULT hres; @@ -1506,6 +1649,25 @@ static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl) return E_OUTOFMEMORY; class_desc->props[i].is_public = prop_decl->is_public; + + if(prop_decl->is_array) { + class_desc->props[i].is_array = TRUE; + class_desc->array_cnt++; + } + } + + if(class_desc->array_cnt) { + class_desc->array_descs = compiler_alloc(ctx->code, class_desc->array_cnt*sizeof(*class_desc->array_descs)); + if(!class_desc->array_descs) + return E_OUTOFMEMORY; + + for(prop_decl = class_decl->props, i=0; prop_decl; prop_decl = prop_decl->next) { + if(prop_decl->is_array) { + hres = fill_array_desc(ctx, prop_decl, class_desc->array_descs + i++); + if(FAILED(hres)) + return hres; + } + } } class_desc->next = ctx->classes; @@ -1620,6 +1782,7 @@ static vbscode_t *alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source) ret->main_code.code_ctx = ret; ret->main_code.vars = NULL; ret->main_code.var_cnt = 0; + ret->main_code.array_cnt = 0; ret->main_code.arg_cnt = 0; ret->main_code.args = NULL; @@ -1655,7 +1818,6 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli ctx.funcs = NULL; ctx.func_decls = NULL; ctx.global_vars = NULL; - ctx.dim_decls = NULL; ctx.classes = NULL; ctx.labels = NULL; ctx.global_consts = NULL; diff --git a/dll/win32/vbscript/error.c b/dll/win32/vbscript/error.c deleted file mode 100644 index 12c268048b0..00000000000 --- a/dll/win32/vbscript/error.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2011 Jacek Caban for CodeWeavers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "vbscript.h" - -static HRESULT Err_Description(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Err_HelpContext(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Err_HelpFile(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Err_Number(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Err_Source(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Err_Clear(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Err_Raise(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static const builtin_prop_t err_props[] = { - {DISPID_ERR_DESCRIPTION, Err_Description, BP_GETPUT}, - {DISPID_ERR_HELPCONTEXT, Err_HelpContext, BP_GETPUT}, - {DISPID_ERR_HELPFILE, Err_HelpFile, BP_GETPUT}, - {DISPID_ERR_NUMBER, Err_Number, BP_GETPUT}, - {DISPID_ERR_SOURCE, Err_Source, BP_GETPUT}, - {DISPID_ERR_CLEAR, Err_Clear}, - {DISPID_ERR_RAISE, Err_Raise, 0, 5}, -}; - -HRESULT init_err(script_ctx_t *ctx) -{ - HRESULT hres; - - ctx->err_desc.ctx = ctx; - ctx->err_desc.builtin_prop_cnt = sizeof(err_props)/sizeof(*err_props); - ctx->err_desc.builtin_props = err_props; - - hres = get_typeinfo(ErrObj_tid, &ctx->err_desc.typeinfo); - if(FAILED(hres)) - return hres; - - return create_vbdisp(&ctx->err_desc, &ctx->err_obj); -} diff --git a/dll/win32/vbscript/global.c b/dll/win32/vbscript/global.c index d171f5668a8..206afc5e0bc 100644 --- a/dll/win32/vbscript/global.c +++ b/dll/win32/vbscript/global.c @@ -144,8 +144,11 @@ static inline HRESULT return_date(VARIANT *res, double date) return S_OK; } -static HRESULT to_int(VARIANT *v, int *ret) +HRESULT to_int(VARIANT *v, int *ret) { + if(V_VT(v) == (VT_BYREF|VT_VARIANT)) + v = V_VARIANTREF(v); + switch(V_VT(v)) { case VT_I2: *ret = V_I2(v); @@ -1857,6 +1860,75 @@ static const builtin_prop_t global_props[] = { {DISPID_GLOBAL_VBMSGBOXRTLREADING, NULL, BP_GET, VT_I4, MB_RTLREADING} }; +static HRESULT Err_Description(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT Err_HelpContext(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT Err_HelpFile(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT Err_Number(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + HRESULT hres; + + TRACE("\n"); + + if(!This->desc) + return E_UNEXPECTED; + + if(args_cnt) { + FIXME("setter not implemented\n"); + return E_NOTIMPL; + } + + hres = This->desc->ctx->err_number; + return return_int(res, HRESULT_FACILITY(hres) == FACILITY_VBS ? HRESULT_CODE(hres) : hres); +} + +static HRESULT Err_Source(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT Err_Clear(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + TRACE("\n"); + + if(!This->desc) + return E_UNEXPECTED; + + This->desc->ctx->err_number = S_OK; + return S_OK; +} + +static HRESULT Err_Raise(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static const builtin_prop_t err_props[] = { + {DISPID_ERR_DESCRIPTION, Err_Description, BP_GETPUT}, + {DISPID_ERR_HELPCONTEXT, Err_HelpContext, BP_GETPUT}, + {DISPID_ERR_HELPFILE, Err_HelpFile, BP_GETPUT}, + {DISPID_ERR_NUMBER, Err_Number, BP_GETPUT}, + {DISPID_ERR_SOURCE, Err_Source, BP_GETPUT}, + {DISPID_ERR_CLEAR, Err_Clear}, + {DISPID_ERR_RAISE, Err_Raise, 0, 5}, +}; + HRESULT init_global(script_ctx_t *ctx) { HRESULT hres; @@ -1877,5 +1949,13 @@ HRESULT init_global(script_ctx_t *ctx) if(FAILED(hres)) return hres; - return init_err(ctx); + ctx->err_desc.ctx = ctx; + ctx->err_desc.builtin_prop_cnt = sizeof(err_props)/sizeof(*err_props); + ctx->err_desc.builtin_props = err_props; + + hres = get_typeinfo(ErrObj_tid, &ctx->err_desc.typeinfo); + if(FAILED(hres)) + return hres; + + return create_vbdisp(&ctx->err_desc, &ctx->err_obj); } diff --git a/dll/win32/vbscript/interp.c b/dll/win32/vbscript/interp.c index 4223a7fa9a2..4a7624b81eb 100644 --- a/dll/win32/vbscript/interp.c +++ b/dll/win32/vbscript/interp.c @@ -26,9 +26,11 @@ typedef struct { script_ctx_t *script; function_t *func; IDispatch *this_obj; + vbdisp_t *vbthis; VARIANT *args; VARIANT *vars; + SAFEARRAY **arrays; dynamic_var_t *dynamic_vars; heap_pool_t heap; @@ -125,6 +127,17 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ return S_OK; if(ctx->func->type != FUNC_GLOBAL) { + if(ctx->vbthis) { + /* FIXME: Bind such identifier while generating bytecode. */ + for(i=0; i < ctx->vbthis->desc->prop_cnt; i++) { + if(!strcmpiW(ctx->vbthis->desc->props[i].name, name)) { + ref->type = REF_VAR; + ref->u.v = ctx->vbthis->props+i; + return S_OK; + } + } + } + hres = disp_get_id(ctx->this_obj, name, invoke_type, TRUE, &id); if(SUCCEEDED(hres)) { ref->type = REF_DISP; @@ -290,33 +303,42 @@ static void stack_popn(exec_ctx_t *ctx, unsigned n) VariantClear(stack_pop(ctx)); } -static HRESULT stack_pop_val(exec_ctx_t *ctx, variant_val_t *v) +static void stack_pop_deref(exec_ctx_t *ctx, variant_val_t *r) { - VARIANT *var; + VARIANT *v; - var = stack_pop(ctx); - - if(V_VT(var) == (VT_BYREF|VT_VARIANT)) { - v->owned = FALSE; - var = V_VARIANTREF(var); + v = stack_pop(ctx); + if(V_VT(v) == (VT_BYREF|VT_VARIANT)) { + r->owned = FALSE; + r->v = V_VARIANTREF(v); }else { - v->owned = TRUE; + r->owned = TRUE; + r->v = v; } +} - if(V_VT(var) == VT_DISPATCH) { +static inline void release_val(variant_val_t *v) +{ + if(v->owned) + VariantClear(v->v); +} + +static HRESULT stack_pop_val(exec_ctx_t *ctx, variant_val_t *r) +{ + stack_pop_deref(ctx, r); + + if(V_VT(r->v) == VT_DISPATCH) { DISPPARAMS dp = {0}; HRESULT hres; - hres = disp_call(ctx->script, V_DISPATCH(var), DISPID_VALUE, &dp, &v->store); - if(v->owned) - IDispatch_Release(V_DISPATCH(var)); + hres = disp_call(ctx->script, V_DISPATCH(r->v), DISPID_VALUE, &dp, &r->store); + if(r->owned) + IDispatch_Release(V_DISPATCH(r->v)); if(FAILED(hres)) return hres; - v->owned = TRUE; - v->v = &v->store; - }else { - v->v = var; + r->owned = TRUE; + r->v = &r->store; } return S_OK; @@ -351,12 +373,6 @@ static HRESULT stack_assume_val(exec_ctx_t *ctx, unsigned n) return S_OK; } -static inline void release_val(variant_val_t *v) -{ - if(v->owned) - VariantClear(v->v); -} - static int stack_pop_bool(exec_ctx_t *ctx, BOOL *b) { variant_val_t val; @@ -471,6 +487,49 @@ static void vbstack_to_dp(exec_ctx_t *ctx, unsigned arg_cnt, BOOL is_propput, DI } } +static HRESULT array_access(exec_ctx_t *ctx, SAFEARRAY *array, DISPPARAMS *dp, VARIANT **ret) +{ + unsigned cell_off = 0, dim_size = 1, i; + unsigned argc = arg_cnt(dp); + VARIANT *data; + LONG idx; + HRESULT hres; + + if(!array) { + FIXME("NULL array\n"); + return E_FAIL; + } + + if(array->cDims != argc) { + FIXME("argc %d does not match cDims %d\n", dp->cArgs, array->cDims); + return E_FAIL; + } + + for(i=0; i < argc; i++) { + hres = to_int(get_arg(dp, i), &idx); + if(FAILED(hres)) + return hres; + + idx -= array->rgsabound[i].lLbound; + if(idx >= array->rgsabound[i].cElements) { + FIXME("out of bound element %d in dim %d of size %d\n", idx, i+1, array->rgsabound[i].cElements); + return E_FAIL; + } + + cell_off += idx*dim_size; + dim_size *= array->rgsabound[i].cElements; + } + + hres = SafeArrayAccessData(array, (void**)&data); + if(FAILED(hres)) + return hres; + + *ret = data+cell_off; + + SafeArrayUnaccessData(array); + return S_OK; +} + static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res) { BSTR identifier = ctx->instr->arg1.bstr; @@ -483,30 +542,51 @@ static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res) if(FAILED(hres)) return hres; - vbstack_to_dp(ctx, arg_cnt, FALSE, &dp); - switch(ref.type) { case REF_VAR: - case REF_CONST: + case REF_CONST: { + VARIANT *v; + if(!res) { FIXME("REF_VAR no res\n"); return E_NOTIMPL; } + v = V_VT(ref.u.v) == (VT_VARIANT|VT_BYREF) ? V_VARIANTREF(ref.u.v) : ref.u.v; + if(arg_cnt) { - FIXME("arguments not implemented\n"); - return E_NOTIMPL; + SAFEARRAY *array; + + switch(V_VT(v)) { + case VT_ARRAY|VT_BYREF|VT_VARIANT: + array = *V_ARRAYREF(ref.u.v); + break; + case VT_ARRAY|VT_VARIANT: + array = V_ARRAY(ref.u.v); + break; + default: + FIXME("arguments not implemented\n"); + return E_NOTIMPL; + } + + vbstack_to_dp(ctx, arg_cnt, FALSE, &dp); + hres = array_access(ctx, array, &dp, &v); + if(FAILED(hres)) + return hres; } V_VT(res) = VT_BYREF|VT_VARIANT; - V_BYREF(res) = V_VT(ref.u.v) == (VT_VARIANT|VT_BYREF) ? V_VARIANTREF(ref.u.v) : ref.u.v; + V_BYREF(res) = v; break; + } case REF_DISP: + vbstack_to_dp(ctx, arg_cnt, FALSE, &dp); hres = disp_call(ctx->script, ref.u.d.disp, ref.u.d.id, &dp, res); if(FAILED(hres)) return hres; break; case REF_FUNC: + vbstack_to_dp(ctx, arg_cnt, FALSE, &dp); hres = exec_script(ctx->script, ref.u.f, NULL, &dp, res); if(FAILED(hres)) return hres; @@ -627,15 +707,43 @@ static HRESULT assign_ident(exec_ctx_t *ctx, BSTR name, DISPPARAMS *dp) case REF_VAR: { VARIANT *v = ref.u.v; - if(arg_cnt(dp)) { - FIXME("arg_cnt %d not supported\n", arg_cnt(dp)); - return E_NOTIMPL; - } - if(V_VT(v) == (VT_VARIANT|VT_BYREF)) v = V_VARIANTREF(v); - hres = VariantCopy(v, dp->rgvarg); + if(arg_cnt(dp)) { + SAFEARRAY *array; + + if(!(V_VT(v) & VT_ARRAY)) { + FIXME("array assign on type %d\n", V_VT(v)); + return E_FAIL; + } + + switch(V_VT(v)) { + case VT_ARRAY|VT_BYREF|VT_VARIANT: + array = *V_ARRAYREF(v); + break; + case VT_ARRAY|VT_VARIANT: + array = V_ARRAY(v); + break; + default: + FIXME("Unsupported array type %x\n", V_VT(v)); + return E_NOTIMPL; + } + + if(!array) { + FIXME("null array\n"); + return E_FAIL; + } + + hres = array_access(ctx, array, dp, &v); + if(FAILED(hres)) + return hres; + }else if(V_VT(v) == (VT_ARRAY|VT_BYREF|VT_VARIANT)) { + FIXME("non-array assign\n"); + return E_NOTIMPL; + } + + hres = VariantCopyInd(v, dp->rgvarg); break; } case REF_DISP: @@ -861,8 +969,19 @@ static HRESULT interp_new(exec_ctx_t *ctx) VARIANT v; HRESULT hres; + static const WCHAR regexpW[] = {'r','e','g','e','x','p',0}; + TRACE("%s\n", debugstr_w(arg)); + if(!strcmpiW(arg, regexpW)) { + V_VT(&v) = VT_DISPATCH; + hres = create_regexp(&V_DISPATCH(&v)); + if(FAILED(hres)) + return hres; + + return stack_push(ctx, &v); + } + for(class_desc = ctx->script->classes; class_desc; class_desc = class_desc->next) { if(!strcmpiW(class_desc->name, arg)) break; @@ -881,6 +1000,51 @@ static HRESULT interp_new(exec_ctx_t *ctx) return stack_push(ctx, &v); } +static HRESULT interp_dim(exec_ctx_t *ctx) +{ + const BSTR ident = ctx->instr->arg1.bstr; + const unsigned array_id = ctx->instr->arg2.uint; + const array_desc_t *array_desc; + ref_t ref; + HRESULT hres; + + TRACE("%s\n", debugstr_w(ident)); + + assert(array_id < ctx->func->array_cnt); + if(!ctx->arrays) { + ctx->arrays = heap_alloc_zero(ctx->func->array_cnt * sizeof(SAFEARRAY*)); + if(!ctx->arrays) + return E_OUTOFMEMORY; + } + + hres = lookup_identifier(ctx, ident, VBDISP_LET, &ref); + if(FAILED(hres)) { + FIXME("lookup %s failed: %08x\n", debugstr_w(ident), hres); + return hres; + } + + if(ref.type != REF_VAR) { + FIXME("got ref.type = %d\n", ref.type); + return E_FAIL; + } + + if(ctx->arrays[array_id]) { + FIXME("Array already initialized\n"); + return E_FAIL; + } + + array_desc = ctx->func->array_descs + array_id; + if(array_desc->dim_cnt) { + ctx->arrays[array_id] = SafeArrayCreate(VT_VARIANT, array_desc->dim_cnt, array_desc->bounds); + if(!ctx->arrays[array_id]) + return E_OUTOFMEMORY; + } + + V_VT(ref.u.v) = VT_ARRAY|VT_BYREF|VT_VARIANT; + V_ARRAYREF(ref.u.v) = ctx->arrays+array_id; + return S_OK; +} + static HRESULT interp_step(exec_ctx_t *ctx) { const BSTR ident = ctx->instr->arg2.bstr; @@ -923,20 +1087,25 @@ static HRESULT interp_step(exec_ctx_t *ctx) static HRESULT interp_newenum(exec_ctx_t *ctx) { - VARIANT *v, r; + variant_val_t v; + VARIANT *r; HRESULT hres; TRACE("\n"); - v = stack_pop(ctx); - switch(V_VT(v)) { + stack_pop_deref(ctx, &v); + assert(V_VT(stack_top(ctx, 0)) == VT_EMPTY); + r = stack_top(ctx, 0); + + switch(V_VT(v.v)) { + case VT_DISPATCH|VT_BYREF: case VT_DISPATCH: { IEnumVARIANT *iter; DISPPARAMS dp = {0}; VARIANT iterv; - hres = disp_call(ctx->script, V_DISPATCH(v), DISPID_NEWENUM, &dp, &iterv); - VariantClear(v); + hres = disp_call(ctx->script, V_ISBYREF(v.v) ? *V_DISPATCHREF(v.v) : V_DISPATCH(v.v), DISPID_NEWENUM, &dp, &iterv); + release_val(&v); if(FAILED(hres)) return hres; @@ -953,17 +1122,17 @@ static HRESULT interp_newenum(exec_ctx_t *ctx) return hres; } - V_VT(&r) = VT_UNKNOWN; - V_UNKNOWN(&r) = (IUnknown*)iter; + V_VT(r) = VT_UNKNOWN; + V_UNKNOWN(r) = (IUnknown*)iter; break; } default: - FIXME("Unsupported for %s\n", debugstr_variant(v)); - VariantClear(v); + FIXME("Unsupported for %s\n", debugstr_variant(v.v)); + release_val(&v); return E_NOTIMPL; } - return stack_push(ctx, &r); + return S_OK; } static HRESULT interp_enumnext(exec_ctx_t *ctx) @@ -978,6 +1147,11 @@ static HRESULT interp_enumnext(exec_ctx_t *ctx) TRACE("\n"); + if(V_VT(stack_top(ctx, 0)) == VT_EMPTY) { + FIXME("uninitialized\n"); + return E_FAIL; + } + assert(V_VT(stack_top(ctx, 0)) == VT_UNKNOWN); iter = (IEnumVARIANT*)V_UNKNOWN(stack_top(ctx, 0)); @@ -1787,6 +1961,12 @@ static HRESULT interp_incc(exec_ctx_t *ctx) return S_OK; } +static HRESULT interp_catch(exec_ctx_t *ctx) +{ + /* Nothing to do here, the OP is for unwinding only. */ + return S_OK; +} + static const instr_func_t op_funcs[] = { #define X(x,n,a,b) interp_ ## x, OP_LIST @@ -1827,13 +2007,21 @@ static void release_exec(exec_ctx_t *ctx) VariantClear(ctx->vars+i); } + if(ctx->arrays) { + for(i=0; i < ctx->func->var_cnt; i++) { + if(ctx->arrays[i]) + SafeArrayDestroy(ctx->arrays[i]); + } + heap_free(ctx->arrays); + } + heap_pool_free(&ctx->heap); heap_free(ctx->args); heap_free(ctx->vars); heap_free(ctx->stack); } -HRESULT exec_script(script_ctx_t *ctx, function_t *func, IDispatch *this_obj, DISPPARAMS *dp, VARIANT *res) +HRESULT exec_script(script_ctx_t *ctx, function_t *func, vbdisp_t *vbthis, DISPPARAMS *dp, VARIANT *res) { exec_ctx_t exec = {func->code_ctx}; vbsop_t op; @@ -1864,9 +2052,9 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, IDispatch *this_obj, DI if(func->args[i].by_ref) exec.args[i] = *v; else - hres = VariantCopy(exec.args+i, V_VARIANTREF(v)); + hres = VariantCopyInd(exec.args+i, V_VARIANTREF(v)); }else { - hres = VariantCopy(exec.args+i, v); + hres = VariantCopyInd(exec.args+i, v); } if(FAILED(hres)) { release_exec(&exec); @@ -1895,12 +2083,14 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, IDispatch *this_obj, DI return E_OUTOFMEMORY; } - if(this_obj) - exec.this_obj = this_obj; - else if (ctx->host_global) + if(vbthis) { + exec.this_obj = (IDispatch*)&vbthis->IDispatchEx_iface; + exec.vbthis = vbthis; + }else if (ctx->host_global) { exec.this_obj = ctx->host_global; - else + }else { exec.this_obj = (IDispatch*)&ctx->script_obj->IDispatchEx_iface; + } IDispatch_AddRef(exec.this_obj); exec.instr = exec.code->instrs + func->code_off; @@ -1911,12 +2101,45 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, IDispatch *this_obj, DI op = exec.instr->op; hres = op_funcs[op](&exec); if(FAILED(hres)) { - if(exec.resume_next) - FIXME("Failed %08x in resume next mode\n", hres); - else + ctx->err_number = hres = map_hres(hres); + + if(exec.resume_next) { + unsigned stack_off; + + WARN("Failed %08x in resume next mode\n", hres); + + /* + * Unwinding here is simple. We need to find the next OP_catch, which contains + * information about expected stack size and jump offset on error. Generated + * bytecode needs to guarantee, that simple jump and stack adjustment will + * guarantee proper execution continuation. + */ + while((++exec.instr)->op != OP_catch); + + TRACE("unwind jmp %d stack_off %d\n", exec.instr->arg1.uint, exec.instr->arg2.uint); + + stack_off = exec.instr->arg2.uint; + instr_jmp(&exec, exec.instr->arg1.uint); + + if(exec.top > stack_off) { + stack_popn(&exec, exec.top-stack_off); + }else if(exec.top < stack_off) { + VARIANT v; + + V_VT(&v) = VT_EMPTY; + while(exec.top < stack_off) { + hres = stack_push(&exec, &v); + if(FAILED(hres)) + break; + } + } + + continue; + }else { WARN("Failed %08x\n", hres); - stack_popn(&exec, exec.top); - break; + stack_popn(&exec, exec.top); + break; + } } exec.instr += op_move[op]; diff --git a/dll/win32/vbscript/parse.h b/dll/win32/vbscript/parse.h index ba1a3115cca..2a497038b4b 100644 --- a/dll/win32/vbscript/parse.h +++ b/dll/win32/vbscript/parse.h @@ -138,8 +138,16 @@ typedef struct { expression_t *value_expr; } assign_statement_t; +typedef struct _dim_list_t { + unsigned val; + struct _dim_list_t *next; +} dim_list_t; + typedef struct _dim_decl_t { const WCHAR *name; + BOOL is_array; + BOOL is_public; /* Used only for class members. */ + dim_list_t *dims; struct _dim_decl_t *next; } dim_decl_t; @@ -169,16 +177,10 @@ typedef struct { function_decl_t *func_decl; } function_statement_t; -typedef struct _class_prop_decl_t { - BOOL is_public; - const WCHAR *name; - struct _class_prop_decl_t *next; -} class_prop_decl_t; - typedef struct _class_decl_t { const WCHAR *name; function_decl_t *funcs; - class_prop_decl_t *props; + dim_decl_t *props; struct _class_decl_t *next; } class_decl_t; diff --git a/dll/win32/vbscript/parser.tab.c b/dll/win32/vbscript/parser.tab.c index 87caa7aecac..18ac409bfb6 100644 --- a/dll/win32/vbscript/parser.tab.c +++ b/dll/win32/vbscript/parser.tab.c @@ -110,7 +110,8 @@ static statement_t *new_onerror_statement(parser_ctx_t*,BOOL); static statement_t *new_const_statement(parser_ctx_t*,const_decl_t*); static statement_t *new_select_statement(parser_ctx_t*,expression_t*,case_clausule_t*); -static dim_decl_t *new_dim_decl(parser_ctx_t*,const WCHAR*,dim_decl_t*); +static dim_decl_t *new_dim_decl(parser_ctx_t*,const WCHAR*,BOOL,dim_list_t*); +static dim_list_t *new_dim(parser_ctx_t*,unsigned,dim_list_t*); static elseif_decl_t *new_elseif_decl(parser_ctx_t*,expression_t*,statement_t*); static function_decl_t *new_function_decl(parser_ctx_t*,const WCHAR*,function_type_t,unsigned,arg_decl_t*,statement_t*); static arg_decl_t *new_argument_decl(parser_ctx_t*,const WCHAR*,BOOL); @@ -119,7 +120,7 @@ static case_clausule_t *new_case_clausule(parser_ctx_t*,expression_t*,statement_ static class_decl_t *new_class_decl(parser_ctx_t*); static class_decl_t *add_class_function(parser_ctx_t*,class_decl_t*,function_decl_t*); -static class_decl_t *add_variant_prop(parser_ctx_t*,class_decl_t*,const WCHAR*,unsigned); +static class_decl_t *add_dim_prop(parser_ctx_t*,class_decl_t*,dim_decl_t*,unsigned); static statement_t *link_statements(statement_t*,statement_t*); @@ -133,7 +134,7 @@ static const WCHAR propertyW[] = {'p','r','o','p','e','r','t','y',0}; /* Line 268 of yacc.c */ -#line 143 "parser.tab.c" +#line 144 "parser.tab.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -238,7 +239,7 @@ typedef union YYSTYPE { /* Line 293 of yacc.c */ -#line 87 "parser.y" +#line 88 "parser.y" const WCHAR *string; statement_t *statement; @@ -246,6 +247,7 @@ typedef union YYSTYPE member_expression_t *member; elseif_decl_t *elseif; dim_decl_t *dim_decl; + dim_list_t *dim_list; function_decl_t *func_decl; arg_decl_t *arg_decl; class_decl_t *class_decl; @@ -259,7 +261,7 @@ typedef union YYSTYPE /* Line 293 of yacc.c */ -#line 269 "parser.tab.c" +#line 271 "parser.tab.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -271,7 +273,7 @@ typedef union YYSTYPE /* Line 343 of yacc.c */ -#line 281 "parser.tab.c" +#line 283 "parser.tab.c" #ifdef short # undef short @@ -490,16 +492,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 800 +#define YYLAST 862 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 87 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 55 +#define YYNNTS 59 /* YYNRULES -- Number of rules. */ -#define YYNRULES 153 +#define YYNRULES 164 /* YYNRULES -- Number of states. */ -#define YYNSTATES 315 +#define YYNSTATES 335 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -515,7 +517,7 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 81, 2, - 77, 78, 84, 82, 75, 76, 74, 85, 73, 2, + 76, 77, 84, 82, 75, 78, 74, 85, 73, 2, 2, 2, 2, 2, 2, 2, 2, 2, 71, 2, 80, 72, 79, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -555,97 +557,102 @@ static const yytype_uint16 yyprhs[] = 22, 24, 27, 30, 32, 35, 37, 41, 44, 47, 51, 56, 59, 61, 67, 74, 81, 86, 88, 91, 94, 97, 100, 103, 109, 111, 116, 121, 124, 135, - 144, 152, 154, 158, 160, 164, 166, 170, 174, 176, - 179, 181, 183, 184, 187, 197, 202, 210, 211, 214, - 215, 217, 219, 222, 228, 229, 233, 234, 239, 245, - 247, 251, 253, 255, 256, 258, 260, 264, 266, 270, - 272, 276, 278, 282, 284, 288, 290, 294, 296, 299, - 301, 305, 309, 313, 317, 321, 325, 329, 331, 335, - 337, 341, 345, 347, 351, 353, 357, 359, 363, 367, - 369, 373, 375, 377, 380, 383, 385, 388, 390, 392, - 394, 396, 398, 400, 402, 404, 406, 408, 410, 414, - 416, 424, 425, 429, 434, 438, 448, 460, 472, 481, - 490, 491, 493, 496, 498, 500, 502, 506, 508, 512, - 514, 517, 520, 522 + 144, 152, 154, 158, 160, 164, 166, 171, 174, 176, + 180, 182, 186, 190, 192, 195, 197, 199, 200, 203, + 213, 218, 226, 227, 230, 231, 233, 235, 238, 244, + 245, 249, 250, 255, 261, 263, 267, 269, 271, 272, + 274, 276, 280, 282, 286, 288, 292, 294, 298, 300, + 304, 306, 310, 312, 315, 317, 321, 325, 329, 333, + 337, 341, 345, 347, 351, 353, 357, 361, 363, 367, + 369, 373, 375, 379, 383, 385, 389, 391, 393, 396, + 399, 401, 404, 406, 408, 410, 412, 414, 416, 418, + 420, 422, 424, 426, 428, 430, 432, 436, 438, 446, + 447, 451, 456, 461, 465, 475, 487, 499, 508, 517, + 518, 520, 523, 525, 527, 529, 533, 535, 539, 542, + 546, 550, 552, 554, 556 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { 88, 0, -1, 89, 90, 3, -1, -1, 48, 49, - 4, -1, -1, 90, 93, -1, 90, 132, -1, -1, + 4, -1, -1, 90, 93, -1, 90, 135, -1, -1, 92, -1, 93, -1, 93, 92, -1, 94, 4, -1, 71, -1, 71, 94, -1, 95, -1, 95, 71, 94, - -1, 95, 71, -1, 96, 111, -1, 20, 96, 110, - -1, 96, 110, 72, 114, -1, 21, 97, -1, 103, - -1, 34, 114, 4, 91, 35, -1, 36, 101, 114, - 4, 91, 37, -1, 36, 4, 91, 37, 101, 114, - -1, 36, 4, 91, 37, -1, 135, -1, 33, 36, + -1, 95, 71, -1, 96, 113, -1, 20, 96, 112, + -1, 96, 112, 72, 116, -1, 21, 97, -1, 105, + -1, 34, 116, 4, 91, 35, -1, 36, 103, 116, + 4, 91, 37, -1, 36, 4, 91, 37, 103, 116, + -1, 36, 4, 91, 37, -1, 138, -1, 33, 36, -1, 33, 39, -1, 33, 23, -1, 33, 24, -1, - 33, 22, -1, 55, 96, 110, 72, 114, -1, 50, + 33, 22, -1, 55, 96, 112, 72, 116, -1, 50, -1, 63, 61, 64, 62, -1, 63, 61, 65, 73, - -1, 27, 98, -1, 39, 141, 72, 114, 40, 114, - 102, 4, 91, 62, -1, 39, 42, 141, 43, 114, - 4, 91, 62, -1, 44, 45, 114, 4, 109, 31, - 44, -1, 141, -1, 128, 74, 141, -1, 141, -1, - 141, 75, 97, -1, 99, -1, 99, 75, 98, -1, - 141, 72, 100, -1, 129, -1, 76, 130, -1, 34, - -1, 38, -1, -1, 41, 114, -1, 28, 114, 32, - 4, 91, 105, 108, 31, 28, -1, 28, 114, 32, - 94, -1, 28, 114, 32, 94, 29, 94, 104, -1, - -1, 31, 28, -1, -1, 106, -1, 107, -1, 107, - 106, -1, 30, 114, 32, 4, 91, -1, -1, 29, - 4, 91, -1, -1, 45, 29, 4, 92, -1, 45, - 113, 4, 91, 109, -1, 112, -1, 77, 113, 78, - -1, 112, -1, 113, -1, -1, 6, -1, 114, -1, - 114, 75, 113, -1, 115, -1, 114, 14, 115, -1, - 116, -1, 115, 13, 116, -1, 117, -1, 116, 12, - 117, -1, 118, -1, 117, 11, 118, -1, 119, -1, - 118, 10, 119, -1, 120, -1, 9, 119, -1, 121, - -1, 120, 72, 121, -1, 120, 15, 121, -1, 120, - 79, 121, -1, 120, 80, 121, -1, 120, 18, 121, - -1, 120, 17, 121, -1, 120, 16, 121, -1, 122, - -1, 121, 81, 122, -1, 123, -1, 122, 82, 123, - -1, 122, 76, 123, -1, 124, -1, 123, 19, 124, - -1, 125, -1, 124, 83, 125, -1, 126, -1, 125, - 84, 126, -1, 125, 85, 126, -1, 127, -1, 126, - 86, 127, -1, 129, -1, 128, -1, 56, 141, -1, - 76, 127, -1, 131, -1, 96, 110, -1, 7, -1, - 8, -1, 67, -1, 130, -1, 52, -1, 53, -1, - 51, -1, 69, -1, 73, -1, 68, -1, 70, -1, - 77, 114, 78, -1, 60, -1, 54, 141, 4, 133, - 31, 54, 4, -1, -1, 135, 4, 133, -1, 137, - 66, 4, 133, -1, 134, 4, 133, -1, 136, 24, - 25, 66, 112, 4, 91, 31, 24, -1, 136, 24, - 26, 66, 77, 140, 78, 4, 91, 31, 24, -1, - 136, 24, 55, 66, 77, 140, 78, 4, 91, 31, - 24, -1, 136, 22, 141, 138, 4, 91, 31, 22, - -1, 136, 23, 141, 138, 4, 91, 31, 23, -1, - -1, 137, -1, 57, 59, -1, 57, -1, 58, -1, - 112, -1, 77, 139, 78, -1, 140, -1, 140, 75, - 139, -1, 141, -1, 46, 141, -1, 47, 141, -1, - 66, -1, 24, -1 + -1, 27, 100, -1, 39, 144, 72, 116, 40, 116, + 104, 4, 91, 62, -1, 39, 42, 144, 43, 116, + 4, 91, 62, -1, 44, 45, 116, 145, 111, 31, + 44, -1, 144, -1, 130, 74, 144, -1, 98, -1, + 98, 75, 97, -1, 144, -1, 144, 76, 99, 77, + -1, 144, 6, -1, 133, -1, 133, 75, 99, -1, + 101, -1, 101, 75, 100, -1, 144, 72, 102, -1, + 131, -1, 78, 132, -1, 34, -1, 38, -1, -1, + 41, 116, -1, 28, 116, 32, 4, 91, 107, 110, + 31, 28, -1, 28, 116, 32, 94, -1, 28, 116, + 32, 94, 29, 94, 106, -1, -1, 31, 28, -1, + -1, 108, -1, 109, -1, 109, 108, -1, 30, 116, + 32, 4, 91, -1, -1, 29, 4, 91, -1, -1, + 45, 29, 145, 92, -1, 45, 115, 145, 91, 111, + -1, 114, -1, 76, 115, 77, -1, 114, -1, 115, + -1, -1, 6, -1, 116, -1, 116, 75, 115, -1, + 117, -1, 116, 14, 117, -1, 118, -1, 117, 13, + 118, -1, 119, -1, 118, 12, 119, -1, 120, -1, + 119, 11, 120, -1, 121, -1, 120, 10, 121, -1, + 122, -1, 9, 121, -1, 123, -1, 122, 72, 123, + -1, 122, 15, 123, -1, 122, 79, 123, -1, 122, + 80, 123, -1, 122, 18, 123, -1, 122, 17, 123, + -1, 122, 16, 123, -1, 124, -1, 123, 81, 124, + -1, 125, -1, 124, 82, 125, -1, 124, 78, 125, + -1, 126, -1, 125, 19, 126, -1, 127, -1, 126, + 83, 127, -1, 128, -1, 127, 84, 128, -1, 127, + 85, 128, -1, 129, -1, 128, 86, 129, -1, 131, + -1, 130, -1, 56, 144, -1, 78, 129, -1, 134, + -1, 96, 112, -1, 7, -1, 8, -1, 67, -1, + 132, -1, 52, -1, 53, -1, 51, -1, 69, -1, + 73, -1, 68, -1, 70, -1, 69, -1, 73, -1, + 68, -1, 76, 116, 77, -1, 60, -1, 54, 144, + 4, 136, 31, 54, 4, -1, -1, 138, 4, 136, + -1, 140, 66, 4, 136, -1, 21, 98, 4, 136, + -1, 137, 4, 136, -1, 139, 24, 25, 66, 114, + 4, 91, 31, 24, -1, 139, 24, 26, 66, 76, + 143, 77, 4, 91, 31, 24, -1, 139, 24, 55, + 66, 76, 143, 77, 4, 91, 31, 24, -1, 139, + 22, 144, 141, 4, 91, 31, 22, -1, 139, 23, + 144, 141, 4, 91, 31, 23, -1, -1, 140, -1, + 57, 59, -1, 57, -1, 58, -1, 114, -1, 76, + 142, 77, -1, 143, -1, 143, 75, 142, -1, 144, + 114, -1, 46, 144, 114, -1, 47, 144, 114, -1, + 66, -1, 24, -1, 4, -1, 71, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 144, 144, 147, 148, 150, 152, 153, 156, 157, - 160, 161, 164, 167, 168, 169, 170, 171, 174, 175, - 176, 178, 179, 180, 182, 185, 188, 189, 190, 191, - 192, 193, 194, 195, 197, 198, 199, 200, 201, 203, - 205, 209, 210, 213, 214, 217, 218, 221, 224, 225, - 228, 229, 232, 233, 236, 238, 239, 242, 244, 247, - 248, 251, 252, 255, 259, 260, 263, 264, 265, 269, - 270, 273, 274, 276, 278, 281, 282, 285, 286, 289, - 290, 293, 294, 297, 298, 301, 302, 305, 306, 309, - 310, 311, 312, 313, 314, 315, 316, 319, 320, 323, - 324, 325, 328, 329, 332, 333, 337, 338, 340, 344, - 345, 348, 349, 350, 351, 354, 355, 358, 359, 360, - 361, 362, 363, 364, 367, 368, 369, 370, 374, 375, - 378, 381, 382, 383, 384, 387, 389, 391, 395, 397, - 401, 402, 405, 406, 407, 410, 411, 414, 415, 418, - 419, 420, 424, 425 + 0, 147, 147, 150, 151, 153, 155, 156, 159, 160, + 163, 164, 167, 170, 171, 172, 173, 174, 177, 178, + 179, 181, 182, 183, 185, 188, 191, 192, 193, 194, + 195, 196, 197, 198, 200, 201, 202, 203, 204, 206, + 208, 212, 213, 216, 217, 220, 221, 222, 225, 226, + 229, 230, 233, 236, 237, 240, 241, 244, 245, 248, + 250, 251, 254, 256, 259, 260, 263, 264, 267, 271, + 272, 275, 276, 277, 281, 282, 285, 286, 288, 290, + 293, 294, 297, 298, 301, 302, 305, 306, 309, 310, + 313, 314, 317, 318, 321, 322, 323, 324, 325, 326, + 327, 328, 331, 332, 335, 336, 337, 340, 341, 344, + 345, 349, 350, 352, 356, 357, 360, 361, 362, 363, + 366, 367, 370, 371, 372, 373, 374, 375, 376, 379, + 380, 381, 382, 385, 386, 387, 390, 391, 394, 397, + 398, 400, 402, 403, 406, 408, 410, 414, 416, 420, + 421, 424, 425, 426, 429, 430, 433, 434, 437, 438, + 439, 443, 444, 448, 449 }; #endif @@ -663,23 +670,24 @@ static const char *const yytname[] = "tOPTION", "tEXPLICIT", "tSTOP", "tNOTHING", "tEMPTY", "tNULL", "tCLASS", "tSET", "tNEW", "tPUBLIC", "tPRIVATE", "tDEFAULT", "tME", "tERROR", "tNEXT", "tON", "tRESUME", "tGOTO", "tIdentifier", "tString", "tLong", - "tShort", "tDouble", "':'", "'='", "'0'", "'.'", "','", "'-'", "'('", - "')'", "'>'", "'<'", "'&'", "'+'", "'\\\\'", "'*'", "'/'", "'^'", + "tShort", "tDouble", "':'", "'='", "'0'", "'.'", "','", "'('", "')'", + "'-'", "'>'", "'<'", "'&'", "'+'", "'\\\\'", "'*'", "'/'", "'^'", "$accept", "Program", "OptionExplicit_opt", "SourceElements", "StatementsNl_opt", "StatementsNl", "StatementNl", "Statement", - "SimpleStatement", "MemberExpression", "DimDeclList", "ConstDeclList", - "ConstDecl", "ConstExpression", "DoType", "Step_opt", "IfStatement", - "EndIf_opt", "ElseIfs_opt", "ElseIfs", "ElseIf", "Else_opt", - "CaseClausules", "Arguments_opt", "ArgumentList_opt", - "EmptyBrackets_opt", "ExpressionList", "Expression", "EqvExpression", - "XorExpression", "OrExpression", "AndExpression", "NotExpression", - "EqualityExpression", "ConcatExpression", "AdditiveExpression", - "ModExpression", "IntdivExpression", "MultiplicativeExpression", - "ExpExpression", "UnaryExpression", "CallExpression", - "LiteralExpression", "NumericLiteralExpression", "PrimaryExpression", - "ClassDeclaration", "ClassBody", "PropertyDecl", "FunctionDecl", - "Storage_opt", "Storage", "ArgumentsDecl_opt", "ArgumentDeclList", - "ArgumentDecl", "Identifier", 0 + "SimpleStatement", "MemberExpression", "DimDeclList", "DimDecl", + "DimList", "ConstDeclList", "ConstDecl", "ConstExpression", "DoType", + "Step_opt", "IfStatement", "EndIf_opt", "ElseIfs_opt", "ElseIfs", + "ElseIf", "Else_opt", "CaseClausules", "Arguments_opt", + "ArgumentList_opt", "EmptyBrackets_opt", "ExpressionList", "Expression", + "EqvExpression", "XorExpression", "OrExpression", "AndExpression", + "NotExpression", "EqualityExpression", "ConcatExpression", + "AdditiveExpression", "ModExpression", "IntdivExpression", + "MultiplicativeExpression", "ExpExpression", "UnaryExpression", + "CallExpression", "LiteralExpression", "NumericLiteralExpression", + "IntegerValue", "PrimaryExpression", "ClassDeclaration", "ClassBody", + "PropertyDecl", "FunctionDecl", "Storage_opt", "Storage", + "ArgumentsDecl_opt", "ArgumentDeclList", "ArgumentDecl", "Identifier", + "StSep", 0 }; #endif @@ -695,7 +703,7 @@ static const yytype_uint16 yytoknum[] = 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 58, 61, 48, 46, 44, 45, 40, 41, 62, + 325, 58, 61, 48, 46, 44, 40, 41, 45, 62, 60, 38, 43, 92, 42, 47, 94 }; # endif @@ -707,18 +715,19 @@ static const yytype_uint8 yyr1[] = 92, 92, 93, 94, 94, 94, 94, 94, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 96, 96, 97, 97, 98, 98, 99, 100, 100, - 101, 101, 102, 102, 103, 103, 103, 104, 104, 105, - 105, 106, 106, 107, 108, 108, 109, 109, 109, 110, - 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, - 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, - 120, 120, 120, 120, 120, 120, 120, 121, 121, 122, - 122, 122, 123, 123, 124, 124, 125, 125, 125, 126, - 126, 127, 127, 127, 127, 128, 128, 129, 129, 129, - 129, 129, 129, 129, 130, 130, 130, 130, 131, 131, - 132, 133, 133, 133, 133, 134, 134, 134, 135, 135, - 136, 136, 137, 137, 137, 138, 138, 139, 139, 140, - 140, 140, 141, 141 + 95, 96, 96, 97, 97, 98, 98, 98, 99, 99, + 100, 100, 101, 102, 102, 103, 103, 104, 104, 105, + 105, 105, 106, 106, 107, 107, 108, 108, 109, 110, + 110, 111, 111, 111, 112, 112, 113, 113, 114, 114, + 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, + 120, 120, 121, 121, 122, 122, 122, 122, 122, 122, + 122, 122, 123, 123, 124, 124, 124, 125, 125, 126, + 126, 127, 127, 127, 128, 128, 129, 129, 129, 129, + 130, 130, 131, 131, 131, 131, 131, 131, 131, 132, + 132, 132, 132, 133, 133, 133, 134, 134, 135, 136, + 136, 136, 136, 136, 137, 137, 137, 138, 138, 139, + 139, 140, 140, 140, 141, 141, 142, 142, 143, 143, + 143, 144, 144, 145, 145 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -728,18 +737,19 @@ static const yytype_uint8 yyr2[] = 1, 2, 2, 1, 2, 1, 3, 2, 2, 3, 4, 2, 1, 5, 6, 6, 4, 1, 2, 2, 2, 2, 2, 5, 1, 4, 4, 2, 10, 8, - 7, 1, 3, 1, 3, 1, 3, 3, 1, 2, - 1, 1, 0, 2, 9, 4, 7, 0, 2, 0, - 1, 1, 2, 5, 0, 3, 0, 4, 5, 1, - 3, 1, 1, 0, 1, 1, 3, 1, 3, 1, - 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, - 3, 3, 3, 3, 3, 3, 3, 1, 3, 1, - 3, 3, 1, 3, 1, 3, 1, 3, 3, 1, - 3, 1, 1, 2, 2, 1, 2, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, - 7, 0, 3, 4, 3, 9, 11, 11, 8, 8, - 0, 1, 2, 1, 1, 1, 3, 1, 3, 1, - 2, 2, 1, 1 + 7, 1, 3, 1, 3, 1, 4, 2, 1, 3, + 1, 3, 3, 1, 2, 1, 1, 0, 2, 9, + 4, 7, 0, 2, 0, 1, 1, 2, 5, 0, + 3, 0, 4, 5, 1, 3, 1, 1, 0, 1, + 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, + 1, 3, 1, 2, 1, 3, 3, 3, 3, 3, + 3, 3, 1, 3, 1, 3, 3, 1, 3, 1, + 3, 1, 3, 3, 1, 3, 1, 1, 2, 2, + 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 3, 1, 7, 0, + 3, 4, 4, 3, 9, 11, 11, 8, 8, 0, + 1, 2, 1, 1, 1, 3, 1, 3, 2, 3, + 3, 1, 1, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. @@ -747,279 +757,295 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 3, 0, 0, 5, 0, 1, 140, 4, 2, 0, - 0, 153, 0, 0, 0, 0, 0, 0, 0, 34, - 0, 0, 143, 144, 129, 0, 152, 13, 0, 6, - 0, 15, 73, 22, 0, 115, 7, 27, 0, 141, - 41, 73, 21, 43, 37, 45, 0, 117, 118, 0, - 123, 121, 122, 0, 119, 126, 124, 127, 125, 0, - 73, 0, 77, 79, 81, 83, 85, 87, 89, 97, - 99, 102, 104, 106, 109, 112, 111, 120, 32, 30, - 31, 28, 29, 0, 140, 50, 51, 0, 0, 0, - 0, 0, 73, 142, 0, 14, 0, 12, 17, 74, - 0, 116, 18, 71, 72, 75, 0, 0, 0, 0, - 19, 69, 0, 0, 0, 88, 113, 114, 116, 0, - 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 3, 0, 0, 5, 0, 1, 149, 4, 2, 0, + 0, 162, 0, 0, 0, 0, 0, 0, 0, 34, + 0, 0, 152, 153, 137, 0, 161, 13, 0, 6, + 0, 15, 78, 22, 0, 120, 7, 27, 0, 150, + 41, 78, 21, 43, 45, 37, 50, 0, 122, 123, + 0, 128, 126, 127, 0, 124, 131, 129, 132, 130, + 0, 78, 0, 82, 84, 86, 88, 90, 92, 94, + 102, 104, 107, 109, 111, 114, 117, 116, 125, 32, + 30, 31, 28, 29, 0, 149, 55, 56, 0, 0, + 0, 0, 0, 78, 151, 0, 14, 0, 12, 17, + 79, 0, 121, 18, 76, 77, 80, 0, 0, 0, + 0, 19, 74, 0, 47, 0, 0, 0, 93, 118, + 119, 121, 0, 149, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 140, 0, 9, 10, 0, 0, 0, 0, 140, 116, - 0, 0, 128, 16, 0, 0, 0, 0, 42, 73, - 73, 44, 46, 0, 47, 48, 78, 8, 55, 80, - 82, 84, 86, 91, 96, 95, 94, 90, 92, 93, - 98, 101, 100, 103, 105, 107, 108, 110, 0, 26, - 11, 140, 0, 0, 66, 0, 0, 0, 0, 141, - 0, 35, 36, 70, 20, 76, 0, 145, 0, 0, - 49, 59, 140, 23, 0, 0, 0, 0, 0, 0, - 0, 140, 140, 0, 0, 33, 0, 0, 0, 147, - 149, 140, 140, 0, 64, 60, 61, 57, 25, 24, - 140, 52, 0, 0, 0, 0, 134, 132, 0, 0, - 0, 140, 150, 151, 146, 0, 0, 0, 0, 0, - 0, 62, 0, 56, 0, 0, 0, 140, 8, 40, - 130, 73, 0, 0, 133, 148, 0, 0, 0, 140, - 0, 58, 39, 53, 140, 67, 66, 0, 0, 0, - 138, 139, 8, 65, 54, 0, 68, 140, 0, 0, - 63, 38, 0, 0, 0, 0, 140, 140, 135, 0, - 0, 0, 0, 136, 137 + 0, 0, 0, 149, 0, 9, 10, 0, 0, 0, + 0, 149, 121, 0, 0, 136, 16, 0, 0, 0, + 0, 42, 78, 78, 44, 135, 133, 134, 0, 48, + 51, 0, 52, 53, 83, 8, 60, 85, 87, 89, + 91, 96, 101, 100, 99, 95, 97, 98, 103, 106, + 105, 108, 110, 112, 113, 115, 0, 26, 11, 149, + 0, 0, 163, 164, 71, 0, 0, 0, 0, 0, + 150, 0, 35, 36, 75, 20, 81, 0, 154, 0, + 0, 46, 0, 54, 64, 149, 23, 0, 0, 0, + 0, 0, 0, 0, 0, 149, 149, 0, 0, 33, + 0, 0, 0, 156, 78, 149, 149, 49, 0, 69, + 65, 66, 62, 25, 24, 149, 57, 0, 0, 0, + 149, 0, 143, 140, 0, 0, 0, 149, 78, 78, + 155, 0, 158, 0, 0, 0, 0, 0, 67, 0, + 61, 0, 0, 0, 149, 8, 40, 142, 138, 78, + 0, 0, 141, 159, 160, 157, 0, 0, 0, 149, + 0, 63, 39, 58, 149, 72, 71, 0, 0, 0, + 147, 148, 8, 70, 59, 0, 73, 149, 0, 0, + 68, 38, 0, 0, 0, 0, 149, 149, 144, 0, + 0, 0, 0, 145, 146 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 2, 3, 6, 141, 142, 143, 30, 31, 60, - 42, 44, 45, 164, 87, 266, 33, 263, 234, 235, - 236, 260, 219, 101, 102, 111, 154, 105, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 35, 36, 195, 196, 37, 38, - 39, 208, 228, 229, 40 + -1, 2, 3, 6, 144, 145, 146, 30, 31, 61, + 42, 43, 168, 45, 46, 172, 88, 283, 33, 280, + 249, 250, 251, 277, 232, 102, 103, 112, 157, 106, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 169, 35, 36, 206, + 207, 37, 38, 39, 219, 242, 243, 40, 204 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -184 +#define YYPACT_NINF -146 static const yytype_int16 yypact[] = { - -21, -15, 46, -184, 51, -184, 287, -184, -184, 82, - 17, -184, 17, 395, 147, 395, 20, 7, 14, -184, - 17, 82, 11, -184, -184, 34, -184, 483, 395, -184, - 70, 29, 144, -184, 56, -184, -184, -184, 44, -184, - -184, 0, -184, 43, -184, 80, 31, -184, -184, 395, - -184, -184, -184, 17, -184, -184, -184, -184, -184, 425, - 0, 21, 66, 168, 173, 178, -184, 47, 122, 84, - 186, 124, 62, 123, -184, 56, -184, -184, -184, -184, - -184, -184, -184, 36, 531, -184, -184, 395, 17, 146, - 395, 215, 0, -184, 126, -184, 6, -184, 483, -184, - 395, 151, -184, 61, -184, -3, 17, 17, 17, 395, - 150, -184, 17, 17, 105, -184, -184, -184, -184, 395, - 335, 395, 395, 395, 395, 425, 425, 425, 425, 425, - 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, - 579, 192, -184, 483, 94, 190, 395, 95, -1, 165, - 177, 167, -184, -184, 163, 18, 395, 395, -184, 13, - 13, -184, -184, 162, -184, -184, 66, 483, 216, 168, - 173, 178, -184, 122, 122, 122, 122, 122, 122, 122, - 84, 186, 186, 124, 62, 123, 123, -184, 209, 9, - -184, 531, 395, 8, 201, 218, 243, 246, 121, 185, - 395, -184, -184, -184, 251, -184, 5, -184, 256, 262, - -184, 237, 723, -184, 395, 231, 117, 395, 358, 238, - 220, -1, -1, 139, 266, 251, 17, 17, 194, 202, - -184, 627, 627, 395, 247, -184, 237, 248, 251, -184, - 675, 4, 277, 278, 239, 281, -184, -184, 221, 223, - 228, -1, -184, -184, -184, 5, 264, 265, 28, 293, - 267, -184, 271, -184, 250, 395, 306, 723, 483, -184, - -184, 307, 240, 241, -184, -184, 294, 296, 318, 627, - 299, -184, -184, 251, 675, -184, 201, 320, 5, 5, - -184, -184, 483, -184, -184, 268, -184, 627, 254, 255, - -184, -184, 297, 325, 330, 311, 627, 627, -184, 305, - 309, 314, 319, -184, -184 + -13, 2, 57, -146, 39, -146, 307, -146, -146, 1, + -2, -146, -2, 468, 184, 468, 20, -11, 15, -146, + -2, 1, 40, -146, -146, 62, -146, 557, 468, -146, + 59, 84, 388, -146, 94, -146, -146, -146, 109, -146, + -146, 4, -146, 101, 8, -146, 106, 111, -146, -146, + 468, -146, -146, -146, -2, -146, -146, -146, -146, -146, + 498, 4, 27, 175, 182, 188, 191, -146, 29, 124, + 38, 193, 130, 68, 129, -146, 94, -146, -146, -146, + -146, -146, -146, -146, 24, 598, -146, -146, 468, -2, + 145, 468, 214, 4, -146, 95, -146, 5, -146, 557, + -146, 468, 152, -146, 64, -146, 19, -2, -2, -2, + 468, 161, -146, -2, -146, 45, -2, 97, -146, -146, + -146, -146, 468, 348, 468, 468, 468, 468, 498, 498, + 498, 498, 498, 498, 498, 498, 498, 498, 498, 498, + 498, 498, 498, 651, 199, -146, 557, 48, 194, 468, + 16, 120, 166, 181, 172, -146, -146, 169, 35, 468, + 468, -146, 10, 10, -146, -146, -146, -146, 170, 173, + -146, 117, -146, -146, 175, 557, 221, 182, 188, 191, + -146, 124, 124, 124, 124, 124, 124, 124, 38, 193, + 193, 130, 68, 129, 129, -146, 217, 73, -146, 598, + 468, 121, -146, -146, 208, -2, 223, 252, 255, 150, + 195, 468, -146, -146, -146, 246, -146, 26, -146, 258, + 259, -146, 45, -146, 234, 786, -146, 468, 228, 61, + 468, 418, 236, 266, 218, 120, 120, 14, 267, 246, + -2, -2, 196, 200, 268, 692, 692, -146, 468, 247, + -146, 234, 253, 246, -146, 733, 12, 7, 7, 233, + 120, 279, -146, -146, 220, 224, 225, 120, 268, 268, + -146, 26, -146, 256, 261, 34, 290, 265, -146, 269, + -146, 237, 468, 297, 786, 557, -146, -146, -146, 268, + 226, 229, -146, -146, -146, -146, 282, 284, 305, 692, + 286, -146, -146, 246, 733, -146, 208, 308, 26, 26, + -146, -146, 557, -146, -146, 254, -146, 692, 238, 240, + -146, -146, 287, 315, 320, 306, 692, 692, -146, 298, + 301, 309, 312, -146, -146 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -184, -184, -184, -184, -130, -142, 340, -23, -184, -6, - 236, 257, -184, -184, 160, -184, -184, -184, -184, 115, - -184, -184, 68, -16, -184, -19, -25, 92, 233, 252, - 253, 249, -33, -184, 128, 229, 65, 225, 242, 64, - -50, -4, 263, 213, -184, -184, -183, -184, -140, -136, - -134, 224, 125, -73, 16 + -146, -146, -146, -146, -101, -137, 332, -23, -146, -6, + 231, 134, 123, 232, -146, -146, 153, -146, -146, -146, + -146, 91, -146, -146, 41, -5, -146, 0, -31, 55, + 227, 230, 235, 245, -42, -146, 99, 239, 43, 215, + 216, 51, -53, -4, 241, 185, -146, -146, -146, -78, + -146, -145, -139, -133, 203, 88, -112, 17, -48 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -141 +#define YYTABLE_NINF -150 static const yytype_int16 yytable[] = { - 32, 190, 34, 41, 95, 34, 99, 104, 197, 117, - 188, 119, 198, 103, 199, 92, 115, 34, 119, 99, - 119, 32, 119, 34, 84, 110, 43, 1, 46, 11, - -131, 11, 119, 89, 4, 119, 91, 211, 246, 247, - 140, 11, 119, 85, 118, 265, 5, 86, 217, 88, - 119, 226, 227, 120, 85, 7, 22, 23, 86, 90, - 278, 215, 125, 126, 127, 128, 107, 108, 274, 116, - 93, 26, 157, 26, 97, 153, 149, 109, 32, 121, - 34, 197, 197, 26, 152, 198, 198, 199, 199, 187, - 206, 172, 32, 157, 34, 94, 152, 168, 191, 194, - 98, 256, 257, 114, 145, 61, 11, 83, 119, 119, - 264, 197, 47, 48, 32, 198, 34, 199, 112, 129, - 96, 240, 158, 159, 160, 285, 130, 131, 43, 46, - 106, 119, 205, -69, 32, -69, 34, 32, 286, 34, - 207, 207, 24, 107, 108, 223, 137, 138, 26, 293, - 99, 47, 48, 49, 295, 113, 50, 51, 52, 28, - 133, 32, 300, 34, 248, 249, 134, 302, 11, 78, - 79, 80, 54, 55, 56, 57, 309, 310, 58, 144, - 122, 163, 147, 81, 123, 32, 82, 34, 124, 237, - 150, 151, 155, 243, 250, 50, 51, 52, 181, 182, - 53, 185, 186, 132, 24, 135, 32, 136, 34, 139, - 26, 54, 55, 56, 57, 298, 299, 58, 146, 148, - 59, 100, 230, 156, -116, 32, 32, 34, 34, 189, - 55, 56, 57, 192, 32, 58, 34, 200, 193, 201, - 202, 203, 252, 253, 213, 212, 218, 221, 204, 220, - 222, 224, 287, 173, 174, 175, 176, 177, 178, 179, - 231, 32, 32, 34, 34, 119, 232, 233, 239, 244, - 251, 230, 254, 32, 245, 34, 259, 255, 32, 262, - 34, 267, 268, 269, 216, 270, 32, 271, 34, 272, - 8, 32, 225, 34, 273, 276, 277, 279, 280, 281, - 32, 32, 34, 34, 230, 230, 238, 9, 10, 241, - 284, 11, 282, 99, 12, 13, 290, 288, 289, 291, - 14, 15, 292, 16, 297, 258, 17, 294, 305, 306, - 301, 18, 303, 304, 307, 308, 311, 19, 313, 167, - 312, 20, 21, 314, 22, 23, 29, 24, 161, 214, - 25, 261, 166, 26, 296, 9, 10, 283, 27, 11, - 183, 180, 12, 13, 28, 47, 48, 49, 14, 15, - 162, 16, 171, 169, 17, 170, 210, 165, 184, 18, - 275, 0, 11, 0, 209, 19, 0, 242, 0, 0, - 21, 0, 22, 23, 0, 24, 0, 0, 25, 0, - 0, 26, 47, 48, 49, 0, 27, 0, 0, 50, - 51, 52, 28, 0, 53, 0, 0, 0, 24, 11, - 0, 0, 0, 0, 26, 54, 55, 56, 57, 0, - 0, 58, 47, 48, 59, 28, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 50, 51, 52, 11, - 0, 53, 0, 0, 0, 24, 0, 0, 0, 0, - 0, 26, 54, 55, 56, 57, 0, 0, 58, 0, - 0, 59, 28, 0, 0, 0, 50, 51, 52, 0, - 0, 53, 0, 0, 0, 24, 0, 0, 0, 0, - 0, 26, 54, 55, 56, 57, 0, 0, 58, 0, - 0, 59, 28, 9, 10, -140, -140, 11, 0, 0, - 12, 13, 0, 0, 0, 0, 14, 15, 0, 16, - 0, 0, 17, 0, 0, 0, 0, 18, 0, 0, - 0, 0, 0, 19, 0, 0, 0, 0, 21, 0, - 22, 23, 0, 24, 0, 0, 25, 0, 0, 26, - 0, 9, 10, 0, 27, 11, 0, 0, 12, 13, - 28, 0, 0, 0, 14, 15, 0, 16, -8, 0, - 17, 0, 0, 0, 0, 18, 0, 0, 0, 0, - 0, 19, 0, 0, 0, 0, 21, 0, 22, 23, - 0, 24, 0, 0, 25, 0, 0, 26, 0, 9, - 10, 0, 27, 11, 0, 0, 12, 13, 28, 0, - 0, 0, 14, 15, -8, 16, 0, 0, 17, 0, - 0, 0, 0, 18, 0, 0, 0, 0, 0, 19, - 0, 0, 0, 0, 21, 0, 22, 23, 0, 24, - 0, 0, 25, 0, 0, 26, 0, 9, 10, 0, - 27, 11, 0, 0, 12, 13, 28, 0, -8, 0, + 32, 105, 34, 41, 96, 34, 208, 120, 118, 198, + 100, 202, 209, 11, 114, 93, 100, 34, 210, 122, + 202, 32, 11, 34, 85, 11, 122, 44, 143, 47, + 122, 89, 104, 122, 90, 1, 111, 92, 122, 264, + 265, 122, 196, 7, 128, 129, 130, 131, 122, 122, + 11, 4, 199, 282, 86, 26, 121, 5, 87, 123, + 91, 24, 122, 98, 26, 255, 298, 26, 62, 266, + 84, 119, 240, 241, 224, 122, 156, 28, 203, 32, + 110, 34, 155, 97, 115, 180, 217, 203, 152, 195, + 208, 208, 26, 32, 160, 34, 209, 209, 228, 94, + 176, 132, 210, 210, 48, 49, 148, 86, 133, 134, + 160, 87, 155, 165, 166, 208, 136, 32, 167, 34, + 137, 209, 208, 95, 161, 162, 163, 210, 209, 216, + 44, 108, 109, 47, 210, 122, -74, 32, -74, 34, + 32, 205, 34, 147, 273, 274, 150, 305, 51, 52, + 53, -139, 140, 141, 281, 99, 158, 262, 263, 153, + 154, 230, 218, 218, 55, 56, 57, 58, 107, 32, + 59, 34, 108, 109, 237, 171, 113, 22, 23, 189, + 190, 116, 287, 117, 306, 56, 57, 58, 124, 292, + 59, 193, 194, 32, 125, 34, 318, 319, 313, 126, + 258, 127, 252, 315, 201, 135, 79, 80, 81, 284, + 285, 320, 138, 139, 215, 142, 322, 149, 151, 32, + 82, 34, 44, 83, 159, 329, 330, 181, 182, 183, + 184, 185, 186, 187, 244, -121, 197, 200, 211, 32, + 32, 34, 34, 212, 272, 213, 214, 221, 222, 32, + 225, 34, 226, 231, 234, 229, 235, 268, 269, 236, + 122, 238, 245, 246, 248, 254, 239, 259, 293, 294, + 260, 267, 261, 270, 100, 271, 276, 286, 32, 32, + 34, 34, 253, 288, 279, 256, 289, 296, 244, 307, + 290, 291, 297, 32, 299, 34, 300, 301, 32, 302, + 34, 304, 308, 275, 310, 309, 32, 311, 34, 312, + 8, 32, 317, 34, 314, 323, 321, 324, 325, 326, + 32, 32, 34, 34, 327, 244, 244, 9, 10, 331, + 328, 11, 332, 333, 12, 13, 334, 303, 29, 233, + 14, 15, 278, 16, 164, 247, 17, 316, 170, 174, + 227, 18, 175, 191, 177, 192, 223, 19, 173, 295, + 178, 20, 21, 0, 22, 23, 220, 24, 9, 10, + 25, 179, 11, 26, 188, 12, 13, 0, 27, 0, + 0, 14, 15, 28, 16, 0, 0, 17, 0, 0, + 0, 0, 18, 0, 100, 48, 49, 50, 19, 0, + 0, 0, 0, 21, 0, 22, 23, 0, 24, 0, + 0, 25, 11, 0, 26, 0, 0, 0, 0, 27, + 0, 0, 0, 0, 28, 48, 49, 50, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 52, 53, 11, 0, 54, 0, 0, 257, 24, 0, + 0, 0, 0, 0, 26, 55, 56, 57, 58, 0, + 0, 59, 0, 0, 101, 0, 60, 0, 0, 51, + 52, 53, 0, 0, 54, 48, 49, 50, 24, 0, + 0, 0, 0, 0, 26, 55, 56, 57, 58, 0, + 0, 59, 11, 0, 28, 0, 60, 0, 0, 0, + 0, 0, 0, 0, 0, 48, 49, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 52, 53, 11, 0, 54, 0, 0, 0, 24, 0, + 0, 0, 0, 0, 26, 55, 56, 57, 58, 0, + 0, 59, 0, 0, 28, 0, 60, 0, 0, 51, + 52, 53, 0, 0, 54, 0, 0, 0, 24, 0, + 0, 0, 0, 0, 26, 55, 56, 57, 58, 0, + 0, 59, 0, 0, 28, 0, 60, 9, 10, -149, + -149, 11, 0, 0, 12, 13, 0, 0, 0, 0, 14, 15, 0, 16, 0, 0, 17, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 19, 0, 0, - 0, 0, 21, 0, 22, 23, 0, 24, 0, 0, - 25, 0, 0, 26, 0, 9, 10, 0, 27, 11, - 0, 0, 12, 13, 28, 0, 0, 0, 14, 15, - 0, 16, 0, 0, 17, 0, 0, 0, 0, 18, - 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, - 21, 0, 22, 23, 0, 24, 0, -8, 25, 0, - 0, 26, 0, 9, 10, 0, 27, 11, 0, 0, - 12, 13, 28, 0, 0, 0, 14, 15, 0, 16, + 0, 0, 21, 0, 22, 23, 0, 24, 9, 10, + 25, 0, 11, 26, 0, 12, 13, 0, 27, 0, + 0, 14, 15, 28, 16, -8, 0, 17, 0, 0, + 0, 0, 18, 0, 0, 0, 0, 0, 19, 0, + 0, 0, 0, 21, 0, 22, 23, 0, 24, 0, + 0, 25, 0, 0, 26, 0, 0, 0, 0, 27, + 0, 9, 10, 0, 28, 11, 0, 0, 12, 13, + 0, 0, 0, 0, 14, 15, -8, 16, 0, 0, + 17, 0, 0, 0, 0, 18, 0, 0, 0, 0, + 0, 19, 0, 0, 0, 0, 21, 0, 22, 23, + 0, 24, 9, 10, 25, 0, 11, 26, 0, 12, + 13, 0, 27, -8, 0, 14, 15, 28, 16, 0, + 0, 17, 0, 0, 0, 0, 18, 0, 0, 0, + 0, 0, 19, 0, 0, 0, 0, 21, 0, 22, + 23, 0, 24, 9, 10, 25, 0, 11, 26, 0, + 12, 13, 0, 27, 0, 0, 14, 15, 28, 16, 0, 0, 17, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 21, 0, - 22, 23, 0, 24, 0, 0, 25, 0, 0, 26, - 0, 0, 0, 0, 27, 0, 0, 0, 0, 0, - 28 + 22, 23, 0, 24, 0, -8, 25, 0, 0, 26, + 0, 0, 0, 0, 27, 0, 9, 10, 0, 28, + 11, 0, 0, 12, 13, 0, 0, 0, 0, 14, + 15, 0, 16, 0, 0, 17, 0, 0, 0, 0, + 18, 0, 0, 0, 0, 0, 19, 0, 0, 0, + 0, 21, 0, 22, 23, 0, 24, 0, 0, 25, + 0, 0, 26, 0, 0, 0, 0, 27, 0, 0, + 0, 0, 28 }; #define yypact_value_is_default(yystate) \ - ((yystate) == (-184)) + ((yystate) == (-146)) #define yytable_value_is_error(yytable_value) \ YYID (0) static const yytype_int16 yycheck[] = { - 6, 143, 6, 9, 27, 9, 6, 32, 148, 59, - 140, 14, 148, 32, 148, 21, 49, 21, 14, 6, - 14, 27, 14, 27, 4, 41, 10, 48, 12, 24, - 31, 24, 14, 17, 49, 14, 20, 167, 221, 222, - 4, 24, 14, 34, 60, 41, 0, 38, 40, 42, - 14, 46, 47, 32, 34, 4, 57, 58, 38, 45, - 32, 191, 15, 16, 17, 18, 22, 23, 251, 53, - 59, 66, 75, 66, 4, 98, 92, 77, 84, 13, - 84, 221, 222, 66, 78, 221, 222, 221, 222, 139, - 77, 124, 98, 75, 98, 61, 78, 120, 4, 4, - 71, 231, 232, 72, 88, 13, 24, 15, 14, 14, - 240, 251, 7, 8, 120, 251, 120, 251, 75, 72, - 28, 4, 106, 107, 108, 267, 79, 80, 112, 113, - 74, 14, 157, 72, 140, 74, 140, 143, 268, 143, - 159, 160, 60, 22, 23, 24, 84, 85, 66, 279, - 6, 7, 8, 9, 284, 75, 51, 52, 53, 77, - 76, 167, 292, 167, 25, 26, 82, 297, 24, 22, - 23, 24, 67, 68, 69, 70, 306, 307, 73, 87, - 12, 76, 90, 36, 11, 191, 39, 191, 10, 212, - 64, 65, 100, 218, 55, 51, 52, 53, 133, 134, - 56, 137, 138, 81, 60, 19, 212, 83, 212, 86, - 66, 67, 68, 69, 70, 288, 289, 73, 72, 4, - 76, 77, 206, 72, 74, 231, 232, 231, 232, 37, - 68, 69, 70, 43, 240, 73, 240, 72, 146, 62, - 73, 78, 226, 227, 35, 29, 45, 4, 156, 31, - 4, 66, 271, 125, 126, 127, 128, 129, 130, 131, - 4, 267, 268, 267, 268, 14, 4, 30, 37, 31, - 4, 255, 78, 279, 54, 279, 29, 75, 284, 31, - 284, 4, 4, 44, 192, 4, 292, 66, 292, 66, - 3, 297, 200, 297, 66, 31, 31, 4, 31, 28, - 306, 307, 306, 307, 288, 289, 214, 20, 21, 217, - 4, 24, 62, 6, 27, 28, 22, 77, 77, 23, - 33, 34, 4, 36, 4, 233, 39, 28, 31, 4, - 62, 44, 78, 78, 4, 24, 31, 50, 24, 4, - 31, 54, 55, 24, 57, 58, 6, 60, 112, 189, - 63, 236, 119, 66, 286, 20, 21, 265, 71, 24, - 135, 132, 27, 28, 77, 7, 8, 9, 33, 34, - 113, 36, 123, 121, 39, 122, 163, 114, 136, 44, - 255, -1, 24, -1, 160, 50, -1, 29, -1, -1, - 55, -1, 57, 58, -1, 60, -1, -1, 63, -1, - -1, 66, 7, 8, 9, -1, 71, -1, -1, 51, - 52, 53, 77, -1, 56, -1, -1, -1, 60, 24, + 6, 32, 6, 9, 27, 9, 151, 60, 50, 146, + 6, 4, 151, 24, 6, 21, 6, 21, 151, 14, + 4, 27, 24, 27, 4, 24, 14, 10, 4, 12, + 14, 42, 32, 14, 17, 48, 41, 20, 14, 25, + 26, 14, 143, 4, 15, 16, 17, 18, 14, 14, + 24, 49, 4, 41, 34, 66, 61, 0, 38, 32, + 45, 60, 14, 4, 66, 4, 32, 66, 13, 55, + 15, 54, 46, 47, 175, 14, 99, 76, 71, 85, + 76, 85, 77, 28, 76, 127, 76, 71, 93, 142, + 235, 236, 66, 99, 75, 99, 235, 236, 199, 59, + 123, 72, 235, 236, 7, 8, 89, 34, 79, 80, + 75, 38, 77, 68, 69, 260, 78, 123, 73, 123, + 82, 260, 267, 61, 107, 108, 109, 260, 267, 160, + 113, 22, 23, 116, 267, 14, 72, 143, 74, 143, + 146, 21, 146, 88, 245, 246, 91, 284, 51, 52, + 53, 31, 84, 85, 255, 71, 101, 235, 236, 64, + 65, 40, 162, 163, 67, 68, 69, 70, 74, 175, + 73, 175, 22, 23, 24, 78, 75, 57, 58, 136, + 137, 75, 260, 72, 285, 68, 69, 70, 13, 267, + 73, 140, 141, 199, 12, 199, 308, 309, 299, 11, + 231, 10, 225, 304, 149, 81, 22, 23, 24, 257, + 258, 312, 19, 83, 159, 86, 317, 72, 4, 225, + 36, 225, 205, 39, 72, 326, 327, 128, 129, 130, + 131, 132, 133, 134, 217, 74, 37, 43, 72, 245, + 246, 245, 246, 62, 244, 73, 77, 77, 75, 255, + 29, 255, 35, 45, 31, 200, 4, 240, 241, 4, + 14, 66, 4, 4, 30, 37, 211, 31, 268, 269, + 4, 4, 54, 77, 6, 75, 29, 44, 284, 285, + 284, 285, 227, 4, 31, 230, 66, 31, 271, 289, + 66, 66, 31, 299, 4, 299, 31, 28, 304, 62, + 304, 4, 76, 248, 22, 76, 312, 23, 312, 4, + 3, 317, 4, 317, 28, 77, 62, 77, 31, 4, + 326, 327, 326, 327, 4, 308, 309, 20, 21, 31, + 24, 24, 31, 24, 27, 28, 24, 282, 6, 205, + 33, 34, 251, 36, 113, 222, 39, 306, 116, 122, + 197, 44, 4, 138, 124, 139, 171, 50, 117, 271, + 125, 54, 55, -1, 57, 58, 163, 60, 20, 21, + 63, 126, 24, 66, 135, 27, 28, -1, 71, -1, + -1, 33, 34, 76, 36, -1, -1, 39, -1, -1, + -1, -1, 44, -1, 6, 7, 8, 9, 50, -1, + -1, -1, -1, 55, -1, 57, 58, -1, 60, -1, + -1, 63, 24, -1, 66, -1, -1, -1, -1, 71, + -1, -1, -1, -1, 76, 7, 8, 9, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, + 52, 53, 24, -1, 56, -1, -1, 29, 60, -1, -1, -1, -1, -1, 66, 67, 68, 69, 70, -1, - -1, 73, 7, 8, 76, 77, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 51, 52, 53, 24, - -1, 56, -1, -1, -1, 60, -1, -1, -1, -1, - -1, 66, 67, 68, 69, 70, -1, -1, 73, -1, - -1, 76, 77, -1, -1, -1, 51, 52, 53, -1, - -1, 56, -1, -1, -1, 60, -1, -1, -1, -1, - -1, 66, 67, 68, 69, 70, -1, -1, 73, -1, - -1, 76, 77, 20, 21, 22, 23, 24, -1, -1, - 27, 28, -1, -1, -1, -1, 33, 34, -1, 36, - -1, -1, 39, -1, -1, -1, -1, 44, -1, -1, - -1, -1, -1, 50, -1, -1, -1, -1, 55, -1, - 57, 58, -1, 60, -1, -1, 63, -1, -1, 66, - -1, 20, 21, -1, 71, 24, -1, -1, 27, 28, - 77, -1, -1, -1, 33, 34, -1, 36, 37, -1, - 39, -1, -1, -1, -1, 44, -1, -1, -1, -1, - -1, 50, -1, -1, -1, -1, 55, -1, 57, 58, - -1, 60, -1, -1, 63, -1, -1, 66, -1, 20, - 21, -1, 71, 24, -1, -1, 27, 28, 77, -1, - -1, -1, 33, 34, 35, 36, -1, -1, 39, -1, - -1, -1, -1, 44, -1, -1, -1, -1, -1, 50, - -1, -1, -1, -1, 55, -1, 57, 58, -1, 60, - -1, -1, 63, -1, -1, 66, -1, 20, 21, -1, - 71, 24, -1, -1, 27, 28, 77, -1, 31, -1, + -1, 73, -1, -1, 76, -1, 78, -1, -1, 51, + 52, 53, -1, -1, 56, 7, 8, 9, 60, -1, + -1, -1, -1, -1, 66, 67, 68, 69, 70, -1, + -1, 73, 24, -1, 76, -1, 78, -1, -1, -1, + -1, -1, -1, -1, -1, 7, 8, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, + 52, 53, 24, -1, 56, -1, -1, -1, 60, -1, + -1, -1, -1, -1, 66, 67, 68, 69, 70, -1, + -1, 73, -1, -1, 76, -1, 78, -1, -1, 51, + 52, 53, -1, -1, 56, -1, -1, -1, 60, -1, + -1, -1, -1, -1, 66, 67, 68, 69, 70, -1, + -1, 73, -1, -1, 76, -1, 78, 20, 21, 22, + 23, 24, -1, -1, 27, 28, -1, -1, -1, -1, 33, 34, -1, 36, -1, -1, 39, -1, -1, -1, -1, 44, -1, -1, -1, -1, -1, 50, -1, -1, - -1, -1, 55, -1, 57, 58, -1, 60, -1, -1, - 63, -1, -1, 66, -1, 20, 21, -1, 71, 24, - -1, -1, 27, 28, 77, -1, -1, -1, 33, 34, - -1, 36, -1, -1, 39, -1, -1, -1, -1, 44, - -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, - 55, -1, 57, 58, -1, 60, -1, 62, 63, -1, - -1, 66, -1, 20, 21, -1, 71, 24, -1, -1, - 27, 28, 77, -1, -1, -1, 33, 34, -1, 36, + -1, -1, 55, -1, 57, 58, -1, 60, 20, 21, + 63, -1, 24, 66, -1, 27, 28, -1, 71, -1, + -1, 33, 34, 76, 36, 37, -1, 39, -1, -1, + -1, -1, 44, -1, -1, -1, -1, -1, 50, -1, + -1, -1, -1, 55, -1, 57, 58, -1, 60, -1, + -1, 63, -1, -1, 66, -1, -1, -1, -1, 71, + -1, 20, 21, -1, 76, 24, -1, -1, 27, 28, + -1, -1, -1, -1, 33, 34, 35, 36, -1, -1, + 39, -1, -1, -1, -1, 44, -1, -1, -1, -1, + -1, 50, -1, -1, -1, -1, 55, -1, 57, 58, + -1, 60, 20, 21, 63, -1, 24, 66, -1, 27, + 28, -1, 71, 31, -1, 33, 34, 76, 36, -1, + -1, 39, -1, -1, -1, -1, 44, -1, -1, -1, + -1, -1, 50, -1, -1, -1, -1, 55, -1, 57, + 58, -1, 60, 20, 21, 63, -1, 24, 66, -1, + 27, 28, -1, 71, -1, -1, 33, 34, 76, 36, -1, -1, 39, -1, -1, -1, -1, 44, -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, 55, -1, - 57, 58, -1, 60, -1, -1, 63, -1, -1, 66, - -1, -1, -1, -1, 71, -1, -1, -1, -1, -1, - 77 + 57, 58, -1, 60, -1, 62, 63, -1, -1, 66, + -1, -1, -1, -1, 71, -1, 20, 21, -1, 76, + 24, -1, -1, 27, 28, -1, -1, -1, -1, 33, + 34, -1, 36, -1, -1, 39, -1, -1, -1, -1, + 44, -1, -1, -1, -1, -1, 50, -1, -1, -1, + -1, 55, -1, 57, 58, -1, 60, -1, -1, 63, + -1, -1, 66, -1, -1, -1, -1, 71, -1, -1, + -1, -1, 76 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -1028,35 +1054,37 @@ static const yytype_uint8 yystos[] = { 0, 48, 88, 89, 49, 0, 90, 4, 3, 20, 21, 24, 27, 28, 33, 34, 36, 39, 44, 50, - 54, 55, 57, 58, 60, 63, 66, 71, 77, 93, - 94, 95, 96, 103, 128, 131, 132, 135, 136, 137, - 141, 96, 97, 141, 98, 99, 141, 7, 8, 9, - 51, 52, 53, 56, 67, 68, 69, 70, 73, 76, - 96, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 22, 23, - 24, 36, 39, 114, 4, 34, 38, 101, 42, 141, - 45, 141, 96, 59, 61, 94, 114, 4, 71, 6, - 77, 110, 111, 112, 113, 114, 74, 22, 23, 77, - 110, 112, 75, 75, 72, 119, 141, 127, 110, 14, - 32, 13, 12, 11, 10, 15, 16, 17, 18, 72, - 79, 80, 81, 76, 82, 19, 83, 84, 85, 86, - 4, 91, 92, 93, 114, 141, 72, 114, 4, 110, - 64, 65, 78, 94, 113, 114, 72, 75, 141, 141, - 141, 97, 98, 76, 100, 129, 115, 4, 94, 116, - 117, 118, 119, 121, 121, 121, 121, 121, 121, 121, - 122, 123, 123, 124, 125, 126, 126, 127, 91, 37, - 92, 4, 43, 114, 4, 133, 134, 135, 136, 137, - 72, 62, 73, 78, 114, 113, 77, 112, 138, 138, - 130, 91, 29, 35, 101, 91, 114, 40, 45, 109, - 31, 4, 4, 24, 66, 114, 46, 47, 139, 140, - 141, 4, 4, 30, 105, 106, 107, 94, 114, 37, - 4, 114, 29, 113, 31, 54, 133, 133, 25, 26, - 55, 4, 141, 141, 78, 75, 91, 91, 114, 29, - 108, 106, 31, 104, 91, 41, 102, 4, 4, 44, - 4, 66, 66, 66, 133, 139, 31, 31, 32, 4, - 31, 28, 62, 114, 4, 92, 91, 112, 77, 77, - 22, 23, 4, 91, 28, 91, 109, 4, 140, 140, - 91, 62, 91, 78, 78, 31, 4, 4, 24, 91, + 54, 55, 57, 58, 60, 63, 66, 71, 76, 93, + 94, 95, 96, 105, 130, 134, 135, 138, 139, 140, + 144, 96, 97, 98, 144, 100, 101, 144, 7, 8, + 9, 51, 52, 53, 56, 67, 68, 69, 70, 73, + 78, 96, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 22, + 23, 24, 36, 39, 116, 4, 34, 38, 103, 42, + 144, 45, 144, 96, 59, 61, 94, 116, 4, 71, + 6, 76, 112, 113, 114, 115, 116, 74, 22, 23, + 76, 112, 114, 75, 6, 76, 75, 72, 121, 144, + 129, 112, 14, 32, 13, 12, 11, 10, 15, 16, + 17, 18, 72, 79, 80, 81, 78, 82, 19, 83, + 84, 85, 86, 4, 91, 92, 93, 116, 144, 72, + 116, 4, 112, 64, 65, 77, 94, 115, 116, 72, + 75, 144, 144, 144, 97, 68, 69, 73, 99, 133, + 100, 78, 102, 131, 117, 4, 94, 118, 119, 120, + 121, 123, 123, 123, 123, 123, 123, 123, 124, 125, + 125, 126, 127, 128, 128, 129, 91, 37, 92, 4, + 43, 116, 4, 71, 145, 21, 136, 137, 138, 139, + 140, 72, 62, 73, 77, 116, 115, 76, 114, 141, + 141, 77, 75, 132, 91, 29, 35, 103, 91, 116, + 40, 45, 111, 98, 31, 4, 4, 24, 66, 116, + 46, 47, 142, 143, 144, 4, 4, 99, 30, 107, + 108, 109, 94, 116, 37, 4, 116, 29, 115, 31, + 4, 54, 136, 136, 25, 26, 55, 4, 144, 144, + 77, 75, 114, 91, 91, 116, 29, 110, 108, 31, + 106, 91, 41, 104, 145, 145, 44, 136, 4, 66, + 66, 66, 136, 114, 114, 142, 31, 31, 32, 4, + 31, 28, 62, 116, 4, 92, 91, 114, 76, 76, + 22, 23, 4, 91, 28, 91, 111, 4, 143, 143, + 91, 62, 91, 77, 77, 31, 4, 4, 24, 91, 91, 31, 31, 24, 24 }; @@ -1899,154 +1927,154 @@ yyreduce: case 2: /* Line 1806 of yacc.c */ -#line 144 "parser.y" +#line 147 "parser.y" { parse_complete(ctx, (yyvsp[(1) - (3)].bool)); } break; case 3: /* Line 1806 of yacc.c */ -#line 147 "parser.y" +#line 150 "parser.y" { (yyval.bool) = FALSE; } break; case 4: /* Line 1806 of yacc.c */ -#line 148 "parser.y" +#line 151 "parser.y" { (yyval.bool) = TRUE; } break; case 6: /* Line 1806 of yacc.c */ -#line 152 "parser.y" +#line 155 "parser.y" { source_add_statement(ctx, (yyvsp[(2) - (2)].statement)); } break; case 7: /* Line 1806 of yacc.c */ -#line 153 "parser.y" +#line 156 "parser.y" { source_add_class(ctx, (yyvsp[(2) - (2)].class_decl)); } break; case 8: /* Line 1806 of yacc.c */ -#line 156 "parser.y" +#line 159 "parser.y" { (yyval.statement) = NULL; } break; case 9: /* Line 1806 of yacc.c */ -#line 157 "parser.y" +#line 160 "parser.y" { (yyval.statement) = (yyvsp[(1) - (1)].statement); } break; case 10: /* Line 1806 of yacc.c */ -#line 160 "parser.y" +#line 163 "parser.y" { (yyval.statement) = (yyvsp[(1) - (1)].statement); } break; case 11: /* Line 1806 of yacc.c */ -#line 161 "parser.y" +#line 164 "parser.y" { (yyval.statement) = link_statements((yyvsp[(1) - (2)].statement), (yyvsp[(2) - (2)].statement)); } break; case 12: /* Line 1806 of yacc.c */ -#line 164 "parser.y" +#line 167 "parser.y" { (yyval.statement) = (yyvsp[(1) - (2)].statement); } break; case 13: /* Line 1806 of yacc.c */ -#line 167 "parser.y" +#line 170 "parser.y" { (yyval.statement) = NULL; } break; case 14: /* Line 1806 of yacc.c */ -#line 168 "parser.y" +#line 171 "parser.y" { (yyval.statement) = (yyvsp[(2) - (2)].statement); } break; case 15: /* Line 1806 of yacc.c */ -#line 169 "parser.y" +#line 172 "parser.y" { (yyval.statement) = (yyvsp[(1) - (1)].statement); } break; case 16: /* Line 1806 of yacc.c */ -#line 170 "parser.y" +#line 173 "parser.y" { (yyvsp[(1) - (3)].statement)->next = (yyvsp[(3) - (3)].statement); (yyval.statement) = (yyvsp[(1) - (3)].statement); } break; case 17: /* Line 1806 of yacc.c */ -#line 171 "parser.y" +#line 174 "parser.y" { (yyval.statement) = (yyvsp[(1) - (2)].statement); } break; case 18: /* Line 1806 of yacc.c */ -#line 174 "parser.y" +#line 177 "parser.y" { (yyvsp[(1) - (2)].member)->args = (yyvsp[(2) - (2)].expression); (yyval.statement) = new_call_statement(ctx, FALSE, (yyvsp[(1) - (2)].member)); CHECK_ERROR; } break; case 19: /* Line 1806 of yacc.c */ -#line 175 "parser.y" +#line 178 "parser.y" { (yyvsp[(2) - (3)].member)->args = (yyvsp[(3) - (3)].expression); (yyval.statement) = new_call_statement(ctx, TRUE, (yyvsp[(2) - (3)].member)); CHECK_ERROR; } break; case 20: /* Line 1806 of yacc.c */ -#line 177 "parser.y" +#line 180 "parser.y" { (yyvsp[(1) - (4)].member)->args = (yyvsp[(2) - (4)].expression); (yyval.statement) = new_assign_statement(ctx, (yyvsp[(1) - (4)].member), (yyvsp[(4) - (4)].expression)); CHECK_ERROR; } break; case 21: /* Line 1806 of yacc.c */ -#line 178 "parser.y" +#line 181 "parser.y" { (yyval.statement) = new_dim_statement(ctx, (yyvsp[(2) - (2)].dim_decl)); CHECK_ERROR; } break; case 22: /* Line 1806 of yacc.c */ -#line 179 "parser.y" +#line 182 "parser.y" { (yyval.statement) = (yyvsp[(1) - (1)].statement); } break; case 23: /* Line 1806 of yacc.c */ -#line 181 "parser.y" +#line 184 "parser.y" { (yyval.statement) = new_while_statement(ctx, STAT_WHILE, (yyvsp[(2) - (5)].expression), (yyvsp[(4) - (5)].statement)); CHECK_ERROR; } break; case 24: /* Line 1806 of yacc.c */ -#line 183 "parser.y" +#line 186 "parser.y" { (yyval.statement) = new_while_statement(ctx, (yyvsp[(2) - (6)].bool) ? STAT_WHILELOOP : STAT_UNTIL, (yyvsp[(3) - (6)].expression), (yyvsp[(5) - (6)].statement)); CHECK_ERROR; } break; @@ -2054,7 +2082,7 @@ yyreduce: case 25: /* Line 1806 of yacc.c */ -#line 186 "parser.y" +#line 189 "parser.y" { (yyval.statement) = new_while_statement(ctx, (yyvsp[(5) - (6)].bool) ? STAT_DOWHILE : STAT_DOUNTIL, (yyvsp[(6) - (6)].expression), (yyvsp[(3) - (6)].statement)); CHECK_ERROR; } break; @@ -2062,554 +2090,554 @@ yyreduce: case 26: /* Line 1806 of yacc.c */ -#line 188 "parser.y" +#line 191 "parser.y" { (yyval.statement) = new_while_statement(ctx, STAT_DOWHILE, NULL, (yyvsp[(3) - (4)].statement)); CHECK_ERROR; } break; case 27: /* Line 1806 of yacc.c */ -#line 189 "parser.y" +#line 192 "parser.y" { (yyval.statement) = new_function_statement(ctx, (yyvsp[(1) - (1)].func_decl)); CHECK_ERROR; } break; case 28: /* Line 1806 of yacc.c */ -#line 190 "parser.y" +#line 193 "parser.y" { (yyval.statement) = new_statement(ctx, STAT_EXITDO, 0); CHECK_ERROR; } break; case 29: /* Line 1806 of yacc.c */ -#line 191 "parser.y" +#line 194 "parser.y" { (yyval.statement) = new_statement(ctx, STAT_EXITFOR, 0); CHECK_ERROR; } break; case 30: /* Line 1806 of yacc.c */ -#line 192 "parser.y" +#line 195 "parser.y" { (yyval.statement) = new_statement(ctx, STAT_EXITFUNC, 0); CHECK_ERROR; } break; case 31: /* Line 1806 of yacc.c */ -#line 193 "parser.y" +#line 196 "parser.y" { (yyval.statement) = new_statement(ctx, STAT_EXITPROP, 0); CHECK_ERROR; } break; case 32: /* Line 1806 of yacc.c */ -#line 194 "parser.y" +#line 197 "parser.y" { (yyval.statement) = new_statement(ctx, STAT_EXITSUB, 0); CHECK_ERROR; } break; case 33: /* Line 1806 of yacc.c */ -#line 196 "parser.y" +#line 199 "parser.y" { (yyvsp[(2) - (5)].member)->args = (yyvsp[(3) - (5)].expression); (yyval.statement) = new_set_statement(ctx, (yyvsp[(2) - (5)].member), (yyvsp[(5) - (5)].expression)); CHECK_ERROR; } break; case 34: /* Line 1806 of yacc.c */ -#line 197 "parser.y" +#line 200 "parser.y" { (yyval.statement) = new_statement(ctx, STAT_STOP, 0); CHECK_ERROR; } break; case 35: /* Line 1806 of yacc.c */ -#line 198 "parser.y" +#line 201 "parser.y" { (yyval.statement) = new_onerror_statement(ctx, TRUE); CHECK_ERROR; } break; case 36: /* Line 1806 of yacc.c */ -#line 199 "parser.y" +#line 202 "parser.y" { (yyval.statement) = new_onerror_statement(ctx, FALSE); CHECK_ERROR; } break; case 37: /* Line 1806 of yacc.c */ -#line 200 "parser.y" +#line 203 "parser.y" { (yyval.statement) = new_const_statement(ctx, (yyvsp[(2) - (2)].const_decl)); CHECK_ERROR; } break; case 38: /* Line 1806 of yacc.c */ -#line 202 "parser.y" +#line 205 "parser.y" { (yyval.statement) = new_forto_statement(ctx, (yyvsp[(2) - (10)].string), (yyvsp[(4) - (10)].expression), (yyvsp[(6) - (10)].expression), (yyvsp[(7) - (10)].expression), (yyvsp[(9) - (10)].statement)); CHECK_ERROR; } break; case 39: /* Line 1806 of yacc.c */ -#line 204 "parser.y" +#line 207 "parser.y" { (yyval.statement) = new_foreach_statement(ctx, (yyvsp[(3) - (8)].string), (yyvsp[(5) - (8)].expression), (yyvsp[(7) - (8)].statement)); } break; case 40: /* Line 1806 of yacc.c */ -#line 206 "parser.y" +#line 209 "parser.y" { (yyval.statement) = new_select_statement(ctx, (yyvsp[(3) - (7)].expression), (yyvsp[(5) - (7)].case_clausule)); } break; case 41: /* Line 1806 of yacc.c */ -#line 209 "parser.y" +#line 212 "parser.y" { (yyval.member) = new_member_expression(ctx, NULL, (yyvsp[(1) - (1)].string)); CHECK_ERROR; } break; case 42: /* Line 1806 of yacc.c */ -#line 210 "parser.y" +#line 213 "parser.y" { (yyval.member) = new_member_expression(ctx, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].string)); CHECK_ERROR; } break; case 43: /* Line 1806 of yacc.c */ -#line 213 "parser.y" - { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[(1) - (1)].string), NULL); CHECK_ERROR; } +#line 216 "parser.y" + { (yyval.dim_decl) = (yyvsp[(1) - (1)].dim_decl); } break; case 44: /* Line 1806 of yacc.c */ -#line 214 "parser.y" - { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[(1) - (3)].string), (yyvsp[(3) - (3)].dim_decl)); CHECK_ERROR; } +#line 217 "parser.y" + { (yyvsp[(1) - (3)].dim_decl)->next = (yyvsp[(3) - (3)].dim_decl); (yyval.dim_decl) = (yyvsp[(1) - (3)].dim_decl); } break; case 45: /* Line 1806 of yacc.c */ -#line 217 "parser.y" - { (yyval.const_decl) = (yyvsp[(1) - (1)].const_decl); } +#line 220 "parser.y" + { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[(1) - (1)].string), FALSE, NULL); CHECK_ERROR; } break; case 46: /* Line 1806 of yacc.c */ -#line 218 "parser.y" - { (yyvsp[(1) - (3)].const_decl)->next = (yyvsp[(3) - (3)].const_decl); (yyval.const_decl) = (yyvsp[(1) - (3)].const_decl); } +#line 221 "parser.y" + { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[(1) - (4)].string), TRUE, (yyvsp[(3) - (4)].dim_list)); CHECK_ERROR; } break; case 47: /* Line 1806 of yacc.c */ -#line 221 "parser.y" - { (yyval.const_decl) = new_const_decl(ctx, (yyvsp[(1) - (3)].string), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } +#line 222 "parser.y" + { (yyval.dim_decl) = new_dim_decl(ctx, (yyvsp[(1) - (2)].string), TRUE, NULL); CHECK_ERROR; } break; case 48: /* Line 1806 of yacc.c */ -#line 224 "parser.y" - { (yyval.expression) = (yyvsp[(1) - (1)].expression); } +#line 225 "parser.y" + { (yyval.dim_list) = new_dim(ctx, (yyvsp[(1) - (1)].uint), NULL); } break; case 49: /* Line 1806 of yacc.c */ -#line 225 "parser.y" - { (yyval.expression) = new_unary_expression(ctx, EXPR_NEG, (yyvsp[(2) - (2)].expression)); CHECK_ERROR; } +#line 226 "parser.y" + { (yyval.dim_list) = new_dim(ctx, (yyvsp[(1) - (3)].uint), (yyvsp[(3) - (3)].dim_list)); } break; case 50: /* Line 1806 of yacc.c */ -#line 228 "parser.y" - { (yyval.bool) = TRUE; } +#line 229 "parser.y" + { (yyval.const_decl) = (yyvsp[(1) - (1)].const_decl); } break; case 51: /* Line 1806 of yacc.c */ -#line 229 "parser.y" - { (yyval.bool) = FALSE; } +#line 230 "parser.y" + { (yyvsp[(1) - (3)].const_decl)->next = (yyvsp[(3) - (3)].const_decl); (yyval.const_decl) = (yyvsp[(1) - (3)].const_decl); } break; case 52: /* Line 1806 of yacc.c */ -#line 232 "parser.y" - { (yyval.expression) = NULL;} +#line 233 "parser.y" + { (yyval.const_decl) = new_const_decl(ctx, (yyvsp[(1) - (3)].string), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; case 53: /* Line 1806 of yacc.c */ -#line 233 "parser.y" - { (yyval.expression) = (yyvsp[(2) - (2)].expression); } +#line 236 "parser.y" + { (yyval.expression) = (yyvsp[(1) - (1)].expression); } break; case 54: /* Line 1806 of yacc.c */ #line 237 "parser.y" - { (yyval.statement) = new_if_statement(ctx, (yyvsp[(2) - (9)].expression), (yyvsp[(5) - (9)].statement), (yyvsp[(6) - (9)].elseif), (yyvsp[(7) - (9)].statement)); CHECK_ERROR; } + { (yyval.expression) = new_unary_expression(ctx, EXPR_NEG, (yyvsp[(2) - (2)].expression)); CHECK_ERROR; } break; case 55: /* Line 1806 of yacc.c */ -#line 238 "parser.y" - { (yyval.statement) = new_if_statement(ctx, (yyvsp[(2) - (4)].expression), (yyvsp[(4) - (4)].statement), NULL, NULL); CHECK_ERROR; } +#line 240 "parser.y" + { (yyval.bool) = TRUE; } break; case 56: /* Line 1806 of yacc.c */ -#line 240 "parser.y" - { (yyval.statement) = new_if_statement(ctx, (yyvsp[(2) - (7)].expression), (yyvsp[(4) - (7)].statement), NULL, (yyvsp[(6) - (7)].statement)); CHECK_ERROR; } +#line 241 "parser.y" + { (yyval.bool) = FALSE; } + break; + + case 57: + +/* Line 1806 of yacc.c */ +#line 244 "parser.y" + { (yyval.expression) = NULL;} + break; + + case 58: + +/* Line 1806 of yacc.c */ +#line 245 "parser.y" + { (yyval.expression) = (yyvsp[(2) - (2)].expression); } break; case 59: /* Line 1806 of yacc.c */ -#line 247 "parser.y" - { (yyval.elseif) = NULL; } +#line 249 "parser.y" + { (yyval.statement) = new_if_statement(ctx, (yyvsp[(2) - (9)].expression), (yyvsp[(5) - (9)].statement), (yyvsp[(6) - (9)].elseif), (yyvsp[(7) - (9)].statement)); CHECK_ERROR; } break; case 60: /* Line 1806 of yacc.c */ -#line 248 "parser.y" - { (yyval.elseif) = (yyvsp[(1) - (1)].elseif); } +#line 250 "parser.y" + { (yyval.statement) = new_if_statement(ctx, (yyvsp[(2) - (4)].expression), (yyvsp[(4) - (4)].statement), NULL, NULL); CHECK_ERROR; } break; case 61: -/* Line 1806 of yacc.c */ -#line 251 "parser.y" - { (yyval.elseif) = (yyvsp[(1) - (1)].elseif); } - break; - - case 62: - /* Line 1806 of yacc.c */ #line 252 "parser.y" - { (yyvsp[(1) - (2)].elseif)->next = (yyvsp[(2) - (2)].elseif); (yyval.elseif) = (yyvsp[(1) - (2)].elseif); } - break; - - case 63: - -/* Line 1806 of yacc.c */ -#line 256 "parser.y" - { (yyval.elseif) = new_elseif_decl(ctx, (yyvsp[(2) - (5)].expression), (yyvsp[(5) - (5)].statement)); } + { (yyval.statement) = new_if_statement(ctx, (yyvsp[(2) - (7)].expression), (yyvsp[(4) - (7)].statement), NULL, (yyvsp[(6) - (7)].statement)); CHECK_ERROR; } break; case 64: /* Line 1806 of yacc.c */ #line 259 "parser.y" - { (yyval.statement) = NULL; } + { (yyval.elseif) = NULL; } break; case 65: /* Line 1806 of yacc.c */ #line 260 "parser.y" - { (yyval.statement) = (yyvsp[(3) - (3)].statement); } + { (yyval.elseif) = (yyvsp[(1) - (1)].elseif); } break; case 66: /* Line 1806 of yacc.c */ #line 263 "parser.y" - { (yyval.case_clausule) = NULL; } + { (yyval.elseif) = (yyvsp[(1) - (1)].elseif); } break; case 67: /* Line 1806 of yacc.c */ #line 264 "parser.y" - { (yyval.case_clausule) = new_case_clausule(ctx, NULL, (yyvsp[(4) - (4)].statement), NULL); } + { (yyvsp[(1) - (2)].elseif)->next = (yyvsp[(2) - (2)].elseif); (yyval.elseif) = (yyvsp[(1) - (2)].elseif); } break; case 68: /* Line 1806 of yacc.c */ -#line 266 "parser.y" - { (yyval.case_clausule) = new_case_clausule(ctx, (yyvsp[(2) - (5)].expression), (yyvsp[(4) - (5)].statement), (yyvsp[(5) - (5)].case_clausule)); } +#line 268 "parser.y" + { (yyval.elseif) = new_elseif_decl(ctx, (yyvsp[(2) - (5)].expression), (yyvsp[(5) - (5)].statement)); } break; case 69: /* Line 1806 of yacc.c */ -#line 269 "parser.y" - { (yyval.expression) = NULL; } +#line 271 "parser.y" + { (yyval.statement) = NULL; } break; case 70: /* Line 1806 of yacc.c */ -#line 270 "parser.y" - { (yyval.expression) = (yyvsp[(2) - (3)].expression); } +#line 272 "parser.y" + { (yyval.statement) = (yyvsp[(3) - (3)].statement); } break; case 71: /* Line 1806 of yacc.c */ -#line 273 "parser.y" - { (yyval.expression) = NULL; } +#line 275 "parser.y" + { (yyval.case_clausule) = NULL; } break; case 72: /* Line 1806 of yacc.c */ -#line 274 "parser.y" - { (yyval.expression) = (yyvsp[(1) - (1)].expression); } +#line 276 "parser.y" + { (yyval.case_clausule) = new_case_clausule(ctx, NULL, (yyvsp[(4) - (4)].statement), NULL); } + break; + + case 73: + +/* Line 1806 of yacc.c */ +#line 278 "parser.y" + { (yyval.case_clausule) = new_case_clausule(ctx, (yyvsp[(2) - (5)].expression), (yyvsp[(4) - (5)].statement), (yyvsp[(5) - (5)].case_clausule)); } + break; + + case 74: + +/* Line 1806 of yacc.c */ +#line 281 "parser.y" + { (yyval.expression) = NULL; } break; case 75: /* Line 1806 of yacc.c */ -#line 281 "parser.y" - { (yyval.expression) = (yyvsp[(1) - (1)].expression); } +#line 282 "parser.y" + { (yyval.expression) = (yyvsp[(2) - (3)].expression); } break; case 76: /* Line 1806 of yacc.c */ -#line 282 "parser.y" - { (yyvsp[(1) - (3)].expression)->next = (yyvsp[(3) - (3)].expression); (yyval.expression) = (yyvsp[(1) - (3)].expression); } +#line 285 "parser.y" + { (yyval.expression) = NULL; } break; case 77: -/* Line 1806 of yacc.c */ -#line 285 "parser.y" - { (yyval.expression) = (yyvsp[(1) - (1)].expression); } - break; - - case 78: - /* Line 1806 of yacc.c */ #line 286 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_IMP, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } - break; - - case 79: - -/* Line 1806 of yacc.c */ -#line 289 "parser.y" { (yyval.expression) = (yyvsp[(1) - (1)].expression); } break; case 80: /* Line 1806 of yacc.c */ -#line 290 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_EQV, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } +#line 293 "parser.y" + { (yyval.expression) = (yyvsp[(1) - (1)].expression); } break; case 81: /* Line 1806 of yacc.c */ -#line 293 "parser.y" - { (yyval.expression) = (yyvsp[(1) - (1)].expression); } +#line 294 "parser.y" + { (yyvsp[(1) - (3)].expression)->next = (yyvsp[(3) - (3)].expression); (yyval.expression) = (yyvsp[(1) - (3)].expression); } break; case 82: -/* Line 1806 of yacc.c */ -#line 294 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_XOR, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } - break; - - case 83: - /* Line 1806 of yacc.c */ #line 297 "parser.y" { (yyval.expression) = (yyvsp[(1) - (1)].expression); } break; - case 84: + case 83: /* Line 1806 of yacc.c */ #line 298 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_OR, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } + { (yyval.expression) = new_binary_expression(ctx, EXPR_IMP, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; - case 85: + case 84: /* Line 1806 of yacc.c */ #line 301 "parser.y" { (yyval.expression) = (yyvsp[(1) - (1)].expression); } break; - case 86: + case 85: /* Line 1806 of yacc.c */ #line 302 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_AND, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } + { (yyval.expression) = new_binary_expression(ctx, EXPR_EQV, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; - case 87: + case 86: /* Line 1806 of yacc.c */ #line 305 "parser.y" { (yyval.expression) = (yyvsp[(1) - (1)].expression); } break; - case 88: + case 87: /* Line 1806 of yacc.c */ #line 306 "parser.y" - { (yyval.expression) = new_unary_expression(ctx, EXPR_NOT, (yyvsp[(2) - (2)].expression)); CHECK_ERROR; } + { (yyval.expression) = new_binary_expression(ctx, EXPR_XOR, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; - case 89: + case 88: /* Line 1806 of yacc.c */ #line 309 "parser.y" { (yyval.expression) = (yyvsp[(1) - (1)].expression); } break; - case 90: + case 89: /* Line 1806 of yacc.c */ #line 310 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_EQUAL, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } + { (yyval.expression) = new_binary_expression(ctx, EXPR_OR, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } + break; + + case 90: + +/* Line 1806 of yacc.c */ +#line 313 "parser.y" + { (yyval.expression) = (yyvsp[(1) - (1)].expression); } break; case 91: /* Line 1806 of yacc.c */ -#line 311 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_NEQUAL, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } +#line 314 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_AND, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; case 92: /* Line 1806 of yacc.c */ -#line 312 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_GT, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } +#line 317 "parser.y" + { (yyval.expression) = (yyvsp[(1) - (1)].expression); } break; case 93: /* Line 1806 of yacc.c */ -#line 313 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_LT, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } +#line 318 "parser.y" + { (yyval.expression) = new_unary_expression(ctx, EXPR_NOT, (yyvsp[(2) - (2)].expression)); CHECK_ERROR; } break; case 94: /* Line 1806 of yacc.c */ -#line 314 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_GTEQ, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } +#line 321 "parser.y" + { (yyval.expression) = (yyvsp[(1) - (1)].expression); } break; case 95: /* Line 1806 of yacc.c */ -#line 315 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_LTEQ, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } +#line 322 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_EQUAL, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; case 96: /* Line 1806 of yacc.c */ -#line 316 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_IS, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } +#line 323 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_NEQUAL, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; case 97: /* Line 1806 of yacc.c */ -#line 319 "parser.y" - { (yyval.expression) = (yyvsp[(1) - (1)].expression); } +#line 324 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_GT, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; case 98: /* Line 1806 of yacc.c */ -#line 320 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_CONCAT, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } +#line 325 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_LT, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; case 99: /* Line 1806 of yacc.c */ -#line 323 "parser.y" - { (yyval.expression) = (yyvsp[(1) - (1)].expression); } +#line 326 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_GTEQ, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; case 100: /* Line 1806 of yacc.c */ -#line 324 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_ADD, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } +#line 327 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_LTEQ, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; case 101: /* Line 1806 of yacc.c */ -#line 325 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_SUB, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } +#line 328 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_IS, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; case 102: /* Line 1806 of yacc.c */ -#line 328 "parser.y" +#line 331 "parser.y" { (yyval.expression) = (yyvsp[(1) - (1)].expression); } break; case 103: /* Line 1806 of yacc.c */ -#line 329 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_MOD, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } +#line 332 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_CONCAT, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; case 104: /* Line 1806 of yacc.c */ -#line 332 "parser.y" +#line 335 "parser.y" { (yyval.expression) = (yyvsp[(1) - (1)].expression); } break; case 105: /* Line 1806 of yacc.c */ -#line 334 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_IDIV, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } +#line 336 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_ADD, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; case 106: /* Line 1806 of yacc.c */ #line 337 "parser.y" - { (yyval.expression) = (yyvsp[(1) - (1)].expression); } + { (yyval.expression) = new_binary_expression(ctx, EXPR_SUB, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; case 107: /* Line 1806 of yacc.c */ -#line 339 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_MUL, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } +#line 340 "parser.y" + { (yyval.expression) = (yyvsp[(1) - (1)].expression); } break; case 108: /* Line 1806 of yacc.c */ #line 341 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_DIV, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } + { (yyval.expression) = new_binary_expression(ctx, EXPR_MOD, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; case 109: @@ -2622,315 +2650,379 @@ yyreduce: case 110: /* Line 1806 of yacc.c */ -#line 345 "parser.y" - { (yyval.expression) = new_binary_expression(ctx, EXPR_EXP, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } +#line 346 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_IDIV, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; case 111: -/* Line 1806 of yacc.c */ -#line 348 "parser.y" - { (yyval.expression) = (yyvsp[(1) - (1)].expression); } - break; - - case 112: - /* Line 1806 of yacc.c */ #line 349 "parser.y" { (yyval.expression) = (yyvsp[(1) - (1)].expression); } break; + case 112: + +/* Line 1806 of yacc.c */ +#line 351 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_MUL, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } + break; + case 113: /* Line 1806 of yacc.c */ -#line 350 "parser.y" - { (yyval.expression) = new_new_expression(ctx, (yyvsp[(2) - (2)].string)); CHECK_ERROR; } +#line 353 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_DIV, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; case 114: /* Line 1806 of yacc.c */ -#line 351 "parser.y" - { (yyval.expression) = new_unary_expression(ctx, EXPR_NEG, (yyvsp[(2) - (2)].expression)); CHECK_ERROR; } +#line 356 "parser.y" + { (yyval.expression) = (yyvsp[(1) - (1)].expression); } break; case 115: /* Line 1806 of yacc.c */ -#line 354 "parser.y" - { (yyval.expression) = (yyvsp[(1) - (1)].expression); } +#line 357 "parser.y" + { (yyval.expression) = new_binary_expression(ctx, EXPR_EXP, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); CHECK_ERROR; } break; case 116: /* Line 1806 of yacc.c */ -#line 355 "parser.y" - { (yyvsp[(1) - (2)].member)->args = (yyvsp[(2) - (2)].expression); (yyval.expression) = &(yyvsp[(1) - (2)].member)->expr; } +#line 360 "parser.y" + { (yyval.expression) = (yyvsp[(1) - (1)].expression); } break; case 117: -/* Line 1806 of yacc.c */ -#line 358 "parser.y" - { (yyval.expression) = new_bool_expression(ctx, VARIANT_TRUE); CHECK_ERROR; } - break; - - case 118: - -/* Line 1806 of yacc.c */ -#line 359 "parser.y" - { (yyval.expression) = new_bool_expression(ctx, VARIANT_FALSE); CHECK_ERROR; } - break; - - case 119: - -/* Line 1806 of yacc.c */ -#line 360 "parser.y" - { (yyval.expression) = new_string_expression(ctx, (yyvsp[(1) - (1)].string)); CHECK_ERROR; } - break; - - case 120: - /* Line 1806 of yacc.c */ #line 361 "parser.y" { (yyval.expression) = (yyvsp[(1) - (1)].expression); } break; - case 121: + case 118: /* Line 1806 of yacc.c */ #line 362 "parser.y" - { (yyval.expression) = new_expression(ctx, EXPR_EMPTY, 0); CHECK_ERROR; } + { (yyval.expression) = new_new_expression(ctx, (yyvsp[(2) - (2)].string)); CHECK_ERROR; } + break; + + case 119: + +/* Line 1806 of yacc.c */ +#line 363 "parser.y" + { (yyval.expression) = new_unary_expression(ctx, EXPR_NEG, (yyvsp[(2) - (2)].expression)); CHECK_ERROR; } + break; + + case 120: + +/* Line 1806 of yacc.c */ +#line 366 "parser.y" + { (yyval.expression) = (yyvsp[(1) - (1)].expression); } + break; + + case 121: + +/* Line 1806 of yacc.c */ +#line 367 "parser.y" + { (yyvsp[(1) - (2)].member)->args = (yyvsp[(2) - (2)].expression); (yyval.expression) = &(yyvsp[(1) - (2)].member)->expr; } break; case 122: /* Line 1806 of yacc.c */ -#line 363 "parser.y" - { (yyval.expression) = new_expression(ctx, EXPR_NULL, 0); CHECK_ERROR; } +#line 370 "parser.y" + { (yyval.expression) = new_bool_expression(ctx, VARIANT_TRUE); CHECK_ERROR; } break; case 123: /* Line 1806 of yacc.c */ -#line 364 "parser.y" - { (yyval.expression) = new_expression(ctx, EXPR_NOTHING, 0); CHECK_ERROR; } +#line 371 "parser.y" + { (yyval.expression) = new_bool_expression(ctx, VARIANT_FALSE); CHECK_ERROR; } break; case 124: /* Line 1806 of yacc.c */ -#line 367 "parser.y" - { (yyval.expression) = new_long_expression(ctx, EXPR_USHORT, (yyvsp[(1) - (1)].lng)); CHECK_ERROR; } +#line 372 "parser.y" + { (yyval.expression) = new_string_expression(ctx, (yyvsp[(1) - (1)].string)); CHECK_ERROR; } break; case 125: /* Line 1806 of yacc.c */ -#line 368 "parser.y" - { (yyval.expression) = new_long_expression(ctx, EXPR_USHORT, 0); CHECK_ERROR; } +#line 373 "parser.y" + { (yyval.expression) = (yyvsp[(1) - (1)].expression); } break; case 126: /* Line 1806 of yacc.c */ -#line 369 "parser.y" - { (yyval.expression) = new_long_expression(ctx, EXPR_ULONG, (yyvsp[(1) - (1)].lng)); CHECK_ERROR; } +#line 374 "parser.y" + { (yyval.expression) = new_expression(ctx, EXPR_EMPTY, 0); CHECK_ERROR; } break; case 127: /* Line 1806 of yacc.c */ -#line 370 "parser.y" - { (yyval.expression) = new_double_expression(ctx, (yyvsp[(1) - (1)].dbl)); CHECK_ERROR; } +#line 375 "parser.y" + { (yyval.expression) = new_expression(ctx, EXPR_NULL, 0); CHECK_ERROR; } break; case 128: /* Line 1806 of yacc.c */ -#line 374 "parser.y" - { (yyval.expression) = new_unary_expression(ctx, EXPR_BRACKETS, (yyvsp[(2) - (3)].expression)); } +#line 376 "parser.y" + { (yyval.expression) = new_expression(ctx, EXPR_NOTHING, 0); CHECK_ERROR; } break; case 129: /* Line 1806 of yacc.c */ -#line 375 "parser.y" - { (yyval.expression) = new_expression(ctx, EXPR_ME, 0); CHECK_ERROR; } +#line 379 "parser.y" + { (yyval.expression) = new_long_expression(ctx, EXPR_USHORT, (yyvsp[(1) - (1)].lng)); CHECK_ERROR; } break; case 130: /* Line 1806 of yacc.c */ -#line 378 "parser.y" - { (yyvsp[(4) - (7)].class_decl)->name = (yyvsp[(2) - (7)].string); (yyval.class_decl) = (yyvsp[(4) - (7)].class_decl); } +#line 380 "parser.y" + { (yyval.expression) = new_long_expression(ctx, EXPR_USHORT, 0); CHECK_ERROR; } break; case 131: /* Line 1806 of yacc.c */ #line 381 "parser.y" - { (yyval.class_decl) = new_class_decl(ctx); } + { (yyval.expression) = new_long_expression(ctx, EXPR_ULONG, (yyvsp[(1) - (1)].lng)); CHECK_ERROR; } break; case 132: /* Line 1806 of yacc.c */ #line 382 "parser.y" - { (yyval.class_decl) = add_class_function(ctx, (yyvsp[(3) - (3)].class_decl), (yyvsp[(1) - (3)].func_decl)); CHECK_ERROR; } + { (yyval.expression) = new_double_expression(ctx, (yyvsp[(1) - (1)].dbl)); CHECK_ERROR; } break; case 133: /* Line 1806 of yacc.c */ -#line 383 "parser.y" - { (yyval.class_decl) = add_variant_prop(ctx, (yyvsp[(4) - (4)].class_decl), (yyvsp[(2) - (4)].string), (yyvsp[(1) - (4)].uint)); CHECK_ERROR; } +#line 385 "parser.y" + { (yyval.uint) = (yyvsp[(1) - (1)].lng); } break; case 134: /* Line 1806 of yacc.c */ -#line 384 "parser.y" - { (yyval.class_decl) = add_class_function(ctx, (yyvsp[(3) - (3)].class_decl), (yyvsp[(1) - (3)].func_decl)); CHECK_ERROR; } +#line 386 "parser.y" + { (yyval.uint) = 0; } break; case 135: /* Line 1806 of yacc.c */ -#line 388 "parser.y" - { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[(4) - (9)].string), FUNC_PROPGET, (yyvsp[(1) - (9)].uint), NULL, (yyvsp[(7) - (9)].statement)); CHECK_ERROR; } +#line 387 "parser.y" + { (yyval.uint) = (yyvsp[(1) - (1)].lng); } break; case 136: /* Line 1806 of yacc.c */ #line 390 "parser.y" - { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[(4) - (11)].string), FUNC_PROPLET, (yyvsp[(1) - (11)].uint), (yyvsp[(6) - (11)].arg_decl), (yyvsp[(9) - (11)].statement)); CHECK_ERROR; } + { (yyval.expression) = new_unary_expression(ctx, EXPR_BRACKETS, (yyvsp[(2) - (3)].expression)); } break; case 137: /* Line 1806 of yacc.c */ -#line 392 "parser.y" - { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[(4) - (11)].string), FUNC_PROPSET, (yyvsp[(1) - (11)].uint), (yyvsp[(6) - (11)].arg_decl), (yyvsp[(9) - (11)].statement)); CHECK_ERROR; } +#line 391 "parser.y" + { (yyval.expression) = new_expression(ctx, EXPR_ME, 0); CHECK_ERROR; } break; case 138: /* Line 1806 of yacc.c */ -#line 396 "parser.y" - { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[(3) - (8)].string), FUNC_SUB, (yyvsp[(1) - (8)].uint), (yyvsp[(4) - (8)].arg_decl), (yyvsp[(6) - (8)].statement)); CHECK_ERROR; } +#line 394 "parser.y" + { (yyvsp[(4) - (7)].class_decl)->name = (yyvsp[(2) - (7)].string); (yyval.class_decl) = (yyvsp[(4) - (7)].class_decl); } break; case 139: /* Line 1806 of yacc.c */ -#line 398 "parser.y" - { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[(3) - (8)].string), FUNC_FUNCTION, (yyvsp[(1) - (8)].uint), (yyvsp[(4) - (8)].arg_decl), (yyvsp[(6) - (8)].statement)); CHECK_ERROR; } +#line 397 "parser.y" + { (yyval.class_decl) = new_class_decl(ctx); } break; case 140: /* Line 1806 of yacc.c */ -#line 401 "parser.y" - { (yyval.uint) = 0; } +#line 398 "parser.y" + { (yyval.class_decl) = add_class_function(ctx, (yyvsp[(3) - (3)].class_decl), (yyvsp[(1) - (3)].func_decl)); CHECK_ERROR; } break; case 141: /* Line 1806 of yacc.c */ -#line 402 "parser.y" - { (yyval.uint) = (yyvsp[(1) - (1)].uint); } +#line 400 "parser.y" + { dim_decl_t *dim_decl = new_dim_decl(ctx, (yyvsp[(2) - (4)].string), FALSE, NULL); CHECK_ERROR; + (yyval.class_decl) = add_dim_prop(ctx, (yyvsp[(4) - (4)].class_decl), dim_decl, (yyvsp[(1) - (4)].uint)); CHECK_ERROR; } break; case 142: /* Line 1806 of yacc.c */ -#line 405 "parser.y" - { (yyval.uint) = STORAGE_IS_DEFAULT; } +#line 402 "parser.y" + { (yyval.class_decl) = add_dim_prop(ctx, (yyvsp[(4) - (4)].class_decl), (yyvsp[(2) - (4)].dim_decl), 0); CHECK_ERROR; } break; case 143: /* Line 1806 of yacc.c */ -#line 406 "parser.y" - { (yyval.uint) = 0; } +#line 403 "parser.y" + { (yyval.class_decl) = add_class_function(ctx, (yyvsp[(3) - (3)].class_decl), (yyvsp[(1) - (3)].func_decl)); CHECK_ERROR; } break; case 144: /* Line 1806 of yacc.c */ #line 407 "parser.y" - { (yyval.uint) = STORAGE_IS_PRIVATE; } + { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[(4) - (9)].string), FUNC_PROPGET, (yyvsp[(1) - (9)].uint), NULL, (yyvsp[(7) - (9)].statement)); CHECK_ERROR; } break; case 145: /* Line 1806 of yacc.c */ -#line 410 "parser.y" - { (yyval.arg_decl) = NULL; } +#line 409 "parser.y" + { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[(4) - (11)].string), FUNC_PROPLET, (yyvsp[(1) - (11)].uint), (yyvsp[(6) - (11)].arg_decl), (yyvsp[(9) - (11)].statement)); CHECK_ERROR; } break; case 146: /* Line 1806 of yacc.c */ #line 411 "parser.y" - { (yyval.arg_decl) = (yyvsp[(2) - (3)].arg_decl); } + { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[(4) - (11)].string), FUNC_PROPSET, (yyvsp[(1) - (11)].uint), (yyvsp[(6) - (11)].arg_decl), (yyvsp[(9) - (11)].statement)); CHECK_ERROR; } break; case 147: /* Line 1806 of yacc.c */ -#line 414 "parser.y" - { (yyval.arg_decl) = (yyvsp[(1) - (1)].arg_decl); } +#line 415 "parser.y" + { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[(3) - (8)].string), FUNC_SUB, (yyvsp[(1) - (8)].uint), (yyvsp[(4) - (8)].arg_decl), (yyvsp[(6) - (8)].statement)); CHECK_ERROR; } break; case 148: /* Line 1806 of yacc.c */ -#line 415 "parser.y" - { (yyvsp[(1) - (3)].arg_decl)->next = (yyvsp[(3) - (3)].arg_decl); (yyval.arg_decl) = (yyvsp[(1) - (3)].arg_decl); } +#line 417 "parser.y" + { (yyval.func_decl) = new_function_decl(ctx, (yyvsp[(3) - (8)].string), FUNC_FUNCTION, (yyvsp[(1) - (8)].uint), (yyvsp[(4) - (8)].arg_decl), (yyvsp[(6) - (8)].statement)); CHECK_ERROR; } break; case 149: /* Line 1806 of yacc.c */ -#line 418 "parser.y" - { (yyval.arg_decl) = new_argument_decl(ctx, (yyvsp[(1) - (1)].string), TRUE); } +#line 420 "parser.y" + { (yyval.uint) = 0; } break; case 150: /* Line 1806 of yacc.c */ -#line 419 "parser.y" - { (yyval.arg_decl) = new_argument_decl(ctx, (yyvsp[(2) - (2)].string), TRUE); } +#line 421 "parser.y" + { (yyval.uint) = (yyvsp[(1) - (1)].uint); } break; case 151: /* Line 1806 of yacc.c */ -#line 420 "parser.y" - { (yyval.arg_decl) = new_argument_decl(ctx, (yyvsp[(2) - (2)].string), FALSE); } +#line 424 "parser.y" + { (yyval.uint) = STORAGE_IS_DEFAULT; } break; case 152: /* Line 1806 of yacc.c */ -#line 424 "parser.y" - { (yyval.string) = (yyvsp[(1) - (1)].string); } +#line 425 "parser.y" + { (yyval.uint) = 0; } break; case 153: /* Line 1806 of yacc.c */ -#line 425 "parser.y" +#line 426 "parser.y" + { (yyval.uint) = STORAGE_IS_PRIVATE; } + break; + + case 154: + +/* Line 1806 of yacc.c */ +#line 429 "parser.y" + { (yyval.arg_decl) = NULL; } + break; + + case 155: + +/* Line 1806 of yacc.c */ +#line 430 "parser.y" + { (yyval.arg_decl) = (yyvsp[(2) - (3)].arg_decl); } + break; + + case 156: + +/* Line 1806 of yacc.c */ +#line 433 "parser.y" + { (yyval.arg_decl) = (yyvsp[(1) - (1)].arg_decl); } + break; + + case 157: + +/* Line 1806 of yacc.c */ +#line 434 "parser.y" + { (yyvsp[(1) - (3)].arg_decl)->next = (yyvsp[(3) - (3)].arg_decl); (yyval.arg_decl) = (yyvsp[(1) - (3)].arg_decl); } + break; + + case 158: + +/* Line 1806 of yacc.c */ +#line 437 "parser.y" + { (yyval.arg_decl) = new_argument_decl(ctx, (yyvsp[(1) - (2)].string), TRUE); } + break; + + case 159: + +/* Line 1806 of yacc.c */ +#line 438 "parser.y" + { (yyval.arg_decl) = new_argument_decl(ctx, (yyvsp[(2) - (3)].string), TRUE); } + break; + + case 160: + +/* Line 1806 of yacc.c */ +#line 439 "parser.y" + { (yyval.arg_decl) = new_argument_decl(ctx, (yyvsp[(2) - (3)].string), FALSE); } + break; + + case 161: + +/* Line 1806 of yacc.c */ +#line 443 "parser.y" + { (yyval.string) = (yyvsp[(1) - (1)].string); } + break; + + case 162: + +/* Line 1806 of yacc.c */ +#line 444 "parser.y" { (yyval.string) = propertyW; } break; /* Line 1806 of yacc.c */ -#line 2940 "parser.tab.c" +#line 3032 "parser.tab.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -3161,7 +3253,7 @@ yyreturn: /* Line 2067 of yacc.c */ -#line 426 "parser.y" +#line 451 "parser.y" static int parser_error(parser_ctx_t *ctx, const char *str) @@ -3358,7 +3450,7 @@ static statement_t *new_set_statement(parser_ctx_t *ctx, member_expression_t *le return &stat->stat; } -static dim_decl_t *new_dim_decl(parser_ctx_t *ctx, const WCHAR *name, dim_decl_t *next) +static dim_decl_t *new_dim_decl(parser_ctx_t *ctx, const WCHAR *name, BOOL is_array, dim_list_t *dims) { dim_decl_t *decl; @@ -3367,10 +3459,25 @@ static dim_decl_t *new_dim_decl(parser_ctx_t *ctx, const WCHAR *name, dim_decl_t return NULL; decl->name = name; - decl->next = next; + decl->is_array = is_array; + decl->dims = dims; + decl->next = NULL; return decl; } +static dim_list_t *new_dim(parser_ctx_t *ctx, unsigned val, dim_list_t *next) +{ + dim_list_t *ret; + + ret = parser_alloc(ctx, sizeof(*ret)); + if(!ret) + return NULL; + + ret->val = val; + ret->next = next; + return ret; +} + static statement_t *new_dim_statement(parser_ctx_t *ctx, dim_decl_t *decls) { dim_statement_t *stat; @@ -3599,24 +3706,17 @@ static class_decl_t *add_class_function(parser_ctx_t *ctx, class_decl_t *class_d return class_decl; } -static class_decl_t *add_variant_prop(parser_ctx_t *ctx, class_decl_t *class_decl, const WCHAR *identifier, unsigned storage_flags) +static class_decl_t *add_dim_prop(parser_ctx_t *ctx, class_decl_t *class_decl, dim_decl_t *dim_decl, unsigned storage_flags) { - class_prop_decl_t *prop; - if(storage_flags & STORAGE_IS_DEFAULT) { FIXME("variant prop van't be default value\n"); ctx->hres = E_FAIL; return NULL; } - prop = parser_alloc(ctx, sizeof(*prop)); - if(!prop) - return NULL; - - prop->name = identifier; - prop->is_public = !(storage_flags & STORAGE_IS_PRIVATE); - prop->next = class_decl->props; - class_decl->props = prop; + dim_decl->is_public = !(storage_flags & STORAGE_IS_PRIVATE); + dim_decl->next = class_decl->props; + class_decl->props = dim_decl; return class_decl; } diff --git a/dll/win32/vbscript/parser.tab.h b/dll/win32/vbscript/parser.tab.h index fd4b235dcd8..7313fd9da58 100644 --- a/dll/win32/vbscript/parser.tab.h +++ b/dll/win32/vbscript/parser.tab.h @@ -115,7 +115,7 @@ typedef union YYSTYPE { /* Line 2068 of yacc.c */ -#line 87 "parser.y" +#line 88 "parser.y" const WCHAR *string; statement_t *statement; @@ -123,6 +123,7 @@ typedef union YYSTYPE member_expression_t *member; elseif_decl_t *elseif; dim_decl_t *dim_decl; + dim_list_t *dim_list; function_decl_t *func_decl; arg_decl_t *arg_decl; class_decl_t *class_decl; @@ -136,7 +137,7 @@ typedef union YYSTYPE /* Line 2068 of yacc.c */ -#line 140 "parser.tab.h" +#line 141 "parser.tab.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/dll/win32/vbscript/parser.y b/dll/win32/vbscript/parser.y index 3c54fd88ba8..6bd4907c125 100644 --- a/dll/win32/vbscript/parser.y +++ b/dll/win32/vbscript/parser.y @@ -57,7 +57,8 @@ static statement_t *new_onerror_statement(parser_ctx_t*,BOOL); static statement_t *new_const_statement(parser_ctx_t*,const_decl_t*); static statement_t *new_select_statement(parser_ctx_t*,expression_t*,case_clausule_t*); -static dim_decl_t *new_dim_decl(parser_ctx_t*,const WCHAR*,dim_decl_t*); +static dim_decl_t *new_dim_decl(parser_ctx_t*,const WCHAR*,BOOL,dim_list_t*); +static dim_list_t *new_dim(parser_ctx_t*,unsigned,dim_list_t*); static elseif_decl_t *new_elseif_decl(parser_ctx_t*,expression_t*,statement_t*); static function_decl_t *new_function_decl(parser_ctx_t*,const WCHAR*,function_type_t,unsigned,arg_decl_t*,statement_t*); static arg_decl_t *new_argument_decl(parser_ctx_t*,const WCHAR*,BOOL); @@ -66,7 +67,7 @@ static case_clausule_t *new_case_clausule(parser_ctx_t*,expression_t*,statement_ static class_decl_t *new_class_decl(parser_ctx_t*); static class_decl_t *add_class_function(parser_ctx_t*,class_decl_t*,function_decl_t*); -static class_decl_t *add_variant_prop(parser_ctx_t*,class_decl_t*,const WCHAR*,unsigned); +static class_decl_t *add_dim_prop(parser_ctx_t*,class_decl_t*,dim_decl_t*,unsigned); static statement_t *link_statements(statement_t*,statement_t*); @@ -91,6 +92,7 @@ static const WCHAR propertyW[] = {'p','r','o','p','e','r','t','y',0}; member_expression_t *member; elseif_decl_t *elseif; dim_decl_t *dim_decl; + dim_list_t *dim_list; function_decl_t *func_decl; arg_decl_t *arg_decl; class_decl_t *class_decl; @@ -132,8 +134,9 @@ static const WCHAR propertyW[] = {'p','r','o','p','e','r','t','y',0}; %type FunctionDecl PropertyDecl %type ElseIfs_opt ElseIfs ElseIf %type ClassDeclaration ClassBody -%type Storage Storage_opt -%type DimDeclList +%type Storage Storage_opt IntegerValue +%type DimDeclList DimDecl +%type DimList %type ConstDecl ConstDeclList %type Identifier %type CaseClausules @@ -202,16 +205,25 @@ SimpleStatement { $$ = new_forto_statement(ctx, $2, $4, $6, $7, $9); CHECK_ERROR; } | tFOR tEACH Identifier tIN Expression tNL StatementsNl_opt tNEXT { $$ = new_foreach_statement(ctx, $3, $5, $7); } - | tSELECT tCASE Expression tNL CaseClausules tEND tSELECT + | tSELECT tCASE Expression StSep CaseClausules tEND tSELECT { $$ = new_select_statement(ctx, $3, $5); } MemberExpression : Identifier { $$ = new_member_expression(ctx, NULL, $1); CHECK_ERROR; } | CallExpression '.' Identifier { $$ = new_member_expression(ctx, $1, $3); CHECK_ERROR; } -DimDeclList /* FIXME: Support arrays */ - : Identifier { $$ = new_dim_decl(ctx, $1, NULL); CHECK_ERROR; } - | Identifier ',' DimDeclList { $$ = new_dim_decl(ctx, $1, $3); CHECK_ERROR; } +DimDeclList + : DimDecl { $$ = $1; } + | DimDecl ',' DimDeclList { $1->next = $3; $$ = $1; } + +DimDecl + : Identifier { $$ = new_dim_decl(ctx, $1, FALSE, NULL); CHECK_ERROR; } + | Identifier '(' DimList ')' { $$ = new_dim_decl(ctx, $1, TRUE, $3); CHECK_ERROR; } + | Identifier tEMPTYBRACKETS { $$ = new_dim_decl(ctx, $1, TRUE, NULL); CHECK_ERROR; } + +DimList + : IntegerValue { $$ = new_dim(ctx, $1, NULL); } + | IntegerValue ',' DimList { $$ = new_dim(ctx, $1, $3); } ConstDeclList : ConstDecl { $$ = $1; } @@ -261,8 +273,8 @@ Else_opt CaseClausules : /* empty */ { $$ = NULL; } - | tCASE tELSE tNL StatementsNl { $$ = new_case_clausule(ctx, NULL, $4, NULL); } - | tCASE ExpressionList tNL StatementsNl_opt CaseClausules + | tCASE tELSE StSep StatementsNl { $$ = new_case_clausule(ctx, NULL, $4, NULL); } + | tCASE ExpressionList StSep StatementsNl_opt CaseClausules { $$ = new_case_clausule(ctx, $2, $4, $5); } Arguments_opt @@ -369,6 +381,10 @@ NumericLiteralExpression | tLong { $$ = new_long_expression(ctx, EXPR_ULONG, $1); CHECK_ERROR; } | tDouble { $$ = new_double_expression(ctx, $1); CHECK_ERROR; } +IntegerValue + : tShort { $$ = $1; } + | '0' { $$ = 0; } + | tLong { $$ = $1; } PrimaryExpression : '(' Expression ')' { $$ = new_unary_expression(ctx, EXPR_BRACKETS, $2); } @@ -380,7 +396,10 @@ ClassDeclaration ClassBody : /* empty */ { $$ = new_class_decl(ctx); } | FunctionDecl tNL ClassBody { $$ = add_class_function(ctx, $3, $1); CHECK_ERROR; } - | Storage tIdentifier tNL ClassBody { $$ = add_variant_prop(ctx, $4, $2, $1); CHECK_ERROR; } + /* FIXME: We should use DimDecl here to support arrays, but that conflicts with PropertyDecl. */ + | Storage tIdentifier tNL ClassBody { dim_decl_t *dim_decl = new_dim_decl(ctx, $2, FALSE, NULL); CHECK_ERROR; + $$ = add_dim_prop(ctx, $4, dim_decl, $1); CHECK_ERROR; } + | tDIM DimDecl tNL ClassBody { $$ = add_dim_prop(ctx, $4, $2, 0); CHECK_ERROR; } | PropertyDecl tNL ClassBody { $$ = add_class_function(ctx, $3, $1); CHECK_ERROR; } PropertyDecl @@ -415,14 +434,20 @@ ArgumentDeclList | ArgumentDecl ',' ArgumentDeclList { $1->next = $3; $$ = $1; } ArgumentDecl - : Identifier { $$ = new_argument_decl(ctx, $1, TRUE); } - | tBYREF Identifier { $$ = new_argument_decl(ctx, $2, TRUE); } - | tBYVAL Identifier { $$ = new_argument_decl(ctx, $2, FALSE); } + : Identifier EmptyBrackets_opt { $$ = new_argument_decl(ctx, $1, TRUE); } + | tBYREF Identifier EmptyBrackets_opt { $$ = new_argument_decl(ctx, $2, TRUE); } + | tBYVAL Identifier EmptyBrackets_opt { $$ = new_argument_decl(ctx, $2, FALSE); } /* 'property' may be both keyword and identifier, depending on context */ Identifier : tIdentifier { $$ = $1; } | tPROPERTY { $$ = propertyW; } + +/* Some statements accept both new line and ':' as a separator */ +StSep + : tNL + | ':' + %% static int parser_error(parser_ctx_t *ctx, const char *str) @@ -619,7 +644,7 @@ static statement_t *new_set_statement(parser_ctx_t *ctx, member_expression_t *le return &stat->stat; } -static dim_decl_t *new_dim_decl(parser_ctx_t *ctx, const WCHAR *name, dim_decl_t *next) +static dim_decl_t *new_dim_decl(parser_ctx_t *ctx, const WCHAR *name, BOOL is_array, dim_list_t *dims) { dim_decl_t *decl; @@ -628,10 +653,25 @@ static dim_decl_t *new_dim_decl(parser_ctx_t *ctx, const WCHAR *name, dim_decl_t return NULL; decl->name = name; - decl->next = next; + decl->is_array = is_array; + decl->dims = dims; + decl->next = NULL; return decl; } +static dim_list_t *new_dim(parser_ctx_t *ctx, unsigned val, dim_list_t *next) +{ + dim_list_t *ret; + + ret = parser_alloc(ctx, sizeof(*ret)); + if(!ret) + return NULL; + + ret->val = val; + ret->next = next; + return ret; +} + static statement_t *new_dim_statement(parser_ctx_t *ctx, dim_decl_t *decls) { dim_statement_t *stat; @@ -860,24 +900,17 @@ static class_decl_t *add_class_function(parser_ctx_t *ctx, class_decl_t *class_d return class_decl; } -static class_decl_t *add_variant_prop(parser_ctx_t *ctx, class_decl_t *class_decl, const WCHAR *identifier, unsigned storage_flags) +static class_decl_t *add_dim_prop(parser_ctx_t *ctx, class_decl_t *class_decl, dim_decl_t *dim_decl, unsigned storage_flags) { - class_prop_decl_t *prop; - if(storage_flags & STORAGE_IS_DEFAULT) { FIXME("variant prop van't be default value\n"); ctx->hres = E_FAIL; return NULL; } - prop = parser_alloc(ctx, sizeof(*prop)); - if(!prop) - return NULL; - - prop->name = identifier; - prop->is_public = !(storage_flags & STORAGE_IS_PRIVATE); - prop->next = class_decl->props; - class_decl->props = prop; + dim_decl->is_public = !(storage_flags & STORAGE_IS_PRIVATE); + dim_decl->next = class_decl->props; + class_decl->props = dim_decl; return class_decl; } diff --git a/dll/win32/vbscript/regexp.c b/dll/win32/vbscript/regexp.c index 724e8de1017..cf5153030da 100644 --- a/dll/win32/vbscript/regexp.c +++ b/dll/win32/vbscript/regexp.c @@ -883,7 +883,7 @@ ProcessOp(CompilerState *state, REOpData *opData, RENode **operandStack, /* * Hack two bits in CompilerState.flags, for use within FindParenCount to flag - * its being on the stack, and to propagate errors to its callers. + * it being on the stack, and to propagate errors to its callers. */ #define JSREG_FIND_PAREN_COUNT 0x8000 #define JSREG_FIND_PAREN_ERROR 0x4000 diff --git a/dll/win32/vbscript/vbdisp.c b/dll/win32/vbscript/vbdisp.c index 67b54da318e..3f8b13e3653 100644 --- a/dll/win32/vbscript/vbdisp.c +++ b/dll/win32/vbscript/vbdisp.c @@ -103,7 +103,7 @@ static HRESULT invoke_variant_prop(VARIANT *v, WORD flags, DISPPARAMS *dp, VARIA return DISP_E_MEMBERNOTFOUND; /* That's what tests show */ } - hres = VariantCopy(res, v); + hres = VariantCopyInd(res, v); break; case DISPATCH_PROPERTYPUT: { @@ -115,10 +115,15 @@ static HRESULT invoke_variant_prop(VARIANT *v, WORD flags, DISPPARAMS *dp, VARIA return DISP_E_PARAMNOTOPTIONAL; } + if(arg_cnt(dp)) { + FIXME("Arguments not supported\n"); + return E_NOTIMPL; + } + if(res) V_VT(res) = VT_EMPTY; - hres = VariantCopy(v, put_val); + hres = VariantCopyInd(v, put_val); break; } @@ -222,7 +227,7 @@ static BOOL run_terminator(vbdisp_t *This) This->ref++; exec_script(This->desc->ctx, This->desc->funcs[This->desc->class_terminate_id].entries[VBDISP_CALLGET], - (IDispatch*)&This->IDispatchEx_iface, &dp, NULL); + This, &dp, NULL); return !--This->ref; } @@ -233,6 +238,13 @@ static void clean_props(vbdisp_t *This) if(!This->desc) return; + for(i=0; i < This->desc->array_cnt; i++) { + if(This->arrays[i]) { + SafeArrayDestroy(This->arrays[i]); + This->arrays[i] = NULL; + } + } + for(i=0; i < This->desc->prop_cnt; i++) VariantClear(This->props+i); } @@ -285,6 +297,7 @@ static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface) if(!ref && run_terminator(This)) { clean_props(This); list_remove(&This->entry); + heap_free(This->arrays); heap_free(This); } @@ -378,7 +391,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc return DISP_E_MEMBERNOTFOUND; } - return exec_script(This->desc->ctx, func, (IDispatch*)&This->IDispatchEx_iface, pdp, pvarRes); + return exec_script(This->desc->ctx, func, This, pdp, pvarRes); case DISPATCH_PROPERTYPUT: { VARIANT *put_val; DISPPARAMS dp = {NULL, NULL, 1, 0}; @@ -401,7 +414,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc return DISP_E_MEMBERNOTFOUND; } - return exec_script(This->desc->ctx, func, (IDispatch*)&This->IDispatchEx_iface, &dp, NULL); + return exec_script(This->desc->ctx, func, This, &dp, NULL); } default: FIXME("flags %x\n", wFlags); @@ -499,6 +512,7 @@ static inline vbdisp_t *unsafe_impl_from_IDispatch(IDispatch *iface) HRESULT create_vbdisp(const class_desc_t *desc, vbdisp_t **ret) { vbdisp_t *vbdisp; + HRESULT hres = S_OK; vbdisp = heap_alloc_zero( FIELD_OFFSET( vbdisp_t, props[desc->prop_cnt] )); if(!vbdisp) @@ -510,18 +524,46 @@ HRESULT create_vbdisp(const class_desc_t *desc, vbdisp_t **ret) list_add_tail(&desc->ctx->objects, &vbdisp->entry); - if(desc->class_initialize_id) { - DISPPARAMS dp = {0}; - HRESULT hres; + if(desc->array_cnt) { + vbdisp->arrays = heap_alloc_zero(desc->array_cnt * sizeof(*vbdisp->arrays)); + if(vbdisp->arrays) { + unsigned i, j; - hres = exec_script(desc->ctx, desc->funcs[desc->class_initialize_id].entries[VBDISP_CALLGET], - (IDispatch*)&vbdisp->IDispatchEx_iface, &dp, NULL); - if(FAILED(hres)) { - IDispatchEx_Release(&vbdisp->IDispatchEx_iface); - return hres; + for(i=0; i < desc->array_cnt; i++) { + if(!desc->array_descs[i].dim_cnt) + continue; + + vbdisp->arrays[i] = SafeArrayCreate(VT_VARIANT, desc->array_descs[i].dim_cnt, desc->array_descs[i].bounds); + if(!vbdisp->arrays[i]) { + hres = E_OUTOFMEMORY; + break; + } + } + + if(SUCCEEDED(hres)) { + for(i=0, j=0; i < desc->prop_cnt; i++) { + if(desc->props[i].is_array) { + V_VT(vbdisp->props+i) = VT_ARRAY|VT_BYREF|VT_VARIANT; + V_ARRAYREF(vbdisp->props+i) = vbdisp->arrays + j++; + } + } + } + }else { + hres = E_OUTOFMEMORY; } } + if(SUCCEEDED(hres) && desc->class_initialize_id) { + DISPPARAMS dp = {0}; + hres = exec_script(desc->ctx, desc->funcs[desc->class_initialize_id].entries[VBDISP_CALLGET], + vbdisp, &dp, NULL); + } + + if(FAILED(hres)) { + IDispatchEx_Release(&vbdisp->IDispatchEx_iface); + return hres; + } + *ret = vbdisp; return S_OK; } @@ -920,6 +962,69 @@ HRESULT disp_get_id(IDispatch *disp, BSTR name, vbdisp_invoke_type_t invoke_type return hres; } +#define RPC_E_SERVER_UNAVAILABLE 0x800706ba + +HRESULT map_hres(HRESULT hres) +{ + if(SUCCEEDED(hres) || HRESULT_FACILITY(hres) == FACILITY_VBS) + return hres; + + switch(hres) { + case E_NOTIMPL: return MAKE_VBSERROR(VBSE_ACTION_NOT_SUPPORTED); + case E_NOINTERFACE: return MAKE_VBSERROR(VBSE_OLE_NOT_SUPPORTED); + case DISP_E_UNKNOWNINTERFACE: return MAKE_VBSERROR(VBSE_OLE_NO_PROP_OR_METHOD); + case DISP_E_MEMBERNOTFOUND: return MAKE_VBSERROR(VBSE_OLE_NO_PROP_OR_METHOD); + case DISP_E_PARAMNOTFOUND: return MAKE_VBSERROR(VBSE_NAMED_PARAM_NOT_FOUND); + case DISP_E_TYPEMISMATCH: return MAKE_VBSERROR(VBSE_TYPE_MISMATCH); + case DISP_E_UNKNOWNNAME: return MAKE_VBSERROR(VBSE_OLE_NO_PROP_OR_METHOD); + case DISP_E_NONAMEDARGS: return MAKE_VBSERROR(VBSE_NAMED_ARGS_NOT_SUPPORTED); + case DISP_E_BADVARTYPE: return MAKE_VBSERROR(VBSE_INVALID_TYPELIB_VARIABLE); + case DISP_E_OVERFLOW: return MAKE_VBSERROR(VBSE_OVERFLOW); + case DISP_E_BADINDEX: return MAKE_VBSERROR(VBSE_OUT_OF_BOUNDS); + case DISP_E_UNKNOWNLCID: return MAKE_VBSERROR(VBSE_LOCALE_SETTING_NOT_SUPPORTED); + case DISP_E_ARRAYISLOCKED: return MAKE_VBSERROR(VBSE_ARRAY_LOCKED); + case DISP_E_BADPARAMCOUNT: return MAKE_VBSERROR(VBSE_FUNC_ARITY_MISMATCH); + case DISP_E_PARAMNOTOPTIONAL: return MAKE_VBSERROR(VBSE_PARAMETER_NOT_OPTIONAL); + case DISP_E_NOTACOLLECTION: return MAKE_VBSERROR(VBSE_NOT_ENUM); + case TYPE_E_DLLFUNCTIONNOTFOUND: return MAKE_VBSERROR(VBSE_INVALID_DLL_FUNCTION_NAME); + case TYPE_E_TYPEMISMATCH: return MAKE_VBSERROR(VBSE_TYPE_MISMATCH); + case TYPE_E_OUTOFBOUNDS: return MAKE_VBSERROR(VBSE_OUT_OF_BOUNDS); + case TYPE_E_IOERROR: return MAKE_VBSERROR(VBSE_IO_ERROR); + case TYPE_E_CANTCREATETMPFILE: return MAKE_VBSERROR(VBSE_CANT_CREATE_TMP_FILE); + case STG_E_FILENOTFOUND: return MAKE_VBSERROR(VBSE_OLE_FILE_NOT_FOUND); + case STG_E_PATHNOTFOUND: return MAKE_VBSERROR(VBSE_PATH_NOT_FOUND); + case STG_E_TOOMANYOPENFILES: return MAKE_VBSERROR(VBSE_TOO_MANY_FILES); + case STG_E_ACCESSDENIED: return MAKE_VBSERROR(VBSE_PERMISSION_DENIED); + case STG_E_INSUFFICIENTMEMORY: return MAKE_VBSERROR(VBSE_OUT_OF_MEMORY); + case STG_E_NOMOREFILES: return MAKE_VBSERROR(VBSE_TOO_MANY_FILES); + case STG_E_DISKISWRITEPROTECTED: return MAKE_VBSERROR(VBSE_PERMISSION_DENIED); + case STG_E_WRITEFAULT: return MAKE_VBSERROR(VBSE_IO_ERROR); + case STG_E_READFAULT: return MAKE_VBSERROR(VBSE_IO_ERROR); + case STG_E_SHAREVIOLATION: return MAKE_VBSERROR(VBSE_PATH_FILE_ACCESS); + case STG_E_LOCKVIOLATION: return MAKE_VBSERROR(VBSE_PERMISSION_DENIED); + case STG_E_FILEALREADYEXISTS: return MAKE_VBSERROR(VBSE_FILE_ALREADY_EXISTS); + case STG_E_MEDIUMFULL: return MAKE_VBSERROR(VBSE_DISK_FULL); + case STG_E_INVALIDNAME: return MAKE_VBSERROR(VBSE_FILE_NOT_FOUND); + case STG_E_INUSE: return MAKE_VBSERROR(VBSE_PERMISSION_DENIED); + case STG_E_NOTCURRENT: return MAKE_VBSERROR(VBSE_PERMISSION_DENIED); + case STG_E_CANTSAVE: return MAKE_VBSERROR(VBSE_IO_ERROR); + case REGDB_E_CLASSNOTREG: return MAKE_VBSERROR(VBSE_CANT_CREATE_OBJECT); + case MK_E_UNAVAILABLE: return MAKE_VBSERROR(VBSE_CANT_CREATE_OBJECT); + case MK_E_INVALIDEXTENSION: return MAKE_VBSERROR(VBSE_OLE_FILE_NOT_FOUND); + case MK_E_CANTOPENFILE: return MAKE_VBSERROR(VBSE_OLE_FILE_NOT_FOUND); + case CO_E_CLASSSTRING: return MAKE_VBSERROR(VBSE_CANT_CREATE_OBJECT); + case CO_E_APPNOTFOUND: return MAKE_VBSERROR(VBSE_CANT_CREATE_OBJECT); + case CO_E_APPDIDNTREG: return MAKE_VBSERROR(VBSE_CANT_CREATE_OBJECT); + case E_ACCESSDENIED: return MAKE_VBSERROR(VBSE_PERMISSION_DENIED); + case E_OUTOFMEMORY: return MAKE_VBSERROR(VBSE_OUT_OF_MEMORY); + case E_INVALIDARG: return MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL); + case RPC_E_SERVER_UNAVAILABLE: return MAKE_VBSERROR(VBSE_SERVER_NOT_FOUND); + case CO_E_SERVER_EXEC_FAILURE: return MAKE_VBSERROR(VBSE_CANT_CREATE_OBJECT); + } + + return hres; +} + HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, DISPPARAMS *dp, VARIANT *retv) { const WORD flags = DISPATCH_METHOD|(retv ? DISPATCH_PROPERTYGET : 0); diff --git a/dll/win32/vbscript/vbregexp.c b/dll/win32/vbscript/vbregexp.c index 63790284423..03aa2a72c67 100644 --- a/dll/win32/vbscript/vbregexp.c +++ b/dll/win32/vbscript/vbregexp.c @@ -1596,29 +1596,41 @@ static IRegExpVtbl RegExpVtbl = { RegExp_Replace }; -HRESULT WINAPI VBScriptRegExpFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppv) +HRESULT create_regexp(IDispatch **ret) { - RegExp2 *ret; + RegExp2 *regexp; HRESULT hres; - TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppv); - hres = init_regexp_typeinfo(RegExp2_tid); if(FAILED(hres)) return hres; - ret = heap_alloc_zero(sizeof(*ret)); - if(!ret) + regexp = heap_alloc_zero(sizeof(*regexp)); + if(!regexp) return E_OUTOFMEMORY; - ret->IRegExp2_iface.lpVtbl = &RegExp2Vtbl; - ret->IRegExp_iface.lpVtbl = &RegExpVtbl; + regexp->IRegExp2_iface.lpVtbl = &RegExp2Vtbl; + regexp->IRegExp_iface.lpVtbl = &RegExpVtbl; + regexp->ref = 1; + heap_pool_init(®exp->pool); - ret->ref = 1; - heap_pool_init(&ret->pool); + *ret = (IDispatch*)®exp->IRegExp2_iface; + return S_OK; +} - hres = IRegExp2_QueryInterface(&ret->IRegExp2_iface, riid, ppv); - IRegExp2_Release(&ret->IRegExp2_iface); +HRESULT WINAPI VBScriptRegExpFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppv) +{ + IDispatch *regexp; + HRESULT hres; + + TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppv); + + hres = create_regexp(®exp); + if(FAILED(hres)) + return hres; + + hres = IDispatch_QueryInterface(regexp, riid, ppv); + IDispatch_Release(regexp); return hres; } diff --git a/dll/win32/vbscript/vbscript.h b/dll/win32/vbscript/vbscript.h index 9ffe55544e0..82eebc20ef1 100644 --- a/dll/win32/vbscript/vbscript.h +++ b/dll/win32/vbscript/vbscript.h @@ -78,14 +78,21 @@ typedef enum { VBDISP_ANY } vbdisp_invoke_type_t; +typedef struct { + unsigned dim_cnt; + SAFEARRAYBOUND *bounds; +} array_desc_t; + typedef struct { BOOL is_public; + BOOL is_array; const WCHAR *name; } vbdisp_prop_desc_t; typedef struct { const WCHAR *name; BOOL is_public; + BOOL is_array; function_t *entries[VBDISP_ANY]; } vbdisp_funcprop_desc_t; @@ -112,6 +119,9 @@ typedef struct _class_desc_t { unsigned prop_cnt; vbdisp_prop_desc_t *props; + unsigned array_cnt; + array_desc_t *array_descs; + unsigned builtin_prop_cnt; const builtin_prop_t *builtin_props; ITypeInfo *typeinfo; @@ -128,6 +138,7 @@ struct _vbdisp_t { struct list entry; const class_desc_t *desc; + SAFEARRAY **arrays; VARIANT props[1]; }; @@ -153,6 +164,8 @@ void collect_objects(script_ctx_t*) DECLSPEC_HIDDEN; HRESULT create_procedure_disp(script_ctx_t*,vbscode_t*,IDispatch**) DECLSPEC_HIDDEN; HRESULT create_script_disp(script_ctx_t*,ScriptDisp**) DECLSPEC_HIDDEN; +HRESULT to_int(VARIANT*,int*) DECLSPEC_HIDDEN; + static inline unsigned arg_cnt(const DISPPARAMS *dp) { return dp->cArgs - dp->cNamedArgs; @@ -187,6 +200,8 @@ struct _script_ctx_t { class_desc_t err_desc; vbdisp_t *err_obj; + HRESULT err_number; + dynamic_var_t *global_vars; function_t *global_funcs; class_desc_t *classes; @@ -220,9 +235,11 @@ typedef enum { X(assign_ident, 1, ARG_BSTR, ARG_UINT) \ X(assign_member, 1, ARG_BSTR, ARG_UINT) \ X(bool, 1, ARG_INT, 0) \ + X(catch, 1, ARG_ADDR, ARG_UINT) \ X(case, 0, ARG_ADDR, 0) \ X(concat, 1, 0, 0) \ X(const, 1, ARG_BSTR, 0) \ + X(dim, 1, ARG_BSTR, ARG_UINT) \ X(div, 1, 0, 0) \ X(double, 1, ARG_DOUBLE, 0) \ X(empty, 1, 0, 0) \ @@ -318,6 +335,8 @@ struct _function_t { unsigned arg_cnt; var_desc_t *vars; unsigned var_cnt; + array_desc_t *array_descs; + unsigned array_cnt; unsigned code_off; vbscode_t *code_ctx; function_t *next; @@ -342,7 +361,7 @@ struct _vbscode_t { void release_vbscode(vbscode_t*) DECLSPEC_HIDDEN; HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,vbscode_t**) DECLSPEC_HIDDEN; -HRESULT exec_script(script_ctx_t*,function_t*,IDispatch*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN; +HRESULT exec_script(script_ctx_t*,function_t*,vbdisp_t*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN; void release_dynamic_vars(dynamic_var_t*) DECLSPEC_HIDDEN; typedef struct { @@ -377,6 +396,43 @@ static inline BOOL is_int32(double d) return INT32_MIN <= d && d <= INT32_MAX && (double)(int)d == d; } +HRESULT create_regexp(IDispatch**) DECLSPEC_HIDDEN; + +HRESULT map_hres(HRESULT) DECLSPEC_HIDDEN; + +#define FACILITY_VBS 0xa +#define MAKE_VBSERROR(code) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_VBS, code) + +#define VBSE_ILLEGAL_FUNC_CALL 5 +#define VBSE_OVERFLOW 6 +#define VBSE_OUT_OF_MEMORY 7 +#define VBSE_OUT_OF_BOUNDS 9 +#define VBSE_ARRAY_LOCKED 10 +#define VBSE_TYPE_MISMATCH 13 +#define VBSE_FILE_NOT_FOUND 53 +#define VBSE_IO_ERROR 57 +#define VBSE_FILE_ALREADY_EXISTS 58 +#define VBSE_DISK_FULL 61 +#define VBSE_TOO_MANY_FILES 67 +#define VBSE_PERMISSION_DENIED 70 +#define VBSE_PATH_FILE_ACCESS 75 +#define VBSE_PATH_NOT_FOUND 76 +#define VBSE_OLE_NOT_SUPPORTED 430 +#define VBSE_OLE_NO_PROP_OR_METHOD 438 +#define VBSE_ACTION_NOT_SUPPORTED 445 +#define VBSE_NAMED_ARGS_NOT_SUPPORTED 446 +#define VBSE_LOCALE_SETTING_NOT_SUPPORTED 447 +#define VBSE_NAMED_PARAM_NOT_FOUND 448 +#define VBSE_INVALID_TYPELIB_VARIABLE 458 +#define VBSE_FUNC_ARITY_MISMATCH 450 +#define VBSE_PARAMETER_NOT_OPTIONAL 449 +#define VBSE_NOT_ENUM 451 +#define VBSE_INVALID_DLL_FUNCTION_NAME 453 +#define VBSE_CANT_CREATE_TMP_FILE 322 +#define VBSE_OLE_FILE_NOT_FOUND 432 +#define VBSE_CANT_CREATE_OBJECT 429 +#define VBSE_SERVER_NOT_FOUND 462 + HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; HRESULT WINAPI VBScriptRegExpFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; diff --git a/dll/win32/vbscript/vbscript_classes.idl b/dll/win32/vbscript/vbscript_classes.idl index c800e1be58d..a433d71d4fb 100644 --- a/dll/win32/vbscript/vbscript_classes.idl +++ b/dll/win32/vbscript/vbscript_classes.idl @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ helpstring("VBScript Regular Expression"), threading(apartment), diff --git a/dll/win32/vbscript/vbsglobal.idl b/dll/win32/vbscript/vbsglobal.idl index fb847c1b70d..c2c80d3dc9c 100644 --- a/dll/win32/vbscript/vbsglobal.idl +++ b/dll/win32/vbscript/vbsglobal.idl @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep regtypelib + import "oaidl.idl"; #include "vbscript_defs.h" diff --git a/dll/win32/vbscript/vbsregexp10.idl b/dll/win32/vbscript/vbsregexp10.idl index d1f181ea184..e76ef52e563 100644 --- a/dll/win32/vbscript/vbsregexp10.idl +++ b/dll/win32/vbscript/vbsregexp10.idl @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep regtypelib + import "oaidl.idl"; #include "vbscript_defs.h" diff --git a/dll/win32/vbscript/vbsregexp55.idl b/dll/win32/vbscript/vbsregexp55.idl index b6934e02711..67d88de9ddd 100644 --- a/dll/win32/vbscript/vbsregexp55.idl +++ b/dll/win32/vbscript/vbsregexp55.idl @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep regtypelib + import "oaidl.idl"; #include "vbscript_defs.h" diff --git a/dll/win32/wbemdisp/locator.c b/dll/win32/wbemdisp/locator.c index 2c49430ce1e..a6704c6bb90 100644 --- a/dll/win32/wbemdisp/locator.c +++ b/dll/win32/wbemdisp/locator.c @@ -239,11 +239,11 @@ static const ISWbemLocatorVtbl locator_vtbl = locator_get_Security_ }; -HRESULT SWbemLocator_create( IUnknown *unk, void **obj ) +HRESULT SWbemLocator_create( void **obj ) { struct locator *locator; - TRACE( "%p, %p\n", unk, obj ); + TRACE( "%p\n", obj ); if (!(locator = heap_alloc( sizeof(*locator) ))) return E_OUTOFMEMORY; locator->ISWbemLocator_iface.lpVtbl = &locator_vtbl; diff --git a/dll/win32/wbemdisp/main.c b/dll/win32/wbemdisp/main.c index aef7ecf409a..577425812c4 100644 --- a/dll/win32/wbemdisp/main.c +++ b/dll/win32/wbemdisp/main.c @@ -67,7 +67,7 @@ static const IParseDisplayNameVtbl WinMGMTSVtbl = { static IParseDisplayName winmgmts = { &WinMGMTSVtbl }; -static HRESULT WinMGMTS_create(IUnknown *outer, void **ppv) +static HRESULT WinMGMTS_create(void **ppv) { *ppv = &winmgmts; return S_OK; @@ -76,7 +76,7 @@ static HRESULT WinMGMTS_create(IUnknown *outer, void **ppv) struct factory { IClassFactory IClassFactory_iface; - HRESULT (*fnCreateInstance)( IUnknown *, LPVOID * ); + HRESULT (*fnCreateInstance)( LPVOID * ); }; static inline struct factory *impl_from_IClassFactory( IClassFactory *iface ) @@ -118,14 +118,11 @@ static HRESULT WINAPI factory_CreateInstance( IClassFactory *iface, LPUNKNOWN ou *obj = NULL; if (outer) return CLASS_E_NOAGGREGATION; - hr = factory->fnCreateInstance( outer, (LPVOID *)&unk ); + hr = factory->fnCreateInstance( (LPVOID *)&unk ); if (FAILED( hr )) return hr; hr = IUnknown_QueryInterface( unk, riid, obj ); - if (FAILED( hr )) - return hr; - IUnknown_Release( unk ); return hr; } diff --git a/dll/win32/wbemdisp/wbemdisp_classes.idl b/dll/win32/wbemdisp/wbemdisp_classes.idl index 4fdedb00932..0cea2c8b895 100644 --- a/dll/win32/wbemdisp/wbemdisp_classes.idl +++ b/dll/win32/wbemdisp/wbemdisp_classes.idl @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep register + [ threading(apartment), uuid(172bddf8-ceea-11d1-8b05-00600806d9b6), diff --git a/dll/win32/wbemdisp/wbemdisp_private.h b/dll/win32/wbemdisp/wbemdisp_private.h index b7fbb533a5f..9d68d07c80c 100644 --- a/dll/win32/wbemdisp/wbemdisp_private.h +++ b/dll/win32/wbemdisp/wbemdisp_private.h @@ -37,7 +37,7 @@ #include WINE_DEFAULT_DEBUG_CHANNEL(wbemdisp); -HRESULT SWbemLocator_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN; +HRESULT SWbemLocator_create(LPVOID *) DECLSPEC_HIDDEN; static void *heap_alloc( size_t len ) __WINE_ALLOC_SIZE(1); static inline void *heap_alloc( size_t len ) diff --git a/dll/win32/wbemdisp/wbemdisp_tlb.idl b/dll/win32/wbemdisp/wbemdisp_tlb.idl index f42f7b4cbd9..9174a2ca6cc 100644 --- a/dll/win32/wbemdisp/wbemdisp_tlb.idl +++ b/dll/win32/wbemdisp/wbemdisp_tlb.idl @@ -18,4 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep regtypelib + #include "wbemdisp.idl" diff --git a/dll/win32/windowscodecs/bitmap.c b/dll/win32/windowscodecs/bitmap.c index 93bc210be32..dfd7dda89fa 100644 --- a/dll/win32/windowscodecs/bitmap.c +++ b/dll/win32/windowscodecs/bitmap.c @@ -18,9 +18,15 @@ #include "wincodecs_private.h" +/* WARNING: .NET Media Integration Layer (MIL) directly dereferences + * BitmapImpl members and depends on its exact layout. + */ typedef struct BitmapImpl { - IWICBitmap IWICBitmap_iface; + IMILUnknown1 IMILUnknown1_iface; LONG ref; + IMILBitmapSource IMILBitmapSource_iface; + IWICBitmap IWICBitmap_iface; + IMILUnknown2 IMILUnknown2_iface; IWICPalette *palette; int palette_set; LONG lock; /* 0 if not locked, -1 if locked for writing, count if locked for reading */ @@ -46,6 +52,21 @@ static inline BitmapImpl *impl_from_IWICBitmap(IWICBitmap *iface) return CONTAINING_RECORD(iface, BitmapImpl, IWICBitmap_iface); } +static inline BitmapImpl *impl_from_IMILBitmapSource(IMILBitmapSource *iface) +{ + return CONTAINING_RECORD(iface, BitmapImpl, IMILBitmapSource_iface); +} + +static inline BitmapImpl *impl_from_IMILUnknown1(IMILUnknown1 *iface) +{ + return CONTAINING_RECORD(iface, BitmapImpl, IMILUnknown1_iface); +} + +static inline BitmapImpl *impl_from_IMILUnknown2(IMILUnknown2 *iface) +{ + return CONTAINING_RECORD(iface, BitmapImpl, IMILUnknown2_iface); +} + static inline BitmapLockImpl *impl_from_IWICBitmapLock(IWICBitmapLock *iface) { return CONTAINING_RECORD(iface, BitmapLockImpl, IWICBitmapLock_iface); @@ -213,6 +234,10 @@ static HRESULT WINAPI BitmapImpl_QueryInterface(IWICBitmap *iface, REFIID iid, { *ppv = &This->IWICBitmap_iface; } + else if (IsEqualIID(&IID_IMILBitmapSource, iid)) + { + *ppv = &This->IMILBitmapSource_iface; + } else { *ppv = NULL; @@ -431,6 +456,229 @@ static const IWICBitmapVtbl BitmapImpl_Vtbl = { BitmapImpl_SetResolution }; +static HRESULT WINAPI IMILBitmapImpl_QueryInterface(IMILBitmapSource *iface, REFIID iid, + void **ppv) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid) || + IsEqualIID(&IID_IMILBitmapSource, iid)) + { + IUnknown_AddRef(&This->IMILBitmapSource_iface); + *ppv = &This->IMILBitmapSource_iface; + return S_OK; + } + + *ppv = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI IMILBitmapImpl_AddRef(IMILBitmapSource *iface) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + return IWICBitmap_AddRef(&This->IWICBitmap_iface); +} + +static ULONG WINAPI IMILBitmapImpl_Release(IMILBitmapSource *iface) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + return IWICBitmap_Release(&This->IWICBitmap_iface); +} + +static HRESULT WINAPI IMILBitmapImpl_GetSize(IMILBitmapSource *iface, + UINT *width, UINT *height) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + return IWICBitmap_GetSize(&This->IWICBitmap_iface, width, height); +} + +static const struct +{ + const GUID *WIC_format; + int enum_format; +} pixel_fmt_map[] = +{ + { &GUID_WICPixelFormatDontCare, 0 }, + { &GUID_WICPixelFormat1bppIndexed, 1 }, + { &GUID_WICPixelFormat2bppIndexed, 2 }, + { &GUID_WICPixelFormat4bppIndexed, 3 }, + { &GUID_WICPixelFormat8bppIndexed, 4 }, + { &GUID_WICPixelFormatBlackWhite, 5 }, + { &GUID_WICPixelFormat2bppGray, 6 }, + { &GUID_WICPixelFormat4bppGray, 7 }, + { &GUID_WICPixelFormat8bppGray, 8 }, + { &GUID_WICPixelFormat16bppBGR555, 9 }, + { &GUID_WICPixelFormat16bppBGR565, 0x0a }, + { &GUID_WICPixelFormat16bppGray, 0x0b }, + { &GUID_WICPixelFormat24bppBGR, 0x0c }, + { &GUID_WICPixelFormat24bppRGB, 0x0d }, + { &GUID_WICPixelFormat32bppBGR, 0x0e }, + { &GUID_WICPixelFormat32bppBGRA, 0x0f }, + { &GUID_WICPixelFormat32bppPBGRA, 0x10 }, + { &GUID_WICPixelFormat48bppRGB, 0x15 }, + { &GUID_WICPixelFormat64bppRGBA, 0x16 }, + { &GUID_WICPixelFormat64bppPRGBA, 0x17 }, + { &GUID_WICPixelFormat32bppCMYK, 0x1c } +}; + +static HRESULT WINAPI IMILBitmapImpl_GetPixelFormat(IMILBitmapSource *iface, + int *format) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + int i; + + TRACE("(%p,%p)\n", iface, format); + + if (!format) return E_INVALIDARG; + + *format = 0; + + for (i = 0; i < sizeof(pixel_fmt_map)/sizeof(pixel_fmt_map[0]); i++) + { + if (IsEqualGUID(pixel_fmt_map[i].WIC_format, &This->pixelformat)) + { + *format = pixel_fmt_map[i].enum_format; + break; + } + } + + return S_OK; +} + +static HRESULT WINAPI IMILBitmapImpl_GetResolution(IMILBitmapSource *iface, + double *dpix, double *dpiy) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + return IWICBitmap_GetResolution(&This->IWICBitmap_iface, dpix, dpiy); +} + +static HRESULT WINAPI IMILBitmapImpl_CopyPalette(IMILBitmapSource *iface, + IWICPalette *palette) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + return IWICBitmap_CopyPalette(&This->IWICBitmap_iface, palette); +} + +static HRESULT WINAPI IMILBitmapImpl_CopyPixels(IMILBitmapSource *iface, + const WICRect *rc, UINT stride, UINT size, BYTE *buffer) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + return IWICBitmap_CopyPixels(&This->IWICBitmap_iface, rc, stride, size, buffer); +} + +static HRESULT WINAPI IMILBitmapImpl_UnknownMethod1(IMILBitmapSource *iface, void **ppv) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + + TRACE("(%p,%p)\n", iface, ppv); + + if (!ppv) return E_INVALIDARG; + + IUnknown_AddRef(&This->IMILUnknown1_iface); + *ppv = &This->IMILUnknown1_iface; + + return S_OK; +} + +static const IMILBitmapSourceVtbl IMILBitmapImpl_Vtbl = +{ + IMILBitmapImpl_QueryInterface, + IMILBitmapImpl_AddRef, + IMILBitmapImpl_Release, + IMILBitmapImpl_GetSize, + IMILBitmapImpl_GetPixelFormat, + IMILBitmapImpl_GetResolution, + IMILBitmapImpl_CopyPalette, + IMILBitmapImpl_CopyPixels, + IMILBitmapImpl_UnknownMethod1, +}; + +static HRESULT WINAPI IMILUnknown1Impl_QueryInterface(IMILUnknown1 *iface, REFIID iid, + void **ppv) +{ + BitmapImpl *This = impl_from_IMILUnknown1(iface); + + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid)) + { + IUnknown_AddRef(&This->IMILUnknown1_iface); + *ppv = iface; + return S_OK; + } + + return IWICBitmap_QueryInterface(&This->IWICBitmap_iface, iid, ppv); +} + +static ULONG WINAPI IMILUnknown1Impl_AddRef(IMILUnknown1 *iface) +{ + BitmapImpl *This = impl_from_IMILUnknown1(iface); + return IWICBitmap_AddRef(&This->IWICBitmap_iface); +} + +static ULONG WINAPI IMILUnknown1Impl_Release(IMILUnknown1 *iface) +{ + BitmapImpl *This = impl_from_IMILUnknown1(iface); + return IWICBitmap_Release(&This->IWICBitmap_iface); +} + +static const IMILUnknown1Vtbl IMILUnknown1Impl_Vtbl = +{ + IMILUnknown1Impl_QueryInterface, + IMILUnknown1Impl_AddRef, + IMILUnknown1Impl_Release, +}; + +static HRESULT WINAPI IMILUnknown2Impl_QueryInterface(IMILUnknown2 *iface, REFIID iid, + void **ppv) +{ + BitmapImpl *This = impl_from_IMILUnknown2(iface); + + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid)) + { + IUnknown_AddRef(&This->IMILUnknown2_iface); + *ppv = iface; + return S_OK; + } + + return IWICBitmap_QueryInterface(&This->IWICBitmap_iface, iid, ppv); +} + +static ULONG WINAPI IMILUnknown2Impl_AddRef(IMILUnknown2 *iface) +{ + BitmapImpl *This = impl_from_IMILUnknown2(iface); + return IWICBitmap_AddRef(&This->IWICBitmap_iface); +} + +static ULONG WINAPI IMILUnknown2Impl_Release(IMILUnknown2 *iface) +{ + BitmapImpl *This = impl_from_IMILUnknown2(iface); + return IWICBitmap_Release(&This->IWICBitmap_iface); +} + +static HRESULT WINAPI IMILUnknown2Impl_UnknownMethod1(IMILUnknown2 *iface, void *arg1, void *arg2) +{ + FIXME("(%p,%p,%p): stub\n", iface, arg1, arg2); + return E_NOTIMPL; +} + +static const IMILUnknown2Vtbl IMILUnknown2Impl_Vtbl = +{ + IMILUnknown2Impl_QueryInterface, + IMILUnknown2Impl_AddRef, + IMILUnknown2Impl_Release, + IMILUnknown2Impl_UnknownMethod1, +}; + HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, UINT stride, UINT datasize, BYTE *bits, REFWICPixelFormatGUID pixelFormat, WICBitmapCreateCacheOption option, @@ -461,6 +709,9 @@ HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, if (bits) memcpy(data, bits, datasize); This->IWICBitmap_iface.lpVtbl = &BitmapImpl_Vtbl; + This->IMILBitmapSource_iface.lpVtbl = &IMILBitmapImpl_Vtbl; + This->IMILUnknown1_iface.lpVtbl = &IMILUnknown1Impl_Vtbl; + This->IMILUnknown2_iface.lpVtbl = &IMILUnknown2Impl_Vtbl; This->ref = 1; This->palette = NULL; This->palette_set = 0; diff --git a/dll/win32/windowscodecs/bmpdecode.c b/dll/win32/windowscodecs/bmpdecode.c index dffd4bc2220..5039694a764 100644 --- a/dll/win32/windowscodecs/bmpdecode.c +++ b/dll/win32/windowscodecs/bmpdecode.c @@ -1169,17 +1169,15 @@ static HRESULT BmpDecoder_Create(int packed, int icoframe, BmpDecoder **ppDecode return S_OK; } -static HRESULT BmpDecoder_Construct(int packed, int icoframe, IUnknown *pUnkOuter, REFIID iid, void** ppv) +static HRESULT BmpDecoder_Construct(int packed, int icoframe, REFIID iid, void** ppv) { BmpDecoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - ret = BmpDecoder_Create(packed, icoframe, &This); if (FAILED(ret)) return ret; @@ -1189,14 +1187,14 @@ static HRESULT BmpDecoder_Construct(int packed, int icoframe, IUnknown *pUnkOute return ret; } -HRESULT BmpDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT BmpDecoder_CreateInstance(REFIID iid, void** ppv) { - return BmpDecoder_Construct(FALSE, FALSE, pUnkOuter, iid, ppv); + return BmpDecoder_Construct(FALSE, FALSE, iid, ppv); } -HRESULT DibDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT DibDecoder_CreateInstance(REFIID iid, void** ppv) { - return BmpDecoder_Construct(TRUE, FALSE, pUnkOuter, iid, ppv); + return BmpDecoder_Construct(TRUE, FALSE, iid, ppv); } HRESULT IcoDibDecoder_CreateInstance(BmpDecoder **ppDecoder) diff --git a/dll/win32/windowscodecs/bmpencode.c b/dll/win32/windowscodecs/bmpencode.c index 774d0d971ba..a30942fb2b4 100644 --- a/dll/win32/windowscodecs/bmpencode.c +++ b/dll/win32/windowscodecs/bmpencode.c @@ -586,17 +586,15 @@ static const IWICBitmapEncoderVtbl BmpEncoder_Vtbl = { BmpEncoder_GetMetadataQueryWriter }; -HRESULT BmpEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT BmpEncoder_CreateInstance(REFIID iid, void** ppv) { BmpEncoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(BmpEncoder)); if (!This) return E_OUTOFMEMORY; diff --git a/dll/win32/windowscodecs/clsfactory.c b/dll/win32/windowscodecs/clsfactory.c index 0a986c8ce6c..9fb72726fc1 100644 --- a/dll/win32/windowscodecs/clsfactory.c +++ b/dll/win32/windowscodecs/clsfactory.c @@ -22,7 +22,7 @@ extern HRESULT WINAPI WIC_DllGetClassObject(REFCLSID, REFIID, LPVOID *) DECLSPEC typedef struct { REFCLSID classid; - HRESULT (*constructor)(IUnknown*,REFIID,void**); + HRESULT (*constructor)(REFIID,void**); } classinfo; static const classinfo wic_classes[] = { @@ -112,7 +112,11 @@ static HRESULT WINAPI ClassFactoryImpl_CreateInstance(IClassFactory *iface, { ClassFactoryImpl *This = impl_from_IClassFactory(iface); - return This->info->constructor(pUnkOuter, riid, ppv); + *ppv = NULL; + + if (pUnkOuter) return CLASS_E_NOAGGREGATION; + + return This->info->constructor(riid, ppv); } static HRESULT WINAPI ClassFactoryImpl_LockServer(IClassFactory *iface, BOOL lock) diff --git a/dll/win32/windowscodecs/converter.c b/dll/win32/windowscodecs/converter.c index 5144ee18732..1dcff39fc38 100644 --- a/dll/win32/windowscodecs/converter.c +++ b/dll/win32/windowscodecs/converter.c @@ -1256,17 +1256,15 @@ static const IWICFormatConverterVtbl FormatConverter_Vtbl = { FormatConverter_CanConvert }; -HRESULT FormatConverter_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT FormatConverter_CreateInstance(REFIID iid, void** ppv) { FormatConverter *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(FormatConverter)); if (!This) return E_OUTOFMEMORY; diff --git a/dll/win32/windowscodecs/gifformat.c b/dll/win32/windowscodecs/gifformat.c index d0cf1a771da..20222d13c4b 100644 --- a/dll/win32/windowscodecs/gifformat.c +++ b/dll/win32/windowscodecs/gifformat.c @@ -129,9 +129,9 @@ static const MetadataHandlerVtbl LSDReader_Vtbl = { load_LSD_metadata }; -HRESULT LSDReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) +HRESULT LSDReader_CreateInstance(REFIID iid, void **ppv) { - return MetadataReader_Create(&LSDReader_Vtbl, pUnkOuter, iid, ppv); + return MetadataReader_Create(&LSDReader_Vtbl, iid, ppv); } #include "pshpack1.h" @@ -227,9 +227,9 @@ static const MetadataHandlerVtbl IMDReader_Vtbl = { load_IMD_metadata }; -HRESULT IMDReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) +HRESULT IMDReader_CreateInstance(REFIID iid, void **ppv) { - return MetadataReader_Create(&IMDReader_Vtbl, pUnkOuter, iid, ppv); + return MetadataReader_Create(&IMDReader_Vtbl, iid, ppv); } static HRESULT load_GCE_metadata(IStream *stream, const GUID *vendor, DWORD options, @@ -305,9 +305,9 @@ static const MetadataHandlerVtbl GCEReader_Vtbl = { load_GCE_metadata }; -HRESULT GCEReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) +HRESULT GCEReader_CreateInstance(REFIID iid, void **ppv) { - return MetadataReader_Create(&GCEReader_Vtbl, pUnkOuter, iid, ppv); + return MetadataReader_Create(&GCEReader_Vtbl, iid, ppv); } static HRESULT load_APE_metadata(IStream *stream, const GUID *vendor, DWORD options, @@ -412,9 +412,9 @@ static const MetadataHandlerVtbl APEReader_Vtbl = { load_APE_metadata }; -HRESULT APEReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) +HRESULT APEReader_CreateInstance(REFIID iid, void **ppv) { - return MetadataReader_Create(&APEReader_Vtbl, pUnkOuter, iid, ppv); + return MetadataReader_Create(&APEReader_Vtbl, iid, ppv); } static HRESULT load_GifComment_metadata(IStream *stream, const GUID *vendor, DWORD options, @@ -506,9 +506,9 @@ static const MetadataHandlerVtbl GifCommentReader_Vtbl = { load_GifComment_metadata }; -HRESULT GifCommentReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) +HRESULT GifCommentReader_CreateInstance(REFIID iid, void **ppv) { - return MetadataReader_Create(&GifCommentReader_Vtbl, pUnkOuter, iid, ppv); + return MetadataReader_Create(&GifCommentReader_Vtbl, iid, ppv); } static IStream *create_stream(const void *data, int data_size) @@ -1079,7 +1079,7 @@ static int _gif_inputfunc(GifFileType *gif, GifByteType *data, int len) { } hr = IStream_Read(stream, data, len, &bytesread); - if (hr != S_OK) bytesread = 0; + if (FAILED(hr)) bytesread = 0; return bytesread; } @@ -1402,17 +1402,15 @@ static const IWICMetadataBlockReaderVtbl GifDecoder_BlockVtbl = GifDecoder_Block_GetEnumerator }; -HRESULT GifDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT GifDecoder_CreateInstance(REFIID iid, void** ppv) { GifDecoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(GifDecoder)); if (!This) return E_OUTOFMEMORY; diff --git a/dll/win32/windowscodecs/guid.c b/dll/win32/windowscodecs/guid.c index 98c8e344554..b3e54f12e44 100644 --- a/dll/win32/windowscodecs/guid.c +++ b/dll/win32/windowscodecs/guid.c @@ -16,5 +16,6 @@ DEFINE_GUID(CLSID_WineTgaDecoder, 0xb11fc79a,0x67cc,0x43e6,0xa9,0xce,0xe3,0xd5,0 DEFINE_GUID(CLSID_WICIcnsEncoder, 0x312fb6f1,0xb767,0x409d,0x8a,0x6d,0x0f,0xc1,0x54,0xd4,0xf0,0x5c); DEFINE_GUID(GUID_WineContainerFormatTga, 0x0c44fda1,0xa5c5,0x4298,0x96,0x85,0x47,0x3f,0xc1,0x7c,0xd3,0x22); DEFINE_GUID(GUID_VendorWine, 0xddf46da1,0x7dc1,0x404e,0x98,0xf2,0xef,0xa4,0x8d,0xfc,0x95,0x0a); +DEFINE_GUID(IID_IMILBitmapSource,0x7543696a,0xbc8d,0x46b0,0x5f,0x81,0x8d,0x95,0x72,0x89,0x72,0xbe); /* NO CODE HERE, THIS IS JUST REQUIRED FOR THE GUID DEFINITIONS */ diff --git a/dll/win32/windowscodecs/icnsformat.c b/dll/win32/windowscodecs/icnsformat.c index 22dd37b154b..7cad87b7e92 100644 --- a/dll/win32/windowscodecs/icnsformat.c +++ b/dll/win32/windowscodecs/icnsformat.c @@ -730,17 +730,15 @@ static const IWICBitmapEncoderVtbl IcnsEncoder_Vtbl = { IcnsEncoder_GetMetadataQueryWriter }; -HRESULT IcnsEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT IcnsEncoder_CreateInstance(REFIID iid, void** ppv) { IcnsEncoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(IcnsEncoder)); if (!This) return E_OUTOFMEMORY; @@ -763,7 +761,7 @@ HRESULT IcnsEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) #else /* !defined(HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H) || MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 */ -HRESULT IcnsEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT IcnsEncoder_CreateInstance(REFIID iid, void** ppv) { ERR("Trying to save ICNS picture, but ICNS support is not compiled in.\n"); return E_FAIL; diff --git a/dll/win32/windowscodecs/icoformat.c b/dll/win32/windowscodecs/icoformat.c index ac6fdc70ae8..86629568fd9 100644 --- a/dll/win32/windowscodecs/icoformat.c +++ b/dll/win32/windowscodecs/icoformat.c @@ -216,7 +216,7 @@ static HRESULT ReadIcoDib(IStream *stream, IcoFrameDecode *result) IWICBitmapFrameDecode *framedecode; WICPixelFormatGUID pixelformat; IWICBitmapSource *source; - int has_alpha=FALSE; /* if TRUE, alpha data might be in the image data */ + BOOL has_alpha=FALSE; /* if TRUE, alpha data might be in the image data */ WICRect rc; hr = IcoDibDecoder_CreateInstance(&bmp_decoder); @@ -381,7 +381,7 @@ static HRESULT ReadIcoPng(IStream *stream, IcoFrameDecode *result) WICRect rect; HRESULT hr; - hr = PngDecoder_CreateInstance(NULL, &IID_IWICBitmapDecoder, (void**)&decoder); + hr = PngDecoder_CreateInstance(&IID_IWICBitmapDecoder, (void**)&decoder); if (FAILED(hr)) goto end; hr = IWICBitmapDecoder_Initialize(decoder, stream, WICDecodeMetadataCacheOnLoad); @@ -722,17 +722,15 @@ static const IWICBitmapDecoderVtbl IcoDecoder_Vtbl = { IcoDecoder_GetFrame }; -HRESULT IcoDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT IcoDecoder_CreateInstance(REFIID iid, void** ppv) { IcoDecoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(IcoDecoder)); if (!This) return E_OUTOFMEMORY; diff --git a/dll/win32/windowscodecs/imgfactory.c b/dll/win32/windowscodecs/imgfactory.c index af9aabc9100..b552c7b5a8b 100644 --- a/dll/win32/windowscodecs/imgfactory.c +++ b/dll/win32/windowscodecs/imgfactory.c @@ -405,7 +405,7 @@ static HRESULT WINAPI ComponentFactory_CreatePalette(IWICComponentFactory *iface static HRESULT WINAPI ComponentFactory_CreateFormatConverter(IWICComponentFactory *iface, IWICFormatConverter **ppIFormatConverter) { - return FormatConverter_CreateInstance(NULL, &IID_IWICFormatConverter, (void**)ppIFormatConverter); + return FormatConverter_CreateInstance(&IID_IWICFormatConverter, (void**)ppIFormatConverter); } static HRESULT WINAPI ComponentFactory_CreateBitmapScaler(IWICComponentFactory *iface, @@ -585,12 +585,166 @@ static HRESULT WINAPI ComponentFactory_CreateBitmapFromMemory(IWICComponentFacto return BitmapImpl_Create(width, height, stride, size, buffer, format, WICBitmapCacheOnLoad, bitmap); } -static HRESULT WINAPI ComponentFactory_CreateBitmapFromHBITMAP(IWICComponentFactory *iface, - HBITMAP hBitmap, HPALETTE hPalette, WICBitmapAlphaChannelOption options, - IWICBitmap **ppIBitmap) +static BOOL get_16bpp_format(HBITMAP hbm, WICPixelFormatGUID *format) { - FIXME("(%p,%p,%p,%u,%p): stub\n", iface, hBitmap, hPalette, options, ppIBitmap); - return E_NOTIMPL; + BOOL ret = TRUE; + BITMAPV4HEADER bmh; + HDC hdc; + + hdc = CreateCompatibleDC(0); + + memset(&bmh, 0, sizeof(bmh)); + bmh.bV4Size = sizeof(bmh); + bmh.bV4Width = 1; + bmh.bV4Height = 1; + bmh.bV4V4Compression = BI_BITFIELDS; + bmh.bV4BitCount = 16; + + GetDIBits(hdc, hbm, 0, 0, NULL, (BITMAPINFO *)&bmh, DIB_RGB_COLORS); + + if (bmh.bV4RedMask == 0x7c00 && + bmh.bV4GreenMask == 0x3e0 && + bmh.bV4BlueMask == 0x1f) + { + *format = GUID_WICPixelFormat16bppBGR555; + } + else if (bmh.bV4RedMask == 0xf800 && + bmh.bV4GreenMask == 0x7e0 && + bmh.bV4BlueMask == 0x1f) + { + *format = GUID_WICPixelFormat16bppBGR565; + } + else + { + FIXME("unrecognized bitfields %x,%x,%x\n", bmh.bV4RedMask, + bmh.bV4GreenMask, bmh.bV4BlueMask); + ret = FALSE; + } + + DeleteDC(hdc); + return ret; +} + +static HRESULT WINAPI ComponentFactory_CreateBitmapFromHBITMAP(IWICComponentFactory *iface, + HBITMAP hbm, HPALETTE hpal, WICBitmapAlphaChannelOption option, IWICBitmap **bitmap) +{ + BITMAP bm; + HRESULT hr; + WICPixelFormatGUID format; + IWICBitmapLock *lock; + UINT size, num_palette_entries = 0; + PALETTEENTRY entry[256]; + + TRACE("(%p,%p,%p,%u,%p)\n", iface, hbm, hpal, option, bitmap); + + if (!bitmap) return E_INVALIDARG; + + if (GetObjectW(hbm, sizeof(bm), &bm) != sizeof(bm)) + return WINCODEC_ERR_WIN32ERROR; + + if (hpal) + { + num_palette_entries = GetPaletteEntries(hpal, 0, 256, entry); + if (!num_palette_entries) + return WINCODEC_ERR_WIN32ERROR; + } + + /* TODO: Figure out the correct format for 16, 32, 64 bpp */ + switch(bm.bmBitsPixel) + { + case 1: + format = GUID_WICPixelFormat1bppIndexed; + break; + case 4: + format = GUID_WICPixelFormat4bppIndexed; + break; + case 8: + format = GUID_WICPixelFormat8bppIndexed; + break; + case 16: + if (!get_16bpp_format(hbm, &format)) + return E_INVALIDARG; + break; + case 24: + format = GUID_WICPixelFormat24bppBGR; + break; + case 32: + switch (option) + { + case WICBitmapUseAlpha: + format = GUID_WICPixelFormat32bppBGRA; + break; + case WICBitmapUsePremultipliedAlpha: + format = GUID_WICPixelFormat32bppPBGRA; + break; + case WICBitmapIgnoreAlpha: + format = GUID_WICPixelFormat32bppBGR; + break; + default: + return E_INVALIDARG; + } + break; + case 48: + format = GUID_WICPixelFormat48bppRGB; + break; + default: + FIXME("unsupported %d bpp\n", bm.bmBitsPixel); + return E_INVALIDARG; + } + + hr = BitmapImpl_Create(bm.bmWidth, bm.bmHeight, bm.bmWidthBytes, 0, NULL, &format, option, bitmap); + if (hr != S_OK) return hr; + + hr = IWICBitmap_Lock(*bitmap, NULL, WICBitmapLockWrite, &lock); + if (hr == S_OK) + { + BYTE *buffer; + HDC hdc; + char bmibuf[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)]; + BITMAPINFO *bmi = (BITMAPINFO *)bmibuf; + + IWICBitmapLock_GetDataPointer(lock, &size, &buffer); + + hdc = CreateCompatibleDC(0); + + bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmi->bmiHeader.biBitCount = 0; + GetDIBits(hdc, hbm, 0, 0, NULL, bmi, DIB_RGB_COLORS); + bmi->bmiHeader.biHeight = -bm.bmHeight; + GetDIBits(hdc, hbm, 0, bm.bmHeight, buffer, bmi, DIB_RGB_COLORS); + + DeleteDC(hdc); + IWICBitmapLock_Release(lock); + + if (num_palette_entries) + { + IWICPalette *palette; + WICColor colors[256]; + UINT i; + + hr = PaletteImpl_Create(&palette); + if (hr == S_OK) + { + for (i = 0; i < num_palette_entries; i++) + colors[i] = 0xff000000 | entry[i].peRed << 16 | + entry[i].peGreen << 8 | entry[i].peBlue; + + hr = IWICPalette_InitializeCustom(palette, colors, num_palette_entries); + if (hr == S_OK) + hr = IWICBitmap_SetPalette(*bitmap, palette); + + IWICPalette_Release(palette); + } + } + } + + if (hr != S_OK) + { + IWICBitmap_Release(*bitmap); + *bitmap = NULL; + } + + return hr; } static HRESULT WINAPI ComponentFactory_CreateBitmapFromHICON(IWICComponentFactory *iface, @@ -860,17 +1014,15 @@ static const IWICComponentFactoryVtbl ComponentFactory_Vtbl = { ComponentFactory_CreateEncoderPropertyBag }; -HRESULT ComponentFactory_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT ComponentFactory_CreateInstance(REFIID iid, void** ppv) { ComponentFactory *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(ComponentFactory)); if (!This) return E_OUTOFMEMORY; diff --git a/dll/win32/windowscodecs/info.c b/dll/win32/windowscodecs/info.c index 22c62821a23..a020b261e04 100644 --- a/dll/win32/windowscodecs/info.c +++ b/dll/win32/windowscodecs/info.c @@ -1754,7 +1754,7 @@ HRESULT CreateComponentInfo(REFCLSID clsid, IWICComponentInfo **ppIInfo) WCHAR guidstring[39]; LONG res; const struct category *category; - int found=0; + BOOL found = FALSE; HRESULT hr; res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, KEY_READ, &clsidkey); @@ -1775,7 +1775,7 @@ HRESULT CreateComponentInfo(REFCLSID clsid, IWICComponentInfo **ppIInfo) if (res == ERROR_SUCCESS) { RegCloseKey(classkey); - found = 1; + found = TRUE; } RegCloseKey(instancekey); } diff --git a/dll/win32/windowscodecs/jpegformat.c b/dll/win32/windowscodecs/jpegformat.c index 9ecc25b13f3..50ea8c070d5 100644 --- a/dll/win32/windowscodecs/jpegformat.c +++ b/dll/win32/windowscodecs/jpegformat.c @@ -231,7 +231,7 @@ static jpeg_boolean source_mgr_fill_input_buffer(j_decompress_ptr cinfo) hr = IStream_Read(This->stream, This->source_buffer, 1024, &bytesread); - if (hr != S_OK || bytesread == 0) + if (FAILED(hr) || bytesread == 0) { return FALSE; } @@ -696,12 +696,12 @@ static const IWICBitmapFrameDecodeVtbl JpegDecoder_Frame_Vtbl = { JpegDecoder_Frame_GetThumbnail }; -HRESULT JpegDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT JpegDecoder_CreateInstance(REFIID iid, void** ppv) { JpegDecoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); if (!libjpeg_handle && !load_libjpeg()) { @@ -711,8 +711,6 @@ HRESULT JpegDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(JpegDecoder)); if (!This) return E_OUTOFMEMORY; @@ -754,13 +752,13 @@ typedef struct JpegEncoder { struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; struct jpeg_destination_mgr dest_mgr; - int initialized; + BOOL initialized; int frame_count; - int frame_initialized; - int started_compress; + BOOL frame_initialized; + BOOL started_compress; int lines_written; - int frame_committed; - int committed; + BOOL frame_committed; + BOOL committed; UINT width, height; double xres, yres; const jpeg_compress_format *format; @@ -1031,7 +1029,7 @@ static HRESULT WINAPI JpegEncoder_Frame_WritePixels(IWICBitmapFrameEncode *iface pjpeg_start_compress(&This->cinfo, TRUE); - This->started_compress = 1; + This->started_compress = TRUE; } row_size = This->format->bpp / 8 * This->width; @@ -1438,17 +1436,15 @@ static const IWICBitmapEncoderVtbl JpegEncoder_Vtbl = { JpegEncoder_GetMetadataQueryWriter }; -HRESULT JpegEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT JpegEncoder_CreateInstance(REFIID iid, void** ppv) { JpegEncoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - if (!libjpeg_handle && !load_libjpeg()) { ERR("Failed writing JPEG because unable to find %s\n",SONAME_LIBJPEG); @@ -1461,13 +1457,13 @@ HRESULT JpegEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) This->IWICBitmapEncoder_iface.lpVtbl = &JpegEncoder_Vtbl; This->IWICBitmapFrameEncode_iface.lpVtbl = &JpegEncoder_FrameVtbl; This->ref = 1; - This->initialized = 0; + This->initialized = FALSE; This->frame_count = 0; - This->frame_initialized = 0; - This->started_compress = 0; + This->frame_initialized = FALSE; + This->started_compress = FALSE; This->lines_written = 0; - This->frame_committed = 0; - This->committed = 0; + This->frame_committed = FALSE; + This->committed = FALSE; This->width = This->height = 0; This->xres = This->yres = 0.0; This->format = NULL; @@ -1483,13 +1479,13 @@ HRESULT JpegEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) #else /* !defined(SONAME_LIBJPEG) */ -HRESULT JpegDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT JpegDecoder_CreateInstance(REFIID iid, void** ppv) { ERR("Trying to load JPEG picture, but JPEG support is not compiled in.\n"); return E_FAIL; } -HRESULT JpegEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT JpegEncoder_CreateInstance(REFIID iid, void** ppv) { ERR("Trying to save JPEG picture, but JPEG support is not compiled in.\n"); return E_FAIL; diff --git a/dll/win32/windowscodecs/metadatahandler.c b/dll/win32/windowscodecs/metadatahandler.c index 66dd2ed84f7..f7239e4ac29 100644 --- a/dll/win32/windowscodecs/metadatahandler.c +++ b/dll/win32/windowscodecs/metadatahandler.c @@ -440,7 +440,7 @@ static const IWICPersistStreamVtbl MetadataHandler_PersistStream_Vtbl = { MetadataHandler_SaveEx }; -HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, REFIID iid, void** ppv) { MetadataHandler *This; HRESULT hr; @@ -449,8 +449,6 @@ HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, IUnknown *pUnkO *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(MetadataHandler)); if (!This) return E_OUTOFMEMORY; @@ -709,9 +707,9 @@ static const MetadataHandlerVtbl UnknownMetadataReader_Vtbl = { LoadUnknownMetadata }; -HRESULT UnknownMetadataReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT UnknownMetadataReader_CreateInstance(REFIID iid, void** ppv) { - return MetadataReader_Create(&UnknownMetadataReader_Vtbl, pUnkOuter, iid, ppv); + return MetadataReader_Create(&UnknownMetadataReader_Vtbl, iid, ppv); } #define SWAP_USHORT(x) do { if (!native_byte_order) (x) = RtlUshortByteSwap(x); } while(0) @@ -1144,7 +1142,7 @@ static const MetadataHandlerVtbl IfdMetadataReader_Vtbl = { LoadIfdMetadata }; -HRESULT IfdMetadataReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) +HRESULT IfdMetadataReader_CreateInstance(REFIID iid, void **ppv) { - return MetadataReader_Create(&IfdMetadataReader_Vtbl, pUnkOuter, iid, ppv); + return MetadataReader_Create(&IfdMetadataReader_Vtbl, iid, ppv); } diff --git a/dll/win32/windowscodecs/pngformat.c b/dll/win32/windowscodecs/pngformat.c index 025eff4af11..9fb1acfe4aa 100644 --- a/dll/win32/windowscodecs/pngformat.c +++ b/dll/win32/windowscodecs/pngformat.c @@ -129,9 +129,9 @@ static const MetadataHandlerVtbl TextReader_Vtbl = { LoadTextMetadata }; -HRESULT PngTextReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT PngTextReader_CreateInstance(REFIID iid, void** ppv) { - return MetadataReader_Create(&TextReader_Vtbl, pUnkOuter, iid, ppv); + return MetadataReader_Create(&TextReader_Vtbl, iid, ppv); } #ifdef SONAME_LIBPNG @@ -935,7 +935,9 @@ static HRESULT WINAPI PngDecoder_Block_GetContainerFormat(IWICMetadataBlockReade static HRESULT WINAPI PngDecoder_Block_GetCount(IWICMetadataBlockReader *iface, UINT *pcCount) { - FIXME("%p,%p: stub\n", iface, pcCount); + static int once; + TRACE("%p,%p\n", iface, pcCount); + if (!once++) FIXME("stub\n"); return E_NOTIMPL; } @@ -963,17 +965,15 @@ static const IWICMetadataBlockReaderVtbl PngDecoder_BlockVtbl = { PngDecoder_Block_GetEnumerator, }; -HRESULT PngDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT PngDecoder_CreateInstance(REFIID iid, void** ppv) { PngDecoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - if (!libpng_handle && !load_libpng()) { ERR("Failed reading PNG because unable to find %s\n",SONAME_LIBPNG); @@ -1655,17 +1655,15 @@ static const IWICBitmapEncoderVtbl PngEncoder_Vtbl = { PngEncoder_GetMetadataQueryWriter }; -HRESULT PngEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT PngEncoder_CreateInstance(REFIID iid, void** ppv) { PngEncoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - if (!libpng_handle && !load_libpng()) { ERR("Failed writing PNG because unable to find %s\n",SONAME_LIBPNG); @@ -1703,13 +1701,13 @@ HRESULT PngEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) #else /* !HAVE_PNG_H */ -HRESULT PngDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT PngDecoder_CreateInstance(REFIID iid, void** ppv) { ERR("Trying to load PNG picture, but PNG support is not compiled in.\n"); return E_FAIL; } -HRESULT PngEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT PngEncoder_CreateInstance(REFIID iid, void** ppv) { ERR("Trying to save PNG picture, but PNG support is not compiled in.\n"); return E_FAIL; diff --git a/dll/win32/windowscodecs/proxy.c b/dll/win32/windowscodecs/proxy.c index 0a2378397e0..1eea7a0ed41 100644 --- a/dll/win32/windowscodecs/proxy.c +++ b/dll/win32/windowscodecs/proxy.c @@ -20,6 +20,12 @@ #include "wincodecs_private.h" +HRESULT WINAPI IPropertyBag2_Write_Proxy(IPropertyBag2 *iface, + ULONG cProperties, PROPBAG2 *ppropbag, VARIANT *pvarValue) +{ + return IPropertyBag2_Write(iface, cProperties, ppropbag, pvarValue); +} + HRESULT WINAPI IWICBitmapClipper_Initialize_Proxy_W(IWICBitmapClipper *iface, IWICBitmapSource *pISource, const WICRect *prc) { @@ -614,5 +620,45 @@ HRESULT WINAPI WICCreateImagingFactory_Proxy(UINT SDKVersion, IWICImagingFactory { TRACE("%x, %p\n", SDKVersion, ppIImagingFactory); - return ComponentFactory_CreateInstance(NULL, &IID_IWICImagingFactory, (void**)ppIImagingFactory); + return ComponentFactory_CreateInstance(&IID_IWICImagingFactory, (void**)ppIImagingFactory); +} + +HRESULT WINAPI WICSetEncoderFormat_Proxy(IWICBitmapSource *pSourceIn, + IWICPalette *pIPalette, IWICBitmapFrameEncode *pIFrameEncode, + IWICBitmapSource **ppSourceOut) +{ + HRESULT hr; + WICPixelFormatGUID pixelformat, framepixelformat; + + TRACE("%p,%p,%p,%p\n", pSourceIn, pIPalette, pIFrameEncode, ppSourceOut); + + if (pIPalette) FIXME("ignoring palette\n"); + + if (!pSourceIn || !pIFrameEncode || !ppSourceOut) + return E_INVALIDARG; + + *ppSourceOut = NULL; + + hr = IWICBitmapSource_GetPixelFormat(pSourceIn, &pixelformat); + + if (SUCCEEDED(hr)) + { + framepixelformat = pixelformat; + hr = IWICBitmapFrameEncode_SetPixelFormat(pIFrameEncode, &framepixelformat); + } + + if (SUCCEEDED(hr)) + { + if (IsEqualGUID(&pixelformat, &framepixelformat)) + { + *ppSourceOut = pSourceIn; + IWICBitmapSource_AddRef(pSourceIn); + } + else + { + hr = WICConvertBitmapSource(&framepixelformat, pSourceIn, ppSourceOut); + } + } + + return hr; } diff --git a/dll/win32/windowscodecs/regsvr.c b/dll/win32/windowscodecs/regsvr.c index da90f1f4d5d..3a6bc60b0b7 100644 --- a/dll/win32/windowscodecs/regsvr.c +++ b/dll/win32/windowscodecs/regsvr.c @@ -218,21 +218,21 @@ static HRESULT register_decoders(struct regsvr_decoder const *list) KEY_READ | KEY_WRITE, NULL, &instance_clsid_key, NULL); if (res == ERROR_SUCCESS) { res = RegSetValueExW(instance_clsid_key, clsid_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); RegCloseKey(instance_clsid_key); } if (res != ERROR_SUCCESS) goto error_close_clsid_key; if (list->author) { res = RegSetValueExA(clsid_key, author_valuename, 0, REG_SZ, - (CONST BYTE*)(list->author), + (const BYTE*)list->author, strlen(list->author) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->friendlyname) { res = RegSetValueExA(clsid_key, friendlyname_valuename, 0, REG_SZ, - (CONST BYTE*)(list->friendlyname), + (const BYTE*)list->friendlyname, strlen(list->friendlyname) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -240,34 +240,34 @@ static HRESULT register_decoders(struct regsvr_decoder const *list) if (list->vendor) { StringFromGUID2(list->vendor, buf, 39); res = RegSetValueExW(clsid_key, vendor_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->container_format) { StringFromGUID2(list->container_format, buf, 39); res = RegSetValueExW(clsid_key, containerformat_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->version) { res = RegSetValueExA(clsid_key, version_valuename, 0, REG_SZ, - (CONST BYTE*)(list->version), + (const BYTE*)list->version, strlen(list->version) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->mimetypes) { res = RegSetValueExA(clsid_key, mimetypes_valuename, 0, REG_SZ, - (CONST BYTE*)(list->mimetypes), + (const BYTE*)list->mimetypes, strlen(list->mimetypes) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->extensions) { res = RegSetValueExA(clsid_key, extensions_valuename, 0, REG_SZ, - (CONST BYTE*)(list->extensions), + (const BYTE*)list->extensions, strlen(list->extensions) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -308,10 +308,10 @@ static HRESULT register_decoders(struct regsvr_decoder const *list) KEY_READ | KEY_WRITE, NULL, &pattern_key, NULL); if (res != ERROR_SUCCESS) break; res = RegSetValueExA(pattern_key, length_valuename, 0, REG_DWORD, - (CONST BYTE*)(&list->patterns[i].length), 4); + (const BYTE*)&list->patterns[i].length, 4); if (res == ERROR_SUCCESS) res = RegSetValueExA(pattern_key, position_valuename, 0, REG_DWORD, - (CONST BYTE*)(&list->patterns[i].position), 4); + (const BYTE*)&list->patterns[i].position, 4); if (res == ERROR_SUCCESS) res = RegSetValueExA(pattern_key, pattern_valuename, 0, REG_BINARY, list->patterns[i].pattern, @@ -322,7 +322,7 @@ static HRESULT register_decoders(struct regsvr_decoder const *list) list->patterns[i].length); if (res == ERROR_SUCCESS) res = RegSetValueExA(pattern_key, endofstream_valuename, 0, REG_DWORD, - (CONST BYTE*)&(list->patterns[i].endofstream), 4); + (const BYTE*)&list->patterns[i].endofstream, 4); RegCloseKey(pattern_key); } RegCloseKey(patterns_key); @@ -433,21 +433,21 @@ static HRESULT register_encoders(struct regsvr_encoder const *list) KEY_READ | KEY_WRITE, NULL, &instance_clsid_key, NULL); if (res == ERROR_SUCCESS) { res = RegSetValueExW(instance_clsid_key, clsid_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); RegCloseKey(instance_clsid_key); } if (res != ERROR_SUCCESS) goto error_close_clsid_key; if (list->author) { res = RegSetValueExA(clsid_key, author_valuename, 0, REG_SZ, - (CONST BYTE*)(list->author), + (const BYTE*)list->author, strlen(list->author) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->friendlyname) { res = RegSetValueExA(clsid_key, friendlyname_valuename, 0, REG_SZ, - (CONST BYTE*)(list->friendlyname), + (const BYTE*)list->friendlyname, strlen(list->friendlyname) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -455,34 +455,34 @@ static HRESULT register_encoders(struct regsvr_encoder const *list) if (list->vendor) { StringFromGUID2(list->vendor, buf, 39); res = RegSetValueExW(clsid_key, vendor_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->container_format) { StringFromGUID2(list->container_format, buf, 39); res = RegSetValueExW(clsid_key, containerformat_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->version) { res = RegSetValueExA(clsid_key, version_valuename, 0, REG_SZ, - (CONST BYTE*)(list->version), + (const BYTE*)list->version, strlen(list->version) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->mimetypes) { res = RegSetValueExA(clsid_key, mimetypes_valuename, 0, REG_SZ, - (CONST BYTE*)(list->mimetypes), + (const BYTE*)list->mimetypes, strlen(list->mimetypes) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->extensions) { res = RegSetValueExA(clsid_key, extensions_valuename, 0, REG_SZ, - (CONST BYTE*)(list->extensions), + (const BYTE*)list->extensions, strlen(list->extensions) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -611,21 +611,21 @@ static HRESULT register_converters(struct regsvr_converter const *list) KEY_READ | KEY_WRITE, NULL, &instance_clsid_key, NULL); if (res == ERROR_SUCCESS) { res = RegSetValueExW(instance_clsid_key, clsid_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); RegCloseKey(instance_clsid_key); } if (res != ERROR_SUCCESS) goto error_close_clsid_key; if (list->author) { res = RegSetValueExA(clsid_key, author_valuename, 0, REG_SZ, - (CONST BYTE*)(list->author), + (const BYTE*)list->author, strlen(list->author) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->friendlyname) { res = RegSetValueExA(clsid_key, friendlyname_valuename, 0, REG_SZ, - (CONST BYTE*)(list->friendlyname), + (const BYTE*)list->friendlyname, strlen(list->friendlyname) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -633,13 +633,13 @@ static HRESULT register_converters(struct regsvr_converter const *list) if (list->vendor) { StringFromGUID2(list->vendor, buf, 39); res = RegSetValueExW(clsid_key, vendor_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->version) { res = RegSetValueExA(clsid_key, version_valuename, 0, REG_SZ, - (CONST BYTE*)(list->version), + (const BYTE*)list->version, strlen(list->version) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -768,21 +768,21 @@ static HRESULT register_metadatareaders(struct regsvr_metadatareader const *list KEY_READ | KEY_WRITE, NULL, &instance_clsid_key, NULL); if (res == ERROR_SUCCESS) { res = RegSetValueExW(instance_clsid_key, clsid_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); RegCloseKey(instance_clsid_key); } if (res != ERROR_SUCCESS) goto error_close_clsid_key; if (list->author) { res = RegSetValueExA(clsid_key, author_valuename, 0, REG_SZ, - (CONST BYTE*)(list->author), + (const BYTE*)list->author, strlen(list->author) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->friendlyname) { res = RegSetValueExA(clsid_key, friendlyname_valuename, 0, REG_SZ, - (CONST BYTE*)(list->friendlyname), + (const BYTE*)list->friendlyname, strlen(list->friendlyname) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -790,42 +790,42 @@ static HRESULT register_metadatareaders(struct regsvr_metadatareader const *list if (list->vendor) { StringFromGUID2(list->vendor, buf, 39); res = RegSetValueExW(clsid_key, vendor_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->metadata_format) { StringFromGUID2(list->metadata_format, buf, 39); res = RegSetValueExW(clsid_key, metadataformat_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->version) { res = RegSetValueExA(clsid_key, version_valuename, 0, REG_SZ, - (CONST BYTE*)(list->version), + (const BYTE*)list->version, strlen(list->version) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->specversion) { res = RegSetValueExA(clsid_key, specversion_valuename, 0, REG_SZ, - (CONST BYTE*)(list->version), + (const BYTE*)list->version, strlen(list->version) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } res = RegSetValueExA(clsid_key, requiresfullstream_valuename, 0, REG_DWORD, - (CONST BYTE*)(&list->requires_fullstream), 4); + (const BYTE*)&list->requires_fullstream, 4); if (res != ERROR_SUCCESS) goto error_close_clsid_key; res = RegSetValueExA(clsid_key, supportspadding_valuename, 0, REG_DWORD, - (CONST BYTE*)(&list->supports_padding), 4); + (const BYTE*)&list->supports_padding, 4); if (res != ERROR_SUCCESS) goto error_close_clsid_key; if (list->requires_fixedsize) { res = RegSetValueExA(clsid_key, requiresfixedsize_valuename, 0, REG_DWORD, - (CONST BYTE*)(&list->requires_fixedsize), 4); + (const BYTE*)&list->requires_fixedsize, 4); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -854,7 +854,7 @@ static HRESULT register_metadatareaders(struct regsvr_metadatareader const *list KEY_READ | KEY_WRITE, NULL, &pattern_key, NULL); if (res != ERROR_SUCCESS) break; res = RegSetValueExA(pattern_key, position_valuename, 0, REG_DWORD, - (CONST BYTE*)(&container->patterns[i].position), 4); + (const BYTE*)&container->patterns[i].position, 4); if (res == ERROR_SUCCESS) res = RegSetValueExA(pattern_key, pattern_valuename, 0, REG_BINARY, container->patterns[i].pattern, @@ -865,7 +865,7 @@ static HRESULT register_metadatareaders(struct regsvr_metadatareader const *list container->patterns[i].length); if (res == ERROR_SUCCESS && container->patterns[i].data_offset) res = RegSetValueExA(pattern_key, dataoffset_valuename, 0, REG_DWORD, - (CONST BYTE*)&(container->patterns[i].data_offset), 4); + (const BYTE*)&container->patterns[i].data_offset, 4); RegCloseKey(pattern_key); } @@ -978,21 +978,21 @@ static HRESULT register_pixelformats(struct regsvr_pixelformat const *list) KEY_READ | KEY_WRITE, NULL, &instance_clsid_key, NULL); if (res == ERROR_SUCCESS) { res = RegSetValueExW(instance_clsid_key, clsid_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); RegCloseKey(instance_clsid_key); } if (res != ERROR_SUCCESS) goto error_close_clsid_key; if (list->author) { res = RegSetValueExA(clsid_key, author_valuename, 0, REG_SZ, - (CONST BYTE*)(list->author), + (const BYTE*)list->author, strlen(list->author) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->friendlyname) { res = RegSetValueExA(clsid_key, friendlyname_valuename, 0, REG_SZ, - (CONST BYTE*)(list->friendlyname), + (const BYTE*)list->friendlyname, strlen(list->friendlyname) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -1000,31 +1000,31 @@ static HRESULT register_pixelformats(struct regsvr_pixelformat const *list) if (list->vendor) { StringFromGUID2(list->vendor, buf, 39); res = RegSetValueExW(clsid_key, vendor_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->version) { res = RegSetValueExA(clsid_key, version_valuename, 0, REG_SZ, - (CONST BYTE*)(list->version), + (const BYTE*)list->version, strlen(list->version) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } res = RegSetValueExA(clsid_key, bitsperpixel_valuename, 0, REG_DWORD, - (CONST BYTE*)(&list->bitsperpixel), 4); + (const BYTE*)&list->bitsperpixel, 4); if (res != ERROR_SUCCESS) goto error_close_clsid_key; res = RegSetValueExA(clsid_key, channelcount_valuename, 0, REG_DWORD, - (CONST BYTE*)(&list->channelcount), 4); + (const BYTE*)&list->channelcount, 4); if (res != ERROR_SUCCESS) goto error_close_clsid_key; res = RegSetValueExA(clsid_key, numericrepresentation_valuename, 0, REG_DWORD, - (CONST BYTE*)(&list->numericrepresentation), 4); + (const BYTE*)&list->numericrepresentation, 4); if (res != ERROR_SUCCESS) goto error_close_clsid_key; res = RegSetValueExA(clsid_key, supportstransparency_valuename, 0, REG_DWORD, - (CONST BYTE*)(&list->supportsalpha), 4); + (const BYTE*)&list->supportsalpha, 4); if (res != ERROR_SUCCESS) goto error_close_clsid_key; if (list->channelmasks) { diff --git a/dll/win32/windowscodecs/tgaformat.c b/dll/win32/windowscodecs/tgaformat.c index 03fd653ae4e..6b7c71fdbdd 100644 --- a/dll/win32/windowscodecs/tgaformat.c +++ b/dll/win32/windowscodecs/tgaformat.c @@ -934,17 +934,15 @@ static const IWICBitmapFrameDecodeVtbl TgaDecoder_Frame_Vtbl = { TgaDecoder_Frame_GetThumbnail }; -HRESULT TgaDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT TgaDecoder_CreateInstance(REFIID iid, void** ppv) { TgaDecoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(TgaDecoder)); if (!This) return E_OUTOFMEMORY; diff --git a/dll/win32/windowscodecs/tiffformat.c b/dll/win32/windowscodecs/tiffformat.c index 03771662fec..3f48033d5b8 100644 --- a/dll/win32/windowscodecs/tiffformat.c +++ b/dll/win32/windowscodecs/tiffformat.c @@ -1279,17 +1279,15 @@ static const IWICMetadataBlockReaderVtbl TiffFrameDecode_BlockVtbl = TiffFrameDecode_Block_GetEnumerator }; -HRESULT TiffDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT TiffDecoder_CreateInstance(REFIID iid, void** ppv) { HRESULT ret; TiffDecoder *This; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - if (!load_libtiff()) { ERR("Failed reading TIFF because unable to load %s\n",SONAME_LIBTIFF); @@ -2023,17 +2021,15 @@ static const IWICBitmapEncoderVtbl TiffEncoder_Vtbl = { TiffEncoder_GetMetadataQueryWriter }; -HRESULT TiffEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT TiffEncoder_CreateInstance(REFIID iid, void** ppv) { TiffEncoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - if (!load_libtiff()) { ERR("Failed writing TIFF because unable to load %s\n",SONAME_LIBTIFF); @@ -2062,13 +2058,13 @@ HRESULT TiffEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) #else /* !SONAME_LIBTIFF */ -HRESULT TiffDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT TiffDecoder_CreateInstance(REFIID iid, void** ppv) { ERR("Trying to load TIFF picture, but Wine was compiled without TIFF support.\n"); return E_FAIL; } -HRESULT TiffEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT TiffEncoder_CreateInstance(REFIID iid, void** ppv) { ERR("Trying to save TIFF picture, but Wine was compiled without TIFF support.\n"); return E_FAIL; diff --git a/dll/win32/windowscodecs/wincodecs_private.h b/dll/win32/windowscodecs/wincodecs_private.h index 7d4d198b191..c6a5d9fd56f 100644 --- a/dll/win32/windowscodecs/wincodecs_private.h +++ b/dll/win32/windowscodecs/wincodecs_private.h @@ -54,22 +54,61 @@ DEFINE_GUID(GUID_WineContainerFormatTga, 0x0c44fda1,0xa5c5,0x4298,0x96,0x85,0x47 DEFINE_GUID(GUID_VendorWine, 0xddf46da1,0x7dc1,0x404e,0x98,0xf2,0xef,0xa4,0x8d,0xfc,0x95,0x0a); -extern HRESULT FormatConverter_CreateInstance(IUnknown *pUnkOuter, REFIID riid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT ComponentFactory_CreateInstance(IUnknown *pUnkOuter, REFIID riid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT BmpDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID riid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT PngDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT PngEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT BmpEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT DibDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT GifDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID riid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT IcoDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT JpegDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT JpegEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT TiffDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT TiffEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT IcnsEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; +DEFINE_GUID(IID_IMILBitmapSource,0x7543696a,0xbc8d,0x46b0,0x5f,0x81,0x8d,0x95,0x72,0x89,0x72,0xbe); +#define INTERFACE IMILBitmapSource +DECLARE_INTERFACE_(IMILBitmapSource,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IMILBitmapSource methods ***/ + STDMETHOD_(HRESULT,GetSize)(THIS_ UINT *,UINT *); + STDMETHOD_(HRESULT,GetPixelFormat)(THIS_ int *); + STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *); + STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *); + STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *); + STDMETHOD_(HRESULT,UnknownMethod1)(THIS_ void **); +}; +#undef INTERFACE -extern HRESULT TgaDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; +#define INTERFACE IMILUnknown1 +DECLARE_INTERFACE_(IMILUnknown1,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; +}; +#undef INTERFACE + +#define INTERFACE IMILUnknown2 +DECLARE_INTERFACE_(IMILUnknown2,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** unknown methods ***/ + STDMETHOD_(HRESULT,UnknownMethod1)(THIS_ void *, void *) PURE; +}; +#undef INTERFACE + +extern HRESULT FormatConverter_CreateInstance(REFIID riid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT ComponentFactory_CreateInstance(REFIID riid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT BmpDecoder_CreateInstance(REFIID riid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT PngDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT PngEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT BmpEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT DibDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT GifDecoder_CreateInstance(REFIID riid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT IcoDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT JpegDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT JpegEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT TiffDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT TiffEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT IcnsEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT TgaDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; extern HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, UINT stride, UINT datasize, BYTE *bits, @@ -122,16 +161,16 @@ typedef struct _MetadataHandlerVtbl ULARGE_INTEGER *size); } MetadataHandlerVtbl; -extern HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT UnknownMetadataReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT IfdMetadataReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) DECLSPEC_HIDDEN; -extern HRESULT PngTextReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT LSDReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) DECLSPEC_HIDDEN; -extern HRESULT IMDReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) DECLSPEC_HIDDEN; -extern HRESULT GCEReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) DECLSPEC_HIDDEN; -extern HRESULT APEReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) DECLSPEC_HIDDEN; -extern HRESULT GifCommentReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) DECLSPEC_HIDDEN; +extern HRESULT UnknownMetadataReader_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT IfdMetadataReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN; +extern HRESULT PngTextReader_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT LSDReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN; +extern HRESULT IMDReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN; +extern HRESULT GCEReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN; +extern HRESULT APEReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN; +extern HRESULT GifCommentReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN; extern HRESULT stream_initialize_from_filehandle(IWICStream *iface, HANDLE hfile) DECLSPEC_HIDDEN; diff --git a/dll/win32/windowscodecs/windowscodecs.spec b/dll/win32/windowscodecs/windowscodecs.spec index 5250bea23d3..289525c32a8 100644 --- a/dll/win32/windowscodecs/windowscodecs.spec +++ b/dll/win32/windowscodecs/windowscodecs.spec @@ -4,7 +4,7 @@ @ stdcall -private DllUnregisterServer() @ stub IEnumString_Next_WIC_Proxy @ stub IEnumString_Reset_WIC_Proxy -@ stub IPropertyBag2_Write_Proxy +@ stdcall IPropertyBag2_Write_Proxy(ptr long ptr ptr) @ stdcall IWICBitmapClipper_Initialize_Proxy(ptr ptr ptr) IWICBitmapClipper_Initialize_Proxy_W @ stdcall IWICBitmapCodecInfo_DoesSupportAnimation_Proxy(ptr ptr) IWICBitmapCodecInfo_DoesSupportAnimation_Proxy_W @ stdcall IWICBitmapCodecInfo_DoesSupportLossless_Proxy(ptr ptr) IWICBitmapCodecInfo_DoesSupportLossless_Proxy_W @@ -114,4 +114,4 @@ @ stub WICMapShortNameToGuid @ stub WICMatchMetadataContent @ stub WICSerializeMetadataContent -@ stub WICSetEncoderFormat_Proxy +@ stdcall WICSetEncoderFormat_Proxy(ptr ptr ptr ptr) diff --git a/dll/win32/windowscodecs/windowscodecs_wincodec.idl b/dll/win32/windowscodecs/windowscodecs_wincodec.idl index 658ced08e72..489d74bc5c7 100644 --- a/dll/win32/windowscodecs/windowscodecs_wincodec.idl +++ b/dll/win32/windowscodecs/windowscodecs_wincodec.idl @@ -16,6 +16,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep proxy +#pragma makedep register + #include "wincodec.idl" [ diff --git a/dll/win32/wintrust/crypt.c b/dll/win32/wintrust/crypt.c index 8236515b013..b59bfddedce 100644 --- a/dll/win32/wintrust/crypt.c +++ b/dll/win32/wintrust/crypt.c @@ -104,7 +104,7 @@ BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN *catAdmin, TRACE("%p %s %x\n", catAdmin, debugstr_guid(sys), dwFlags); - if (!catAdmin) + if (!catAdmin || dwFlags) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; @@ -900,6 +900,7 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h if (!CryptMsgGetParam(hmsg, CMSG_ATTR_CERT_PARAM, i, NULL, &size)) { CryptMsgClose(hmsg); + HeapFree(GetProcessHeap(), 0, cc); return INVALID_HANDLE_VALUE; } sum += size; @@ -907,6 +908,7 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h if (!(cc->attr = HeapAlloc(GetProcessHeap(), 0, sizeof(*cc->attr) * cc->attr_count + sum))) { CryptMsgClose(hmsg); + HeapFree(GetProcessHeap(), 0, cc); SetLastError(ERROR_OUTOFMEMORY); return INVALID_HANDLE_VALUE; } @@ -917,12 +919,14 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h { CryptMsgClose(hmsg); HeapFree(GetProcessHeap(), 0, cc->attr); + HeapFree(GetProcessHeap(), 0, cc); return INVALID_HANDLE_VALUE; } if (!CryptMsgGetParam(hmsg, CMSG_ATTR_CERT_PARAM, i, p, &size)) { CryptMsgClose(hmsg); HeapFree(GetProcessHeap(), 0, cc->attr); + HeapFree(GetProcessHeap(), 0, cc); return INVALID_HANDLE_VALUE; } p += size; @@ -939,6 +943,7 @@ HANDLE WINAPI CryptCATOpen(LPWSTR pwszFileName, DWORD fdwOpenFlags, HCRYPTPROV h cc->magic = CRYPTCAT_MAGIC; return cc; } + HeapFree(GetProcessHeap(), 0, cc); return INVALID_HANDLE_VALUE; } diff --git a/dll/win32/wintrust/register.c b/dll/win32/wintrust/register.c index 22e0f0fcb1f..d914b8e0815 100644 --- a/dll/win32/wintrust/register.c +++ b/dll/win32/wintrust/register.c @@ -215,7 +215,7 @@ error_close_key: * * NOTES * Adding definitions is basically only adding relevant information - * to the registry. No verification takes place whether a DLL or it's + * to the registry. No verification takes place whether a DLL or its * entrypoints exist. * Information in the registry will always be overwritten. * @@ -948,10 +948,10 @@ HRESULT WINAPI DllRegisterServer(void) TRACE("\n"); /* Testing on native shows that when an error is encountered in one of the CryptRegisterOIDFunction calls - * the rest of these calls is skipped. Registering is however continued for the trust providers. + * the rest of these calls are skipped. Registering is however continued for the trust providers. * - * We are not totally in line with native as there all decoding functions are registered after all encoding - * functions. + * We are not totally in line with native as all decoding functions are registered after all encoding + * functions there. */ #define WINTRUST_REGISTEROID( oid, encode_funcname, decode_funcname ) \ do { \ diff --git a/dll/win32/wldap32/init.c b/dll/win32/wldap32/init.c index 6a863604ea0..c17d27aa76c 100644 --- a/dll/win32/wldap32/init.c +++ b/dll/win32/wldap32/init.c @@ -98,13 +98,12 @@ oom: } /* Determine if a URL starts with a known LDAP scheme */ -static int has_ldap_scheme( char *url ) +static BOOL has_ldap_scheme( char *url ) { - if (!strncasecmp( url, "ldap://", 7 ) || - !strncasecmp( url, "ldaps://", 8 ) || - !strncasecmp( url, "ldapi://", 8 ) || - !strncasecmp( url, "cldap://", 8 )) return 1; - return 0; + return !strncasecmp( url, "ldap://", 7 ) || + !strncasecmp( url, "ldaps://", 8 ) || + !strncasecmp( url, "ldapi://", 8 ) || + !strncasecmp( url, "cldap://", 8 ); } /* Flatten an array of hostnames into a space separated string of URLs. diff --git a/dll/win32/wmi/wmi.spec b/dll/win32/wmi/wmi.spec index b795d26cbc3..4291d4d910e 100644 --- a/dll/win32/wmi/wmi.spec +++ b/dll/win32/wmi/wmi.spec @@ -1,13 +1,13 @@ -@ stdcall CloseTrace(long) advapi32.CloseTrace -@ stdcall ControlTraceA(long long ptr long) advapi32.ControlTraceA -@ stdcall ControlTraceW(long long ptr long) advapi32.ControlTraceW +@ stdcall CloseTrace(int64) advapi32.CloseTrace +@ stdcall ControlTraceA(int64 str ptr long) advapi32.ControlTraceA +@ stdcall ControlTraceW(int64 wstr ptr long) advapi32.ControlTraceW @ stdcall CreateTraceInstanceId(long ptr) advapi32.CreateTraceInstanceId -@ stdcall EnableTrace(long long long ptr long) advapi32.EnableTrace -@ stdcall GetTraceEnableFlags(long) advapi32.GetTraceEnableFlags -@ stdcall GetTraceEnableLevel(long) advapi32.GetTraceEnableLevel -@ stdcall GetTraceLoggerHandle(ptr) advapi32.GetTraceLoggerHandle -@ stdcall OpenTraceA(ptr) advapi32.OpenTraceA -@ stdcall OpenTraceW(ptr) advapi32.OpenTraceW +@ stdcall EnableTrace(long long long ptr int64) advapi32.EnableTrace +@ stdcall GetTraceEnableFlags(int64) advapi32.GetTraceEnableFlags +@ stdcall GetTraceEnableLevel(int64) advapi32.GetTraceEnableLevel +@ stdcall -ret64 GetTraceLoggerHandle(ptr) advapi32.GetTraceLoggerHandle +@ stdcall -ret64 OpenTraceA(ptr) advapi32.OpenTraceA +@ stdcall -ret64 OpenTraceW(ptr) advapi32.OpenTraceW @ stdcall ProcessTrace(ptr long ptr ptr) advapi32.ProcessTrace @ stdcall QueryAllTracesA(ptr long ptr) advapi32.QueryAllTracesA @ stdcall QueryAllTracesW(ptr long ptr) advapi32.QueryAllTracesW @@ -17,9 +17,9 @@ @ stdcall SetTraceCallback(ptr ptr) advapi32.SetTraceCallback @ stdcall StartTraceA(ptr str ptr) advapi32.StartTraceA @ stdcall StartTraceW(ptr wstr ptr) advapi32.StartTraceW -@ stdcall TraceEvent(long ptr) advapi32.TraceEvent -@ stdcall TraceEventInstance(long ptr ptr ptr) advapi32.TraceEventInstance -@ stdcall UnregisterTraceGuids(long) advapi32.UnregisterTraceGuids +@ stdcall TraceEvent(int64 ptr) advapi32.TraceEvent +@ stdcall TraceEventInstance(int64 ptr ptr ptr) advapi32.TraceEventInstance +@ stdcall UnregisterTraceGuids(int64) advapi32.UnregisterTraceGuids @ stdcall WmiCloseBlock() advapi32.WmiCloseBlock @ stdcall WmiDevInstToInstanceNameA() advapi32.WmiDevInstToInstanceNameA @ stdcall WmiDevInstToInstanceNameW() advapi32.WmiDevInstToInstanceNameW diff --git a/dll/win32/xmllite/guid.c b/dll/win32/xmllite/guid.c index 6203cdea7c3..4b4de25b8e8 100644 --- a/dll/win32/xmllite/guid.c +++ b/dll/win32/xmllite/guid.c @@ -14,5 +14,7 @@ /* reader.c */ DEFINE_GUID(IID_IXmlReaderInput, 0x0b3ccc9b, 0x9214, 0x428b, 0xa2, 0xae, 0xef, 0x3a, 0xa8, 0x71, 0xaf, 0xda); +/* writer.c */ +DEFINE_GUID(IID_IXmlWriterOutput, 0xc1131708, 0x0f59, 0x477f, 0x93, 0x59, 0x7d, 0x33, 0x24, 0x51, 0xbc, 0x1a); /* NO CODE HERE, THIS IS JUST REQUIRED FOR THE GUID DEFINITIONS */ diff --git a/dll/win32/xmllite/reader.c b/dll/win32/xmllite/reader.c index a9a46ad246b..ba963e9b31f 100644 --- a/dll/win32/xmllite/reader.c +++ b/dll/win32/xmllite/reader.c @@ -28,13 +28,6 @@ /* not defined in public headers */ DEFINE_GUID(IID_IXmlReaderInput, 0x0b3ccc9b, 0x9214, 0x428b, 0xa2, 0xae, 0xef, 0x3a, 0xa8, 0x71, 0xaf, 0xda); -typedef enum -{ - XmlEncoding_UTF16, - XmlEncoding_UTF8, - XmlEncoding_Unknown -} xml_encoding; - typedef enum { XmlReadInState_Initial, @@ -58,7 +51,8 @@ typedef enum XmlReadResumeState_CDATA, XmlReadResumeState_Comment, XmlReadResumeState_STag, - XmlReadResumeState_CharData + XmlReadResumeState_CharData, + XmlReadResumeState_Whitespace } XmlReaderResumeState; /* saved pointer index to resume from particular input position */ @@ -91,7 +85,7 @@ static const WCHAR piW[] = {'<','?',0}; static const char *debugstr_nodetype(XmlNodeType nodetype) { - static const char* type_names[] = + static const char * const type_names[] = { "None", "Element", @@ -114,17 +108,14 @@ static const char *debugstr_nodetype(XmlNodeType nodetype) }; if (nodetype > _XmlNodeType_Last) - { - static char buf[25]; - sprintf(buf, "unknown type=%d", nodetype); - return buf; - } + return wine_dbg_sprintf("unknown type=%d", nodetype); + return type_names[nodetype]; } static const char *debugstr_prop(XmlReaderProperty prop) { - static const char* prop_names[] = + static const char * const prop_names[] = { "MultiLanguage", "ConformanceLevel", @@ -137,11 +128,8 @@ static const char *debugstr_prop(XmlReaderProperty prop) }; if (prop > _XmlReaderProperty_Last) - { - static char buf[25]; - sprintf(buf, "unknown property=%d", prop); - return buf; - } + return wine_dbg_sprintf("unknown property=%d", prop); + return prop_names[prop]; } @@ -160,7 +148,7 @@ static const struct xml_encoding_data xml_encoding_map[] = { typedef struct { char *data; - char *cur; + UINT cur; unsigned int allocated; unsigned int written; } encoded_buffer; @@ -199,11 +187,11 @@ typedef struct { WCHAR *str; /* allocated null-terminated string */ UINT len; /* length in WCHARs, altered after ReadValueChunk */ - WCHAR *start; /* input position where value starts */ + UINT start; /* input position where value starts */ } strval; static WCHAR emptyW[] = {0}; -static const strval strval_empty = {emptyW, 0, emptyW}; +static const strval strval_empty = { emptyW }; struct attribute { @@ -239,7 +227,7 @@ typedef struct UINT depth; UINT max_depth; BOOL empty_element; - WCHAR *resume[XmlReadResume_Last]; /* pointers used to resume reader */ + UINT resume[XmlReadResume_Last]; /* offsets used to resume reader */ } xmlreader; struct input_buffer @@ -260,14 +248,6 @@ static inline xmlreaderinput *impl_from_IXmlReaderInput(IXmlReaderInput *iface) return CONTAINING_RECORD(iface, xmlreaderinput, IXmlReaderInput_iface); } -static inline void *m_alloc(IMalloc *imalloc, size_t len) -{ - if (imalloc) - return IMalloc_Alloc(imalloc, len); - else - return heap_alloc(len); -} - static inline void *m_realloc(IMalloc *imalloc, void *mem, size_t len) { if (imalloc) @@ -276,14 +256,6 @@ static inline void *m_realloc(IMalloc *imalloc, void *mem, size_t len) return heap_realloc(mem, len); } -static inline void m_free(IMalloc *imalloc, void *mem) -{ - if (imalloc) - IMalloc_Free(imalloc, mem); - else - heap_free(mem); -} - /* reader memory allocation functions */ static inline void *reader_alloc(xmlreader *reader, size_t len) { @@ -295,6 +267,18 @@ static inline void reader_free(xmlreader *reader, void *mem) m_free(reader->imalloc, mem); } +/* Just return pointer from offset, no attempt to read more. */ +static inline WCHAR *reader_get_ptr2(const xmlreader *reader, UINT offset) +{ + encoded_buffer *buffer = &reader->input->buffer->utf16; + return (WCHAR*)buffer->data + offset; +} + +static inline WCHAR *reader_get_strptr(const xmlreader *reader, const strval *v) +{ + return v->str ? v->str : reader_get_ptr2(reader, v->start); +} + static HRESULT reader_strvaldup(xmlreader *reader, const strval *src, strval *dest) { *dest = *src; @@ -303,8 +287,9 @@ static HRESULT reader_strvaldup(xmlreader *reader, const strval *src, strval *de { dest->str = reader_alloc(reader, (dest->len+1)*sizeof(WCHAR)); if (!dest->str) return E_OUTOFMEMORY; - memcpy(dest->str, src->str, dest->len*sizeof(WCHAR)); + memcpy(dest->str, reader_get_strptr(reader, src), dest->len*sizeof(WCHAR)); dest->str[dest->len] = 0; + dest->start = 0; } return S_OK; @@ -350,6 +335,7 @@ static void reader_clear_attrs(xmlreader *reader) } list_init(&reader->attrs); reader->attr_count = 0; + reader->attr = NULL; } /* attribute data holds pointers to buffer data, so buffer shrink is not possible @@ -379,10 +365,30 @@ static void reader_free_strvalued(xmlreader *reader, strval *v) } } -static inline void reader_init_strvalue(WCHAR *str, UINT len, strval *v) +/* returns length in WCHARs from 'start' to current buffer offset */ +static inline UINT reader_get_len(const xmlreader *reader, UINT start) { - v->start = v->str = str; + return reader->input->buffer->utf16.cur - start; +} + +static inline void reader_init_strvalue(UINT start, UINT len, strval *v) +{ + v->start = start; v->len = len; + v->str = NULL; +} + +static inline const char* debug_strval(const xmlreader *reader, const strval *v) +{ + return debugstr_wn(reader_get_strptr(reader, v), v->len); +} + +/* used to initialize from constant string */ +static inline void reader_init_cstrvalue(WCHAR *str, UINT len, strval *v) +{ + v->start = 0; + v->len = len; + v->str = str; } static void reader_free_strvalue(xmlreader *reader, XmlReaderStringValue type) @@ -399,10 +405,10 @@ static void reader_free_strvalues(xmlreader *reader) /* This helper should only be used to test if strings are the same, it doesn't try to sort. */ -static inline int strval_eq(const strval *str1, const strval *str2) +static inline int strval_eq(const xmlreader *reader, const strval *str1, const strval *str2) { if (str1->len != str2->len) return 0; - return !memcmp(str1->str, str2->str, str1->len*sizeof(WCHAR)); + return !memcmp(reader_get_strptr(reader, str1), reader_get_strptr(reader, str2), str1->len*sizeof(WCHAR)); } static void reader_clear_elements(xmlreader *reader) @@ -488,7 +494,7 @@ static void reader_set_strvalue(xmlreader *reader, XmlReaderStringValue type, co if (!value) { v->str = NULL; - v->start = NULL; + v->start = 0; v->len = 0; return; } @@ -507,7 +513,7 @@ static void reader_set_strvalue(xmlreader *reader, XmlReaderStringValue type, co else { v->str = reader_alloc(reader, (value->len + 1)*sizeof(WCHAR)); - memcpy(v->str, value->start, value->len*sizeof(WCHAR)); + memcpy(v->str, reader_get_strptr(reader, value), value->len*sizeof(WCHAR)); v->str[value->len] = 0; v->len = value->len; } @@ -526,7 +532,7 @@ static HRESULT init_encoded_buffer(xmlreaderinput *input, encoded_buffer *buffer if (!buffer->data) return E_OUTOFMEMORY; memset(buffer->data, 0, 4); - buffer->cur = buffer->data; + buffer->cur = 0; buffer->allocated = initial_len; buffer->written = 0; @@ -551,7 +557,7 @@ static HRESULT get_code_page(xml_encoding encoding, UINT *cp) return S_OK; } -static xml_encoding parse_encoding_name(const WCHAR *name, int len) +xml_encoding parse_encoding_name(const WCHAR *name, int len) { int min, max, n, c; @@ -660,7 +666,7 @@ static HRESULT readerinput_growraw(xmlreaderinput *readerinput) read = 0; hr = ISequentialStream_Read(readerinput->stream, buffer->data + buffer->written, len, &read); - TRACE("requested %d, read %d, ret 0x%08x\n", len, read, hr); + TRACE("written=%d, alloc=%d, requested=%d, read=%d, ret=0x%08x\n", buffer->written, buffer->allocated, len, read, hr); readerinput->pending = hr == E_PENDING; if (FAILED(hr)) return hr; buffer->written += read; @@ -668,11 +674,12 @@ static HRESULT readerinput_growraw(xmlreaderinput *readerinput) return hr; } -/* grows UTF-16 buffer so it has at least 'length' bytes free on return */ +/* grows UTF-16 buffer so it has at least 'length' WCHAR chars free on return */ static void readerinput_grow(xmlreaderinput *readerinput, int length) { encoded_buffer *buffer = &readerinput->buffer->utf16; + length *= sizeof(WCHAR); /* grow if needed, plus 4 bytes to be sure null terminator will fit in */ if (buffer->allocated < buffer->written + length + 4) { @@ -682,10 +689,10 @@ static void readerinput_grow(xmlreaderinput *readerinput, int length) } } -static inline int readerinput_is_utf8(xmlreaderinput *readerinput) +static inline BOOL readerinput_is_utf8(xmlreaderinput *readerinput) { - static char startA[] = {'<','?'}; - static char commentA[] = {'<','!'}; + static const char startA[] = {'<','?'}; + static const char commentA[] = {'<','!'}; encoded_buffer *buffer = &readerinput->buffer->encoded; unsigned char *ptr = (unsigned char*)buffer->data; @@ -704,10 +711,10 @@ static inline int readerinput_is_utf8(xmlreaderinput *readerinput) static HRESULT readerinput_detectencoding(xmlreaderinput *readerinput, xml_encoding *enc) { encoded_buffer *buffer = &readerinput->buffer->encoded; - static WCHAR startW[] = {'<','?'}; - static WCHAR commentW[] = {'<','!'}; - static char utf8bom[] = {0xef,0xbb,0xbf}; - static char utf16lebom[] = {0xff,0xfe}; + static const WCHAR startW[] = {'<','?'}; + static const WCHAR commentW[] = {'<','!'}; + static const char utf8bom[] = {0xef,0xbb,0xbf}; + static const char utf16lebom[] = {0xff,0xfe}; *enc = XmlEncoding_Unknown; @@ -768,8 +775,8 @@ static int readerinput_get_convlen(xmlreaderinput *readerinput) else len = buffer->written; - TRACE("%d\n", len - (int)(buffer->cur - buffer->data)); - return len - (buffer->cur - buffer->data); + TRACE("%d\n", len - buffer->cur); + return len - buffer->cur; } /* It's possible that raw buffer has some leftovers from last conversion - some char @@ -782,12 +789,12 @@ static void readerinput_shrinkraw(xmlreaderinput *readerinput, int len) if (len == -1) len = readerinput_get_convlen(readerinput); - memmove(buffer->data, buffer->cur + (buffer->written - len), len); + memmove(buffer->data, buffer->data + buffer->cur + (buffer->written - len), len); /* everything below cur is lost too */ - buffer->written -= len + (buffer->cur - buffer->data); - /* after this point we don't need cur pointer really, + buffer->written -= len + buffer->cur; + /* after this point we don't need cur offset really, it's used only to mark where actual data begins when first chunk is read */ - buffer->cur = buffer->data; + buffer->cur = 0; } /* note that raw buffer content is kept */ @@ -812,15 +819,15 @@ static void readerinput_switchencoding(xmlreaderinput *readerinput, xml_encoding if (enc == XmlEncoding_UTF16) { readerinput_grow(readerinput, len); - memcpy(dest->data, src->cur, len); + memcpy(dest->data, src->data + src->cur, len); dest->written += len*sizeof(WCHAR); return; } - dest_len = MultiByteToWideChar(cp, 0, src->cur, len, NULL, 0); + dest_len = MultiByteToWideChar(cp, 0, src->data + src->cur, len, NULL, 0); readerinput_grow(readerinput, dest_len); ptr = (WCHAR*)dest->data; - MultiByteToWideChar(cp, 0, src->cur, len, ptr, dest_len); + MultiByteToWideChar(cp, 0, src->data + src->cur, len, ptr, dest_len); ptr[dest_len] = 0; dest->written += dest_len*sizeof(WCHAR); } @@ -831,12 +838,12 @@ static void reader_shrink(xmlreader *reader) encoded_buffer *buffer = &reader->input->buffer->utf16; /* avoid to move too often using threshold shrink length */ - if (buffer->cur - buffer->data > buffer->written / 2) + if (buffer->cur*sizeof(WCHAR) > buffer->written / 2) { - buffer->written -= buffer->cur - buffer->data; - memmove(buffer->data, buffer->cur, buffer->written); - buffer->cur = buffer->data; - *(WCHAR*)&buffer->cur[buffer->written] = 0; + buffer->written -= buffer->cur*sizeof(WCHAR); + memmove(buffer->data, (WCHAR*)buffer->data + buffer->cur, buffer->written); + buffer->cur = 0; + *(WCHAR*)&buffer->data[buffer->written] = 0; } } @@ -860,15 +867,15 @@ static HRESULT reader_more(xmlreader *reader) if (cp == ~0) { readerinput_grow(readerinput, len); - memcpy(dest->data, src->cur, len); + memcpy(dest->data + dest->written, src->data + src->cur, len); dest->written += len*sizeof(WCHAR); return hr; } - dest_len = MultiByteToWideChar(cp, 0, src->cur, len, NULL, 0); + dest_len = MultiByteToWideChar(cp, 0, src->data + src->cur, len, NULL, 0); readerinput_grow(readerinput, dest_len); - ptr = (WCHAR*)dest->data; - MultiByteToWideChar(cp, 0, src->cur, len, ptr, dest_len); + ptr = (WCHAR*)(dest->data + dest->written); + MultiByteToWideChar(cp, 0, src->data + src->cur, len, ptr, dest_len); ptr[dest_len] = 0; dest->written += dest_len*sizeof(WCHAR); /* get rid of processed data */ @@ -877,16 +884,22 @@ static HRESULT reader_more(xmlreader *reader) return hr; } -static inline WCHAR *reader_get_cur(xmlreader *reader) +static inline UINT reader_get_cur(xmlreader *reader) { - WCHAR *ptr = (WCHAR*)reader->input->buffer->utf16.cur; + return reader->input->buffer->utf16.cur; +} + +static inline WCHAR *reader_get_ptr(xmlreader *reader) +{ + encoded_buffer *buffer = &reader->input->buffer->utf16; + WCHAR *ptr = (WCHAR*)buffer->data + buffer->cur; if (!*ptr) reader_more(reader); - return ptr; + return (WCHAR*)buffer->data + buffer->cur; } static int reader_cmp(xmlreader *reader, const WCHAR *str) { - const WCHAR *ptr = reader_get_cur(reader); + const WCHAR *ptr = reader_get_ptr(reader); return strncmpW(str, ptr, strlenW(str)); } @@ -894,16 +907,16 @@ static int reader_cmp(xmlreader *reader, const WCHAR *str) static void reader_skipn(xmlreader *reader, int n) { encoded_buffer *buffer = &reader->input->buffer->utf16; - const WCHAR *ptr = reader_get_cur(reader); + const WCHAR *ptr = reader_get_ptr(reader); while (*ptr++ && n--) { - buffer->cur += sizeof(WCHAR); + buffer->cur++; reader->pos++; } } -static inline int is_wchar_space(WCHAR ch) +static inline BOOL is_wchar_space(WCHAR ch) { return ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n'; } @@ -912,11 +925,11 @@ static inline int is_wchar_space(WCHAR ch) static int reader_skipspaces(xmlreader *reader) { encoded_buffer *buffer = &reader->input->buffer->utf16; - const WCHAR *ptr = reader_get_cur(reader), *start = ptr; + const WCHAR *ptr = reader_get_ptr(reader); + UINT start = reader_get_cur(reader); while (is_wchar_space(*ptr)) { - buffer->cur += sizeof(WCHAR); if (*ptr == '\r') reader->pos = 0; else if (*ptr == '\n') @@ -926,30 +939,37 @@ static int reader_skipspaces(xmlreader *reader) } else reader->pos++; - ptr++; + + buffer->cur++; + ptr = reader_get_ptr(reader); } - return ptr - start; + return reader_get_cur(reader) - start; } /* [26] VersionNum ::= '1.' [0-9]+ */ static HRESULT reader_parse_versionnum(xmlreader *reader, strval *val) { - WCHAR *ptr, *ptr2, *start = reader_get_cur(reader); static const WCHAR onedotW[] = {'1','.',0}; + WCHAR *ptr, *ptr2; + UINT start; if (reader_cmp(reader, onedotW)) return WC_E_XMLDECL; + + start = reader_get_cur(reader); /* skip "1." */ reader_skipn(reader, 2); - ptr2 = ptr = reader_get_cur(reader); + ptr2 = ptr = reader_get_ptr(reader); while (*ptr >= '0' && *ptr <= '9') - ptr++; + { + reader_skipn(reader, 1); + ptr = reader_get_ptr(reader); + } if (ptr2 == ptr) return WC_E_DIGIT; - TRACE("version=%s\n", debugstr_wn(start, ptr-start)); - reader_init_strvalue(start, ptr-start, val); - reader_skipn(reader, ptr-ptr2); + reader_init_strvalue(start, reader_get_cur(reader)-start, val); + TRACE("version=%s\n", debug_strval(reader, val)); return S_OK; } @@ -1000,7 +1020,7 @@ static HRESULT reader_parse_versioninfo(xmlreader *reader) } /* ([A-Za-z0-9._] | '-') */ -static inline int is_wchar_encname(WCHAR ch) +static inline BOOL is_wchar_encname(WCHAR ch) { return ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || @@ -1012,13 +1032,15 @@ static inline int is_wchar_encname(WCHAR ch) /* [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')* */ static HRESULT reader_parse_encname(xmlreader *reader, strval *val) { - WCHAR *start = reader_get_cur(reader), *ptr; + WCHAR *start = reader_get_ptr(reader), *ptr; xml_encoding enc; int len; if ((*start < 'A' || *start > 'Z') && (*start < 'a' || *start > 'z')) return WC_E_ENCNAME; + val->start = reader_get_cur(reader); + ptr = start; while (is_wchar_encname(*++ptr)) ; @@ -1044,10 +1066,11 @@ static HRESULT reader_parse_encdecl(xmlreader *reader) strval name, val; HRESULT hr; - if (!reader_skipspaces(reader)) return WC_E_WHITESPACE; + if (!reader_skipspaces(reader)) return S_FALSE; if (reader_cmp(reader, encodingW)) return S_FALSE; - name.str = reader_get_cur(reader); + name.str = reader_get_ptr(reader); + name.start = reader_get_cur(reader); name.len = 8; /* skip 'encoding' */ reader_skipn(reader, 8); @@ -1078,11 +1101,11 @@ static HRESULT reader_parse_sddecl(xmlreader *reader) static const WCHAR standaloneW[] = {'s','t','a','n','d','a','l','o','n','e',0}; static const WCHAR yesW[] = {'y','e','s',0}; static const WCHAR noW[] = {'n','o',0}; - WCHAR *start, *ptr; strval name, val; + UINT start; HRESULT hr; - if (!reader_skipspaces(reader)) return WC_E_WHITESPACE; + if (!reader_skipspaces(reader)) return S_FALSE; if (reader_cmp(reader, standaloneW)) return S_FALSE; reader_init_strvalue(reader_get_cur(reader), 10, &name); @@ -1103,10 +1126,8 @@ static HRESULT reader_parse_sddecl(xmlreader *reader) start = reader_get_cur(reader); /* skip 'yes'|'no' */ reader_skipn(reader, reader_cmp(reader, yesW) ? 2 : 3); - ptr = reader_get_cur(reader); - TRACE("standalone=%s\n", debugstr_wn(start, ptr-start)); - val.str = val.start = start; - val.len = ptr-start; + reader_init_strvalue(start, reader_get_cur(reader)-start, &val); + TRACE("standalone=%s\n", debug_strval(reader, &val)); if (reader_cmp(reader, quoteW) && reader_cmp(reader, dblquoteW)) return WC_E_QUOTE; @@ -1155,19 +1176,21 @@ static HRESULT reader_parse_xmldecl(xmlreader *reader) /* [15] Comment ::= '' */ static HRESULT reader_parse_comment(xmlreader *reader) { - WCHAR *start, *ptr; + WCHAR *ptr; + UINT start; - if (reader->resume[XmlReadResume_Body]) + if (reader->resumestate == XmlReadResumeState_Comment) { start = reader->resume[XmlReadResume_Body]; - ptr = reader_get_cur(reader); + ptr = reader_get_ptr(reader); } else { /* skip '' */ + reader_init_strvalue(start, reader_get_cur(reader)-start, &value); + TRACE("%s\n", debug_strval(reader, &value)); + + /* skip rest of markup '->' */ reader_skipn(reader, 3); - reader_init_strvalue(start, ptr-start, &value); + reader_set_strvalue(reader, StringValue_LocalName, &strval_empty); reader_set_strvalue(reader, StringValue_QualifiedName, &strval_empty); reader_set_strvalue(reader, StringValue_Value, &value); - reader->resume[XmlReadResume_Body] = NULL; + reader->resume[XmlReadResume_Body] = 0; reader->resumestate = XmlReadResumeState_Initial; return S_OK; } else return WC_E_COMMENT; } - else - ptr++; - } - else - { - reader_skipn(reader, 1); - ptr++; } + + reader_skipn(reader, 1); + ptr++; } return S_OK; } /* [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] */ -static inline int is_char(WCHAR ch) +static inline BOOL is_char(WCHAR ch) { return (ch == '\t') || (ch == '\r') || (ch == '\n') || (ch >= 0x20 && ch <= 0xd7ff) || @@ -1226,7 +1247,7 @@ static inline int is_char(WCHAR ch) } /* [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] */ -static inline int is_pubchar(WCHAR ch) +static inline BOOL is_pubchar(WCHAR ch) { return (ch == ' ') || (ch >= 'a' && ch <= 'z') || @@ -1239,7 +1260,7 @@ static inline int is_pubchar(WCHAR ch) (ch == '_') || (ch == '\r') || (ch == '\n'); } -static inline int is_namestartchar(WCHAR ch) +static inline BOOL is_namestartchar(WCHAR ch) { return (ch == ':') || (ch >= 'A' && ch <= 'Z') || (ch == '_') || (ch >= 'a' && ch <= 'z') || @@ -1259,7 +1280,7 @@ static inline int is_namestartchar(WCHAR ch) } /* [4 NS] NCName ::= Name - (Char* ':' Char*) */ -static inline int is_ncnamechar(WCHAR ch) +static inline BOOL is_ncnamechar(WCHAR ch) { return (ch >= 'A' && ch <= 'Z') || (ch == '_') || (ch >= 'a' && ch <= 'z') || @@ -1283,7 +1304,7 @@ static inline int is_ncnamechar(WCHAR ch) (ch >= 0xfdf0 && ch <= 0xfffd); } -static inline int is_namechar(WCHAR ch) +static inline BOOL is_namechar(WCHAR ch) { return (ch == ':') || is_ncnamechar(ch); } @@ -1303,23 +1324,25 @@ static XmlNodeType reader_get_nodetype(const xmlreader *reader) [5] Name ::= NameStartChar (NameChar)* */ static HRESULT reader_parse_name(xmlreader *reader, strval *name) { - WCHAR *ptr, *start; + WCHAR *ptr; + UINT start; if (reader->resume[XmlReadResume_Name]) { start = reader->resume[XmlReadResume_Name]; - ptr = reader_get_cur(reader); + ptr = reader_get_ptr(reader); } else { - ptr = start = reader_get_cur(reader); + ptr = reader_get_ptr(reader); + start = reader_get_cur(reader); if (!is_namestartchar(*ptr)) return WC_E_NAMECHARACTER; } while (is_namechar(*ptr)) { reader_skipn(reader, 1); - ptr = reader_get_cur(reader); + ptr = reader_get_ptr(reader); } if (is_reader_pending(reader)) @@ -1328,10 +1351,10 @@ static HRESULT reader_parse_name(xmlreader *reader, strval *name) return E_PENDING; } else - reader->resume[XmlReadResume_Name] = NULL; + reader->resume[XmlReadResume_Name] = 0; - TRACE("name %s:%d\n", debugstr_wn(start, ptr-start), (int)(ptr-start)); - reader_init_strvalue(start, ptr-start, name); + reader_init_strvalue(start, reader_get_cur(reader)-start, name); + TRACE("name %s:%d\n", debug_strval(reader, name), name->len); return S_OK; } @@ -1340,7 +1363,9 @@ static HRESULT reader_parse_name(xmlreader *reader, strval *name) static HRESULT reader_parse_pitarget(xmlreader *reader, strval *target) { static const WCHAR xmlW[] = {'x','m','l'}; + static const strval xmlval = { (WCHAR*)xmlW, 3 }; strval name; + WCHAR *ptr; HRESULT hr; UINT i; @@ -1348,15 +1373,16 @@ static HRESULT reader_parse_pitarget(xmlreader *reader, strval *target) if (FAILED(hr)) return is_reader_pending(reader) ? E_PENDING : WC_E_PI; /* now that we got name check for illegal content */ - if (name.len == 3 && !strncmpiW(name.str, xmlW, 3)) + if (strval_eq(reader, &name, &xmlval)) return WC_E_LEADINGXML; /* PITarget can't be a qualified name */ + ptr = reader_get_strptr(reader, &name); for (i = 0; i < name.len; i++) - if (name.str[i] == ':') + if (ptr[i] == ':') return i ? NC_E_NAMECOLON : WC_E_PI; - TRACE("pitarget %s:%d\n", debugstr_wn(name.str, name.len), name.len); + TRACE("pitarget %s:%d\n", debug_strval(reader, &name), name.len); *target = name; return S_OK; } @@ -1364,8 +1390,9 @@ static HRESULT reader_parse_pitarget(xmlreader *reader, strval *target) /* [16] PI ::= '' Char*)))? '?>' */ static HRESULT reader_parse_pi(xmlreader *reader) { - WCHAR *ptr, *start; strval target; + WCHAR *ptr; + UINT start; HRESULT hr; switch (reader->resumestate) @@ -1382,64 +1409,45 @@ static HRESULT reader_parse_pi(xmlreader *reader) reader_set_strvalue(reader, StringValue_QualifiedName, &target); reader_set_strvalue(reader, StringValue_Value, &strval_empty); reader->resumestate = XmlReadResumeState_PIBody; + reader->resume[XmlReadResume_Body] = reader_get_cur(reader); default: ; } - ptr = reader_get_cur(reader); - /* exit earlier if there's no content */ - if (ptr[0] == '?' && ptr[1] == '>') - { - /* skip '?>' */ - reader_skipn(reader, 2); - reader->nodetype = XmlNodeType_ProcessingInstruction; - reader->resumestate = XmlReadResumeState_Initial; - return S_OK; - } - - if (!reader->resume[XmlReadResume_Body]) - { - /* now at least a single space char should be there */ - if (!is_wchar_space(*ptr)) return WC_E_WHITESPACE; - reader_skipspaces(reader); - ptr = start = reader_get_cur(reader); - reader->resume[XmlReadResume_Body] = start; - } - else - { - start = reader->resume[XmlReadResume_Body]; - ptr = reader_get_cur(reader); - } - + start = reader->resume[XmlReadResume_Body]; + ptr = reader_get_ptr(reader); while (*ptr) { if (ptr[0] == '?') { if (ptr[1] == '>') { + UINT cur = reader_get_cur(reader); strval value; - TRACE("%s\n", debugstr_wn(start, ptr-start)); + /* strip all leading whitespace chars */ + while (start < cur) + { + ptr = reader_get_ptr2(reader, start); + if (!is_wchar_space(*ptr)) break; + start++; + } + + reader_init_strvalue(start, cur-start, &value); + /* skip '?>' */ reader_skipn(reader, 2); + TRACE("%s\n", debug_strval(reader, &value)); reader->nodetype = XmlNodeType_ProcessingInstruction; reader->resumestate = XmlReadResumeState_Initial; - reader->resume[XmlReadResume_Body] = NULL; - reader_init_strvalue(start, ptr-start, &value); + reader->resume[XmlReadResume_Body] = 0; reader_set_strvalue(reader, StringValue_Value, &value); return S_OK; } - else - { - ptr++; - reader_more(reader); - } - } - else - { - reader_skipn(reader, 1); - ptr = reader_get_cur(reader); } + + reader_skipn(reader, 1); + ptr = reader_get_ptr(reader); } return S_OK; @@ -1448,19 +1456,35 @@ static HRESULT reader_parse_pi(xmlreader *reader) /* This one is used to parse significant whitespace nodes, like in Misc production */ static HRESULT reader_parse_whitespace(xmlreader *reader) { - WCHAR *start, *ptr; + switch (reader->resumestate) + { + case XmlReadResumeState_Initial: + reader_shrink(reader); + reader->resumestate = XmlReadResumeState_Whitespace; + reader->resume[XmlReadResume_Body] = reader_get_cur(reader); + reader->nodetype = XmlNodeType_Whitespace; + reader_set_strvalue(reader, StringValue_LocalName, &strval_empty); + reader_set_strvalue(reader, StringValue_QualifiedName, &strval_empty); + reader_set_strvalue(reader, StringValue_Value, &strval_empty); + /* fallthrough */ + case XmlReadResumeState_Whitespace: + { + strval value; + UINT start; - reader_shrink(reader); - start = reader_get_cur(reader); + reader_skipspaces(reader); + if (is_reader_pending(reader)) return S_OK; - reader_skipspaces(reader); - ptr = reader_get_cur(reader); - TRACE("%s\n", debugstr_wn(start, ptr-start)); + start = reader->resume[XmlReadResume_Body]; + reader_init_strvalue(start, reader_get_cur(reader)-start, &value); + reader_set_strvalue(reader, StringValue_Value, &value); + TRACE("%s\n", debug_strval(reader, &value)); + reader->resumestate = XmlReadResumeState_Initial; + } + default: + ; + } - reader->nodetype = XmlNodeType_Whitespace; - reader_set_strvalue(reader, StringValue_LocalName, &strval_empty); - reader_set_strvalue(reader, StringValue_QualifiedName, &strval_empty); - reader_set_strvalue(reader, StringValue_Value, &strval_empty); return S_OK; } @@ -1482,6 +1506,8 @@ static HRESULT reader_parse_misc(xmlreader *reader) return reader_parse_pi(reader); case XmlReadResumeState_Comment: return reader_parse_comment(reader); + case XmlReadResumeState_Whitespace: + return reader_parse_whitespace(reader); default: ERR("unknown resume state %d\n", reader->resumestate); } @@ -1489,7 +1515,7 @@ static HRESULT reader_parse_misc(xmlreader *reader) while (1) { - const WCHAR *cur = reader_get_cur(reader); + const WCHAR *cur = reader_get_ptr(reader); if (is_wchar_space(*cur)) hr = reader_parse_whitespace(reader); @@ -1509,23 +1535,25 @@ static HRESULT reader_parse_misc(xmlreader *reader) /* [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'") */ static HRESULT reader_parse_sys_literal(xmlreader *reader, strval *literal) { - WCHAR *start = reader_get_cur(reader), *cur, quote; + WCHAR *cur = reader_get_ptr(reader), quote; + UINT start; - if (*start != '"' && *start != '\'') return WC_E_QUOTE; + if (*cur != '"' && *cur != '\'') return WC_E_QUOTE; - quote = *start; + quote = *cur; reader_skipn(reader, 1); - cur = start = reader_get_cur(reader); + cur = reader_get_ptr(reader); + start = reader_get_cur(reader); while (is_char(*cur) && *cur != quote) { reader_skipn(reader, 1); - cur = reader_get_cur(reader); + cur = reader_get_ptr(reader); } + reader_init_strvalue(start, reader_get_cur(reader)-start, literal); if (*cur == quote) reader_skipn(reader, 1); - reader_init_strvalue(start, cur-start, literal); - TRACE("%s\n", debugstr_wn(start, cur-start)); + TRACE("%s\n", debug_strval(reader, literal)); return S_OK; } @@ -1533,22 +1561,24 @@ static HRESULT reader_parse_sys_literal(xmlreader *reader, strval *literal) [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] */ static HRESULT reader_parse_pub_literal(xmlreader *reader, strval *literal) { - WCHAR *start = reader_get_cur(reader), *cur, quote; + WCHAR *cur = reader_get_ptr(reader), quote; + UINT start; - if (*start != '"' && *start != '\'') return WC_E_QUOTE; + if (*cur != '"' && *cur != '\'') return WC_E_QUOTE; - quote = *start; + quote = *cur; reader_skipn(reader, 1); - cur = start; + start = reader_get_cur(reader); + cur = reader_get_ptr(reader); while (is_pubchar(*cur) && *cur != quote) { reader_skipn(reader, 1); - cur = reader_get_cur(reader); + cur = reader_get_ptr(reader); } - reader_init_strvalue(start, cur-start, literal); - TRACE("%s\n", debugstr_wn(start, cur-start)); + reader_init_strvalue(start, reader_get_cur(reader)-start, literal); + TRACE("%s\n", debug_strval(reader, literal)); return S_OK; } @@ -1577,7 +1607,7 @@ static HRESULT reader_parse_externalid(xmlreader *reader) hr = reader_parse_pub_literal(reader, &pub); if (FAILED(hr)) return hr; - reader_init_strvalue(publicW, strlenW(publicW), &name); + reader_init_cstrvalue(publicW, strlenW(publicW), &name); return reader_add_attr(reader, &name, &pub); } } @@ -1593,7 +1623,7 @@ static HRESULT reader_parse_externalid(xmlreader *reader) hr = reader_parse_sys_literal(reader, &sys); if (FAILED(hr)) return hr; - reader_init_strvalue(systemW, strlenW(systemW), &name); + reader_init_cstrvalue(systemW, strlenW(systemW), &name); return reader_add_attr(reader, &name, &sys); } @@ -1629,7 +1659,7 @@ static HRESULT reader_parse_dtd(xmlreader *reader) reader_skipspaces(reader); - cur = reader_get_cur(reader); + cur = reader_get_ptr(reader); if (*cur != '>') { FIXME("internal subset parsing not implemented\n"); @@ -1649,22 +1679,24 @@ static HRESULT reader_parse_dtd(xmlreader *reader) /* [11 NS] LocalPart ::= NCName */ static HRESULT reader_parse_local(xmlreader *reader, strval *local) { - WCHAR *ptr, *start; + WCHAR *ptr; + UINT start; if (reader->resume[XmlReadResume_Local]) { start = reader->resume[XmlReadResume_Local]; - ptr = reader_get_cur(reader); + ptr = reader_get_ptr(reader); } else { - ptr = start = reader_get_cur(reader); + ptr = reader_get_ptr(reader); + start = reader_get_cur(reader); } while (is_ncnamechar(*ptr)) { reader_skipn(reader, 1); - ptr = reader_get_cur(reader); + ptr = reader_get_ptr(reader); } if (is_reader_pending(reader)) @@ -1673,9 +1705,9 @@ static HRESULT reader_parse_local(xmlreader *reader, strval *local) return E_PENDING; } else - reader->resume[XmlReadResume_Local] = NULL; + reader->resume[XmlReadResume_Local] = 0; - reader_init_strvalue(start, ptr-start, local); + reader_init_strvalue(start, reader_get_cur(reader)-start, local); return S_OK; } @@ -1686,17 +1718,19 @@ static HRESULT reader_parse_local(xmlreader *reader, strval *local) [10 NS] Prefix ::= NCName */ static HRESULT reader_parse_qname(xmlreader *reader, strval *prefix, strval *local, strval *qname) { - WCHAR *ptr, *start; + WCHAR *ptr; + UINT start; HRESULT hr; if (reader->resume[XmlReadResume_Name]) { start = reader->resume[XmlReadResume_Name]; - ptr = reader_get_cur(reader); + ptr = reader_get_ptr(reader); } else { - ptr = start = reader_get_cur(reader); + ptr = reader_get_ptr(reader); + start = reader_get_cur(reader); reader->resume[XmlReadResume_Name] = start; if (!is_ncnamechar(*ptr)) return NC_E_QNAMECHARACTER; } @@ -1716,7 +1750,7 @@ static HRESULT reader_parse_qname(xmlreader *reader, strval *prefix, strval *loc while (is_ncnamechar(*ptr)) { reader_skipn(reader, 1); - ptr = reader_get_cur(reader); + ptr = reader_get_ptr(reader); } if (is_reader_pending(reader)) return E_PENDING; @@ -1724,7 +1758,7 @@ static HRESULT reader_parse_qname(xmlreader *reader, strval *prefix, strval *loc /* got a qualified name */ if (*ptr == ':') { - reader_init_strvalue(start, ptr-start, prefix); + reader_init_strvalue(start, reader_get_cur(reader)-start, prefix); /* skip ':' */ reader_skipn(reader, 1); @@ -1733,25 +1767,25 @@ static HRESULT reader_parse_qname(xmlreader *reader, strval *prefix, strval *loc } else { - reader_init_strvalue(reader->resume[XmlReadResume_Name], ptr-reader->resume[XmlReadResume_Name], local); - reader_init_strvalue(NULL, 0, prefix); + reader_init_strvalue(reader->resume[XmlReadResume_Name], reader_get_cur(reader)-reader->resume[XmlReadResume_Name], local); + reader_init_strvalue(0, 0, prefix); } } - reader_init_strvalue(start, ptr-start, local); + reader_init_strvalue(start, reader_get_cur(reader)-start, local); if (prefix->len) - TRACE("qname %s:%s\n", debugstr_wn(prefix->start, prefix->len), debugstr_wn(local->start, local->len)); + TRACE("qname %s:%s\n", debug_strval(reader, prefix), debug_strval(reader, local)); else - TRACE("ncname %s\n", debugstr_wn(local->start, local->len)); + TRACE("ncname %s\n", debug_strval(reader, local)); - reader_init_strvalue(prefix->start ? prefix->start : local->start, + reader_init_strvalue(prefix->len ? prefix->start : local->start, /* count ':' too */ (prefix->len ? prefix->len + 1 : 0) + local->len, qname); - reader->resume[XmlReadResume_Name] = NULL; - reader->resume[XmlReadResume_Local] = NULL; + reader->resume[XmlReadResume_Name] = 0; + reader->resume[XmlReadResume_Local] = 0; return S_OK; } @@ -1778,36 +1812,36 @@ static void reader_normalize_space(xmlreader *reader, WCHAR *ptr) *ptr = ' '; } -static WCHAR get_predefined_entity(const strval *name) +static WCHAR get_predefined_entity(const xmlreader *reader, const strval *name) { static const WCHAR entltW[] = {'l','t'}; static const WCHAR entgtW[] = {'g','t'}; static const WCHAR entampW[] = {'a','m','p'}; static const WCHAR entaposW[] = {'a','p','o','s'}; static const WCHAR entquotW[] = {'q','u','o','t'}; - static const strval lt = { (WCHAR*)entltW, 2 }; static const strval gt = { (WCHAR*)entgtW, 2 }; static const strval amp = { (WCHAR*)entampW, 3 }; static const strval apos = { (WCHAR*)entaposW, 4 }; static const strval quot = { (WCHAR*)entquotW, 4 }; + WCHAR *str = reader_get_strptr(reader, name); - switch (name->str[0]) + switch (*str) { case 'l': - if (strval_eq(name, <)) return '<'; + if (strval_eq(reader, name, <)) return '<'; break; case 'g': - if (strval_eq(name, >)) return '>'; + if (strval_eq(reader, name, >)) return '>'; break; case 'a': - if (strval_eq(name, &)) + if (strval_eq(reader, name, &)) return '&'; - else if (strval_eq(name, &apos)) + else if (strval_eq(reader, name, &apos)) return '\''; break; case 'q': - if (strval_eq(name, ")) return '\"'; + if (strval_eq(reader, name, ")) return '\"'; break; default: ; @@ -1822,24 +1856,25 @@ static WCHAR get_predefined_entity(const strval *name) static HRESULT reader_parse_reference(xmlreader *reader) { encoded_buffer *buffer = &reader->input->buffer->utf16; - WCHAR *start = reader_get_cur(reader), *ptr; + WCHAR *start = reader_get_ptr(reader), *ptr; + UINT cur = reader_get_cur(reader); WCHAR ch = 0; int len; /* skip '&' */ reader_skipn(reader, 1); - ptr = reader_get_cur(reader); + ptr = reader_get_ptr(reader); if (*ptr == '#') { reader_skipn(reader, 1); - ptr = reader_get_cur(reader); + ptr = reader_get_ptr(reader); /* hex char or decimal */ if (*ptr == 'x') { reader_skipn(reader, 1); - ptr = reader_get_cur(reader); + ptr = reader_get_ptr(reader); while (*ptr != ';') { @@ -1852,7 +1887,7 @@ static HRESULT reader_parse_reference(xmlreader *reader) else return ch ? WC_E_SEMICOLON : WC_E_HEXDIGIT; reader_skipn(reader, 1); - ptr = reader_get_cur(reader); + ptr = reader_get_ptr(reader); } } else @@ -1863,7 +1898,7 @@ static HRESULT reader_parse_reference(xmlreader *reader) { ch = ch*10 + *ptr - '0'; reader_skipn(reader, 1); - ptr = reader_get_cur(reader); + ptr = reader_get_ptr(reader); } else return ch ? WC_E_SEMICOLON : WC_E_DIGIT; @@ -1877,7 +1912,7 @@ static HRESULT reader_parse_reference(xmlreader *reader) len = buffer->written - ((char*)ptr - buffer->data) - sizeof(WCHAR); memmove(start+1, ptr+1, len); - buffer->cur = (char*)(start+1); + buffer->cur = cur + 1; *start = ch; } @@ -1889,22 +1924,22 @@ static HRESULT reader_parse_reference(xmlreader *reader) hr = reader_parse_name(reader, &name); if (FAILED(hr)) return hr; - ptr = reader_get_cur(reader); + ptr = reader_get_ptr(reader); if (*ptr != ';') return WC_E_SEMICOLON; /* predefined entities resolve to a single character */ - ch = get_predefined_entity(&name); + ch = get_predefined_entity(reader, &name); if (ch) { len = buffer->written - ((char*)ptr - buffer->data) - sizeof(WCHAR); memmove(start+1, ptr+1, len); - buffer->cur = (char*)(start+1); + buffer->cur = cur + 1; *start = ch; } else { - FIXME("undeclared entity %s\n", debugstr_wn(name.str, name.len)); + FIXME("undeclared entity %s\n", debug_strval(reader, &name)); return WC_E_UNDECLAREDENTITY; } @@ -1916,26 +1951,28 @@ static HRESULT reader_parse_reference(xmlreader *reader) /* [10 NS] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'" */ static HRESULT reader_parse_attvalue(xmlreader *reader, strval *value) { - WCHAR *ptr, *start; - WCHAR quote; + WCHAR *ptr, quote; + UINT start; - ptr = reader_get_cur(reader); + ptr = reader_get_ptr(reader); /* skip opening quote */ quote = *ptr; if (quote != '\"' && quote != '\'') return WC_E_QUOTE; reader_skipn(reader, 1); - start = ptr = reader_get_cur(reader); + ptr = reader_get_ptr(reader); + start = reader_get_cur(reader); while (*ptr) { if (*ptr == '<') return WC_E_LESSTHAN; if (*ptr == quote) { + reader_init_strvalue(start, reader_get_cur(reader)-start, value); /* skip closing quote */ reader_skipn(reader, 1); - break; + return S_OK; } if (*ptr == '&') @@ -1948,12 +1985,10 @@ static HRESULT reader_parse_attvalue(xmlreader *reader, strval *value) reader_normalize_space(reader, ptr); reader_skipn(reader, 1); } - ptr = reader_get_cur(reader); + ptr = reader_get_ptr(reader); } - reader_init_strvalue(start, ptr-start, value); - - return S_OK; + return WC_E_QUOTE; } /* [1 NS] NSAttName ::= PrefixedAttName | DefaultAttName @@ -1969,19 +2004,16 @@ static HRESULT reader_parse_attribute(xmlreader *reader) hr = reader_parse_qname(reader, &prefix, &local, &qname); if (FAILED(hr)) return hr; - reader_init_strvalue((WCHAR*)xmlnsW, 5, &xmlns); + reader_init_cstrvalue((WCHAR*)xmlnsW, 5, &xmlns); - if (strval_eq(&prefix, &xmlns)) + if (strval_eq(reader, &prefix, &xmlns)) { FIXME("namespace definitions not supported\n"); return E_NOTIMPL; } - if (strval_eq(&qname, &xmlns)) - { + if (strval_eq(reader, &qname, &xmlns)) FIXME("default namespace definitions not supported\n"); - return E_NOTIMPL; - } hr = reader_parse_eq(reader); if (FAILED(hr)) return hr; @@ -1989,7 +2021,7 @@ static HRESULT reader_parse_attribute(xmlreader *reader) hr = reader_parse_attvalue(reader, &value); if (FAILED(hr)) return hr; - TRACE("%s=%s\n", debugstr_wn(local.str, local.len), debugstr_wn(value.str, value.len)); + TRACE("%s=%s\n", debug_strval(reader, &local), debug_strval(reader, &value)); return reader_add_attr(reader, &local, &value); } @@ -2104,7 +2136,7 @@ static HRESULT reader_parse_endtag(xmlreader *reader) /* Element stack should never be empty at this point, cause we shouldn't get to content parsing if it's empty. */ elem = LIST_ENTRY(list_head(&reader->elements), struct element, entry); - if (!strval_eq(&elem->qname, &qname)) return WC_E_ELEMENTMATCH; + if (!strval_eq(reader, &elem->qname, &qname)) return WC_E_ELEMENTMATCH; reader_pop_element(reader); @@ -2125,19 +2157,21 @@ static HRESULT reader_parse_endtag(xmlreader *reader) [21] CDEnd ::= ']]>' */ static HRESULT reader_parse_cdata(xmlreader *reader) { - WCHAR *start, *ptr; + WCHAR *ptr; + UINT start; - if (reader->resume[XmlReadResume_Body]) + if (reader->resumestate == XmlReadResumeState_CDATA) { start = reader->resume[XmlReadResume_Body]; - ptr = reader_get_cur(reader); + ptr = reader_get_ptr(reader); } else { /* skip markup 'nodetype = XmlNodeType_CDATA; reader->resume[XmlReadResume_Body] = start; reader->resumestate = XmlReadResumeState_CDATA; @@ -2152,14 +2186,16 @@ static HRESULT reader_parse_cdata(xmlreader *reader) { strval value; - TRACE("%s\n", debugstr_wn(start, ptr-start)); + reader_init_strvalue(start, reader_get_cur(reader)-start, &value); + /* skip ']]>' */ reader_skipn(reader, 3); - reader_init_strvalue(start, ptr-start, &value); + TRACE("%s\n", debug_strval(reader, &value)); + reader_set_strvalue(reader, StringValue_LocalName, &strval_empty); reader_set_strvalue(reader, StringValue_QualifiedName, &strval_empty); reader_set_strvalue(reader, StringValue_Value, &value); - reader->resume[XmlReadResume_Body] = NULL; + reader->resume[XmlReadResume_Body] = 0; reader->resumestate = XmlReadResumeState_Initial; return S_OK; } @@ -2182,20 +2218,22 @@ static HRESULT reader_parse_cdata(xmlreader *reader) /* [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) */ static HRESULT reader_parse_chardata(xmlreader *reader) { - WCHAR *start, *ptr; + WCHAR *ptr; + UINT start; - if (reader->resume[XmlReadResume_Body]) + if (reader->resumestate == XmlReadResumeState_CharData) { start = reader->resume[XmlReadResume_Body]; - ptr = reader_get_cur(reader); + ptr = reader_get_ptr(reader); } else { reader_shrink(reader); - ptr = start = reader_get_cur(reader); + ptr = reader_get_ptr(reader); + start = reader_get_cur(reader); /* There's no text */ if (!*ptr || *ptr == '<') return S_OK; - reader->nodetype = XmlNodeType_Text; + reader->nodetype = is_wchar_space(*ptr) ? XmlNodeType_Whitespace : XmlNodeType_Text; reader->resume[XmlReadResume_Body] = start; reader->resumestate = XmlReadResumeState_CharData; reader_set_strvalue(reader, StringValue_LocalName, &strval_empty); @@ -2214,12 +2252,17 @@ static HRESULT reader_parse_chardata(xmlreader *reader) { strval value; - reader_init_strvalue(start, ptr-start, &value); + reader_init_strvalue(start, reader_get_cur(reader)-start, &value); reader_set_strvalue(reader, StringValue_Value, &value); + reader->resume[XmlReadResume_Body] = 0; + reader->resumestate = XmlReadResumeState_Initial; return S_OK; } reader_skipn(reader, 1); + + /* this covers a case when text has leading whitespace chars */ + if (!is_wchar_space(*ptr)) reader->nodetype = XmlNodeType_Text; ptr++; } @@ -2682,10 +2725,11 @@ static HRESULT WINAPI xmlreader_GetValue(IXmlReader* iface, const WCHAR **value, if (!val->str) { - val->str = reader_alloc(reader, (val->len+1)*sizeof(WCHAR)); - if (!val->str) return E_OUTOFMEMORY; - memcpy(val->str, val->start, val->len*sizeof(WCHAR)); - val->str[val->len] = 0; + WCHAR *ptr = reader_alloc(reader, (val->len+1)*sizeof(WCHAR)); + if (!ptr) return E_OUTOFMEMORY; + memcpy(ptr, reader_get_strptr(reader, val), val->len*sizeof(WCHAR)); + ptr[val->len] = 0; + val->str = ptr; } *value = val->str; @@ -2707,7 +2751,7 @@ static HRESULT WINAPI xmlreader_ReadValueChunk(IXmlReader* iface, WCHAR *buffer, if (val->len) { len = min(chunk_size, val->len); - memcpy(buffer, val->start, len); + memcpy(buffer, reader_get_ptr2(reader, val->start), len); val->start += len; val->len -= len; if (read) *read = len; diff --git a/dll/win32/xmllite/writer.c b/dll/win32/xmllite/writer.c index 7fad8ab2df3..ea7381b3320 100644 --- a/dll/win32/xmllite/writer.c +++ b/dll/win32/xmllite/writer.c @@ -20,6 +20,18 @@ #include "xmllite_private.h" +/* not defined in public headers */ +DEFINE_GUID(IID_IXmlWriterOutput, 0xc1131708, 0x0f59, 0x477f, 0x93, 0x59, 0x7d, 0x33, 0x24, 0x51, 0xbc, 0x1a); + +typedef struct +{ + IXmlWriterOutput IXmlWriterOutput_iface; + LONG ref; + IUnknown *output; + IMalloc *imalloc; + xml_encoding encoding; +} xmlwriteroutput; + typedef struct _xmlwriter { IXmlWriter IXmlWriter_iface; @@ -31,6 +43,22 @@ static inline xmlwriter *impl_from_IXmlWriter(IXmlWriter *iface) return CONTAINING_RECORD(iface, xmlwriter, IXmlWriter_iface); } +static inline xmlwriteroutput *impl_from_IXmlWriterOutput(IXmlWriterOutput *iface) +{ + return CONTAINING_RECORD(iface, xmlwriteroutput, IXmlWriterOutput_iface); +} + +/* reader input memory allocation functions */ +static inline void *writeroutput_alloc(xmlwriteroutput *output, size_t len) +{ + return m_alloc(output->imalloc, len); +} + +static inline void writeroutput_free(xmlwriteroutput *output, void *mem) +{ + m_free(output->imalloc, mem); +} + static HRESULT WINAPI xmlwriter_QueryInterface(IXmlWriter *iface, REFIID riid, void **ppvObject) { xmlwriter *This = impl_from_IXmlWriter(iface); @@ -64,9 +92,7 @@ static ULONG WINAPI xmlwriter_Release(IXmlWriter *iface) ref = InterlockedDecrement(&This->ref); if (ref == 0) - { - HeapFree(GetProcessHeap(), 0, This); - } + heap_free(This); return ref; } @@ -376,6 +402,63 @@ static const struct IXmlWriterVtbl xmlwriter_vtbl = xmlwriter_Flush }; +/** IXmlWriterOutput **/ +static HRESULT WINAPI xmlwriteroutput_QueryInterface(IXmlWriterOutput *iface, REFIID riid, void** ppvObject) +{ + xmlwriteroutput *This = impl_from_IXmlWriterOutput(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); + + if (IsEqualGUID(riid, &IID_IXmlWriterOutput) || + IsEqualGUID(riid, &IID_IUnknown)) + { + *ppvObject = iface; + } + else + { + WARN("interface %s not implemented\n", debugstr_guid(riid)); + *ppvObject = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef(iface); + + return S_OK; +} + +static ULONG WINAPI xmlwriteroutput_AddRef(IXmlWriterOutput *iface) +{ + xmlwriteroutput *This = impl_from_IXmlWriterOutput(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + return ref; +} + +static ULONG WINAPI xmlwriteroutput_Release(IXmlWriterOutput *iface) +{ + xmlwriteroutput *This = impl_from_IXmlWriterOutput(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p)->(%d)\n", This, ref); + + if (ref == 0) + { + IMalloc *imalloc = This->imalloc; + if (This->output) IUnknown_Release(This->output); + writeroutput_free(This, This); + if (imalloc) IMalloc_Release(imalloc); + } + + return ref; +} + +static const struct IUnknownVtbl xmlwriteroutputvtbl = +{ + xmlwriteroutput_QueryInterface, + xmlwriteroutput_AddRef, + xmlwriteroutput_Release +}; + HRESULT WINAPI CreateXmlWriter(REFIID riid, void **pObject, IMalloc *pMalloc) { xmlwriter *writer; @@ -390,7 +473,7 @@ HRESULT WINAPI CreateXmlWriter(REFIID riid, void **pObject, IMalloc *pMalloc) return E_FAIL; } - writer = HeapAlloc(GetProcessHeap(), 0, sizeof (*writer)); + writer = heap_alloc(sizeof(*writer)); if(!writer) return E_OUTOFMEMORY; writer->IXmlWriter_iface.lpVtbl = &xmlwriter_vtbl; @@ -402,3 +485,35 @@ HRESULT WINAPI CreateXmlWriter(REFIID riid, void **pObject, IMalloc *pMalloc) return S_OK; } + +HRESULT WINAPI CreateXmlWriterOutputWithEncodingName(IUnknown *stream, + IMalloc *imalloc, + LPCWSTR encoding, + IXmlWriterOutput **output) +{ + xmlwriteroutput *writeroutput; + + TRACE("%p %p %s %p\n", stream, imalloc, debugstr_w(encoding), output); + + if (!stream || !output) return E_INVALIDARG; + + if (imalloc) + writeroutput = IMalloc_Alloc(imalloc, sizeof(*writeroutput)); + else + writeroutput = heap_alloc(sizeof(*writeroutput)); + if(!writeroutput) return E_OUTOFMEMORY; + + writeroutput->IXmlWriterOutput_iface.lpVtbl = &xmlwriteroutputvtbl; + writeroutput->ref = 1; + writeroutput->imalloc = imalloc; + if (imalloc) IMalloc_AddRef(imalloc); + writeroutput->encoding = parse_encoding_name(encoding, -1); + + IUnknown_QueryInterface(stream, &IID_IUnknown, (void**)&writeroutput->output); + + *output = &writeroutput->IXmlWriterOutput_iface; + + TRACE("returning iface %p\n", *output); + + return S_OK; +} diff --git a/dll/win32/xmllite/xmllite.spec b/dll/win32/xmllite/xmllite.spec index 30b02aae9ef..295bff6381c 100644 --- a/dll/win32/xmllite/xmllite.spec +++ b/dll/win32/xmllite/xmllite.spec @@ -3,4 +3,4 @@ @ stdcall CreateXmlReaderInputWithEncodingName(ptr ptr ptr long ptr ptr) @ stdcall CreateXmlWriter(ptr ptr ptr) @ stub CreateXmlWriterOutputWithEncodingCodePage -@ stub CreateXmlWriterOutputWithEncodingName +@ stdcall CreateXmlWriterOutputWithEncodingName(ptr ptr wstr ptr) diff --git a/dll/win32/xmllite/xmllite_private.h b/dll/win32/xmllite/xmllite_private.h index babae48542f..b08755f0c08 100644 --- a/dll/win32/xmllite/xmllite_private.h +++ b/dll/win32/xmllite/xmllite_private.h @@ -55,4 +55,29 @@ static inline BOOL heap_free(void *mem) return HeapFree(GetProcessHeap(), 0, mem); } +static inline void *m_alloc(IMalloc *imalloc, size_t len) +{ + if (imalloc) + return IMalloc_Alloc(imalloc, len); + else + return heap_alloc(len); +} + +static inline void m_free(IMalloc *imalloc, void *mem) +{ + if (imalloc) + IMalloc_Free(imalloc, mem); + else + heap_free(mem); +} + +typedef enum +{ + XmlEncoding_UTF16, + XmlEncoding_UTF8, + XmlEncoding_Unknown +} xml_encoding; + +xml_encoding parse_encoding_name(const WCHAR *name, int len) DECLSPEC_HIDDEN; + #endif /* __XMLLITE_PRIVATE__ */ diff --git a/drivers/bus/acpi/CMakeLists.txt b/drivers/bus/acpi/CMakeLists.txt index 5d6aacc9e44..0352cc0cf19 100644 --- a/drivers/bus/acpi/CMakeLists.txt +++ b/drivers/bus/acpi/CMakeLists.txt @@ -138,7 +138,6 @@ list(APPEND ACPICA_SOURCE acpica/utilities/utdelete.c acpica/utilities/uterror.c acpica/utilities/uteval.c - acpica/utilities/utexcep.c acpica/utilities/utids.c acpica/utilities/utinit.c acpica/utilities/utlock.c @@ -161,9 +160,10 @@ list(APPEND ACPICA_SOURCE add_library(acpica ${ACPICA_SOURCE} + acpica/utilities/utexcep.c acpica/utilities/utglobal.c) -#add_pch(acpica acpica/include/acpi.h ACPICA_SOURCE) +add_pch(acpica acpica/include/acpi.h ACPICA_SOURCE) set_target_properties(acpica PROPERTIES COMPILE_DEFINITIONS "ACPI_USE_LOCAL_CACHE") add_dependencies(acpica bugcodes) diff --git a/drivers/filesystems/cdfs/cdfs.h b/drivers/filesystems/cdfs/cdfs.h index 5a344137d61..dd281f027f7 100644 --- a/drivers/filesystems/cdfs/cdfs.h +++ b/drivers/filesystems/cdfs/cdfs.h @@ -160,6 +160,10 @@ typedef struct PFILE_OBJECT StreamFileObject; CDINFO CdInfo; + + /* Notifications */ + LIST_ENTRY NotifyList; + PNOTIFY_SYNC NotifySync; } DEVICE_EXTENSION, *PDEVICE_EXTENSION, VCB, *PVCB; @@ -189,8 +193,9 @@ typedef struct _FCB UNICODE_STRING ShortNameU; - WCHAR *ObjectName; /* point on filename (250 chars max) in PathName */ - WCHAR PathName[MAX_PATH]; /* path+filename 260 max */ + WCHAR *ObjectName; /* point on filename (250 chars max) in PathName */ + UNICODE_STRING PathName; /* path+filename 260 max */ + WCHAR PathNameBuffer[MAX_PATH]; /* Buffer for PathName */ WCHAR ShortNameBuffer[13]; LIST_ENTRY FcbListEntry; @@ -198,8 +203,8 @@ typedef struct _FCB ULONG DirIndex; - LARGE_INTEGER IndexNumber; /* HighPart: Parent directory start sector */ - /* LowPart: Directory record offset in the parent directory file */ + LARGE_INTEGER IndexNumber; /* HighPart: Parent directory start sector */ + /* LowPart: Directory record offset in the parent directory file */ LONG RefCount; ULONG Flags; diff --git a/drivers/filesystems/cdfs/cleanup.c b/drivers/filesystems/cdfs/cleanup.c index ee494d181a0..f46ecdbe0fd 100644 --- a/drivers/filesystems/cdfs/cleanup.c +++ b/drivers/filesystems/cdfs/cleanup.c @@ -41,11 +41,22 @@ CdfsCleanupFile(PDEVICE_EXTENSION DeviceExt, * FUNCTION: Cleans up after a file has been closed. */ { + PFCB Fcb; DPRINT("CdfsCleanupFile(DeviceExt %p, FileObject %p)\n", DeviceExt, FileObject); + Fcb = FileObject->FsContext; + if (!Fcb) + { + return STATUS_SUCCESS; + } + + /* Notify about the cleanup */ + FsRtlNotifyCleanup(DeviceExt->NotifySync, + &(DeviceExt->NotifyList), + FileObject->FsContext2); /* Uninitialize file cache if initialized for this file object. */ if (FileObject->SectionObjectPointer && FileObject->SectionObjectPointer->SharedCacheMap) diff --git a/drivers/filesystems/cdfs/create.c b/drivers/filesystems/cdfs/create.c index dcec4d15dbf..eef173d90a0 100644 --- a/drivers/filesystems/cdfs/create.c +++ b/drivers/filesystems/cdfs/create.c @@ -56,7 +56,7 @@ CdfsMakeAbsoluteFilename(PFILE_OBJECT FileObject, } /* construct absolute path name */ - Length = (wcslen(Fcb->PathName) * sizeof(WCHAR)) + + Length = Fcb->PathName.Length + sizeof(WCHAR) + RelativeFileName->Length + sizeof(WCHAR); @@ -69,8 +69,8 @@ CdfsMakeAbsoluteFilename(PFILE_OBJECT FileObject, return STATUS_INSUFFICIENT_RESOURCES; } - Status = RtlAppendUnicodeToString(AbsoluteFileName, - Fcb->PathName); + Status = RtlAppendUnicodeStringToString(AbsoluteFileName, + &Fcb->PathName); if (!NT_SUCCESS(Status)) { RtlFreeUnicodeString(AbsoluteFileName); diff --git a/drivers/filesystems/cdfs/dirctl.c b/drivers/filesystems/cdfs/dirctl.c index e8568e31d23..5677c83954a 100644 --- a/drivers/filesystems/cdfs/dirctl.c +++ b/drivers/filesystems/cdfs/dirctl.c @@ -215,9 +215,11 @@ CdfsFindFile(PDEVICE_EXTENSION DeviceExt, { /* it's root : complete essentials fields then return ok */ RtlZeroMemory(Fcb, sizeof(FCB)); + RtlInitEmptyUnicodeString(&Fcb->PathName, Fcb->PathNameBuffer, sizeof(Fcb->PathNameBuffer)); - Fcb->PathName[0] = '\\'; - Fcb->ObjectName = &Fcb->PathName[1]; + Fcb->PathNameBuffer[0] = '\\'; + Fcb->PathName.Length = sizeof(WCHAR); + Fcb->ObjectName = &Fcb->PathNameBuffer[1]; Fcb->Entry.ExtentLocationL = DeviceExt->CdInfo.RootStart; Fcb->Entry.DataLengthL = DeviceExt->CdInfo.RootSize; Fcb->Entry.FileFlags = 0x02; //FILE_ATTRIBUTE_DIRECTORY; @@ -226,7 +228,7 @@ CdfsFindFile(PDEVICE_EXTENSION DeviceExt, *pDirIndex = 0; if (pOffset) *pOffset = 0; - DPRINT("CdfsFindFile: new Pathname %S, new Objectname %S)\n",Fcb->PathName, Fcb->ObjectName); + DPRINT("CdfsFindFile: new Pathname %wZ, new Objectname %S)\n",&Fcb->PathName, Fcb->ObjectName); return STATUS_SUCCESS; } } @@ -303,12 +305,12 @@ CdfsFindFile(PDEVICE_EXTENSION DeviceExt, if (FsRtlIsNameInExpression(&FileToFindUpcase, &LongName, TRUE, NULL) || FsRtlIsNameInExpression(&FileToFindUpcase, &ShortName, TRUE, NULL)) { - if (Parent->PathName[0]) + if (Parent->PathName.Buffer[0]) { - len = wcslen(Parent->PathName); - memcpy(Fcb->PathName, Parent->PathName, len*sizeof(WCHAR)); - Fcb->ObjectName=&Fcb->PathName[len]; - if (len != 1 || Fcb->PathName[0] != '\\') + RtlCopyUnicodeString(&Fcb->PathName, &Parent->PathName); + len = Parent->PathName.Length / sizeof(WCHAR); + Fcb->ObjectName=&Fcb->PathName.Buffer[len]; + if (len != 1 || Fcb->PathName.Buffer[0] != '\\') { Fcb->ObjectName[0] = '\\'; Fcb->ObjectName = &Fcb->ObjectName[1]; @@ -316,16 +318,16 @@ CdfsFindFile(PDEVICE_EXTENSION DeviceExt, } else { - Fcb->ObjectName=Fcb->PathName; + Fcb->ObjectName=Fcb->PathName.Buffer; Fcb->ObjectName[0]='\\'; Fcb->ObjectName=&Fcb->ObjectName[1]; } - DPRINT("PathName '%S' ObjectName '%S'\n", Fcb->PathName, Fcb->ObjectName); + DPRINT("PathName '%wZ' ObjectName '%S'\n", &Fcb->PathName, Fcb->ObjectName); memcpy(&Fcb->Entry, Record, sizeof(DIR_RECORD)); wcsncpy(Fcb->ObjectName, name, min(wcslen(name) + 1, - MAX_PATH - wcslen(Fcb->PathName) + wcslen(Fcb->ObjectName))); + MAX_PATH - (Fcb->PathName.Length / sizeof(WCHAR)) + wcslen(Fcb->ObjectName))); /* Copy short name */ Fcb->ShortNameU.Length = ShortName.Length; @@ -338,8 +340,8 @@ CdfsFindFile(PDEVICE_EXTENSION DeviceExt, if (pOffset) *pOffset = Offset; - DPRINT("FindFile: new Pathname %S, new Objectname %S, DirIndex %u\n", - Fcb->PathName, Fcb->ObjectName, DirIndex); + DPRINT("FindFile: new Pathname %wZ, new Objectname %S, DirIndex %u\n", + &Fcb->PathName, Fcb->ObjectName, DirIndex); RtlFreeUnicodeString(&FileToFindUpcase); CcUnpinData(Context); @@ -572,6 +574,7 @@ CdfsQueryDirectory(PDEVICE_OBJECT DeviceObject, DeviceExtension = DeviceObject->DeviceExtension; Stack = IoGetCurrentIrpStackLocation(Irp); FileObject = Stack->FileObject; + RtlInitEmptyUnicodeString(&TempFcb.PathName, TempFcb.PathNameBuffer, sizeof(TempFcb.PathNameBuffer)); Ccb = (PCCB)FileObject->FsContext2; Fcb = (PFCB)FileObject->FsContext; @@ -646,7 +649,7 @@ CdfsQueryDirectory(PDEVICE_OBJECT DeviceObject, } DPRINT("Buffer = %p tofind = %wZ\n", Buffer, &Ccb->DirectorySearchPattern); - TempFcb.ObjectName = TempFcb.PathName; + TempFcb.ObjectName = TempFcb.PathName.Buffer; while (Status == STATUS_SUCCESS && BufferLength > 0) { Status = CdfsFindFile(DeviceExtension, @@ -746,6 +749,39 @@ CdfsQueryDirectory(PDEVICE_OBJECT DeviceObject, } +static NTSTATUS +CdfsNotifyChangeDirectory(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PDEVICE_EXTENSION DeviceExtension; + PFCB Fcb; + PCCB Ccb; + PIO_STACK_LOCATION Stack; + PFILE_OBJECT FileObject; + + DPRINT("CdfsNotifyChangeDirectory() called\n"); + + DeviceExtension = DeviceObject->DeviceExtension; + Stack = IoGetCurrentIrpStackLocation(Irp); + FileObject = Stack->FileObject; + + Ccb = (PCCB)FileObject->FsContext2; + Fcb = (PFCB)FileObject->FsContext; + + FsRtlNotifyFullChangeDirectory(DeviceExtension->NotifySync, + &(DeviceExtension->NotifyList), + Ccb, + (PSTRING)&(Fcb->PathName), + BooleanFlagOn(Stack->Flags, SL_WATCH_TREE), + FALSE, + Stack->Parameters.NotifyDirectory.CompletionFilter, + Irp, + NULL, + NULL); + + return STATUS_PENDING; +} + NTSTATUS NTAPI CdfsDirectoryControl(PDEVICE_OBJECT DeviceObject, @@ -767,8 +803,8 @@ CdfsDirectoryControl(PDEVICE_OBJECT DeviceObject, break; case IRP_MN_NOTIFY_CHANGE_DIRECTORY: - DPRINT1("IRP_MN_NOTIFY_CHANGE_DIRECTORY\n"); - Status = STATUS_NOT_IMPLEMENTED; + Status = CdfsNotifyChangeDirectory(DeviceObject, + Irp); break; default: @@ -780,7 +816,10 @@ CdfsDirectoryControl(PDEVICE_OBJECT DeviceObject, Irp->IoStatus.Status = Status; Irp->IoStatus.Information = 0; - IoCompleteRequest(Irp, IO_NO_INCREMENT); + if (Status != STATUS_PENDING) + { + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } FsRtlExitFileSystem(); return(Status); diff --git a/drivers/filesystems/cdfs/fcb.c b/drivers/filesystems/cdfs/fcb.c index 66570085db5..28e0e8ebcf4 100644 --- a/drivers/filesystems/cdfs/fcb.c +++ b/drivers/filesystems/cdfs/fcb.c @@ -73,17 +73,18 @@ CdfsCreateFCB(PCWSTR FileName) if(!Fcb) return NULL; RtlZeroMemory(Fcb, sizeof(FCB)); + RtlInitEmptyUnicodeString(&Fcb->PathName, Fcb->PathNameBuffer, sizeof(Fcb->PathNameBuffer)); if (FileName) { - CdfsWSubString(Fcb->PathName, FileName, sizeof(Fcb->PathName) / sizeof(Fcb->PathName[0]) - 1); - if (wcsrchr(Fcb->PathName, '\\') != 0) + RtlAppendUnicodeToString(&Fcb->PathName, FileName); + if (wcsrchr(Fcb->PathName.Buffer, '\\') != 0) { - Fcb->ObjectName = wcsrchr(Fcb->PathName, '\\'); + Fcb->ObjectName = wcsrchr(Fcb->PathName.Buffer, '\\'); } else { - Fcb->ObjectName = Fcb->PathName; + Fcb->ObjectName = Fcb->PathName.Buffer; } } @@ -129,7 +130,7 @@ CdfsFCBIsDirectory(PFCB Fcb) BOOLEAN CdfsFCBIsRoot(PFCB Fcb) { - return(wcscmp(Fcb->PathName, L"\\") == 0); + return (Fcb->PathName.Length == sizeof(WCHAR) && Fcb->PathName.Buffer[0] == L'\\'); } @@ -156,9 +157,9 @@ CdfsReleaseFCB(PDEVICE_EXTENSION Vcb, { KIRQL oldIrql; - DPRINT("releasing FCB at %p: %S, refCount:%d\n", + DPRINT("releasing FCB at %p: %wZ, refCount:%d\n", Fcb, - Fcb->PathName, + &Fcb->PathName, Fcb->RefCount); KeAcquireSpinLock(&Vcb->FcbListLock, &oldIrql); @@ -209,8 +210,8 @@ CdfsGrabFCBFromTable(PDEVICE_EXTENSION Vcb, { Fcb = CONTAINING_RECORD(current_entry, FCB, FcbListEntry); - DPRINT("Comparing '%wZ' and '%S'\n", FileName, Fcb->PathName); - if (_wcsicmp(FileName->Buffer, Fcb->PathName) == 0) + DPRINT("Comparing '%wZ' and '%wZ'\n", FileName, &Fcb->PathName); + if (RtlCompareUnicodeString(FileName, &Fcb->PathName, TRUE) == 0) { Fcb->RefCount++; KeReleaseSpinLock(&Vcb->FcbListLock, oldIrql); @@ -365,12 +366,12 @@ CdfsMakeFCBFromDirEntry(PVCB Vcb, /* Check if the full string would overflow the pathName buffer (the additional characters are for '\\' and '\0') */ if ((LongName[0] != 0) && - (wcslen(DirectoryFCB->PathName) + 1 + wcslen(LongName) + 1 > MAX_PATH)) + ((DirectoryFCB->PathName.Length / sizeof(WCHAR)) + 1 + wcslen(LongName) + 1 > MAX_PATH)) { return(STATUS_OBJECT_NAME_INVALID); } - wcscpy(pathName, DirectoryFCB->PathName); + wcscpy(pathName, DirectoryFCB->PathName.Buffer); if (!CdfsFCBIsRoot(DirectoryFCB)) { wcscat(pathName, L"\\"); @@ -488,7 +489,7 @@ CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt, DeviceExt, DirectoryFcb, FileToFind); - DPRINT("Dir Path:%S\n", DirectoryFcb->PathName); + DPRINT("Dir Path:%wZ\n", &DirectoryFcb->PathName); /* default to '.' if no filename specified */ if (FileToFind->Length == 0) diff --git a/drivers/filesystems/cdfs/finfo.c b/drivers/filesystems/cdfs/finfo.c index 41304a8ce34..a64d7cc448d 100644 --- a/drivers/filesystems/cdfs/finfo.c +++ b/drivers/filesystems/cdfs/finfo.c @@ -164,7 +164,7 @@ CdfsGetNameInformation(PFILE_OBJECT FileObject, return STATUS_BUFFER_OVERFLOW; /* Calculate file name length in bytes */ - NameLength = wcslen(Fcb->PathName) * sizeof(WCHAR); + NameLength = Fcb->PathName.Length; NameInfo->FileNameLength = NameLength; /* Calculate amount of bytes to copy not to overflow the buffer */ @@ -172,7 +172,7 @@ CdfsGetNameInformation(PFILE_OBJECT FileObject, *BufferLength - FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0])); /* Fill in the bytes */ - RtlCopyMemory(NameInfo->FileName, Fcb->PathName, BytesToCopy); + RtlCopyMemory(NameInfo->FileName, Fcb->PathName.Buffer, BytesToCopy); /* Check if we could write more but are not able to */ if (*BufferLength < NameLength + FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0])) @@ -268,7 +268,7 @@ CdfsGetAllInformation(PFILE_OBJECT FileObject, ASSERT(Info); ASSERT(Fcb); - NameLength = wcslen(Fcb->PathName) * sizeof(WCHAR); + NameLength = Fcb->PathName.Length; if (*BufferLength < sizeof(FILE_ALL_INFORMATION) + NameLength) return(STATUS_BUFFER_OVERFLOW); @@ -321,7 +321,7 @@ CdfsGetAllInformation(PFILE_OBJECT FileObject, /* Name Information */ Info->NameInformation.FileNameLength = NameLength; RtlCopyMemory(Info->NameInformation.FileName, - Fcb->PathName, + Fcb->PathName.Buffer, NameLength + sizeof(WCHAR)); *BufferLength -= (sizeof(FILE_ALL_INFORMATION) + NameLength + sizeof(WCHAR)); diff --git a/drivers/filesystems/cdfs/fsctl.c b/drivers/filesystems/cdfs/fsctl.c index 9b658c76aaf..8504b0f8c22 100644 --- a/drivers/filesystems/cdfs/fsctl.c +++ b/drivers/filesystems/cdfs/fsctl.c @@ -429,6 +429,9 @@ CdfsMountVolume(PDEVICE_OBJECT DeviceObject, KeInitializeSpinLock(&DeviceExt->FcbListLock); InitializeListHead(&DeviceExt->FcbListHead); + FsRtlNotifyInitializeSync(&DeviceExt->NotifySync); + InitializeListHead(&DeviceExt->NotifyList); + Status = STATUS_SUCCESS; ByeBye: @@ -513,7 +516,7 @@ CdfsVerifyVolume(PDEVICE_OBJECT DeviceObject, while (Entry != &DeviceExt->FcbListHead) { Fcb = (PFCB)CONTAINING_RECORD(Entry, FCB, FcbListEntry); - DPRINT1("OpenFile %S RefCount %ld\n", Fcb->PathName, Fcb->RefCount); + DPRINT1("OpenFile %wZ RefCount %ld\n", &Fcb->PathName, Fcb->RefCount); Entry = Entry->Flink; } diff --git a/drivers/filesystems/fastfat/close.c b/drivers/filesystems/fastfat/close.c index 78f016f7d6e..007c3c5f444 100644 --- a/drivers/filesystems/fastfat/close.c +++ b/drivers/filesystems/fastfat/close.c @@ -28,7 +28,7 @@ VfatCloseFile( NTSTATUS Status = STATUS_SUCCESS; DPRINT("VfatCloseFile(DeviceExt %p, FileObject %p)\n", - DeviceExt, FileObject); + DeviceExt, FileObject); /* FIXME : update entry in directory? */ pCcb = (PVFATCCB) (FileObject->FsContext2); @@ -52,6 +52,17 @@ VfatCloseFile( if (pFcb->Flags & FCB_DELETE_PENDING) { VfatDelEntry(DeviceExt, pFcb); + + FsRtlNotifyFullReportChange(DeviceExt->NotifySync, + &(DeviceExt->NotifyList), + (PSTRING)&pFcb->PathNameU, + pFcb->PathNameU.Length - pFcb->LongNameU.Length, + NULL, + NULL, + ((*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) ? + FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME), + FILE_ACTION_REMOVED, + NULL); } else { diff --git a/drivers/filesystems/fastfat/create.c b/drivers/filesystems/fastfat/create.c index 0e27105aefb..76967dd6d73 100644 --- a/drivers/filesystems/fastfat/create.c +++ b/drivers/filesystems/fastfat/create.c @@ -550,7 +550,7 @@ VfatCreateFile( if (!NT_SUCCESS(Status) && ParentFcb == NULL) { - DPRINT1("VfatOpenFile faild for '%wZ', status %x\n", &PathNameU, Status); + DPRINT1("VfatOpenFile failed for '%wZ', status %x\n", &PathNameU, Status); return Status; } diff --git a/include/dxsdk/axextend.idl b/include/dxsdk/axextend.idl index 9b472019836..cd4955d38ab 100644 --- a/include/dxsdk/axextend.idl +++ b/include/dxsdk/axextend.idl @@ -22,6 +22,7 @@ interface IAMAudioInputMixer; interface IAMAudioRendererStats; interface IAMBufferNegotiation; interface IAMCameraControl; +interface IAMCertifiedOutputProtection; interface IAMCopyCaptureFileProgress; interface IAMCrossbar; interface IAMDevMemoryAllocator; @@ -746,6 +747,122 @@ interface ICaptureGraphBuilder2 : IUnknown [out] IPin **ppPin); } +[ + local, + object, + uuid(5acd6aa0-f482-11ce-8b67-00aa00a3f1a6), + pointer_default(unique) +] +interface IConfigAviMux : IUnknown +{ + HRESULT SetMasterStream( + [in] LONG iStream); + + HRESULT GetMasterStream( + [out] LONG *pStream); + + HRESULT SetOutputCompatibilityIndex( + [in] BOOL fOldIndex); + + HRESULT GetOutputCompatibilityIndex( + [out] BOOL *pfOldIndex); +} + +[ + local, + object, + uuid(bee3d220-157b-11d0-bd23-00a0c911ce86), + pointer_default(unique) +] +interface IConfigInterleaving : IUnknown +{ + typedef enum InterleavingMode { + INTERLEAVE_NONE, + INTERLEAVE_CAPTURE, + INTERLEAVE_FULL, + INTERLEAVE_NONE_BUFFERED + } InterleavingMode; + + HRESULT put_Mode( + [in] InterleavingMode mode); + + HRESULT get_Mode( + [out] InterleavingMode *pMode); + + HRESULT put_Interleaving( + [in] const REFERENCE_TIME *prtInterleave, + [in] const REFERENCE_TIME *prtPreroll); + + HRESULT get_Interleaving( + [out] REFERENCE_TIME *prtInterleave, + [out] REFERENCE_TIME *prtPreroll); +} + +[ + local, + object, + uuid(9fd52741-176d-4b36-8f51-ca8f933223be), + pointer_default(unique) +] +interface IAMClockSlave : IUnknown +{ + HRESULT SetErrorTolerance( + [in] DWORD dwTolerance); + + HRESULT GetErrorTolerance( + [out] DWORD *pdwTolerance); +} + +typedef struct _AMCOPPSignature { + BYTE Signature[256]; +} AMCOPPSignature; + +typedef struct _AMCOPPCommand { + GUID macKDI; + GUID guidCommandID; + DWORD dwSequence; + DWORD bSizeData; + BYTE CommandData[4056]; +} AMCOPPCommand, *LPAMCOPPCommand; + +typedef struct _AMCOPPStatusInput { + GUID rApp; + GUID guidStatusRequestID; + DWORD dwSequence; + DWORD cbSizeData; + BYTE StatusData[4056]; +} AMCOPPStatusInput, *LPAMCOPPStatusInput; + +typedef struct _AMCOPPStatusOutput { + GUID macKDI; + DWORD cbSizeData; + BYTE COPPStatus[4076]; +} AMCOPPStatusOutput, *LPAMCOPPStatusOutput; + +[ + local, + object, + uuid(6feded3e-0ff1-4901-a2f1-43f7012c8515), + pointer_default(unique) +] +interface IAMCertifiedOutputProtection : IUnknown +{ + HRESULT KeyExchange ( + [out] GUID* pRandom, + [out] BYTE** VarLenCertGH, + [out] DWORD* pdwLengthCertGH); + + HRESULT SessionSequenceStart( + [in] AMCOPPSignature* pSig); + + HRESULT ProtectionCommand( + [in] const AMCOPPCommand* cmd); + + HRESULT ProtectionStatus( + [in] const AMCOPPStatusInput* pStatusInput, + [out] AMCOPPStatusOutput* pStatusOutput); +}; + enum _AM_RENSDEREXFLAGS { AM_RENDEREX_RENDERTOEXISTINGRENDERERS = 0x01 diff --git a/include/dxsdk/d3dx9anim.h b/include/dxsdk/d3dx9anim.h index 2ae780d157a..b5f2232fdb2 100644 --- a/include/dxsdk/d3dx9anim.h +++ b/include/dxsdk/d3dx9anim.h @@ -92,7 +92,7 @@ typedef struct _D3DXMESHDATA typedef struct _D3DXMESHCONTAINER { - LPSTR Name; + char *Name; D3DXMESHDATA MeshData; LPD3DXMATERIAL pMaterials; LPD3DXEFFECTINSTANCE pEffects; @@ -104,7 +104,7 @@ typedef struct _D3DXMESHCONTAINER typedef struct _D3DXFRAME { - LPSTR Name; + char *Name; D3DXMATRIX TransformationMatrix; LPD3DXMESHCONTAINER pMeshContainer; struct _D3DXFRAME *pFrameSibling; @@ -125,8 +125,8 @@ typedef struct _D3DXKEY_QUATERNION typedef struct _D3DXKEY_CALLBACK { - FLOAT Time; - LPVOID pCallbackData; + float Time; + void *pCallbackData; } D3DXKEY_CALLBACK, *LPD3DXKEY_CALLBACK; typedef struct _D3DXTRACK_DESC @@ -170,7 +170,7 @@ typedef interface ID3DXAnimationController *LPD3DXANIMATIONCONTROLLER; #define INTERFACE ID3DXAllocateHierarchy DECLARE_INTERFACE(ID3DXAllocateHierarchy) { - STDMETHOD(CreateFrame)(THIS_ LPCSTR Name, LPD3DXFRAME *new_frame) PURE; + STDMETHOD(CreateFrame)(THIS_ const char *name, D3DXFRAME **new_frame) PURE; STDMETHOD(CreateMeshContainer)(THIS_ const char *name, const D3DXMESHDATA *mesh_data, const D3DXMATERIAL *materials, const D3DXEFFECTINSTANCE *effect_instances, DWORD num_materials, const DWORD *adjacency, ID3DXSkinInfo *skin_info, @@ -207,20 +207,20 @@ DECLARE_INTERFACE(ID3DXSaveUserData) DECLARE_INTERFACE_(ID3DXAnimationSet, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXAnimationSet methods ***/ - STDMETHOD_(LPCSTR, GetName)(THIS) PURE; + STDMETHOD_(const char *, GetName)(THIS) PURE; STDMETHOD_(DOUBLE, GetPeriod)(THIS) PURE; STDMETHOD_(DOUBLE, GetPeriodicPosition)(THIS_ DOUBLE position) PURE; STDMETHOD_(UINT, GetNumAnimations)(THIS) PURE; - STDMETHOD(GetAnimationNameByIndex)(THIS_ UINT index, LPCSTR *name) PURE; - STDMETHOD(GetAnimationIndexByName)(THIS_ LPCSTR name, UINT *index) PURE; + STDMETHOD(GetAnimationNameByIndex)(THIS_ UINT index, const char **name) PURE; + STDMETHOD(GetAnimationIndexByName)(THIS_ const char *name, UINT *index) PURE; STDMETHOD(GetSRT)(THIS_ DOUBLE periodic_position, UINT animation, D3DXVECTOR3 *scale, D3DXQUATERNION *rotation, D3DXVECTOR3 *translation) PURE; - STDMETHOD(GetCallback)(THIS_ DOUBLE position, DWORD flags, DOUBLE *callback_position, - LPVOID *callback_data) PURE; + STDMETHOD(GetCallback)(THIS_ double position, DWORD flags, double *callback_position, + void **callback_data) PURE; }; #undef INTERFACE @@ -228,20 +228,20 @@ DECLARE_INTERFACE_(ID3DXAnimationSet, IUnknown) DECLARE_INTERFACE_(ID3DXKeyframedAnimationSet, ID3DXAnimationSet) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXAnimationSet methods ***/ - STDMETHOD_(LPCSTR, GetName)(THIS) PURE; + STDMETHOD_(const char *, GetName)(THIS) PURE; STDMETHOD_(DOUBLE, GetPeriod)(THIS) PURE; STDMETHOD_(DOUBLE, GetPeriodicPosition)(THIS_ DOUBLE position) PURE; STDMETHOD_(UINT, GetNumAnimations)(THIS) PURE; - STDMETHOD(GetAnimationNameByIndex)(THIS_ UINT index, LPCSTR *name) PURE; - STDMETHOD(GetAnimationIndexByName)(THIS_ LPCSTR name, UINT *index) PURE; + STDMETHOD(GetAnimationNameByIndex)(THIS_ UINT index, const char **name) PURE; + STDMETHOD(GetAnimationIndexByName)(THIS_ const char *name, UINT *index) PURE; STDMETHOD(GetSRT)(THIS_ DOUBLE periodic_position, UINT animation, D3DXVECTOR3 *scale, D3DXQUATERNION *rotation, D3DXVECTOR3 *translation) PURE; - STDMETHOD(GetCallback)(THIS_ DOUBLE position, DWORD flags, DOUBLE *callback_position, - LPVOID *callback_data) PURE; + STDMETHOD(GetCallback)(THIS_ double position, DWORD flags, double *callback_position, + void **callback_data) PURE; /*** ID3DXKeyframedAnimationSet methods ***/ STDMETHOD_(D3DXPLAYBACK_TYPE, GetPlaybackType)(THIS) PURE; STDMETHOD_(DOUBLE, GetSourceTicksPerSecond)(THIS) PURE; @@ -264,9 +264,9 @@ DECLARE_INTERFACE_(ID3DXKeyframedAnimationSet, ID3DXAnimationSet) STDMETHOD(UnregisterScaleKey)(THIS_ UINT animation, UINT key) PURE; STDMETHOD(UnregisterRotationKey)(THIS_ UINT animation, UINT key) PURE; STDMETHOD(UnregisterTranslationKey)(THIS_ UINT animation, UINT key) PURE; - STDMETHOD(RegisterAnimationSRTKeys)(THIS_ LPCSTR name, UINT num_scale_keys, - UINT num_rotation_keys, UINT num_translation_keys, CONST D3DXKEY_VECTOR3 *scale_keys, - CONST D3DXKEY_QUATERNION *rotation_keys, CONST D3DXKEY_VECTOR3 *translation_keys, + STDMETHOD(RegisterAnimationSRTKeys)(THIS_ const char *name, UINT num_scale_keys, + UINT num_rotation_keys, UINT num_translation_keys, const D3DXKEY_VECTOR3 *scale_keys, + const D3DXKEY_QUATERNION *rotation_keys, const D3DXKEY_VECTOR3 *translation_keys, DWORD *animation_index) PURE; STDMETHOD(Compress)(THIS_ DWORD flags, float lossiness, D3DXFRAME *hierarchy, ID3DXBuffer **compressed_data) PURE; @@ -278,20 +278,20 @@ DECLARE_INTERFACE_(ID3DXKeyframedAnimationSet, ID3DXAnimationSet) DECLARE_INTERFACE_(ID3DXCompressedAnimationSet, ID3DXAnimationSet) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXAnimationSet methods ***/ - STDMETHOD_(LPCSTR, GetName)(THIS) PURE; + STDMETHOD_(const char *, GetName)(THIS) PURE; STDMETHOD_(DOUBLE, GetPeriod)(THIS) PURE; STDMETHOD_(DOUBLE, GetPeriodicPosition)(THIS_ DOUBLE position) PURE; STDMETHOD_(UINT, GetNumAnimations)(THIS) PURE; - STDMETHOD(GetAnimationNameByIndex)(THIS_ UINT index, LPCSTR *name) PURE; - STDMETHOD(GetAnimationIndexByName)(THIS_ LPCSTR name, UINT *index) PURE; + STDMETHOD(GetAnimationNameByIndex)(THIS_ UINT index, const char **name) PURE; + STDMETHOD(GetAnimationIndexByName)(THIS_ const char *name, UINT *index) PURE; STDMETHOD(GetSRT)(THIS_ DOUBLE periodic_position, UINT animation, D3DXVECTOR3 *scale, D3DXQUATERNION *rotation, D3DXVECTOR3 *translation) PURE; - STDMETHOD(GetCallback)(THIS_ DOUBLE position, DWORD flags, DOUBLE *callback_position, - LPVOID *callback_data) PURE; + STDMETHOD(GetCallback)(THIS_ double position, DWORD flags, double *callback_position, + void **callback_data) PURE; /*** ID3DXCompressedAnimationSet methods ***/ STDMETHOD_(D3DXPLAYBACK_TYPE, GetPlaybackType)(THIS) PURE; STDMETHOD_(DOUBLE, GetSourceTicksPerSecond)(THIS) PURE; @@ -304,7 +304,7 @@ DECLARE_INTERFACE_(ID3DXCompressedAnimationSet, ID3DXAnimationSet) #define INTERFACE ID3DXAnimationCallbackHandler DECLARE_INTERFACE(ID3DXAnimationCallbackHandler) { - STDMETHOD(HandleCallback)(THIS_ UINT track, LPVOID callback_data) PURE; + STDMETHOD(HandleCallback)(THIS_ UINT track, void *callback_data) PURE; }; #undef INTERFACE @@ -312,7 +312,7 @@ DECLARE_INTERFACE(ID3DXAnimationCallbackHandler) DECLARE_INTERFACE_(ID3DXAnimationController, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXAnimationController methods ***/ @@ -320,7 +320,7 @@ DECLARE_INTERFACE_(ID3DXAnimationController, IUnknown) STDMETHOD_(UINT, GetMaxNumAnimationSets)(THIS) PURE; STDMETHOD_(UINT, GetMaxNumTracks)(THIS) PURE; STDMETHOD_(UINT, GetMaxNumEvents)(THIS) PURE; - STDMETHOD(RegisterAnimationOutput)(THIS_ LPCSTR name, D3DXMATRIX *matrix, + STDMETHOD(RegisterAnimationOutput)(THIS_ const char *name, D3DXMATRIX *matrix, D3DXVECTOR3 *scale, D3DXQUATERNION *rotation, D3DXVECTOR3 *translation) PURE; STDMETHOD(RegisterAnimationSet)(THIS_ ID3DXAnimationSet *anim_set) PURE; STDMETHOD(UnregisterAnimationSet)(THIS_ ID3DXAnimationSet *anim_set) PURE; @@ -386,11 +386,12 @@ HRESULT WINAPI D3DXSaveMeshHierarchyToFileW(const WCHAR *filename, DWORD format, ID3DXSaveUserData *user_data_saver); #define D3DXSaveMeshHierarchyToFile WINELIB_NAME_AW(D3DXSaveMeshHierarchyToFile) HRESULT WINAPI D3DXFrameDestroy(D3DXFRAME *frame_root, ID3DXAllocateHierarchy *alloc); -HRESULT WINAPI D3DXFrameAppendChild(LPD3DXFRAME, CONST D3DXFRAME*); -LPD3DXFRAME WINAPI D3DXFrameFind(CONST D3DXFRAME*, LPCSTR); +HRESULT WINAPI D3DXFrameAppendChild(D3DXFRAME *parent, const D3DXFRAME *child); +D3DXFRAME * WINAPI D3DXFrameFind(const D3DXFRAME *root, const char *name); HRESULT WINAPI D3DXFrameRegisterNamedMatrices(D3DXFRAME *frame_root, ID3DXAnimationController *animation_controller); -UINT WINAPI D3DXFrameNumNamedMatrices(CONST D3DXFRAME *frame_root); -HRESULT WINAPI D3DXFrameCalculateBoundingSphere(CONST D3DXFRAME*, LPD3DXVECTOR3, FLOAT*); +UINT WINAPI D3DXFrameNumNamedMatrices(const D3DXFRAME *frame_root); +HRESULT WINAPI D3DXFrameCalculateBoundingSphere(const D3DXFRAME *frame_root, D3DXVECTOR3 *center, + FLOAT *radius); HRESULT WINAPI D3DXCreateKeyframedAnimationSet(const char *name, double ticks_per_second, D3DXPLAYBACK_TYPE playback_type, UINT animation_count, UINT callback_key_count, const D3DXKEY_CALLBACK *callback_keys, ID3DXKeyframedAnimationSet **animation_set); diff --git a/include/dxsdk/d3dx9core.h b/include/dxsdk/d3dx9core.h index c28fe7128bc..5233317bc04 100644 --- a/include/dxsdk/d3dx9core.h +++ b/include/dxsdk/d3dx9core.h @@ -27,7 +27,9 @@ /* D3DX_VERSION will be completely ignored since we are implementing all dlls from d3dx9_24 to d3dx9_36 */ #define D3DX_VERSION 0x0902 +#ifndef D3DX_SDK_VERSION #define D3DX_SDK_VERSION 36 +#endif #define D3DXSPRITE_DONOTSAVESTATE 0x00000001 #define D3DXSPRITE_DONOTMODIFY_RENDERSTATE 0x00000002 #define D3DXSPRITE_OBJECTSPACE 0x00000004 @@ -65,11 +67,11 @@ typedef struct ID3DXSprite *LPD3DXSPRITE; DECLARE_INTERFACE_(ID3DXBuffer, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXBuffer methods ***/ - STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE; + STDMETHOD_(void *, GetBufferPointer)(THIS) PURE; STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE; }; #undef INTERFACE @@ -127,7 +129,7 @@ DECL_WINELIB_TYPE_AW(LPD3DXFONT_DESC) DECLARE_INTERFACE_(ID3DXFont, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXFont methods ***/ @@ -143,7 +145,7 @@ DECLARE_INTERFACE_(ID3DXFont, IUnknown) STDMETHOD(PreloadCharacters)(THIS_ UINT first, UINT last) PURE; STDMETHOD(PreloadGlyphs)(THIS_ UINT first, UINT last) PURE; - STDMETHOD(PreloadTextA)(THIS_ LPCSTR string, INT count) PURE; + STDMETHOD(PreloadTextA)(THIS_ const char *string, INT count) PURE; STDMETHOD(PreloadTextW)(THIS_ const WCHAR *string, INT count) PURE; STDMETHOD_(INT, DrawTextA)(THIS_ struct ID3DXSprite *sprite, const char *string, @@ -209,7 +211,7 @@ DECLARE_INTERFACE_(ID3DXFont, IUnknown) DECLARE_INTERFACE_(ID3DXLine, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; @@ -217,9 +219,9 @@ DECLARE_INTERFACE_(ID3DXLine, IUnknown) STDMETHOD(GetDevice)(THIS_ struct IDirect3DDevice9 **device) PURE; STDMETHOD(Begin)(THIS) PURE; - STDMETHOD(Draw)(THIS_ CONST D3DXVECTOR2 *vertexlist, DWORD vertexlistcount, D3DCOLOR color) PURE; - STDMETHOD(DrawTransform)(THIS_ CONST D3DXVECTOR3 *vertexlist, DWORD vertexlistcount, - CONST D3DXMATRIX *transform, D3DCOLOR color) PURE; + STDMETHOD(Draw)(THIS_ const D3DXVECTOR2 *vertexlist, DWORD vertexlistcount, D3DCOLOR color) PURE; + STDMETHOD(DrawTransform)(THIS_ const D3DXVECTOR3 *vertexlist, DWORD vertexlistcount, + const D3DXMATRIX *transform, D3DCOLOR color) PURE; STDMETHOD(SetPattern)(THIS_ DWORD pattern) PURE; STDMETHOD_(DWORD, GetPattern)(THIS) PURE; STDMETHOD(SetPatternScale)(THIS_ FLOAT scale) PURE; @@ -298,7 +300,7 @@ typedef struct _D3DXRTE_DESC DECLARE_INTERFACE_(ID3DXRenderToEnvMap, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; @@ -366,7 +368,7 @@ typedef struct _D3DXRTS_DESC DECLARE_INTERFACE_(ID3DXRenderToSurface, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXRenderToSurface methods ***/ @@ -411,16 +413,16 @@ DECLARE_INTERFACE_(ID3DXRenderToSurface, IUnknown) DECLARE_INTERFACE_(ID3DXSprite, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **object) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXSprite methods ***/ STDMETHOD(GetDevice)(THIS_ struct IDirect3DDevice9 **device) PURE; STDMETHOD(GetTransform)(THIS_ D3DXMATRIX *transform) PURE; - STDMETHOD(SetTransform)(THIS_ CONST D3DXMATRIX *transform) PURE; - STDMETHOD(SetWorldViewRH)(THIS_ CONST D3DXMATRIX *world, CONST D3DXMATRIX *view) PURE; - STDMETHOD(SetWorldViewLH)(THIS_ CONST D3DXMATRIX *world, CONST D3DXMATRIX *view) PURE; + STDMETHOD(SetTransform)(THIS_ const D3DXMATRIX *transform) PURE; + STDMETHOD(SetWorldViewRH)(THIS_ const D3DXMATRIX *world, const D3DXMATRIX *view) PURE; + STDMETHOD(SetWorldViewLH)(THIS_ const D3DXMATRIX *world, const D3DXMATRIX *view) PURE; STDMETHOD(Begin)(THIS_ DWORD flags) PURE; STDMETHOD(Draw)(THIS_ struct IDirect3DTexture9 *texture, const RECT *rect, diff --git a/include/dxsdk/d3dx9effect.h b/include/dxsdk/d3dx9effect.h index 0fd27ff0989..25d1fd23f96 100644 --- a/include/dxsdk/d3dx9effect.h +++ b/include/dxsdk/d3dx9effect.h @@ -31,16 +31,18 @@ #define D3DX_PARAMETER_LITERAL 2 #define D3DX_PARAMETER_ANNOTATION 4 -typedef struct _D3DXEFFECT_DESC { - LPCSTR Creator; +typedef struct _D3DXEFFECT_DESC +{ + const char *Creator; UINT Parameters; UINT Techniques; UINT Functions; } D3DXEFFECT_DESC; -typedef struct _D3DXPARAMETER_DESC { - LPCSTR Name; - LPCSTR Semantic; +typedef struct _D3DXPARAMETER_DESC +{ + const char *Name; + const char *Semantic; D3DXPARAMETER_CLASS Class; D3DXPARAMETER_TYPE Type; UINT Rows; @@ -52,21 +54,24 @@ typedef struct _D3DXPARAMETER_DESC { UINT Bytes; } D3DXPARAMETER_DESC; -typedef struct _D3DXTECHNIQUE_DESC { - LPCSTR Name; +typedef struct _D3DXTECHNIQUE_DESC +{ + const char *Name; UINT Passes; UINT Annotations; } D3DXTECHNIQUE_DESC; -typedef struct _D3DXPASS_DESC { - LPCSTR Name; +typedef struct _D3DXPASS_DESC +{ + const char *Name; UINT Annotations; - CONST DWORD *pVertexShaderFunction; - CONST DWORD *pPixelShaderFunction; + const DWORD *pVertexShaderFunction; + const DWORD *pPixelShaderFunction; } D3DXPASS_DESC; -typedef struct _D3DXFUNCTION_DESC { - LPCSTR Name; +typedef struct _D3DXFUNCTION_DESC +{ + const char *Name; UINT Annotations; } D3DXFUNCTION_DESC; @@ -80,7 +85,7 @@ DEFINE_GUID(IID_ID3DXEffectPool, 0x9537ab04, 0x3250, 0x412e, 0x82, 0x13, 0xfc, 0 DECLARE_INTERFACE_(ID3DXEffectPool, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; }; @@ -95,7 +100,7 @@ DEFINE_GUID(IID_ID3DXBaseEffect, 0x17c18ac, 0x103f, 0x4417, 0x8c, 0x51, 0x6b, 0x DECLARE_INTERFACE_(ID3DXBaseEffect, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXBaseEffect methods ***/ @@ -105,49 +110,49 @@ DECLARE_INTERFACE_(ID3DXBaseEffect, IUnknown) STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE pass, D3DXPASS_DESC* desc) PURE; STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE shader, D3DXFUNCTION_DESC* desc) PURE; STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE parameter, UINT index) PURE; - STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE parameter, LPCSTR name) PURE; - STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE parameter, LPCSTR semantic) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE parameter, const char *name) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE parameter, const char *semantic) PURE; STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE parameter, UINT index) PURE; STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT index) PURE; - STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ const char *name) PURE; STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE technique, UINT index) PURE; - STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE technique, LPCSTR name) PURE; + STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE technique, const char *name) PURE; STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT index); - STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR name); + STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ const char *name); STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE object, UINT index) PURE; - STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE object, LPCSTR name) PURE; - STDMETHOD(SetValue)(THIS_ D3DXHANDLE parameter, LPCVOID data, UINT bytes) PURE; - STDMETHOD(GetValue)(THIS_ D3DXHANDLE parameter, LPVOID data, UINT bytes) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE object, const char *name) PURE; + STDMETHOD(SetValue)(THIS_ D3DXHANDLE parameter, const void *data, UINT bytes) PURE; + STDMETHOD(GetValue)(THIS_ D3DXHANDLE parameter, void *data, UINT bytes) PURE; STDMETHOD(SetBool)(THIS_ D3DXHANDLE parameter, BOOL b) PURE; STDMETHOD(GetBool)(THIS_ D3DXHANDLE parameter, BOOL* b) PURE; - STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE parameter, CONST BOOL* b, UINT count) PURE; + STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE parameter, const BOOL *b, UINT count) PURE; STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE parameter, BOOL* b, UINT count) PURE; STDMETHOD(SetInt)(THIS_ D3DXHANDLE parameter, INT n) PURE; STDMETHOD(GetInt)(THIS_ D3DXHANDLE parameter, INT* n) PURE; - STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE parameter, CONST INT* n, UINT count) PURE; + STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE parameter, const INT *n, UINT count) PURE; STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE parameter, INT* n, UINT count) PURE; STDMETHOD(SetFloat)(THIS_ D3DXHANDLE parameter, FLOAT f) PURE; STDMETHOD(GetFloat)(THIS_ D3DXHANDLE parameter, FLOAT* f) PURE; - STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE parameter, CONST FLOAT* f, UINT count) PURE; + STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE parameter, const FLOAT *f, UINT count) PURE; STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE parameter, FLOAT* f, UINT count) PURE; - STDMETHOD(SetVector)(THIS_ D3DXHANDLE parameter, CONST D3DXVECTOR4* vector) PURE; + STDMETHOD(SetVector)(THIS_ D3DXHANDLE parameter, const D3DXVECTOR4 *vector) PURE; STDMETHOD(GetVector)(THIS_ D3DXHANDLE parameter, D3DXVECTOR4* vector) PURE; - STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE parameter, CONST D3DXVECTOR4* vector, UINT count) PURE; + STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE parameter, const D3DXVECTOR4 *vector, UINT count) PURE; STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE parameter, D3DXVECTOR4* vector, UINT count) PURE; - STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE parameter, CONST D3DXMATRIX* matrix) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX *matrix) PURE; STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE parameter, D3DXMATRIX* matrix) PURE; - STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE parameter, CONST D3DXMATRIX* matrix, UINT count) PURE; + STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX *matrix, UINT count) PURE; STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE parameter, D3DXMATRIX* matrix, UINT count) PURE; - STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE parameter, CONST D3DXMATRIX** matrix, UINT count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX **matrix, UINT count) PURE; STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE parameter, D3DXMATRIX** matrix, UINT count) PURE; - STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE parameter, CONST D3DXMATRIX* matrix) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX *matrix) PURE; STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE parameter, D3DXMATRIX* matrix) PURE; - STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE parameter, CONST D3DXMATRIX* matrix, UINT count) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX *matrix, UINT count) PURE; STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE parameter, D3DXMATRIX* matrix, UINT count) PURE; - STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE parameter, CONST D3DXMATRIX** matrix, UINT count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX **matrix, UINT count) PURE; STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE parameter, D3DXMATRIX** matrix, UINT count) PURE; - STDMETHOD(SetString)(THIS_ D3DXHANDLE parameter, LPCSTR string) PURE; - STDMETHOD(GetString)(THIS_ D3DXHANDLE parameter, LPCSTR* string) PURE; + STDMETHOD(SetString)(THIS_ D3DXHANDLE parameter, const char *string) PURE; + STDMETHOD(GetString)(THIS_ D3DXHANDLE parameter, const char **string) PURE; STDMETHOD(SetTexture)(THIS_ D3DXHANDLE parameter, struct IDirect3DBaseTexture9 *texture) PURE; STDMETHOD(GetTexture)(THIS_ D3DXHANDLE parameter, struct IDirect3DBaseTexture9 **texture) PURE; STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE parameter, struct IDirect3DPixelShader9 **shader) PURE; @@ -165,13 +170,13 @@ DEFINE_GUID(IID_ID3DXEffectStateManager, 0x79aab587, 0x6dbc, 0x4fa7, 0x82, 0xde, DECLARE_INTERFACE_(ID3DXEffectStateManager, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXEffectStateManager methods ***/ - STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE state, CONST D3DMATRIX* matrix) PURE; - STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9* material) PURE; - STDMETHOD(SetLight)(THIS_ DWORD index, CONST D3DLIGHT9* light) PURE; + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE state, const D3DMATRIX *matrix) PURE; + STDMETHOD(SetMaterial)(THIS_ const D3DMATERIAL9 *material) PURE; + STDMETHOD(SetLight)(THIS_ DWORD index, const D3DLIGHT9 *light) PURE; STDMETHOD(LightEnable)(THIS_ DWORD index, BOOL enable) PURE; STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE state, DWORD value) PURE; STDMETHOD(SetTexture)(THIS_ DWORD stage, struct IDirect3DBaseTexture9 *texture) PURE; @@ -180,13 +185,13 @@ DECLARE_INTERFACE_(ID3DXEffectStateManager, IUnknown) STDMETHOD(SetNPatchMode)(THIS_ FLOAT num_segments) PURE; STDMETHOD(SetFVF)(THIS_ DWORD format) PURE; STDMETHOD(SetVertexShader)(THIS_ struct IDirect3DVertexShader9 *shader) PURE; - STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT register_index, CONST FLOAT* constant_data, UINT register_count) PURE; - STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT register_index, CONST INT* constant_data, UINT register_count) PURE; - STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT register_index, CONST BOOL* constant_data, UINT register_count) PURE; + STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT register_index, const FLOAT *constant_data, UINT register_count) PURE; + STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT register_index, const INT *constant_data, UINT register_count) PURE; + STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT register_index, const BOOL *constant_data, UINT register_count) PURE; STDMETHOD(SetPixelShader)(THIS_ struct IDirect3DPixelShader9 *shader) PURE; - STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT register_index, CONST FLOAT* constant_data, UINT register_count) PURE; - STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT register_index, CONST INT * constant_data, UINT register_count) PURE; - STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT register_index, CONST BOOL* constant_data, UINT register_count) PURE; + STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT register_index, const FLOAT *constant_data, UINT register_count) PURE; + STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT register_index, const INT *constant_data, UINT register_count) PURE; + STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT register_index, const BOOL *constant_data, UINT register_count) PURE; }; #undef INTERFACE @@ -199,7 +204,7 @@ DEFINE_GUID(IID_ID3DXEffect, 0xf6ceb4b3, 0x4e4c, 0x40dd, 0xb8, 0x83, 0x8d, 0x8d, DECLARE_INTERFACE_(ID3DXEffect, ID3DXBaseEffect) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXBaseEffect methods ***/ @@ -209,49 +214,49 @@ DECLARE_INTERFACE_(ID3DXEffect, ID3DXBaseEffect) STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE pass, D3DXPASS_DESC* desc) PURE; STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE shader, D3DXFUNCTION_DESC* desc) PURE; STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE parameter, UINT index) PURE; - STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE parameter, LPCSTR name) PURE; - STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE parameter, LPCSTR semantic) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE parameter, const char *name) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE parameter, const char *semantic) PURE; STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE parameter, UINT index) PURE; STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT index) PURE; - STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ const char *name) PURE; STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE technique, UINT index) PURE; - STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE technique, LPCSTR name) PURE; + STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE technique, const char *name) PURE; STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT index); - STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR name); + STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ const char *name); STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE object, UINT index) PURE; - STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE object, LPCSTR name) PURE; - STDMETHOD(SetValue)(THIS_ D3DXHANDLE parameter, LPCVOID data, UINT bytes) PURE; - STDMETHOD(GetValue)(THIS_ D3DXHANDLE parameter, LPVOID data, UINT bytes) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE object, const char *name) PURE; + STDMETHOD(SetValue)(THIS_ D3DXHANDLE parameter, const void *data, UINT bytes) PURE; + STDMETHOD(GetValue)(THIS_ D3DXHANDLE parameter, void *data, UINT bytes) PURE; STDMETHOD(SetBool)(THIS_ D3DXHANDLE parameter, BOOL b) PURE; STDMETHOD(GetBool)(THIS_ D3DXHANDLE parameter, BOOL* b) PURE; - STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE parameter, CONST BOOL* b, UINT count) PURE; + STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE parameter, const BOOL *b, UINT count) PURE; STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE parameter, BOOL* b, UINT count) PURE; STDMETHOD(SetInt)(THIS_ D3DXHANDLE parameter, INT n) PURE; STDMETHOD(GetInt)(THIS_ D3DXHANDLE parameter, INT* n) PURE; - STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE parameter, CONST INT* n, UINT count) PURE; + STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE parameter, const INT *n, UINT count) PURE; STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE parameter, INT* n, UINT count) PURE; STDMETHOD(SetFloat)(THIS_ D3DXHANDLE parameter, FLOAT f) PURE; STDMETHOD(GetFloat)(THIS_ D3DXHANDLE parameter, FLOAT* f) PURE; - STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE parameter, CONST FLOAT* f, UINT count) PURE; + STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE parameter, const FLOAT *f, UINT count) PURE; STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE parameter, FLOAT* f, UINT count) PURE; - STDMETHOD(SetVector)(THIS_ D3DXHANDLE parameter, CONST D3DXVECTOR4* vector) PURE; + STDMETHOD(SetVector)(THIS_ D3DXHANDLE parameter, const D3DXVECTOR4 *vector) PURE; STDMETHOD(GetVector)(THIS_ D3DXHANDLE parameter, D3DXVECTOR4* vector) PURE; - STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE parameter, CONST D3DXVECTOR4* vector, UINT count) PURE; + STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE parameter, const D3DXVECTOR4 *vector, UINT count) PURE; STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE parameter, D3DXVECTOR4* vector, UINT count) PURE; - STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE parameter, CONST D3DXMATRIX* matrix) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX *matrix) PURE; STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE parameter, D3DXMATRIX* matrix) PURE; - STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE parameter, CONST D3DXMATRIX* matrix, UINT count) PURE; + STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX *matrix, UINT count) PURE; STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE parameter, D3DXMATRIX* matrix, UINT count) PURE; - STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE parameter, CONST D3DXMATRIX** matrix, UINT count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX **matrix, UINT count) PURE; STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE parameter, D3DXMATRIX** matrix, UINT count) PURE; - STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE parameter, CONST D3DXMATRIX* matrix) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX *matrix) PURE; STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE parameter, D3DXMATRIX* matrix) PURE; - STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE parameter, CONST D3DXMATRIX* matrix, UINT count) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX *matrix, UINT count) PURE; STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE parameter, D3DXMATRIX* matrix, UINT count) PURE; - STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE parameter, CONST D3DXMATRIX** matrix, UINT count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX **matrix, UINT count) PURE; STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE parameter, D3DXMATRIX** matrix, UINT count) PURE; - STDMETHOD(SetString)(THIS_ D3DXHANDLE parameter, LPCSTR string) PURE; - STDMETHOD(GetString)(THIS_ D3DXHANDLE parameter, LPCSTR* string) PURE; + STDMETHOD(SetString)(THIS_ D3DXHANDLE parameter, const char *string) PURE; + STDMETHOD(GetString)(THIS_ D3DXHANDLE parameter, const char **string) PURE; STDMETHOD(SetTexture)(THIS_ D3DXHANDLE parameter, struct IDirect3DBaseTexture9 *texture) PURE; STDMETHOD(GetTexture)(THIS_ D3DXHANDLE parameter, struct IDirect3DBaseTexture9 **texture) PURE; STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE parameter, struct IDirect3DPixelShader9 **shader) PURE; @@ -279,7 +284,7 @@ DECLARE_INTERFACE_(ID3DXEffect, ID3DXBaseEffect) STDMETHOD(ApplyParameterBlock)(THIS_ D3DXHANDLE parameter_block) PURE; STDMETHOD(DeleteParameterBlock)(THIS_ D3DXHANDLE parameter_block) PURE; STDMETHOD(CloneEffect)(THIS_ struct IDirect3DDevice9 *device, struct ID3DXEffect **effect) PURE; - STDMETHOD(SetRawValue)(THIS_ D3DXHANDLE parameter, LPCVOID data, UINT byte_offset, UINT bytes) PURE; + STDMETHOD(SetRawValue)(THIS_ D3DXHANDLE parameter, const void *data, UINT byte_offset, UINT bytes) PURE; }; #undef INTERFACE @@ -292,7 +297,7 @@ DEFINE_GUID(IID_ID3DXEffectCompiler, 0x51b8a949, 0x1a31, 0x47e6, 0xbe, 0xa0, 0x4 DECLARE_INTERFACE_(ID3DXEffectCompiler, ID3DXBaseEffect) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXBaseEffect methods ***/ @@ -302,49 +307,49 @@ DECLARE_INTERFACE_(ID3DXEffectCompiler, ID3DXBaseEffect) STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE pass, D3DXPASS_DESC* desc) PURE; STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE shader, D3DXFUNCTION_DESC* desc) PURE; STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE parameter, UINT index) PURE; - STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE parameter, LPCSTR name) PURE; - STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE parameter, LPCSTR semantic) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE parameter, const char *name) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE parameter, const char *semantic) PURE; STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE parameter, UINT index) PURE; STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT index) PURE; - STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR name) PURE; + STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ const char *name) PURE; STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE technique, UINT index) PURE; - STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE technique, LPCSTR name) PURE; + STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE technique, const char *name) PURE; STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT index); - STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR name); + STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ const char *name); STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE object, UINT index) PURE; - STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE object, LPCSTR name) PURE; - STDMETHOD(SetValue)(THIS_ D3DXHANDLE parameter, LPCVOID data, UINT bytes) PURE; - STDMETHOD(GetValue)(THIS_ D3DXHANDLE parameter, LPVOID data, UINT bytes) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE object, const char *name) PURE; + STDMETHOD(SetValue)(THIS_ D3DXHANDLE parameter, const void *data, UINT bytes) PURE; + STDMETHOD(GetValue)(THIS_ D3DXHANDLE parameter, void *data, UINT bytes) PURE; STDMETHOD(SetBool)(THIS_ D3DXHANDLE parameter, BOOL b) PURE; STDMETHOD(GetBool)(THIS_ D3DXHANDLE parameter, BOOL* b) PURE; - STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE parameter, CONST BOOL* b, UINT count) PURE; + STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE parameter, const BOOL *b, UINT count) PURE; STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE parameter, BOOL* b, UINT count) PURE; STDMETHOD(SetInt)(THIS_ D3DXHANDLE parameter, INT n) PURE; STDMETHOD(GetInt)(THIS_ D3DXHANDLE parameter, INT* n) PURE; - STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE parameter, CONST INT* n, UINT count) PURE; + STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE parameter, const INT *n, UINT count) PURE; STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE parameter, INT* n, UINT count) PURE; STDMETHOD(SetFloat)(THIS_ D3DXHANDLE parameter, FLOAT f) PURE; STDMETHOD(GetFloat)(THIS_ D3DXHANDLE parameter, FLOAT* f) PURE; - STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE parameter, CONST FLOAT* f, UINT count) PURE; + STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE parameter, const FLOAT *f, UINT count) PURE; STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE parameter, FLOAT* f, UINT count) PURE; - STDMETHOD(SetVector)(THIS_ D3DXHANDLE parameter, CONST D3DXVECTOR4* vector) PURE; + STDMETHOD(SetVector)(THIS_ D3DXHANDLE parameter, const D3DXVECTOR4 *vector) PURE; STDMETHOD(GetVector)(THIS_ D3DXHANDLE parameter, D3DXVECTOR4* vector) PURE; - STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE parameter, CONST D3DXVECTOR4* vector, UINT count) PURE; + STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE parameter, const D3DXVECTOR4 *vector, UINT count) PURE; STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE parameter, D3DXVECTOR4* vector, UINT count) PURE; - STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE parameter, CONST D3DXMATRIX* matrix) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX *matrix) PURE; STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE parameter, D3DXMATRIX* matrix) PURE; - STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE parameter, CONST D3DXMATRIX* matrix, UINT count) PURE; + STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX *matrix, UINT count) PURE; STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE parameter, D3DXMATRIX* matrix, UINT count) PURE; - STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE parameter, CONST D3DXMATRIX** matrix, UINT count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX **matrix, UINT count) PURE; STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE parameter, D3DXMATRIX** matrix, UINT count) PURE; - STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE parameter, CONST D3DXMATRIX* matrix) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX *matrix) PURE; STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE parameter, D3DXMATRIX* matrix) PURE; - STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE parameter, CONST D3DXMATRIX* matrix, UINT count) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX *matrix, UINT count) PURE; STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE parameter, D3DXMATRIX* matrix, UINT count) PURE; - STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE parameter, CONST D3DXMATRIX** matrix, UINT count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX **matrix, UINT count) PURE; STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE parameter, D3DXMATRIX** matrix, UINT count) PURE; - STDMETHOD(SetString)(THIS_ D3DXHANDLE parameter, LPCSTR string) PURE; - STDMETHOD(GetString)(THIS_ D3DXHANDLE parameter, LPCSTR* string) PURE; + STDMETHOD(SetString)(THIS_ D3DXHANDLE parameter, const char *string) PURE; + STDMETHOD(GetString)(THIS_ D3DXHANDLE parameter, const char **string) PURE; STDMETHOD(SetTexture)(THIS_ D3DXHANDLE parameter, struct IDirect3DBaseTexture9 *texture) PURE; STDMETHOD(GetTexture)(THIS_ D3DXHANDLE parameter, struct IDirect3DBaseTexture9 **texture) PURE; STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE parameter, struct IDirect3DPixelShader9 **shader) PURE; diff --git a/include/dxsdk/d3dx9math.h b/include/dxsdk/d3dx9math.h index 36c9df0d95f..2c41b73d423 100644 --- a/include/dxsdk/d3dx9math.h +++ b/include/dxsdk/d3dx9math.h @@ -414,7 +414,7 @@ DEFINE_GUID(IID_ID3DXMatrixStack, DECLARE_INTERFACE_(ID3DXMatrixStack, IUnknown) { - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; STDMETHOD(Pop)(THIS) PURE; diff --git a/include/dxsdk/d3dx9math.inl b/include/dxsdk/d3dx9math.inl index 84c0c623d3b..ee2f82b851c 100644 --- a/include/dxsdk/d3dx9math.inl +++ b/include/dxsdk/d3dx9math.inl @@ -27,7 +27,7 @@ inline D3DXVECTOR2::D3DXVECTOR2() { } -inline D3DXVECTOR2::D3DXVECTOR2(CONST FLOAT *pf) +inline D3DXVECTOR2::D3DXVECTOR2(const FLOAT *pf) { if(!pf) return; x = pf[0]; @@ -45,19 +45,19 @@ inline D3DXVECTOR2::operator FLOAT* () return (FLOAT*)&x; } -inline D3DXVECTOR2::operator CONST FLOAT* () const +inline D3DXVECTOR2::operator const FLOAT* () const { - return (CONST FLOAT*)&x; + return (const FLOAT*)&x; } -inline D3DXVECTOR2& D3DXVECTOR2::operator += (CONST D3DXVECTOR2& v) +inline D3DXVECTOR2& D3DXVECTOR2::operator += (const D3DXVECTOR2& v) { x += v.x; y += v.y; return *this; } -inline D3DXVECTOR2& D3DXVECTOR2::operator -= (CONST D3DXVECTOR2& v) +inline D3DXVECTOR2& D3DXVECTOR2::operator -= (const D3DXVECTOR2& v) { x -= v.x; y -= v.y; @@ -88,12 +88,12 @@ inline D3DXVECTOR2 D3DXVECTOR2::operator - () const return D3DXVECTOR2(-x, -y); } -inline D3DXVECTOR2 D3DXVECTOR2::operator + (CONST D3DXVECTOR2& v) const +inline D3DXVECTOR2 D3DXVECTOR2::operator + (const D3DXVECTOR2& v) const { return D3DXVECTOR2(x + v.x, y + v.y); } -inline D3DXVECTOR2 D3DXVECTOR2::operator - (CONST D3DXVECTOR2& v) const +inline D3DXVECTOR2 D3DXVECTOR2::operator - (const D3DXVECTOR2& v) const { return D3DXVECTOR2(x - v.x, y - v.y); } @@ -108,17 +108,17 @@ inline D3DXVECTOR2 D3DXVECTOR2::operator / (FLOAT f) const return D3DXVECTOR2(x / f, y / f); } -inline D3DXVECTOR2 operator * (FLOAT f, CONST D3DXVECTOR2& v) +inline D3DXVECTOR2 operator * (FLOAT f, const D3DXVECTOR2& v) { return D3DXVECTOR2(f * v.x, f * v.y); } -inline BOOL D3DXVECTOR2::operator == (CONST D3DXVECTOR2& v) const +inline BOOL D3DXVECTOR2::operator == (const D3DXVECTOR2& v) const { return x == v.x && y == v.y; } -inline BOOL D3DXVECTOR2::operator != (CONST D3DXVECTOR2& v) const +inline BOOL D3DXVECTOR2::operator != (const D3DXVECTOR2& v) const { return x != v.x || y != v.y; } @@ -127,7 +127,7 @@ inline D3DXVECTOR3::D3DXVECTOR3() { } -inline D3DXVECTOR3::D3DXVECTOR3(CONST FLOAT *pf) +inline D3DXVECTOR3::D3DXVECTOR3(const FLOAT *pf) { if(!pf) return; x = pf[0]; @@ -135,7 +135,7 @@ inline D3DXVECTOR3::D3DXVECTOR3(CONST FLOAT *pf) z = pf[2]; } -inline D3DXVECTOR3::D3DXVECTOR3(CONST D3DVECTOR& v) +inline D3DXVECTOR3::D3DXVECTOR3(const D3DVECTOR& v) { x = v.x; y = v.y; @@ -154,12 +154,12 @@ inline D3DXVECTOR3::operator FLOAT* () return (FLOAT*)&x; } -inline D3DXVECTOR3::operator CONST FLOAT* () const +inline D3DXVECTOR3::operator const FLOAT* () const { - return (CONST FLOAT*)&x; + return (const FLOAT*)&x; } -inline D3DXVECTOR3& D3DXVECTOR3::operator += (CONST D3DXVECTOR3& v) +inline D3DXVECTOR3& D3DXVECTOR3::operator += (const D3DXVECTOR3& v) { x += v.x; y += v.y; @@ -167,7 +167,7 @@ inline D3DXVECTOR3& D3DXVECTOR3::operator += (CONST D3DXVECTOR3& v) return *this; } -inline D3DXVECTOR3& D3DXVECTOR3::operator -= (CONST D3DXVECTOR3& v) +inline D3DXVECTOR3& D3DXVECTOR3::operator -= (const D3DXVECTOR3& v) { x -= v.x; y -= v.y; @@ -201,12 +201,12 @@ inline D3DXVECTOR3 D3DXVECTOR3::operator - () const return D3DXVECTOR3(-x, -y, -z); } -inline D3DXVECTOR3 D3DXVECTOR3::operator + (CONST D3DXVECTOR3& v) const +inline D3DXVECTOR3 D3DXVECTOR3::operator + (const D3DXVECTOR3& v) const { return D3DXVECTOR3(x + v.x, y + v.y, z + v.z); } -inline D3DXVECTOR3 D3DXVECTOR3::operator - (CONST D3DXVECTOR3& v) const +inline D3DXVECTOR3 D3DXVECTOR3::operator - (const D3DXVECTOR3& v) const { return D3DXVECTOR3(x - v.x, y - v.y, z - v.z); } @@ -221,17 +221,17 @@ inline D3DXVECTOR3 D3DXVECTOR3::operator / (FLOAT f) const return D3DXVECTOR3(x / f, y / f, z / f); } -inline D3DXVECTOR3 operator * (FLOAT f, CONST D3DXVECTOR3& v) +inline D3DXVECTOR3 operator * (FLOAT f, const D3DXVECTOR3& v) { return D3DXVECTOR3(f * v.x, f * v.y, f * v.z); } -inline BOOL D3DXVECTOR3::operator == (CONST D3DXVECTOR3& v) const +inline BOOL D3DXVECTOR3::operator == (const D3DXVECTOR3& v) const { return x == v.x && y == v.y && z == v.z; } -inline BOOL D3DXVECTOR3::operator != (CONST D3DXVECTOR3& v) const +inline BOOL D3DXVECTOR3::operator != (const D3DXVECTOR3& v) const { return x != v.x || y != v.y || z != v.z; } @@ -240,7 +240,7 @@ inline D3DXVECTOR4::D3DXVECTOR4() { } -inline D3DXVECTOR4::D3DXVECTOR4(CONST FLOAT *pf) +inline D3DXVECTOR4::D3DXVECTOR4(const FLOAT *pf) { if(!pf) return; x = pf[0]; @@ -262,12 +262,12 @@ inline D3DXVECTOR4::operator FLOAT* () return (FLOAT*)&x; } -inline D3DXVECTOR4::operator CONST FLOAT* () const +inline D3DXVECTOR4::operator const FLOAT* () const { - return (CONST FLOAT*)&x; + return (const FLOAT*)&x; } -inline D3DXVECTOR4& D3DXVECTOR4::operator += (CONST D3DXVECTOR4& v) +inline D3DXVECTOR4& D3DXVECTOR4::operator += (const D3DXVECTOR4& v) { x += v.x; y += v.y; @@ -276,7 +276,7 @@ inline D3DXVECTOR4& D3DXVECTOR4::operator += (CONST D3DXVECTOR4& v) return *this; } -inline D3DXVECTOR4& D3DXVECTOR4::operator -= (CONST D3DXVECTOR4& v) +inline D3DXVECTOR4& D3DXVECTOR4::operator -= (const D3DXVECTOR4& v) { x -= v.x; y -= v.y; @@ -313,12 +313,12 @@ inline D3DXVECTOR4 D3DXVECTOR4::operator - () const return D3DXVECTOR4(-x, -y, -z, -w); } -inline D3DXVECTOR4 D3DXVECTOR4::operator + (CONST D3DXVECTOR4& v) const +inline D3DXVECTOR4 D3DXVECTOR4::operator + (const D3DXVECTOR4& v) const { return D3DXVECTOR4(x + v.x, y + v.y, z + v.z, w + v.w); } -inline D3DXVECTOR4 D3DXVECTOR4::operator - (CONST D3DXVECTOR4& v) const +inline D3DXVECTOR4 D3DXVECTOR4::operator - (const D3DXVECTOR4& v) const { return D3DXVECTOR4(x - v.x, y - v.y, z - v.z, w - v.w); } @@ -333,17 +333,17 @@ inline D3DXVECTOR4 D3DXVECTOR4::operator / (FLOAT f) const return D3DXVECTOR4(x / f, y / f, z / f, w / f); } -inline D3DXVECTOR4 operator * (FLOAT f, CONST D3DXVECTOR4& v) +inline D3DXVECTOR4 operator * (FLOAT f, const D3DXVECTOR4& v) { return D3DXVECTOR4(f * v.x, f * v.y, f * v.z, f * v.w); } -inline BOOL D3DXVECTOR4::operator == (CONST D3DXVECTOR4& v) const +inline BOOL D3DXVECTOR4::operator == (const D3DXVECTOR4& v) const { return x == v.x && y == v.y && z == v.z && w == v.w; } -inline BOOL D3DXVECTOR4::operator != (CONST D3DXVECTOR4& v) const +inline BOOL D3DXVECTOR4::operator != (const D3DXVECTOR4& v) const { return x != v.x || y != v.y || z != v.z || w != v.w; } @@ -352,13 +352,13 @@ inline D3DXMATRIX::D3DXMATRIX() { } -inline D3DXMATRIX::D3DXMATRIX(CONST FLOAT *pf) +inline D3DXMATRIX::D3DXMATRIX(const FLOAT *pf) { if(!pf) return; memcpy(&_11, pf, sizeof(D3DXMATRIX)); } -inline D3DXMATRIX::D3DXMATRIX(CONST D3DMATRIX& mat) +inline D3DXMATRIX::D3DXMATRIX(const D3DMATRIX& mat) { memcpy(&_11, &mat, sizeof(D3DXMATRIX)); } @@ -389,18 +389,18 @@ inline D3DXMATRIX::operator FLOAT* () return (FLOAT*)&_11; } -inline D3DXMATRIX::operator CONST FLOAT* () const +inline D3DXMATRIX::operator const FLOAT* () const { - return (CONST FLOAT*)&_11; + return (const FLOAT*)&_11; } -inline D3DXMATRIX& D3DXMATRIX::operator *= (CONST D3DXMATRIX& mat) +inline D3DXMATRIX& D3DXMATRIX::operator *= (const D3DXMATRIX& mat) { D3DXMatrixMultiply(this, this, &mat); return *this; } -inline D3DXMATRIX& D3DXMATRIX::operator += (CONST D3DXMATRIX& mat) +inline D3DXMATRIX& D3DXMATRIX::operator += (const D3DXMATRIX& mat) { _11 += mat._11; _12 += mat._12; _13 += mat._13; _14 += mat._14; _21 += mat._21; _22 += mat._22; _23 += mat._23; _24 += mat._24; @@ -409,7 +409,7 @@ inline D3DXMATRIX& D3DXMATRIX::operator += (CONST D3DXMATRIX& mat) return *this; } -inline D3DXMATRIX& D3DXMATRIX::operator -= (CONST D3DXMATRIX& mat) +inline D3DXMATRIX& D3DXMATRIX::operator -= (const D3DXMATRIX& mat) { _11 -= mat._11; _12 -= mat._12; _13 -= mat._13; _14 -= mat._14; _21 -= mat._21; _22 -= mat._22; _23 -= mat._23; _24 -= mat._24; @@ -450,14 +450,14 @@ inline D3DXMATRIX D3DXMATRIX::operator - () const -_41, -_42, -_43, -_44); } -inline D3DXMATRIX D3DXMATRIX::operator * (CONST D3DXMATRIX& mat) const +inline D3DXMATRIX D3DXMATRIX::operator * (const D3DXMATRIX& mat) const { D3DXMATRIX buf; D3DXMatrixMultiply(&buf, this, &mat); return buf; } -inline D3DXMATRIX D3DXMATRIX::operator + (CONST D3DXMATRIX& mat) const +inline D3DXMATRIX D3DXMATRIX::operator + (const D3DXMATRIX& mat) const { return D3DXMATRIX(_11 + mat._11, _12 + mat._12, _13 + mat._13, _14 + mat._14, _21 + mat._21, _22 + mat._22, _23 + mat._23, _24 + mat._24, @@ -465,7 +465,7 @@ inline D3DXMATRIX D3DXMATRIX::operator + (CONST D3DXMATRIX& mat) const _41 + mat._41, _42 + mat._42, _43 + mat._43, _44 + mat._44); } -inline D3DXMATRIX D3DXMATRIX::operator - (CONST D3DXMATRIX& mat) const +inline D3DXMATRIX D3DXMATRIX::operator - (const D3DXMATRIX& mat) const { return D3DXMATRIX(_11 - mat._11, _12 - mat._12, _13 - mat._13, _14 - mat._14, _21 - mat._21, _22 - mat._22, _23 - mat._23, _24 - mat._24, @@ -490,7 +490,7 @@ inline D3DXMATRIX D3DXMATRIX::operator / (FLOAT f) const _41 * inv, _42 * inv, _43 * inv, _44 * inv); } -inline D3DXMATRIX operator * (FLOAT f, CONST D3DXMATRIX& mat) +inline D3DXMATRIX operator * (FLOAT f, const D3DXMATRIX& mat) { return D3DXMATRIX(f * mat._11, f * mat._12, f * mat._13, f * mat._14, f * mat._21, f * mat._22, f * mat._23, f * mat._24, @@ -498,12 +498,12 @@ inline D3DXMATRIX operator * (FLOAT f, CONST D3DXMATRIX& mat) f * mat._41, f * mat._42, f * mat._43, f * mat._44); } -inline BOOL D3DXMATRIX::operator == (CONST D3DXMATRIX& mat) const +inline BOOL D3DXMATRIX::operator == (const D3DXMATRIX& mat) const { return (memcmp(this, &mat, sizeof(D3DXMATRIX)) == 0); } -inline BOOL D3DXMATRIX::operator != (CONST D3DXMATRIX& mat) const +inline BOOL D3DXMATRIX::operator != (const D3DXMATRIX& mat) const { return (memcmp(this, &mat, sizeof(D3DXMATRIX)) != 0); } @@ -512,7 +512,7 @@ inline D3DXQUATERNION::D3DXQUATERNION() { } -inline D3DXQUATERNION::D3DXQUATERNION(CONST FLOAT *pf) +inline D3DXQUATERNION::D3DXQUATERNION(const FLOAT *pf) { if(!pf) return; x = pf[0]; @@ -534,12 +534,12 @@ inline D3DXQUATERNION::operator FLOAT* () return (FLOAT*)&x; } -inline D3DXQUATERNION::operator CONST FLOAT* () const +inline D3DXQUATERNION::operator const FLOAT* () const { - return (CONST FLOAT*)&x; + return (const FLOAT*)&x; } -inline D3DXQUATERNION& D3DXQUATERNION::operator += (CONST D3DXQUATERNION& quat) +inline D3DXQUATERNION& D3DXQUATERNION::operator += (const D3DXQUATERNION& quat) { x += quat.x; y += quat.y; @@ -548,7 +548,7 @@ inline D3DXQUATERNION& D3DXQUATERNION::operator += (CONST D3DXQUATERNION& quat) return *this; } -inline D3DXQUATERNION& D3DXQUATERNION::operator -= (CONST D3DXQUATERNION& quat) +inline D3DXQUATERNION& D3DXQUATERNION::operator -= (const D3DXQUATERNION& quat) { x -= quat.x; y -= quat.y; @@ -557,7 +557,7 @@ inline D3DXQUATERNION& D3DXQUATERNION::operator -= (CONST D3DXQUATERNION& quat) return *this; } -inline D3DXQUATERNION& D3DXQUATERNION::operator *= (CONST D3DXQUATERNION& quat) +inline D3DXQUATERNION& D3DXQUATERNION::operator *= (const D3DXQUATERNION& quat) { D3DXQuaternionMultiply(this, this, &quat); return *this; @@ -592,17 +592,17 @@ inline D3DXQUATERNION D3DXQUATERNION::operator - () const return D3DXQUATERNION(-x, -y, -z, -w); } -inline D3DXQUATERNION D3DXQUATERNION::operator + (CONST D3DXQUATERNION& quat) const +inline D3DXQUATERNION D3DXQUATERNION::operator + (const D3DXQUATERNION& quat) const { return D3DXQUATERNION(x + quat.x, y + quat.y, z + quat.z, w + quat.w); } -inline D3DXQUATERNION D3DXQUATERNION::operator - (CONST D3DXQUATERNION& quat) const +inline D3DXQUATERNION D3DXQUATERNION::operator - (const D3DXQUATERNION& quat) const { return D3DXQUATERNION(x - quat.x, y - quat.y, z - quat.z, w - quat.w); } -inline D3DXQUATERNION D3DXQUATERNION::operator * (CONST D3DXQUATERNION& quat) const +inline D3DXQUATERNION D3DXQUATERNION::operator * (const D3DXQUATERNION& quat) const { D3DXQUATERNION buf; D3DXQuaternionMultiply(&buf, this, &quat); @@ -620,17 +620,17 @@ inline D3DXQUATERNION D3DXQUATERNION::operator / (FLOAT f) const return D3DXQUATERNION(x * inv, y * inv, z * inv, w * inv); } -inline D3DXQUATERNION operator * (FLOAT f, CONST D3DXQUATERNION& quat) +inline D3DXQUATERNION operator * (FLOAT f, const D3DXQUATERNION& quat) { return D3DXQUATERNION(f * quat.x, f * quat.y, f * quat.z, f * quat.w); } -inline BOOL D3DXQUATERNION::operator == (CONST D3DXQUATERNION& quat) const +inline BOOL D3DXQUATERNION::operator == (const D3DXQUATERNION& quat) const { return x == quat.x && y == quat.y && z == quat.z && w == quat.w; } -inline BOOL D3DXQUATERNION::operator != (CONST D3DXQUATERNION& quat) const +inline BOOL D3DXQUATERNION::operator != (const D3DXQUATERNION& quat) const { return x != quat.x || y != quat.y || z != quat.z || w != quat.w; } @@ -639,7 +639,7 @@ inline D3DXPLANE::D3DXPLANE() { } -inline D3DXPLANE::D3DXPLANE(CONST FLOAT *pf) +inline D3DXPLANE::D3DXPLANE(const FLOAT *pf) { if(!pf) return; a = pf[0]; @@ -661,9 +661,9 @@ inline D3DXPLANE::operator FLOAT* () return (FLOAT*)&a; } -inline D3DXPLANE::operator CONST FLOAT* () const +inline D3DXPLANE::operator const FLOAT* () const { - return (CONST FLOAT*)&a; + return (const FLOAT*)&a; } inline D3DXPLANE D3DXPLANE::operator + () const @@ -676,12 +676,12 @@ inline D3DXPLANE D3DXPLANE::operator - () const return D3DXPLANE(-a, -b, -c, -d); } -inline BOOL D3DXPLANE::operator == (CONST D3DXPLANE& pl) const +inline BOOL D3DXPLANE::operator == (const D3DXPLANE& pl) const { return a == pl.a && b == pl.b && c == pl.c && d == pl.d; } -inline BOOL D3DXPLANE::operator != (CONST D3DXPLANE& pl) const +inline BOOL D3DXPLANE::operator != (const D3DXPLANE& pl) const { return a != pl.a || b != pl.b || c != pl.c || d != pl.d; } @@ -692,14 +692,14 @@ inline D3DXCOLOR::D3DXCOLOR() inline D3DXCOLOR::D3DXCOLOR(DWORD col) { - CONST FLOAT f = 1.0f / 255.0f; + const FLOAT f = 1.0f / 255.0f; r = f * (FLOAT)(unsigned char)(col >> 16); g = f * (FLOAT)(unsigned char)(col >> 8); b = f * (FLOAT)(unsigned char)col; a = f * (FLOAT)(unsigned char)(col >> 24); } -inline D3DXCOLOR::D3DXCOLOR(CONST FLOAT *pf) +inline D3DXCOLOR::D3DXCOLOR(const FLOAT *pf) { if(!pf) return; r = pf[0]; @@ -708,7 +708,7 @@ inline D3DXCOLOR::D3DXCOLOR(CONST FLOAT *pf) a = pf[3]; } -inline D3DXCOLOR::D3DXCOLOR(CONST D3DCOLORVALUE& col) +inline D3DXCOLOR::D3DXCOLOR(const D3DCOLORVALUE& col) { r = col.r; g = col.g; @@ -739,9 +739,9 @@ inline D3DXCOLOR::operator FLOAT * () return (FLOAT*)&r; } -inline D3DXCOLOR::operator CONST FLOAT * () const +inline D3DXCOLOR::operator const FLOAT * () const { - return (CONST FLOAT*)&r; + return (const FLOAT*)&r; } inline D3DXCOLOR::operator D3DCOLORVALUE * () @@ -749,9 +749,9 @@ inline D3DXCOLOR::operator D3DCOLORVALUE * () return (D3DCOLORVALUE*)&r; } -inline D3DXCOLOR::operator CONST D3DCOLORVALUE * () const +inline D3DXCOLOR::operator const D3DCOLORVALUE * () const { - return (CONST D3DCOLORVALUE*)&r; + return (const D3DCOLORVALUE*)&r; } inline D3DXCOLOR::operator D3DCOLORVALUE& () @@ -759,12 +759,12 @@ inline D3DXCOLOR::operator D3DCOLORVALUE& () return *((D3DCOLORVALUE*)&r); } -inline D3DXCOLOR::operator CONST D3DCOLORVALUE& () const +inline D3DXCOLOR::operator const D3DCOLORVALUE& () const { - return *((CONST D3DCOLORVALUE*)&r); + return *((const D3DCOLORVALUE*)&r); } -inline D3DXCOLOR& D3DXCOLOR::operator += (CONST D3DXCOLOR& col) +inline D3DXCOLOR& D3DXCOLOR::operator += (const D3DXCOLOR& col) { r += col.r; g += col.g; @@ -773,7 +773,7 @@ inline D3DXCOLOR& D3DXCOLOR::operator += (CONST D3DXCOLOR& col) return *this; } -inline D3DXCOLOR& D3DXCOLOR::operator -= (CONST D3DXCOLOR& col) +inline D3DXCOLOR& D3DXCOLOR::operator -= (const D3DXCOLOR& col) { r -= col.r; g -= col.g; @@ -811,12 +811,12 @@ inline D3DXCOLOR D3DXCOLOR::operator - () const return D3DXCOLOR(-r, -g, -b, -a); } -inline D3DXCOLOR D3DXCOLOR::operator + (CONST D3DXCOLOR& col) const +inline D3DXCOLOR D3DXCOLOR::operator + (const D3DXCOLOR& col) const { return D3DXCOLOR(r + col.r, g + col.g, b + col.b, a + col.a); } -inline D3DXCOLOR D3DXCOLOR::operator - (CONST D3DXCOLOR& col) const +inline D3DXCOLOR D3DXCOLOR::operator - (const D3DXCOLOR& col) const { return D3DXCOLOR(r - col.r, g - col.g, b - col.b, a - col.a); } @@ -832,17 +832,17 @@ inline D3DXCOLOR D3DXCOLOR::operator / (FLOAT f) const return D3DXCOLOR(r * inv, g * inv, b * inv, a * inv); } -inline D3DXCOLOR operator * (FLOAT f, CONST D3DXCOLOR& col) +inline D3DXCOLOR operator * (FLOAT f, const D3DXCOLOR& col) { return D3DXCOLOR(f * col.r, f * col.g, f * col.b, f * col.a); } -inline BOOL D3DXCOLOR::operator == (CONST D3DXCOLOR& col) const +inline BOOL D3DXCOLOR::operator == (const D3DXCOLOR& col) const { return r == col.r && g == col.g && b == col.b && a == col.a; } -inline BOOL D3DXCOLOR::operator != (CONST D3DXCOLOR& col) const +inline BOOL D3DXCOLOR::operator != (const D3DXCOLOR& col) const { return r != col.r || g != col.g || b != col.b || a != col.a; } @@ -856,7 +856,7 @@ inline D3DXFLOAT16::D3DXFLOAT16(FLOAT f) D3DXFloat32To16Array(this, &f, 1); } -inline D3DXFLOAT16::D3DXFLOAT16(CONST D3DXFLOAT16 &f) +inline D3DXFLOAT16::D3DXFLOAT16(const D3DXFLOAT16 &f) { value = f.value; } @@ -868,12 +868,12 @@ inline D3DXFLOAT16::operator FLOAT () return f; } -inline BOOL D3DXFLOAT16::operator == (CONST D3DXFLOAT16 &f) const +inline BOOL D3DXFLOAT16::operator == (const D3DXFLOAT16 &f) const { return value == f.value; } -inline BOOL D3DXFLOAT16::operator != (CONST D3DXFLOAT16 &f) const +inline BOOL D3DXFLOAT16::operator != (const D3DXFLOAT16 &f) const { return value != f.value; } @@ -882,7 +882,7 @@ inline BOOL D3DXFLOAT16::operator != (CONST D3DXFLOAT16 &f) const /*_______________D3DXCOLOR_____________________*/ -static inline D3DXCOLOR* D3DXColorAdd(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1, CONST D3DXCOLOR *pc2) +static inline D3DXCOLOR* D3DXColorAdd(D3DXCOLOR *pout, const D3DXCOLOR *pc1, const D3DXCOLOR *pc2) { if ( !pout || !pc1 || !pc2 ) return NULL; pout->r = (pc1->r) + (pc2->r); @@ -892,7 +892,7 @@ static inline D3DXCOLOR* D3DXColorAdd(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1, CON return pout; } -static inline D3DXCOLOR* D3DXColorLerp(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1, CONST D3DXCOLOR *pc2, FLOAT s) +static inline D3DXCOLOR* D3DXColorLerp(D3DXCOLOR *pout, const D3DXCOLOR *pc1, const D3DXCOLOR *pc2, FLOAT s) { if ( !pout || !pc1 || !pc2 ) return NULL; pout->r = (1-s) * (pc1->r) + s *(pc2->r); @@ -902,7 +902,7 @@ static inline D3DXCOLOR* D3DXColorLerp(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1, CO return pout; } -static inline D3DXCOLOR* D3DXColorModulate(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1, CONST D3DXCOLOR *pc2) +static inline D3DXCOLOR* D3DXColorModulate(D3DXCOLOR *pout, const D3DXCOLOR *pc1, const D3DXCOLOR *pc2) { if ( !pout || !pc1 || !pc2 ) return NULL; pout->r = (pc1->r) * (pc2->r); @@ -912,7 +912,7 @@ static inline D3DXCOLOR* D3DXColorModulate(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1 return pout; } -static inline D3DXCOLOR* D3DXColorNegative(D3DXCOLOR *pout, CONST D3DXCOLOR *pc) +static inline D3DXCOLOR* D3DXColorNegative(D3DXCOLOR *pout, const D3DXCOLOR *pc) { if ( !pout || !pc ) return NULL; pout->r = 1.0f - pc->r; @@ -922,7 +922,7 @@ static inline D3DXCOLOR* D3DXColorNegative(D3DXCOLOR *pout, CONST D3DXCOLOR *pc) return pout; } -static inline D3DXCOLOR* D3DXColorScale(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FLOAT s) +static inline D3DXCOLOR* D3DXColorScale(D3DXCOLOR *pout, const D3DXCOLOR *pc, FLOAT s) { if ( !pout || !pc ) return NULL; pout->r = s* (pc->r); @@ -932,7 +932,7 @@ static inline D3DXCOLOR* D3DXColorScale(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FL return pout; } -static inline D3DXCOLOR* D3DXColorSubtract(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1, CONST D3DXCOLOR *pc2) +static inline D3DXCOLOR* D3DXColorSubtract(D3DXCOLOR *pout, const D3DXCOLOR *pc1, const D3DXCOLOR *pc2) { if ( !pout || !pc1 || !pc2 ) return NULL; pout->r = (pc1->r) - (pc2->r); @@ -944,7 +944,7 @@ static inline D3DXCOLOR* D3DXColorSubtract(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1 /*_______________D3DXVECTOR2________________________*/ -static inline D3DXVECTOR2* D3DXVec2Add(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2) +static inline D3DXVECTOR2* D3DXVec2Add(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pv2) { if ( !pout || !pv1 || !pv2) return NULL; pout->x = pv1->x + pv2->x; @@ -952,31 +952,31 @@ static inline D3DXVECTOR2* D3DXVec2Add(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1 return pout; } -static inline FLOAT D3DXVec2CCW(CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2) +static inline FLOAT D3DXVec2CCW(const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pv2) { if ( !pv1 || !pv2) return 0.0f; return ( (pv1->x) * (pv2->y) - (pv1->y) * (pv2->x) ); } -static inline FLOAT D3DXVec2Dot(CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2) +static inline FLOAT D3DXVec2Dot(const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pv2) { if ( !pv1 || !pv2) return 0.0f; return ( (pv1->x * pv2->x + pv1->y * pv2->y) ); } -static inline FLOAT D3DXVec2Length(CONST D3DXVECTOR2 *pv) +static inline FLOAT D3DXVec2Length(const D3DXVECTOR2 *pv) { if (!pv) return 0.0f; return sqrtf( pv->x * pv->x + pv->y * pv->y ); } -static inline FLOAT D3DXVec2LengthSq(CONST D3DXVECTOR2 *pv) +static inline FLOAT D3DXVec2LengthSq(const D3DXVECTOR2 *pv) { if (!pv) return 0.0f; return( (pv->x) * (pv->x) + (pv->y) * (pv->y) ); } -static inline D3DXVECTOR2* D3DXVec2Lerp(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, FLOAT s) +static inline D3DXVECTOR2* D3DXVec2Lerp(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pv2, FLOAT s) { if ( !pout || !pv1 || !pv2) return NULL; pout->x = (1-s) * (pv1->x) + s * (pv2->x); @@ -984,7 +984,7 @@ static inline D3DXVECTOR2* D3DXVec2Lerp(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv return pout; } -static inline D3DXVECTOR2* D3DXVec2Maximize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2) +static inline D3DXVECTOR2* D3DXVec2Maximize(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pv2) { if ( !pout || !pv1 || !pv2) return NULL; pout->x = pv1->x > pv2->x ? pv1->x : pv2->x; @@ -992,7 +992,7 @@ static inline D3DXVECTOR2* D3DXVec2Maximize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 return pout; } -static inline D3DXVECTOR2* D3DXVec2Minimize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2) +static inline D3DXVECTOR2* D3DXVec2Minimize(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pv2) { if ( !pout || !pv1 || !pv2) return NULL; pout->x = pv1->x < pv2->x ? pv1->x : pv2->x; @@ -1000,7 +1000,7 @@ static inline D3DXVECTOR2* D3DXVec2Minimize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 return pout; } -static inline D3DXVECTOR2* D3DXVec2Scale(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv, FLOAT s) +static inline D3DXVECTOR2* D3DXVec2Scale(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv, FLOAT s) { if ( !pout || !pv) return NULL; pout->x = s * (pv->x); @@ -1008,7 +1008,7 @@ static inline D3DXVECTOR2* D3DXVec2Scale(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *p return pout; } -static inline D3DXVECTOR2* D3DXVec2Subtract(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2) +static inline D3DXVECTOR2* D3DXVec2Subtract(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv1, const D3DXVECTOR2 *pv2) { if ( !pout || !pv1 || !pv2) return NULL; pout->x = pv1->x - pv2->x; @@ -1018,7 +1018,7 @@ static inline D3DXVECTOR2* D3DXVec2Subtract(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 /*__________________D3DXVECTOR3_______________________*/ -static inline D3DXVECTOR3* D3DXVec3Add(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2) +static inline D3DXVECTOR3* D3DXVec3Add(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2) { if ( !pout || !pv1 || !pv2) return NULL; pout->x = pv1->x + pv2->x; @@ -1027,7 +1027,7 @@ static inline D3DXVECTOR3* D3DXVec3Add(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1 return pout; } -static inline D3DXVECTOR3* D3DXVec3Cross(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2) +static inline D3DXVECTOR3* D3DXVec3Cross(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2) { D3DXVECTOR3 temp; @@ -1039,25 +1039,25 @@ static inline D3DXVECTOR3* D3DXVec3Cross(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *p return pout; } -static inline FLOAT D3DXVec3Dot(CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2) +static inline FLOAT D3DXVec3Dot(const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2) { if ( !pv1 || !pv2 ) return 0.0f; return (pv1->x) * (pv2->x) + (pv1->y) * (pv2->y) + (pv1->z) * (pv2->z); } -static inline FLOAT D3DXVec3Length(CONST D3DXVECTOR3 *pv) +static inline FLOAT D3DXVec3Length(const D3DXVECTOR3 *pv) { if (!pv) return 0.0f; return sqrtf( pv->x * pv->x + pv->y * pv->y + pv->z * pv->z ); } -static inline FLOAT D3DXVec3LengthSq(CONST D3DXVECTOR3 *pv) +static inline FLOAT D3DXVec3LengthSq(const D3DXVECTOR3 *pv) { if (!pv) return 0.0f; return (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z); } -static inline D3DXVECTOR3* D3DXVec3Lerp(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, FLOAT s) +static inline D3DXVECTOR3* D3DXVec3Lerp(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2, FLOAT s) { if ( !pout || !pv1 || !pv2) return NULL; pout->x = (1-s) * (pv1->x) + s * (pv2->x); @@ -1066,7 +1066,7 @@ static inline D3DXVECTOR3* D3DXVec3Lerp(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv return pout; } -static inline D3DXVECTOR3* D3DXVec3Maximize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2) +static inline D3DXVECTOR3* D3DXVec3Maximize(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2) { if ( !pout || !pv1 || !pv2) return NULL; pout->x = pv1->x > pv2->x ? pv1->x : pv2->x; @@ -1075,7 +1075,7 @@ static inline D3DXVECTOR3* D3DXVec3Maximize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 return pout; } -static inline D3DXVECTOR3* D3DXVec3Minimize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2) +static inline D3DXVECTOR3* D3DXVec3Minimize(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2) { if ( !pout || !pv1 || !pv2) return NULL; pout->x = pv1->x < pv2->x ? pv1->x : pv2->x; @@ -1084,7 +1084,7 @@ static inline D3DXVECTOR3* D3DXVec3Minimize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 return pout; } -static inline D3DXVECTOR3* D3DXVec3Scale(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, FLOAT s) +static inline D3DXVECTOR3* D3DXVec3Scale(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, FLOAT s) { if ( !pout || !pv) return NULL; pout->x = s * (pv->x); @@ -1093,7 +1093,7 @@ static inline D3DXVECTOR3* D3DXVec3Scale(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *p return pout; } -static inline D3DXVECTOR3* D3DXVec3Subtract(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2) +static inline D3DXVECTOR3* D3DXVec3Subtract(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv1, const D3DXVECTOR3 *pv2) { if ( !pout || !pv1 || !pv2) return NULL; pout->x = pv1->x - pv2->x; @@ -1103,7 +1103,7 @@ static inline D3DXVECTOR3* D3DXVec3Subtract(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 } /*__________________D3DXVECTOR4_______________________*/ -static inline D3DXVECTOR4* D3DXVec4Add(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2) +static inline D3DXVECTOR4* D3DXVec4Add(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv1, const D3DXVECTOR4 *pv2) { if ( !pout || !pv1 || !pv2) return NULL; pout->x = pv1->x + pv2->x; @@ -1113,25 +1113,25 @@ static inline D3DXVECTOR4* D3DXVec4Add(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1 return pout; } -static inline FLOAT D3DXVec4Dot(CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2) +static inline FLOAT D3DXVec4Dot(const D3DXVECTOR4 *pv1, const D3DXVECTOR4 *pv2) { if (!pv1 || !pv2 ) return 0.0f; return (pv1->x) * (pv2->x) + (pv1->y) * (pv2->y) + (pv1->z) * (pv2->z) + (pv1->w) * (pv2->w); } -static inline FLOAT D3DXVec4Length(CONST D3DXVECTOR4 *pv) +static inline FLOAT D3DXVec4Length(const D3DXVECTOR4 *pv) { if (!pv) return 0.0f; return sqrtf( pv->x * pv->x + pv->y * pv->y + pv->z * pv->z + pv->w * pv->w ); } -static inline FLOAT D3DXVec4LengthSq(CONST D3DXVECTOR4 *pv) +static inline FLOAT D3DXVec4LengthSq(const D3DXVECTOR4 *pv) { if (!pv) return 0.0f; return (pv->x) * (pv->x) + (pv->y) * (pv->y) + (pv->z) * (pv->z) + (pv->w) * (pv->w); } -static inline D3DXVECTOR4* D3DXVec4Lerp(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, FLOAT s) +static inline D3DXVECTOR4* D3DXVec4Lerp(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv1, const D3DXVECTOR4 *pv2, FLOAT s) { if ( !pout || !pv1 || !pv2) return NULL; pout->x = (1-s) * (pv1->x) + s * (pv2->x); @@ -1142,7 +1142,7 @@ static inline D3DXVECTOR4* D3DXVec4Lerp(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv } -static inline D3DXVECTOR4* D3DXVec4Maximize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2) +static inline D3DXVECTOR4* D3DXVec4Maximize(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv1, const D3DXVECTOR4 *pv2) { if ( !pout || !pv1 || !pv2) return NULL; pout->x = pv1->x > pv2->x ? pv1->x : pv2->x; @@ -1152,7 +1152,7 @@ static inline D3DXVECTOR4* D3DXVec4Maximize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 return pout; } -static inline D3DXVECTOR4* D3DXVec4Minimize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2) +static inline D3DXVECTOR4* D3DXVec4Minimize(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv1, const D3DXVECTOR4 *pv2) { if ( !pout || !pv1 || !pv2) return NULL; pout->x = pv1->x < pv2->x ? pv1->x : pv2->x; @@ -1162,7 +1162,7 @@ static inline D3DXVECTOR4* D3DXVec4Minimize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 return pout; } -static inline D3DXVECTOR4* D3DXVec4Scale(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv, FLOAT s) +static inline D3DXVECTOR4* D3DXVec4Scale(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv, FLOAT s) { if ( !pout || !pv) return NULL; pout->x = s * (pv->x); @@ -1172,7 +1172,7 @@ static inline D3DXVECTOR4* D3DXVec4Scale(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *p return pout; } -static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2) +static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, const D3DXVECTOR4 *pv1, const D3DXVECTOR4 *pv2) { if ( !pout || !pv1 || !pv2) return NULL; pout->x = pv1->x - pv2->x; @@ -1231,19 +1231,19 @@ static inline BOOL D3DXMatrixIsIdentity(D3DXMATRIX *pm) /*__________________D3DXPLANE____________________*/ -static inline FLOAT D3DXPlaneDot(CONST D3DXPLANE *pp, CONST D3DXVECTOR4 *pv) +static inline FLOAT D3DXPlaneDot(const D3DXPLANE *pp, const D3DXVECTOR4 *pv) { if ( !pp || !pv ) return 0.0f; return ( (pp->a) * (pv->x) + (pp->b) * (pv->y) + (pp->c) * (pv->z) + (pp->d) * (pv->w) ); } -static inline FLOAT D3DXPlaneDotCoord(CONST D3DXPLANE *pp, CONST D3DXVECTOR4 *pv) +static inline FLOAT D3DXPlaneDotCoord(const D3DXPLANE *pp, const D3DXVECTOR4 *pv) { if ( !pp || !pv ) return 0.0f; return ( (pp->a) * (pv->x) + (pp->b) * (pv->y) + (pp->c) * (pv->z) + (pp->d) ); } -static inline FLOAT D3DXPlaneDotNormal(CONST D3DXPLANE *pp, CONST D3DXVECTOR4 *pv) +static inline FLOAT D3DXPlaneDotNormal(const D3DXPLANE *pp, const D3DXVECTOR4 *pv) { if ( !pp || !pv ) return 0.0f; return ( (pp->a) * (pv->x) + (pp->b) * (pv->y) + (pp->c) * (pv->z) ); @@ -1251,7 +1251,7 @@ static inline FLOAT D3DXPlaneDotNormal(CONST D3DXPLANE *pp, CONST D3DXVECTOR4 *p /*__________________D3DXQUATERNION____________________*/ -static inline D3DXQUATERNION* D3DXQuaternionConjugate(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq) +static inline D3DXQUATERNION* D3DXQuaternionConjugate(D3DXQUATERNION *pout, const D3DXQUATERNION *pq) { if ( !pout || !pq) return NULL; pout->x = -pq->x; @@ -1261,7 +1261,7 @@ static inline D3DXQUATERNION* D3DXQuaternionConjugate(D3DXQUATERNION *pout, CONS return pout; } -static inline FLOAT D3DXQuaternionDot(CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2) +static inline FLOAT D3DXQuaternionDot(const D3DXQUATERNION *pq1, const D3DXQUATERNION *pq2) { if ( !pq1 || !pq2 ) return 0.0f; return (pq1->x) * (pq2->x) + (pq1->y) * (pq2->y) + (pq1->z) * (pq2->z) + (pq1->w) * (pq2->w); @@ -1283,13 +1283,13 @@ static inline BOOL D3DXQuaternionIsIdentity(D3DXQUATERNION *pq) return ( (pq->x == 0.0f) && (pq->y == 0.0f) && (pq->z == 0.0f) && (pq->w == 1.0f) ); } -static inline FLOAT D3DXQuaternionLength(CONST D3DXQUATERNION *pq) +static inline FLOAT D3DXQuaternionLength(const D3DXQUATERNION *pq) { if (!pq) return 0.0f; return sqrtf( pq->x * pq->x + pq->y * pq->y + pq->z * pq->z + pq->w * pq->w ); } -static inline FLOAT D3DXQuaternionLengthSq(CONST D3DXQUATERNION *pq) +static inline FLOAT D3DXQuaternionLengthSq(const D3DXQUATERNION *pq) { if (!pq) return 0.0f; return (pq->x) * (pq->x) + (pq->y) * (pq->y) + (pq->z) * (pq->z) + (pq->w) * (pq->w); diff --git a/include/dxsdk/d3dx9mesh.h b/include/dxsdk/d3dx9mesh.h index 1347a79e009..1dcc2443d7b 100644 --- a/include/dxsdk/d3dx9mesh.h +++ b/include/dxsdk/d3dx9mesh.h @@ -193,20 +193,20 @@ typedef D3DXATTRIBUTERANGE* LPD3DXATTRIBUTERANGE; typedef struct _D3DXMATERIAL { D3DMATERIAL9 MatD3D; - LPSTR pTextureFilename; + char *pTextureFilename; } D3DXMATERIAL, *LPD3DXMATERIAL; typedef struct _D3DXEFFECTDEFAULT { - LPSTR pParamName; + char *pParamName; D3DXEFFECTDEFAULTTYPE Type; DWORD NumBytes; - LPVOID pValue; + void *pValue; } D3DXEFFECTDEFAULT, *LPD3DXEFFECTDEFAULT; typedef struct _D3DXEFFECTINSTANCE { - LPSTR pEffectFilename; + char *pEffectFilename; DWORD NumDefaults; LPD3DXEFFECTDEFAULT pDefaults; } D3DXEFFECTINSTANCE, *LPD3DXEFFECTINSTANCE; @@ -297,9 +297,9 @@ typedef struct _XFILECOMPRESSEDANIMATIONSET DWORD BufferLength; } XFILECOMPRESSEDANIMATIONSET; -typedef HRESULT (WINAPI *LPD3DXUVATLASCB)(FLOAT, LPVOID); -typedef HRESULT (WINAPI *LPD3DXIMTSIGNALCALLBACK)(CONST D3DXVECTOR2 *, UINT, UINT, VOID *, FLOAT *); -typedef HRESULT (WINAPI *LPD3DXSHPRTSIMCB)(float, LPVOID); +typedef HRESULT (WINAPI *LPD3DXUVATLASCB)(float complete, void *ctx); +typedef HRESULT (WINAPI *LPD3DXIMTSIGNALCALLBACK)(const D3DXVECTOR2 *, UINT, UINT, void *, FLOAT *); +typedef HRESULT (WINAPI *LPD3DXSHPRTSIMCB)(float complete, void *ctx); #undef INTERFACE #define INTERFACE ID3DXBaseMesh @@ -307,7 +307,7 @@ typedef HRESULT (WINAPI *LPD3DXSHPRTSIMCB)(float, LPVOID); DECLARE_INTERFACE_(ID3DXBaseMesh, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXBaseMesh ***/ @@ -325,13 +325,13 @@ DECLARE_INTERFACE_(ID3DXBaseMesh, IUnknown) struct IDirect3DDevice9 *device, struct ID3DXMesh **clone_mesh) PURE; STDMETHOD(GetVertexBuffer)(THIS_ struct IDirect3DVertexBuffer9 **vertex_buffer) PURE; STDMETHOD(GetIndexBuffer)(THIS_ struct IDirect3DIndexBuffer9 **index_buffer) PURE; - STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, LPVOID* data) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, void **data) PURE; STDMETHOD(UnlockVertexBuffer)(THIS) PURE; - STDMETHOD(LockIndexBuffer)(THIS_ DWORD flags, LPVOID* data) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD flags, void **data) PURE; STDMETHOD(UnlockIndexBuffer)(THIS) PURE; STDMETHOD(GetAttributeTable)(THIS_ D3DXATTRIBUTERANGE* attrib_table, DWORD* attrib_table_size) PURE; - STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* point_reps, DWORD* adjacency) PURE; - STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* adjacency, DWORD* point_reps) PURE; + STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ const DWORD *point_reps, DWORD *adjacency) PURE; + STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ const DWORD *adjacency, DWORD *point_reps) PURE; STDMETHOD(GenerateAdjacency)(THIS_ FLOAT epsilon, DWORD* adjacency) PURE; STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE]) PURE; }; @@ -341,7 +341,7 @@ DECLARE_INTERFACE_(ID3DXBaseMesh, IUnknown) DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXBaseMesh ***/ @@ -359,13 +359,13 @@ DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh) struct IDirect3DDevice9 *device, struct ID3DXMesh **clone_mesh) PURE; STDMETHOD(GetVertexBuffer)(THIS_ struct IDirect3DVertexBuffer9 **vertex_buffer) PURE; STDMETHOD(GetIndexBuffer)(THIS_ struct IDirect3DIndexBuffer9 **index_buffer) PURE; - STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, LPVOID* data) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, void **data) PURE; STDMETHOD(UnlockVertexBuffer)(THIS) PURE; - STDMETHOD(LockIndexBuffer)(THIS_ DWORD flags, LPVOID* data) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD flags, void **data) PURE; STDMETHOD(UnlockIndexBuffer)(THIS) PURE; STDMETHOD(GetAttributeTable)(THIS_ D3DXATTRIBUTERANGE* attrib_table, DWORD* attrib_table_size) PURE; - STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* point_reps, DWORD* adjacency) PURE; - STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* adjacency, DWORD* point_reps) PURE; + STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ const DWORD *point_reps, DWORD *adjacency) PURE; + STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ const DWORD *adjacency, DWORD *point_reps) PURE; STDMETHOD(GenerateAdjacency)(THIS_ FLOAT epsilon, DWORD* adjacency) PURE; STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE]) PURE; /*** ID3DXMesh ***/ @@ -375,7 +375,8 @@ DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh) DWORD *face_remap, ID3DXBuffer **vertex_remap, ID3DXMesh **opt_mesh) PURE; STDMETHOD(OptimizeInplace)(THIS_ DWORD flags, const DWORD *adjacency_in, DWORD *adjacency_out, DWORD *face_remap, ID3DXBuffer **vertex_remap) PURE; - STDMETHOD(SetAttributeTable)(THIS_ CONST D3DXATTRIBUTERANGE* attrib_table, DWORD attrib_table_size) PURE; + STDMETHOD(SetAttributeTable)(THIS_ const D3DXATTRIBUTERANGE *attrib_table, + DWORD attrib_table_size) PURE; }; #undef INTERFACE @@ -383,7 +384,7 @@ DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh) DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXBaseMesh ***/ @@ -401,13 +402,13 @@ DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh) struct IDirect3DDevice9 *device, struct ID3DXMesh **clone_mesh) PURE; STDMETHOD(GetVertexBuffer)(THIS_ struct IDirect3DVertexBuffer9 **vertex_buffer) PURE; STDMETHOD(GetIndexBuffer)(THIS_ struct IDirect3DIndexBuffer9 **index_buffer) PURE; - STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, LPVOID* data) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, void **data) PURE; STDMETHOD(UnlockVertexBuffer)(THIS) PURE; - STDMETHOD(LockIndexBuffer)(THIS_ DWORD flags, LPVOID* data) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD flags, void **data) PURE; STDMETHOD(UnlockIndexBuffer)(THIS) PURE; STDMETHOD(GetAttributeTable)(THIS_ D3DXATTRIBUTERANGE* attrib_table, DWORD* attrib_table_size) PURE; - STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* point_reps, DWORD* adjacency) PURE; - STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* adjacency, DWORD* point_reps) PURE; + STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ const DWORD *point_reps, DWORD *adjacency) PURE; + STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ const DWORD *adjacency, DWORD *point_reps) PURE; STDMETHOD(GenerateAdjacency)(THIS_ FLOAT epsilon, DWORD* adjacency) PURE; STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE]) PURE; /*** ID3DXPMesh ***/ @@ -421,7 +422,8 @@ DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh) STDMETHOD_(DWORD, GetMinFaces)(THIS) PURE; STDMETHOD_(DWORD, GetMaxVertices)(THIS) PURE; STDMETHOD_(DWORD, GetMinVertices)(THIS) PURE; - STDMETHOD(Save)(THIS_ IStream *stream, CONST D3DXMATERIAL* material, CONST D3DXEFFECTINSTANCE* effect_instance, DWORD num_materials) PURE; + STDMETHOD(Save)(THIS_ IStream *stream, const D3DXMATERIAL *material, + const D3DXEFFECTINSTANCE *effect_instance, DWORD num_materials) PURE; STDMETHOD(Optimize)(THIS_ DWORD flags, DWORD *adjacency_out, DWORD *face_remap, ID3DXBuffer **vertex_remap, ID3DXMesh **opt_mesh) PURE; STDMETHOD(OptimizeBaseLOD)(THIS_ DWORD flags, DWORD* face_remap) PURE; @@ -436,7 +438,7 @@ DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh) DECLARE_INTERFACE_(ID3DXSPMesh, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXSPMesh ***/ @@ -471,7 +473,7 @@ DECLARE_INTERFACE_(ID3DXSPMesh, IUnknown) DECLARE_INTERFACE_(ID3DXPatchMesh, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXPatchMesh ***/ @@ -484,9 +486,9 @@ DECLARE_INTERFACE_(ID3DXPatchMesh, IUnknown) STDMETHOD(GetPatchInfo)(THIS_ LPD3DXPATCHINFO patch_info) PURE; STDMETHOD(GetVertexBuffer)(THIS_ struct IDirect3DVertexBuffer9 **vertex_buffer) PURE; STDMETHOD(GetIndexBuffer)(THIS_ struct IDirect3DIndexBuffer9 **index_buffer) PURE; - STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, LPVOID* data) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, void **data) PURE; STDMETHOD(UnlockVertexBuffer)(THIS) PURE; - STDMETHOD(LockIndexBuffer)(THIS_ DWORD flags, LPVOID* data) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD flags, void **data) PURE; STDMETHOD(UnlockIndexBuffer)(THIS) PURE; STDMETHOD(LockAttributeBuffer)(THIS_ DWORD flags, DWORD** data) PURE; STDMETHOD(UnlockAttributeBuffer)(THIS) PURE; @@ -510,11 +512,12 @@ DECLARE_INTERFACE_(ID3DXPatchMesh, IUnknown) DECLARE_INTERFACE_(ID3DXSkinInfo, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXSkinInfo ***/ - STDMETHOD(SetBoneInfluence)(THIS_ DWORD bone, DWORD num_influences, CONST DWORD* vertices, CONST FLOAT* weights) PURE; + STDMETHOD(SetBoneInfluence)(THIS_ DWORD bone, DWORD num_influences, const DWORD *vertices, + const FLOAT *weights) PURE; STDMETHOD(SetBoneVertexInfluence)(THIS_ DWORD bone_num, DWORD influence_num, float weight) PURE; STDMETHOD_(DWORD, GetNumBoneInfluences)(THIS_ DWORD bone) PURE; STDMETHOD(GetBoneInfluence)(THIS_ DWORD bone, DWORD* vertices, FLOAT* weights) PURE; @@ -526,18 +529,18 @@ DECLARE_INTERFACE_(ID3DXSkinInfo, IUnknown) DWORD num_faces, DWORD *max_face_influences) PURE; STDMETHOD(SetMinBoneInfluence)(THIS_ FLOAT min_influence) PURE; STDMETHOD_(FLOAT, GetMinBoneInfluence)(THIS) PURE; - STDMETHOD(SetBoneName)(THIS_ DWORD bone, LPCSTR name) PURE; - STDMETHOD_(LPCSTR, GetBoneName)(THIS_ DWORD bone) PURE; - STDMETHOD(SetBoneOffsetMatrix)(THIS_ DWORD bone, CONST D3DXMATRIX* bone_transform) PURE; + STDMETHOD(SetBoneName)(THIS_ DWORD bone_idx, const char *name) PURE; + STDMETHOD_(const char *, GetBoneName)(THIS_ DWORD bone_idx) PURE; + STDMETHOD(SetBoneOffsetMatrix)(THIS_ DWORD bone, const D3DXMATRIX *bone_transform) PURE; STDMETHOD_(D3DXMATRIX *, GetBoneOffsetMatrix)(THIS_ DWORD bone) PURE; STDMETHOD(Clone)(THIS_ ID3DXSkinInfo **skin_info) PURE; STDMETHOD(Remap)(THIS_ DWORD num_vertices, DWORD* vertex_remap) PURE; STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE; - STDMETHOD(SetDeclaration)(THIS_ CONST D3DVERTEXELEMENT9* declaration) PURE; + STDMETHOD(SetDeclaration)(THIS_ const D3DVERTEXELEMENT9 *declaration) PURE; STDMETHOD_(DWORD, GetFVF)(THIS) PURE; STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE]) PURE; - STDMETHOD(UpdateSkinnedMesh)(THIS_ CONST D3DXMATRIX* bone_transforms, - CONST D3DXMATRIX* bone_inv_transpose_transforms, LPCVOID vertices_src, PVOID vertices_dest) PURE; + STDMETHOD(UpdateSkinnedMesh)(THIS_ const D3DXMATRIX *bone_transforms, + const D3DXMATRIX *bone_inv_transpose_transforms, const void *src_vertices, void *dst_vertices) PURE; STDMETHOD(ConvertToBlendedMesh)(THIS_ ID3DXMesh *mesh_in, DWORD options, const DWORD *adjacency_in, DWORD *adjacency_out, DWORD *face_remap, ID3DXBuffer **vertex_remap, DWORD *max_face_infl, DWORD *num_bone_combinations, ID3DXBuffer **bone_combination_table, ID3DXMesh **mesh_out) PURE; @@ -551,7 +554,7 @@ DECLARE_INTERFACE_(ID3DXSkinInfo, IUnknown) DECLARE_INTERFACE_(ID3DXPRTBuffer, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXPRTBuffer methods ***/ @@ -580,7 +583,7 @@ DECLARE_INTERFACE_(ID3DXPRTBuffer, IUnknown) DECLARE_INTERFACE_(ID3DXPRTCompBuffer, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXPRTCompBuffer methods ***/ @@ -605,7 +608,7 @@ DECLARE_INTERFACE_(ID3DXPRTCompBuffer, IUnknown) DECLARE_INTERFACE_(ID3DXTextureGutterHelper, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXTextureGutterHelper methods ***/ @@ -632,13 +635,13 @@ DECLARE_INTERFACE_(ID3DXTextureGutterHelper, IUnknown) DECLARE_INTERFACE_(ID3DXPRTEngine, IUnknown) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID* object) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXPRTEngine methods ***/ - STDMETHOD(SetMeshMaterials)(THIS_ CONST D3DXSHMATERIAL **materials, UINT num_meshes, + STDMETHOD(SetMeshMaterials)(THIS_ const D3DXSHMATERIAL **materials, UINT num_meshes, UINT num_channels, BOOL set_albedo, FLOAT length_scale) PURE; - STDMETHOD(SetPerVertexAlbedo)(THIS_ CONST VOID *data_in, UINT num_channels, UINT stride) PURE; + STDMETHOD(SetPerVertexAlbedo)(THIS_ const void *data_in, UINT num_channels, UINT stride) PURE; STDMETHOD(SetPerTexelAlbedo)(THIS_ struct IDirect3DTexture9 *albedo_texture, UINT num_channels, struct ID3DXTextureGutterHelper *gh) PURE; STDMETHOD(GetVertexAlbedo)(THIS_ D3DXCOLOR *vert_colors, UINT num_verts) PURE; @@ -681,10 +684,11 @@ DECLARE_INTERFACE_(ID3DXPRTEngine, IUnknown) ID3DXPRTBuffer *data_out) PURE; STDMETHOD(ScaleMeshChunk)(THIS_ UINT mesh_chunk, float scale, ID3DXPRTBuffer *data_out) PURE; STDMETHOD(MultiplyAlbedo)(THIS_ ID3DXPRTBuffer *data_out) PURE; - STDMETHOD(SetCallback)(THIS_ LPD3DXSHPRTSIMCB cb, FLOAT frequency, LPVOID user_context) PURE; - STDMETHOD_(BOOL, ShadowRayIntersects)(THIS_ CONST D3DXVECTOR3 *ray_pos, CONST D3DXVECTOR3 *ray_dir) PURE; - STDMETHOD_(BOOL, ClosestRayIntersects)(THIS_ CONST D3DXVECTOR3 *ray_pos, CONST D3DXVECTOR3 *ray_dir, - DWORD *face_index, FLOAT *u, FLOAT *v, FLOAT *dist) PURE; + STDMETHOD(SetCallback)(THIS_ LPD3DXSHPRTSIMCB cb, float frequency, void *user_context) PURE; + STDMETHOD_(BOOL, ShadowRayIntersects)(THIS_ const D3DXVECTOR3 *ray_pos, + const D3DXVECTOR3 *ray_dir) PURE; + STDMETHOD_(BOOL, ClosestRayIntersects)(THIS_ const D3DXVECTOR3 *ray_pos, + const D3DXVECTOR3 *ray_dir, DWORD *face_index, FLOAT *u, FLOAT *v, FLOAT *dist) PURE; }; #undef INTERFACE @@ -762,15 +766,19 @@ HRESULT WINAPI D3DXSavePRTCompBufferToFileW(const WCHAR *filename, ID3DXPRTCompB UINT WINAPI D3DXGetDeclLength(const D3DVERTEXELEMENT9 *decl); UINT WINAPI D3DXGetDeclVertexSize(const D3DVERTEXELEMENT9 *decl, DWORD stream_idx); UINT WINAPI D3DXGetFVFVertexSize(DWORD); -BOOL WINAPI D3DXBoxBoundProbe(CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *); -BOOL WINAPI D3DXSphereBoundProbe(CONST D3DXVECTOR3 *,FLOAT,CONST D3DXVECTOR3 *,CONST D3DXVECTOR3 *); +BOOL WINAPI D3DXBoxBoundProbe(const D3DXVECTOR3 *vmin, const D3DXVECTOR3 *vmax, + const D3DXVECTOR3 *ray_pos, const D3DXVECTOR3 *ray_dir); +BOOL WINAPI D3DXSphereBoundProbe(const D3DXVECTOR3 *center, FLOAT radius, + const D3DXVECTOR3 *ray_pos, const D3DXVECTOR3 *ray_dir); HRESULT WINAPI D3DXCleanMesh(D3DXCLEANTYPE clean_type, ID3DXMesh *mesh_in, const DWORD *adjacency_in, ID3DXMesh **mesh_out, DWORD *adjacency_out, ID3DXBuffer **errors); HRESULT WINAPI D3DXConcatenateMeshes(struct ID3DXMesh **meshes, UINT mesh_count, DWORD flags, const D3DXMATRIX *geometry_matrices, const D3DXMATRIX *texture_matrices, const D3DVERTEXELEMENT9 *declaration, struct IDirect3DDevice9 *device, struct ID3DXMesh **mesh); -HRESULT WINAPI D3DXComputeBoundingBox(CONST D3DXVECTOR3 *, DWORD, DWORD, D3DXVECTOR3 *, D3DXVECTOR3 *); -HRESULT WINAPI D3DXComputeBoundingSphere(CONST D3DXVECTOR3 *, DWORD, DWORD, D3DXVECTOR3 *, FLOAT *); +HRESULT WINAPI D3DXComputeBoundingBox(const D3DXVECTOR3 *first_pos, DWORD num_vertices, + DWORD stride, D3DXVECTOR3 *vmin, D3DXVECTOR3 *vmax); +HRESULT WINAPI D3DXComputeBoundingSphere(const D3DXVECTOR3 *first_pos, DWORD num_vertices, + DWORD stride, D3DXVECTOR3 *center, FLOAT *radius); HRESULT WINAPI D3DXComputeIMTFromPerTexelSignal(ID3DXMesh *mesh, DWORD texture_idx, float *texel_signal, UINT width, UINT height, UINT signal_dimension, UINT component_count, DWORD flags, LPD3DXUVATLASCB cb, void *ctx, ID3DXBuffer **buffer); @@ -797,7 +805,7 @@ HRESULT WINAPI D3DXConvertMeshSubsetToStrips(struct ID3DXBaseMesh *mesh_in, DWOR struct ID3DXBuffer **strip_lengths, DWORD *strip_count); HRESULT WINAPI D3DXDeclaratorFromFVF(DWORD, D3DVERTEXELEMENT9[MAX_FVF_DECL_SIZE]); HRESULT WINAPI D3DXFVFFromDeclarator(const D3DVERTEXELEMENT9 *decl, DWORD *fvf); -HRESULT WINAPI D3DXGenerateOutputDecl(D3DVERTEXELEMENT9 *, CONST D3DVERTEXELEMENT9 *); +HRESULT WINAPI D3DXGenerateOutputDecl(D3DVERTEXELEMENT9 *decl_out, const D3DVERTEXELEMENT9 *decl_in); HRESULT WINAPI D3DXGeneratePMesh(ID3DXMesh *mesh, const DWORD *adjacency, const D3DXATTRIBUTEWEIGHTS *attribute_weights, const float *vertex_weights, DWORD min_value, DWORD flags, ID3DXPMesh **pmesh); @@ -806,10 +814,15 @@ HRESULT WINAPI D3DXIntersect(ID3DXBaseMesh *mesh, const D3DXVECTOR3 *ray_positio HRESULT WINAPI D3DXIntersectSubset(ID3DXBaseMesh *mesh, DWORD attribute_id, const D3DXVECTOR3 *ray_position, const D3DXVECTOR3 *ray_direction, BOOL *hit, DWORD *face_idx, float *u, float *v, float *distance, ID3DXBuffer **hits, DWORD *hit_count); -BOOL WINAPI D3DXIntersectTri(CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3*, FLOAT *, FLOAT *, FLOAT *); -HRESULT WINAPI D3DXOptimizeFaces(LPCVOID, UINT, UINT, BOOL, DWORD *); -HRESULT WINAPI D3DXOptimizeVertices(LPCVOID, UINT, UINT, BOOL, DWORD *); -HRESULT WINAPI D3DXRectPatchSize(CONST FLOAT *, DWORD *, DWORD *); +BOOL WINAPI D3DXIntersectTri(const D3DXVECTOR3 *vtx0, const D3DXVECTOR3 *vtx1, + const D3DXVECTOR3 *vtx2, const D3DXVECTOR3 *ray_pos, const D3DXVECTOR3 *ray_dir, FLOAT *u, + FLOAT *v, FLOAT *dist); +HRESULT WINAPI D3DXOptimizeFaces(const void *indices, UINT face_count, + UINT vertex_count, BOOL idx_32bit, DWORD *face_remap); +HRESULT WINAPI D3DXOptimizeVertices(const void *indices, UINT face_count, + UINT vertex_count, BOOL idx_32bit, DWORD *vertex_remap); +HRESULT WINAPI D3DXRectPatchSize(const FLOAT *segment_count, DWORD *num_triangles, + DWORD *num_vertices); HRESULT WINAPI D3DXSHPRTCompSuperCluster(UINT *cluster_ids, ID3DXMesh *scene, UINT max_cluster_count, UINT cluster_count, UINT *scluster_ids, UINT *scluster_count); HRESULT WINAPI D3DXSHPRTCompSplitMeshSC(UINT *cluster_idx, UINT vertex_count, UINT cluster_count, UINT *scluster_ids, @@ -828,7 +841,8 @@ HRESULT WINAPI D3DXTesselateRectPatch(struct IDirect3DVertexBuffer9 *buffer, con const D3DVERTEXELEMENT9 *declaration, const D3DRECTPATCH_INFO *patch_info, struct ID3DXMesh *mesh); HRESULT WINAPI D3DXTesselateTriPatch(struct IDirect3DVertexBuffer9 *buffer, const float *segment_count, const D3DVERTEXELEMENT9 *declaration, const D3DTRIPATCH_INFO *patch_info, struct ID3DXMesh *mesh); -HRESULT WINAPI D3DXTriPatchSize(CONST FLOAT *, DWORD *, DWORD *); +HRESULT WINAPI D3DXTriPatchSize(const FLOAT *segment_count, DWORD *num_triangles, + DWORD *num_vertices); HRESULT WINAPI D3DXUVAtlasCreate(ID3DXMesh *mesh_in, UINT max_chart_count, float max_stretch_in, UINT width, UINT height, float gutter, DWORD texture_idx, const DWORD *adjacency, const DWORD *false_edges, const float *imt_array, LPD3DXUVATLASCB cb, float cb_freq, void *ctx, DWORD flags, ID3DXMesh **mesh_out, diff --git a/include/dxsdk/d3dx9shader.h b/include/dxsdk/d3dx9shader.h index 0b30519962c..d665f72e0e5 100644 --- a/include/dxsdk/d3dx9shader.h +++ b/include/dxsdk/d3dx9shader.h @@ -1,5 +1,6 @@ /* * Copyright 2008 Luis Busquets + * Copyright 2014 Kai Tietz * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -42,7 +43,10 @@ #define D3DXSHADER_USE_LEGACY_D3DX9_31_DLL 0x10000 -typedef LPCSTR D3DXHANDLE; +#define D3DXCONSTTABLE_LARGEADDRESSAWARE 0x20000 + +typedef const char *D3DXHANDLE; +typedef D3DXHANDLE *LPD3DXHANDLE; typedef enum _D3DXREGISTER_SET { @@ -91,14 +95,14 @@ typedef enum D3DXPARAMETER_TYPE typedef struct _D3DXCONSTANTTABLE_DESC { - LPCSTR Creator; + const char *Creator; DWORD Version; UINT Constants; } D3DXCONSTANTTABLE_DESC, *LPD3DXCONSTANTTABLE_DESC; typedef struct _D3DXCONSTANT_DESC { - LPCSTR Name; + const char *Name; D3DXREGISTER_SET RegisterSet; UINT RegisterIndex; UINT RegisterCount; @@ -109,10 +113,14 @@ typedef struct _D3DXCONSTANT_DESC UINT Elements; UINT StructMembers; UINT Bytes; - LPCVOID DefaultValue; + const void *DefaultValue; } D3DXCONSTANT_DESC, *LPD3DXCONSTANT_DESC; +#if D3DX_SDK_VERSION < 43 DEFINE_GUID(IID_ID3DXConstantTable, 0x9dca3190, 0x38b9, 0x4fc3, 0x92, 0xe3, 0x39, 0xc6, 0xdd, 0xfb, 0x35, 0x8b); +#else +DEFINE_GUID(IID_ID3DXConstantTable, 0xab3c758f, 0x093e, 0x4356, 0xb7, 0x62, 0x4d, 0xb1, 0x8f, 0x1b, 0x3a, 0x01); +#endif #undef INTERFACE #define INTERFACE ID3DXConstantTable @@ -120,18 +128,18 @@ DEFINE_GUID(IID_ID3DXConstantTable, 0x9dca3190, 0x38b9, 0x4fc3, 0x92, 0xe3, 0x39 DECLARE_INTERFACE_(ID3DXConstantTable, ID3DXBuffer) { /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE; STDMETHOD_(ULONG, AddRef)(THIS) PURE; STDMETHOD_(ULONG, Release)(THIS) PURE; /*** ID3DXBuffer methods ***/ - STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE; + STDMETHOD_(void *, GetBufferPointer)(THIS) PURE; STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE; /*** ID3DXConstantTable methods ***/ STDMETHOD(GetDesc)(THIS_ D3DXCONSTANTTABLE_DESC *pDesc) PURE; STDMETHOD(GetConstantDesc)(THIS_ D3DXHANDLE hConstant, D3DXCONSTANT_DESC *pConstantDesc, UINT *pCount) PURE; STDMETHOD_(UINT, GetSamplerIndex)(THIS_ D3DXHANDLE hConstant) PURE; STDMETHOD_(D3DXHANDLE, GetConstant)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; - STDMETHOD_(D3DXHANDLE, GetConstantByName)(THIS_ D3DXHANDLE hConstant, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetConstantByName)(THIS_ D3DXHANDLE constant, const char *name) PURE; STDMETHOD_(D3DXHANDLE, GetConstantElement)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; STDMETHOD(SetDefaults)(THIS_ struct IDirect3DDevice9 *device) PURE; STDMETHOD(SetValue)(THIS_ struct IDirect3DDevice9 *device, D3DXHANDLE constant, @@ -228,9 +236,46 @@ DECLARE_INTERFACE_(ID3DXConstantTable, ID3DXBuffer) typedef struct ID3DXConstantTable *LPD3DXCONSTANTTABLE; -typedef struct _D3DXMACRO { - LPCSTR Name; - LPCSTR Definition; +typedef interface ID3DXTextureShader *LPD3DXTEXTURESHADER; + +DEFINE_GUID(IID_ID3DXTextureShader, 0x3e3d67f8, 0xaa7a, 0x405d, 0xa8, 0x57, 0xba, 0x1, 0xd4, 0x75, 0x84, 0x26); + +#define INTERFACE ID3DXTextureShader +DECLARE_INTERFACE_(ID3DXTextureShader, IUnknown) +{ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + STDMETHOD(GetFunction)(THIS_ struct ID3DXBuffer **ppFunction) PURE; + STDMETHOD(GetConstantBuffer)(THIS_ struct ID3DXBuffer **ppConstantBuffer) PURE; + STDMETHOD(GetDesc)(THIS_ D3DXCONSTANTTABLE_DESC *pDesc) PURE; + STDMETHOD(GetConstantDesc)(THIS_ D3DXHANDLE hConstant, D3DXCONSTANT_DESC *pConstantDesc, UINT *pCount) PURE; + STDMETHOD_(D3DXHANDLE, GetConstant)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetConstantByName)(THIS_ D3DXHANDLE hConstant, const char *pName) PURE; + STDMETHOD_(D3DXHANDLE, GetConstantElement)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; + STDMETHOD(SetDefaults)(THIS) PURE; + STDMETHOD(SetValue)(THIS_ D3DXHANDLE hConstant, const void *pData, UINT Bytes) PURE; + STDMETHOD(SetBool)(THIS_ D3DXHANDLE hConstant, BOOL b) PURE; + STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hConstant, const BOOL *pb, UINT Count) PURE; + STDMETHOD(SetInt)(THIS_ D3DXHANDLE hConstant, INT n) PURE; + STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hConstant, const INT *pn, UINT Count) PURE; + STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hConstant, FLOAT f) PURE; + STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hConstant, const FLOAT *pf, UINT Count) PURE; + STDMETHOD(SetVector)(THIS_ D3DXHANDLE hConstant, const D3DXVECTOR4 *pVector) PURE; + STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hConstant, const D3DXVECTOR4 *pVector, UINT Count) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hConstant, const D3DXMATRIX *pMatrix) PURE; + STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hConstant, const D3DXMATRIX *pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hConstant, const D3DXMATRIX **ppMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hConstant, const D3DXMATRIX *pMatrix) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hConstant, const D3DXMATRIX *pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hConstant, const D3DXMATRIX **ppMatrix, UINT Count) PURE; +}; +#undef INTERFACE + +typedef struct _D3DXMACRO +{ + const char *Name; + const char *Definition; } D3DXMACRO, *LPD3DXMACRO; typedef struct _D3DXSEMANTIC { @@ -249,8 +294,9 @@ typedef enum _D3DXINCLUDE_TYPE DECLARE_INTERFACE(ID3DXInclude) { - STDMETHOD(Open)(THIS_ D3DXINCLUDE_TYPE include_type, LPCSTR filename, LPCVOID parent_data, LPCVOID *data, UINT *bytes) PURE; - STDMETHOD(Close)(THIS_ LPCVOID data) PURE; + STDMETHOD(Open)(THIS_ D3DXINCLUDE_TYPE include_type, const char *filename, + const void *parent_data, const void **data, UINT *bytes) PURE; + STDMETHOD(Close)(THIS_ const void *data) PURE; }; #undef INTERFACE @@ -267,8 +313,8 @@ const char * WINAPI D3DXGetPixelShaderProfile(struct IDirect3DDevice9 *device); UINT WINAPI D3DXGetShaderSize(const DWORD *byte_code); DWORD WINAPI D3DXGetShaderVersion(const DWORD *byte_code); const char * WINAPI D3DXGetVertexShaderProfile(struct IDirect3DDevice9 *device); -HRESULT WINAPI D3DXFindShaderComment(CONST DWORD* byte_code, DWORD fourcc, LPCVOID* data, UINT* size); -HRESULT WINAPI D3DXGetShaderSamplers(CONST DWORD *byte_code, LPCSTR *samplers, UINT *count); +HRESULT WINAPI D3DXFindShaderComment(const DWORD *byte_code, DWORD fourcc, const void **data, UINT *size); +HRESULT WINAPI D3DXGetShaderSamplers(const DWORD *byte_code, const char **samplers, UINT *count); HRESULT WINAPI D3DXAssembleShaderFromFileA(const char *filename, const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages); @@ -289,6 +335,8 @@ HRESULT WINAPI D3DXCompileShader(const char *src_data, UINT data_len, const D3DX ID3DXInclude *include, const char *function_name, const char *profile, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages, ID3DXConstantTable **constant_table); +HRESULT WINAPI D3DXDisassembleShader(const DWORD *pShader, BOOL EnableColorCode, const char *pComments, struct ID3DXBuffer **ppDisassembly); + HRESULT WINAPI D3DXCompileShaderFromFileA(const char *filename, const D3DXMACRO *defines, ID3DXInclude *include, const char *entrypoint, const char *profile, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages, ID3DXConstantTable **constant_table); @@ -324,6 +372,11 @@ HRESULT WINAPI D3DXGetShaderConstantTableEx(const DWORD *byte_code, DWORD flags, HRESULT WINAPI D3DXGetShaderConstantTable(const DWORD *byte_code, ID3DXConstantTable **constant_table); +HRESULT WINAPI D3DXGetShaderInputSemantics(const DWORD *pFunction, D3DXSEMANTIC *pSemantics, UINT *pCount); +HRESULT WINAPI D3DXGetShaderOutputSemantics(const DWORD *pFunction, D3DXSEMANTIC *pSemantics, UINT *pCount); + +HRESULT WINAPI D3DXCreateTextureShader(const DWORD *pFunction, ID3DXTextureShader **ppTextureShader); + #ifdef __cplusplus } #endif diff --git a/include/dxsdk/d3dx9tex.h b/include/dxsdk/d3dx9tex.h index 295a3243d77..542460f7362 100644 --- a/include/dxsdk/d3dx9tex.h +++ b/include/dxsdk/d3dx9tex.h @@ -39,6 +39,11 @@ #define D3DX_FILTER_SRGB_OUT 0x00400000 #define D3DX_FILTER_SRGB 0x00600000 +#define D3DX_SKIP_DDS_MIP_LEVELS_MASK 0x1f +#define D3DX_SKIP_DDS_MIP_LEVELS_SHIFT 26 +#define D3DX_SKIP_DDS_MIP_LEVELS(l, f) ((((l) & D3DX_SKIP_DDS_MIP_LEVELS_MASK) \ + << D3DX_SKIP_DDS_MIP_LEVELS_SHIFT) | ((f) == D3DX_DEFAULT ? D3DX_FILTER_BOX : (f))) + #define D3DX_NORMALMAP_MIRROR_U 0x00010000 #define D3DX_NORMALMAP_MIRROR_V 0x00020000 #define D3DX_NORMALMAP_MIRROR 0x00030000 @@ -83,8 +88,10 @@ typedef struct _D3DXIMAGE_INFO ****************** Functions ***************** **********************************************/ /* Typedefs for callback functions */ -typedef VOID (WINAPI *LPD3DXFILL2D)(D3DXVECTOR4 *out, CONST D3DXVECTOR2 *texcoord, CONST D3DXVECTOR2 *texelsize, LPVOID data); -typedef VOID (WINAPI *LPD3DXFILL3D)(D3DXVECTOR4 *out, CONST D3DXVECTOR3 *texcoord, CONST D3DXVECTOR3 *texelsize, LPVOID data); +typedef void (WINAPI *LPD3DXFILL2D)(D3DXVECTOR4 *out, const D3DXVECTOR2 *texcoord, + const D3DXVECTOR2 *texelsize, void *data); +typedef void (WINAPI *LPD3DXFILL3D)(D3DXVECTOR4 *out, const D3DXVECTOR3 *texcoord, + const D3DXVECTOR3 *texelsize, void *data); #ifdef __cplusplus extern "C" { @@ -92,15 +99,15 @@ extern "C" { /* Image Information */ -HRESULT WINAPI D3DXGetImageInfoFromFileA(LPCSTR file, D3DXIMAGE_INFO *info); +HRESULT WINAPI D3DXGetImageInfoFromFileA(const char *file, D3DXIMAGE_INFO *info); HRESULT WINAPI D3DXGetImageInfoFromFileW(const WCHAR *file, D3DXIMAGE_INFO *info); #define D3DXGetImageInfoFromFile WINELIB_NAME_AW(D3DXGetImageInfoFromFile) -HRESULT WINAPI D3DXGetImageInfoFromResourceA(HMODULE module, LPCSTR resource, D3DXIMAGE_INFO *info); +HRESULT WINAPI D3DXGetImageInfoFromResourceA(HMODULE module, const char *resource, D3DXIMAGE_INFO *info); HRESULT WINAPI D3DXGetImageInfoFromResourceW(HMODULE module, const WCHAR *resource, D3DXIMAGE_INFO *info); #define D3DXGetImageInfoFromResource WINELIB_NAME_AW(D3DXGetImageInfoFromResource) -HRESULT WINAPI D3DXGetImageInfoFromFileInMemory(LPCVOID data, UINT datasize, D3DXIMAGE_INFO *info); +HRESULT WINAPI D3DXGetImageInfoFromFileInMemory(const void *data, UINT data_size, D3DXIMAGE_INFO *info); /* Surface Loading/Saving */ diff --git a/include/dxsdk/d3dx9xof.h b/include/dxsdk/d3dx9xof.h index 785bc1c56a1..35019f26d4e 100644 --- a/include/dxsdk/d3dx9xof.h +++ b/include/dxsdk/d3dx9xof.h @@ -40,14 +40,16 @@ typedef DWORD D3DXF_FILELOADOPTIONS; #define D3DXF_FILELOAD_FROMRESOURCE 0x02 #define D3DXF_FILELOAD_FROMMEMORY 0x03 -typedef struct _D3DXF_FILELOADRESOURCE { +typedef struct _D3DXF_FILELOADRESOURCE +{ HMODULE hModule; - LPCSTR lpName; - LPCSTR lpType; + const char *lpName; + const char *lpType; } D3DXF_FILELOADRESOURCE; -typedef struct _D3DXF_FILELOADMEMORY { - LPVOID lpMemory; +typedef struct _D3DXF_FILELOADMEMORY +{ + void *lpMemory; SIZE_T dSize; } D3DXF_FILELOADMEMORY; @@ -72,7 +74,7 @@ STDAPI D3DXFileCreate(struct ID3DXFile **file); DECLARE_INTERFACE_IID_(ID3DXFile,IUnknown,"cef08cf9-7b4f-4429-9624-2a690a933201") { /*** IUnknown methods ***/ - STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID, LPVOID*) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** ID3DXFile methods ***/ @@ -80,7 +82,7 @@ DECLARE_INTERFACE_IID_(ID3DXFile,IUnknown,"cef08cf9-7b4f-4429-9624-2a690a933201" struct ID3DXFileEnumObject **enum_obj) PURE; STDMETHOD(CreateSaveObject)(THIS_ const void *data, D3DXF_FILESAVEOPTIONS flags, D3DXF_FILEFORMAT format, struct ID3DXFileSaveObject **save_obj) PURE; - STDMETHOD(RegisterTemplates)(THIS_ LPCVOID, SIZE_T) PURE; + STDMETHOD(RegisterTemplates)(THIS_ const void *data, SIZE_T data_size) PURE; STDMETHOD(RegisterEnumTemplates)(THIS_ struct ID3DXFileEnumObject *enum_obj) PURE; }; #undef INTERFACE @@ -89,7 +91,7 @@ DECLARE_INTERFACE_IID_(ID3DXFile,IUnknown,"cef08cf9-7b4f-4429-9624-2a690a933201" DECLARE_INTERFACE_IID_(ID3DXFileSaveObject,IUnknown,"cef08cfa-7b4f-4429-9624-2a690a933201") { /*** IUnknown methods ***/ - STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID, LPVOID*) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** ID3DXFileSaveObject methods ***/ @@ -104,17 +106,17 @@ DECLARE_INTERFACE_IID_(ID3DXFileSaveObject,IUnknown,"cef08cfa-7b4f-4429-9624-2a6 DECLARE_INTERFACE_IID_(ID3DXFileSaveData,IUnknown,"cef08cfb-7b4f-4429-9624-2a690a933201") { /*** IUnknown methods ***/ - STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID, LPVOID*) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** ID3DXFileSaveObject methods ***/ STDMETHOD(GetSave)(THIS_ ID3DXFileSaveObject **save_obj) PURE; - STDMETHOD(GetName)(THIS_ LPSTR, SIZE_T*) PURE; + STDMETHOD(GetName)(THIS_ char *name, SIZE_T *size) PURE; STDMETHOD(GetId)(THIS_ LPGUID) PURE; STDMETHOD(GetType)(THIS_ GUID*) PURE; STDMETHOD(AddDataObject)(THIS_ REFGUID template_guid, const char *name, const GUID *guid, SIZE_T data_size, const void *data, ID3DXFileSaveData **obj) PURE; - STDMETHOD(AddDataReference)(THIS_ LPCSTR, CONST GUID*) PURE; + STDMETHOD(AddDataReference)(THIS_ const char *name, const GUID *id) PURE; }; #undef INTERFACE @@ -123,7 +125,7 @@ DECLARE_INTERFACE_IID_(ID3DXFileSaveData,IUnknown,"cef08cfb-7b4f-4429-9624-2a690 DECLARE_INTERFACE_IID_(ID3DXFileEnumObject,IUnknown,"cef08cfc-7b4f-4429-9624-2a690a933201") { /*** IUnknown methods ***/ - STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID, LPVOID*) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** ID3DXFileEnumObject methods ***/ @@ -139,14 +141,14 @@ DECLARE_INTERFACE_IID_(ID3DXFileEnumObject,IUnknown,"cef08cfc-7b4f-4429-9624-2a6 DECLARE_INTERFACE_IID_(ID3DXFileData,IUnknown,"cef08cfd-7b4f-4429-9624-2a690a933201") { /*** IUnknown methods ***/ - STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID, LPVOID*) PURE; + STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** ID3DXFileData methods ***/ STDMETHOD(GetEnum)(THIS_ ID3DXFileEnumObject **enum_obj) PURE; - STDMETHOD(GetName)(THIS_ LPSTR, SIZE_T*) PURE; + STDMETHOD(GetName)(THIS_ char *name, SIZE_T *size) PURE; STDMETHOD(GetId)(THIS_ LPGUID) PURE; - STDMETHOD(Lock)(THIS_ SIZE_T*, LPCVOID*) PURE; + STDMETHOD(Lock)(THIS_ SIZE_T *data_size, const void **data) PURE; STDMETHOD(Unlock)(THIS) PURE; STDMETHOD(GetType)(THIS_ GUID*) PURE; STDMETHOD_(BOOL,IsReference)(THIS) PURE; diff --git a/include/dxsdk/uuids.h b/include/dxsdk/uuids.h index 376cca748fc..c385f3e9148 100644 --- a/include/dxsdk/uuids.h +++ b/include/dxsdk/uuids.h @@ -275,6 +275,7 @@ OUR_GUID_ENTRY(CLSID_VideoProcAmpPropertyPage, 0x71f96464, 0x78f3, 0x11d0, OUR_GUID_ENTRY(CLSID_CameraControlPropertyPage, 0x71f96465, 0x78f3, 0x11d0, 0xa1, 0x8c, 0x00, 0xa0, 0xc9, 0x11, 0x89, 0x56) OUR_GUID_ENTRY(CLSID_AnalogVideoDecoderPropertyPage, 0x71f96466, 0x78f3, 0x11d0, 0xa1, 0x8c, 0x00, 0xa0, 0xc9, 0x11, 0x89, 0x56) OUR_GUID_ENTRY(CLSID_VideoStreamConfigPropertyPage, 0x71f96467, 0x78f3, 0x11d0, 0xa1, 0x8c, 0x00, 0xa0, 0xc9, 0x11, 0x89, 0x56) +OUR_GUID_ENTRY(CLSID_VideoMixingRenderer, 0xb87beb7b, 0x8d29, 0x423f, 0xae, 0x4d, 0x65, 0x82, 0xc1, 0x01, 0x75, 0xac) OUR_GUID_ENTRY(CLSID_VideoMixingRenderer9, 0x51b4abf3, 0x748f, 0x4e3b, 0xa2, 0x76, 0xc8, 0x28, 0x33, 0x0e, 0x92, 0x6a) #undef OUR_GUID_ENTRY diff --git a/include/psdk/bcrypt.h b/include/psdk/bcrypt.h index fd9a6a8cf29..629418a1097 100644 --- a/include/psdk/bcrypt.h +++ b/include/psdk/bcrypt.h @@ -35,6 +35,10 @@ #define OPTIONAL #endif +#ifndef _NTDEF_ +typedef _Return_type_success_(return >= 0) LONG NTSTATUS; +#endif + typedef struct _BCRYPT_ALGORITHM_IDENTIFIER { LPWSTR pszName; @@ -42,4 +46,9 @@ typedef struct _BCRYPT_ALGORITHM_IDENTIFIER ULONG dwFlags; } BCRYPT_ALGORITHM_IDENTIFIER; +typedef PVOID BCRYPT_ALG_HANDLE; + +#define BCRYPT_RNG_USE_ENTROPY_IN_BUFFER 0x00000001 +#define BCRYPT_USE_SYSTEM_PREFERRED_RNG 0x00000002 + #endif /* __WINE_BCRYPT_H */ diff --git a/include/psdk/delayloadhandler.h b/include/psdk/delayloadhandler.h new file mode 100644 index 00000000000..06b658990c4 --- /dev/null +++ b/include/psdk/delayloadhandler.h @@ -0,0 +1,55 @@ +/* + * Copyright 2013 André Hentschel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINE_DELAYLOADHANDLER_H +#define __WINE_DELAYLOADHANDLER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define DELAYLOAD_GPA_FAILURE 4 + +typedef struct _DELAYLOAD_PROC_DESCRIPTOR +{ + ULONG ImportDescribedByName; + union { + LPCSTR Name; + ULONG Ordinal; + } Description; +} DELAYLOAD_PROC_DESCRIPTOR, *PDELAYLOAD_PROC_DESCRIPTOR; + +typedef struct _DELAYLOAD_INFO +{ + ULONG Size; + PCIMAGE_DELAYLOAD_DESCRIPTOR DelayloadDescriptor; + PIMAGE_THUNK_DATA ThunkAddress; + LPCSTR TargetDllName; + DELAYLOAD_PROC_DESCRIPTOR TargetApiDescriptor; + PVOID TargetModuleBase; + PVOID Unused; + ULONG LastError; +} DELAYLOAD_INFO, *PDELAYLOAD_INFO; + +typedef PVOID (WINAPI *PDELAYLOAD_FAILURE_DLL_CALLBACK)(ULONG, PDELAYLOAD_INFO); + +#ifdef __cplusplus +} +#endif + +#endif /* __WINE_DELAYLOADHANDLER_H */ diff --git a/include/psdk/fileapi.h b/include/psdk/fileapi.h new file mode 100644 index 00000000000..02bbbd4d920 --- /dev/null +++ b/include/psdk/fileapi.h @@ -0,0 +1,41 @@ +/* + * Copyright 2013 André Hentschel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINE_FILEAPI_H +#define __WINE_FILEAPI_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _CREATEFILE2_EXTENDED_PARAMETERS { + DWORD dwSize; + DWORD dwFileAttributes; + DWORD dwFileFlags; + DWORD dwSecurityQosFlags; + LPSECURITY_ATTRIBUTES lpSecurityAttributes; + HANDLE hTemplateFile; +} CREATEFILE2_EXTENDED_PARAMETERS, *PCREATEFILE2_EXTENDED_PARAMETERS, *LPCREATEFILE2_EXTENDED_PARAMETERS; + +WINBASEAPI HANDLE WINAPI CreateFile2(LPCWSTR,DWORD,DWORD,DWORD,LPCREATEFILE2_EXTENDED_PARAMETERS); + +#ifdef __cplusplus +} +#endif + +#endif /* __WINE_FILEAPI_H */ diff --git a/include/psdk/iphlpapi.h b/include/psdk/iphlpapi.h index a799280d265..c6ce686047f 100644 --- a/include/psdk/iphlpapi.h +++ b/include/psdk/iphlpapi.h @@ -1,13 +1,14 @@ #ifndef _IPHLPAPI_H #define _IPHLPAPI_H +#ifdef __cplusplus +extern "C" { +#endif + #include #include #include -#include -#ifdef __cplusplus -extern "C" { -#endif + DWORD WINAPI AddIPAddress(IPAddr,IPMask,DWORD,PULONG,PULONG); DWORD WINAPI CreateIpForwardEntry(PMIB_IPFORWARDROW); DWORD WINAPI CreateIpNetEntry(PMIB_IPNETROW); @@ -58,7 +59,13 @@ DWORD WINAPI SetIpStatistics(PMIB_IPSTATS); DWORD WINAPI SetIpTTL(UINT); DWORD WINAPI SetTcpEntry(PMIB_TCPROW); DWORD WINAPI UnenableRouter(OVERLAPPED*, LPDWORD); + +#if (NTDDI_VERSION >= NTDDI_VISTA) +#include +#endif + #ifdef __cplusplus } #endif + #endif /* _IPHLPAPI_H */ diff --git a/include/psdk/msi.h b/include/psdk/msi.h index 5e162e9a42b..e92d9eef88a 100644 --- a/include/psdk/msi.h +++ b/include/psdk/msi.h @@ -657,7 +657,7 @@ INSTALLSTATE WINAPI MsiQueryProductStateW(_In_ LPCWSTR); UINT WINAPI MsiConfigureProductA(_In_ LPCSTR, _In_ int, _In_ INSTALLSTATE); UINT WINAPI MsiConfigureProductW(_In_ LPCWSTR, _In_ int, _In_ INSTALLSTATE); -#define MsiConfigureProduct WINELIB_NAME_AW(MsiConfigureProduct); +#define MsiConfigureProduct WINELIB_NAME_AW(MsiConfigureProduct) UINT WINAPI @@ -675,7 +675,7 @@ MsiConfigureProductExW( _In_ INSTALLSTATE, _In_opt_ LPCWSTR); -#define MsiConfigureProductEx WINELIB_NAME_AW(MsiConfigureProductEx); +#define MsiConfigureProductEx WINELIB_NAME_AW(MsiConfigureProductEx) UINT WINAPI @@ -691,7 +691,7 @@ MsiConfigureFeatureW( _In_ LPCWSTR, _In_ INSTALLSTATE); -#define MsiConfigureFeature WINELIB_NAME_AW(MsiConfigureFeature); +#define MsiConfigureFeature WINELIB_NAME_AW(MsiConfigureFeature) UINT WINAPI diff --git a/include/psdk/mswsock.h b/include/psdk/mswsock.h index 9f3ee8b3f60..b207881fa89 100644 --- a/include/psdk/mswsock.h +++ b/include/psdk/mswsock.h @@ -278,7 +278,7 @@ typedef INT _Inout_opt_ LPWSAOVERLAPPED lpOverlapped, _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); -#define WSAID_WSASENDMSG +#define WSAID_WSASENDMSG \ {0xa441e712,0x754f,0x43ca,{0x84,0xa7,0x0d,0xee,0x44,0xcf,0x60,0x6d}} typedef INT diff --git a/include/psdk/msxml2.idl b/include/psdk/msxml2.idl index b5275232583..7ce929ffd72 100644 --- a/include/psdk/msxml2.idl +++ b/include/psdk/msxml2.idl @@ -2453,17 +2453,17 @@ interface IVBSAXXMLFilter : IDispatch interface IVBSAXXMLReader : IDispatch { [id(DISPID_SAX_XMLREADER_GETFEATURE)] - HRESULT getFeature( [in] const WCHAR * pFeature, + HRESULT getFeature( [in] BSTR pFeature, [out, retval] VARIANT_BOOL * pValue); [id(DISPID_SAX_XMLREADER_PUTFEATURE)] - HRESULT putFeature( [in] const WCHAR * pFeature, + HRESULT putFeature( [in] BSTR pFeature, [in] VARIANT_BOOL vfValue); [id(DISPID_SAX_XMLREADER_GETPROPERTY)] - HRESULT getProperty( [in] const WCHAR * pProp, + HRESULT getProperty( [in] BSTR pProp, [out, retval] VARIANT * pValue); [id(DISPID_SAX_XMLREADER_PUTPROPERTY)] - HRESULT putProperty( [in] const WCHAR * pProp, [in] VARIANT value); + HRESULT putProperty( [in] BSTR pProp, [in] VARIANT value); [propget, id(DISPID_SAX_XMLREADER_ENTITYRESOLVER)] HRESULT entityResolver( @@ -2488,19 +2488,19 @@ interface IVBSAXXMLReader : IDispatch HRESULT errorHandler([in] IVBSAXErrorHandler * errorHandler); [propget, id(DISPID_SAX_XMLREADER_BASEURL)] - HRESULT baseURL([out, retval] const WCHAR ** pBaseUrl); + HRESULT baseURL([out, retval] BSTR *pBaseUrl); [propput, id(DISPID_SAX_XMLREADER_BASEURL)] - HRESULT baseURL([in] const WCHAR * pBaseUrl); + HRESULT baseURL([in] BSTR pBaseUrl); [propget, id(DISPID_SAX_XMLREADER_SECUREBASEURL)] - HRESULT secureBaseURL([out, retval] const WCHAR ** pSecureBaseUrl); + HRESULT secureBaseURL([out, retval] BSTR *pSecureBaseUrl); [propput, id(DISPID_SAX_XMLREADER_SECUREBASEURL)] - HRESULT secureBaseURL([in] const WCHAR * secureBaseUrl); + HRESULT secureBaseURL([in] BSTR secureBaseUrl); [id(DISPID_SAX_XMLREADER_PARSE)] HRESULT parse( [in] VARIANT varInput); [id(DISPID_SAX_XMLREADER_PARSEURL)] - HRESULT parseURL([in] const WCHAR * url); + HRESULT parseURL([in] BSTR url); } [ diff --git a/include/psdk/msxml6.idl b/include/psdk/msxml6.idl index d811b760015..df6d93d3def 100644 --- a/include/psdk/msxml6.idl +++ b/include/psdk/msxml6.idl @@ -2317,17 +2317,17 @@ interface IVBSAXXMLFilter : IDispatch interface IVBSAXXMLReader : IDispatch { [id(DISPID_SAX_XMLREADER_GETFEATURE)] - HRESULT getFeature( [in] const WCHAR * pFeature, + HRESULT getFeature( [in] BSTR pFeature, [out, retval] VARIANT_BOOL * pValue); [id(DISPID_SAX_XMLREADER_PUTFEATURE)] - HRESULT putFeature( [in] const WCHAR * pFeature, + HRESULT putFeature( [in] BSTR pFeature, [in] VARIANT_BOOL vfValue); [id(DISPID_SAX_XMLREADER_GETPROPERTY)] - HRESULT getProperty( [in] const WCHAR * pProp, + HRESULT getProperty( [in] BSTR pProp, [out, retval] VARIANT * pValue); [id(DISPID_SAX_XMLREADER_PUTPROPERTY)] - HRESULT putProperty( [in] const WCHAR * pProp, [in] VARIANT value); + HRESULT putProperty( [in] BSTR pProp, [in] VARIANT value); [propget, id(DISPID_SAX_XMLREADER_ENTITYRESOLVER)] HRESULT entityResolver( @@ -2352,19 +2352,19 @@ interface IVBSAXXMLReader : IDispatch HRESULT errorHandler([in] IVBSAXErrorHandler * errorHandler); [propget, id(DISPID_SAX_XMLREADER_BASEURL)] - HRESULT baseURL([out, retval] const WCHAR ** pBaseUrl); + HRESULT baseURL([out, retval] BSTR *pBaseUrl); [propput, id(DISPID_SAX_XMLREADER_BASEURL)] - HRESULT baseURL([in] const WCHAR * pBaseUrl); + HRESULT baseURL([in] BSTR pBaseUrl); [propget, id(DISPID_SAX_XMLREADER_SECUREBASEURL)] - HRESULT secureBaseURL([out, retval] const WCHAR ** pSecureBaseUrl); + HRESULT secureBaseURL([out, retval] BSTR *pSecureBaseUrl); [propput, id(DISPID_SAX_XMLREADER_SECUREBASEURL)] - HRESULT secureBaseURL([in] const WCHAR * secureBaseUrl); + HRESULT secureBaseURL([in] BSTR secureBaseUrl); [id(DISPID_SAX_XMLREADER_PARSE)] HRESULT parse( [in] VARIANT varInput); [id(DISPID_SAX_XMLREADER_PARSEURL)] - HRESULT parseURL([in] const WCHAR * url); + HRESULT parseURL([in] BSTR url); } [ diff --git a/include/psdk/objbase.h b/include/psdk/objbase.h index 1db973dc8a7..da464214c1b 100644 --- a/include/psdk/objbase.h +++ b/include/psdk/objbase.h @@ -41,7 +41,7 @@ * virtual methods in C++ and a structure with a table of pointer to functions in C. * Unfortunately the layout of the virtual table is compiler specific, the layout of * g++ virtual tables is not the same as that of an egcs virtual table which is not the - * same as that generated by Visual C+. There are workarounds to make the virtual tables + * same as that generated by Visual C++. There are workarounds to make the virtual tables * compatible via padding but unfortunately the one which is imposed to the WINE emulator * by the Windows binaries, i.e. the Visual C++ one, is the most compact of all. * @@ -168,47 +168,6 @@ * - Of course in C++ we use inheritance so that we don't have to duplicate the method definitions. * - Finally there is no IDirect3D_Xxx macro. These are not needed in C++ unless the CINTERFACE * macro is defined in which case we would not be here. - * - * - * Implementing a COM interface. - * - * This continues the above example. This example assumes that the implementation is in C. - * - * typedef struct IDirect3DImpl { - * void* lpVtbl; - * // ... - * - * } IDirect3DImpl; - * - * static IDirect3DVtbl d3dvt; - * - * // implement the IDirect3D methods here - * - * int IDirect3D_QueryInterface(IDirect3D* me) - * { - * IDirect3DImpl *This = (IDirect3DImpl *)me; - * // ... - * } - * - * // ... - * - * static IDirect3DVtbl d3dvt = { - * IDirect3D_QueryInterface, - * IDirect3D_Add, - * IDirect3D_Add2, - * IDirect3D_Initialize, - * IDirect3D_SetWidth - * }; - * - * Comments: - * - We first define what the interface really contains. This is the IDirect3DImpl structure. The - * first field must of course be the virtual table pointer. Everything else is free. - * - Then we predeclare our static virtual table variable, we will need its address in some - * methods to initialize the virtual table pointer of the returned interface objects. - * - Then we implement the interface methods. To match what has been declared in the header file - * they must take a pointer to an IDirect3D structure and we must cast it to an IDirect3DImpl so - * that we can manipulate the fields. - * - Finally we initialize the virtual table. */ #if defined(__cplusplus) && !defined(CINTERFACE) @@ -772,6 +731,13 @@ StringFromGUID2( _Out_writes_to_(cmax, return) LPOLESTR str, _In_ INT cmax); +_Check_return_ +HRESULT +WINAPI +IIDFromString( + _In_ LPCOLESTR lpsz, + _Out_ LPIID lpiid); + /***************************************************************************** * COM Server dll - exports */ diff --git a/include/psdk/shellapi.h b/include/psdk/shellapi.h index a116c918b95..13b5a236506 100644 --- a/include/psdk/shellapi.h +++ b/include/psdk/shellapi.h @@ -652,6 +652,127 @@ typedef LPSHNAMEMAPPINGA LPSHNAMEMAPPING; #define DoEnvironmentSubst DoEnvironmentSubstA #endif +#if (NTDDI_VERSION >= NTDDI_VISTA) + +typedef struct _SHSTOCKICONINFO { + DWORD cbSize; + HICON hIcon; + int iSysImageIndex; + int iIcon; + WCHAR szPath[MAX_PATH]; +} SHSTOCKICONINFO; + +#define SHGSI_ICONLOCATION 0 + +typedef enum SHSTOCKICONID +{ + SIID_INVALID=-1, + SIID_DOCNOASSOC, + SIID_DOCASSOC, + SIID_APPLICATION, + SIID_FOLDER, + SIID_FOLDEROPEN, + SIID_DRIVE525, + SIID_DRIVE35, + SIID_DRIVERREMOVE, + SIID_DRIVERFIXED, + SIID_DRIVERNET, + SIID_DRIVERNETDISABLE, + SIID_DRIVERCD, + SIID_DRIVERRAM, + SIID_WORLD, + /* Missing: 14 */ + SIID_SERVER = 15, + SIID_PRINTER, + SIID_MYNETWORK, + /* Missing: 18 - 21 */ + SIID_FIND = 22, + SIID_HELP, + /* Missing: 24 - 27 */ + SIID_SHARE = 28, + SIID_LINK, + SIID_SLOWFILE, + SIID_RECYCLER, + SIID_RECYCLERFULL, + /* Missing: 33 - 39 */ + SIID_MEDIACDAUDIO = 40, + /* Missing: 41 - 46 */ + SIID_LOCK = 47, + /* Missing: 48 */ + SIID_AUTOLIST = 49, + SIID_PRINTERNET, + SIID_SERVERSHARE, + SIID_PRINTERFAX, + SIID_PRINTERFAXNET, + SIID_PRINTERFILE, + SIID_STACK, + SIID_MEDIASVCD, + SIID_STUFFEDFOLDER, + SIID_DRIVEUNKNOWN, + SIID_DRIVEDVD, + SIID_MEDIADVD, + SIID_MEDIADVDRAM, + SIID_MEDIADVDRW, + SIID_MEDIADVDR, + SIID_MEDIADVDROM, + SIID_MEDIACDAUDIOPLUS, + SIID_MEDIACDRW, + SIID_MEDIACDR, + SIID_MEDIACDBURN, + SIID_MEDIABLANKCD, + SIID_MEDIACDROM, + SIID_AUDIOFILES, + SIID_IMAGEFILES, + SIID_VIDEOFILES, + SIID_MIXEDFILES, + SIID_FOLDERBACK, + SIID_FOLDERFRONT, + SIID_SHIELD, + SIID_WARNING, + SIID_INFO, + SIID_ERROR, + SIID_KEY, + SIID_SOFTWARE, + SIID_RENAME, + SIID_DELETE, + SIID_MEDIAAUDIODVD, + SIID_MEDIAMOVIEDVD, + SIID_MEDIAENHANCEDCD, + SIID_MEDIAENHANCEDDVD, + SIID_MEDIAHDDVD, + SIID_MEDIABLUERAY, + SIID_MEDIAVCD, + SIID_MEDIADVDPLUSR, + SIID_MEDIADVDPLUSRW, + SIID_DESKTOPPC, + SIID_MOBILEPC, + SIID_USERS, + SIID_MEDIASMARTMEDIA, + SIID_MEDIACOMPACTFLASH, + SIID_DEVICECELLPHONE, + SIID_DEVICECAMERA, + SIID_DEVICEVIDEOCAMERA, + SIID_DEVICEAUDIOPLAYER, + SIID_NETWORKCONNECT, + SIID_INTERNET, + SIID_ZIPFILE, + SIID_SETTINGS, + /* Missing: 107 - 131 */ + SIID_DRIVEHDDVD = 132, + SIID_DRIVEBD, + SIID_MEDIAHDDVDROM, + SIID_MEDIAHDDVDR, + SIID_MEDIAHDDVDRAM, + SIID_MEDIABDROM, + SIID_MEDIABDR, + SIID_MEDIABDRE, + SIID_CLUSTEREDDRIVE, + /* Missing: 141 - 174 */ + SIID_MAX_ICONS = 175 +} SHSTOCKICONID; + +#endif /* (NTDDI_VERSION >= NTDDI_VISTA) */ + #if !defined(_WIN64) #include #endif diff --git a/include/psdk/shlobj.h b/include/psdk/shlobj.h index 4765933d88f..4c84afc72ce 100644 --- a/include/psdk/shlobj.h +++ b/include/psdk/shlobj.h @@ -101,6 +101,7 @@ SHCoCreateInstance( HPSXA WINAPI SHCreatePropSheetExtArray(_In_ HKEY, _In_opt_ LPCWSTR, UINT); HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY,LPCWSTR,UINT,IDataObject*); +HRESULT WINAPI SHCreateQueryCancelAutoPlayMoniker(IMoniker**); HRESULT WINAPI diff --git a/include/psdk/shobjidl.idl b/include/psdk/shobjidl.idl index 4ab0fa86c0d..44a549ff470 100644 --- a/include/psdk/shobjidl.idl +++ b/include/psdk/shobjidl.idl @@ -3813,6 +3813,137 @@ interface ICustomDestinationList : IUnknown HRESULT AbortList(); } +[ + uuid(ddefe873-6997-4e68-be26-39b633adbe12), + object, + pointer_default(unique) +] +interface IQueryCancelAutoPlay : IUnknown +{ + HRESULT AllowAutoPlay([in, string] LPCWSTR path, + [in] DWORD content_type, + [in, string] LPCWSTR label, + [in] DWORD serial_number); +} + +[ + uuid(d594d0d8-8da7-457b-b3b4-ce5dbaac0b88), + pointer_default(unique) +] +interface ITransferAdviseSink : IUnknown +{ + [v1_enum] enum _TRANSFER_ADVISE_STATE + { + TS_NONE = 0, + TS_PERFORMING = 1, + TS_PREPARING = 2, + TS_INDETERMINATE = 4 + }; + typedef DWORD TRANSFER_ADVISE_STATE; + + HRESULT UpdateProgress([in] ULONGLONG size_current, + [in] ULONGLONG size_total, + [in] INT files_current, + [in] INT files_total, + [in] INT folders_current, + [in] INT folders_total); + HRESULT UpdateTransferState([in] TRANSFER_ADVISE_STATE state); + HRESULT ConfirmOverwrite([in] IShellItem *source, + [in] IShellItem *dest_parent, + [in, string] LPCWSTR name); + HRESULT ConfirmEncryptLoss([in] IShellItem *source); + HRESULT FileFailure([in] IShellItem *item, + [in, unique, string] LPCWSTR itemname, + [in] HRESULT hr, + [out, unique, size_is(crename)] LPWSTR rename, + [in] ULONG crename); + HRESULT SubStreamFailure([in] IShellItem *item, + [in, string] LPCWSTR stream, + [in] HRESULT hr); + HRESULT PropertyFailure([in] IShellItem *item, + [in, unique] const PROPERTYKEY *key, + [in] HRESULT hr); +} + +[v1_enum] enum _TRANSFER_SOURCE_FLAGS +{ + TSF_NORMAL = 0, + TSF_FAIL_EXIST = 0, + TSF_RENAME_EXIST = 0x1, + TSF_OVERWRITE_EXIST = 0x2, + TSF_ALLOW_DECRYPTION = 0x4, + TSF_NO_SECURITY = 0x8, + TSF_COPY_CREATION_TIME = 0x10, + TSF_COPY_WRITE_TIME = 0x20, + TSF_USE_FULL_ACCESS = 0x40, + TSF_DELETE_RECYCLE_IF_POSSIBLE = 0x80, + TSF_COPY_HARD_LINK = 0x100, + TSF_COPY_LOCALIZED_NAME = 0x200, + TSF_MOVE_AS_COPY_DELETE = 0x400, + TSF_SUSPEND_SHELLEVENTS = 0x800 +}; +typedef DWORD TRANSFER_SOURCE_FLAGS; + +[ + uuid(00adb003-bde9-45c6-8e29-d09f9353e108), + object, + pointer_default(unique) +] +interface ITransferSource : IUnknown +{ + HRESULT Advise([in] ITransferAdviseSink *sink, [out] DWORD *cookie); + HRESULT Unadvise([in] DWORD cookie); + HRESULT SetProperties([in] IPropertyChangeArray *array); + HRESULT OpenItem([in] IShellItem *item, + [in] TRANSFER_SOURCE_FLAGS flags, + [in] REFIID riid, + [out, iid_is(riid)] void **ppv); + HRESULT MoveItem([in] IShellItem *item, + [in] IShellItem *parent_dest, + [in, string] LPCWSTR name_dest, + [in] TRANSFER_SOURCE_FLAGS flags, + [out] IShellItem **newitem); + HRESULT RecycleItem([in] IShellItem *source, + [in] IShellItem *parent_dest, + [in] TRANSFER_SOURCE_FLAGS flags, + [out] IShellItem **new_dest); + HRESULT RemoveItem([in] IShellItem *source, [in] TRANSFER_SOURCE_FLAGS flags); + HRESULT RenameItem([in] IShellItem *source, + [in, string] LPCWSTR newname, + [in] TRANSFER_SOURCE_FLAGS flags, + [out] IShellItem **new_dest); + HRESULT LinkItem([in] IShellItem *source, + [in] IShellItem *parent_dest, + [in, unique, string] LPCWSTR new_name, + [in] TRANSFER_SOURCE_FLAGS flags, + [out] IShellItem **new_dest); + HRESULT ApplyPropertiesToItem([in] IShellItem *source, [out] IShellItem **newitem); + HRESULT GetDefaultDestinationName([in] IShellItem *source, + [in] IShellItem *parent_dest, + [out, string] LPWSTR *dest_name); + HRESULT EnterFolder([in] IShellItem *child_folder); + HRESULT LeaveFolder([in] IShellItem *child_folder); +} + +[ + uuid(48addd32-3ca5-4124-abe3-b5a72531b207), + object, + pointer_default(unique) +] +interface ITransferDestination : IUnknown +{ + HRESULT Advise([in] ITransferAdviseSink *sink, [out] DWORD *cookie); + HRESULT Unadvise([in] DWORD cookie); + HRESULT CreateItem([in, string] LPCWSTR name, + [in] DWORD attr, + [in] ULONGLONG size, + [in] TRANSFER_SOURCE_FLAGS flags, + [in] REFIID riid, + [out, iid_is(riid)] void **ppv, + [in] REFIID resources, + [out, iid_is(riid)] void **presources); +} + /***************************************************************************** * ShellObjects typelibrary */ @@ -3894,6 +4025,14 @@ library ShellObjects interface ICustomDestinationList; } + [ + uuid(331f1768-05a9-4ddd-b86e-dae34ddc998a) + ] + coclass QueryCancelAutoPlay + { + interface IQueryCancelAutoPlay; + } + [ uuid(9ac9fbe1-e0a2-4ad6-b4ee-e212013ea917) ] diff --git a/include/psdk/urlmon.idl b/include/psdk/urlmon.idl index 7407c18b61b..2ccba5b0d6f 100644 --- a/include/psdk/urlmon.idl +++ b/include/psdk/urlmon.idl @@ -258,7 +258,23 @@ interface IBindStatusCallback : IUnknown BINDSTATUS_CONTENTDISPOSITIONFILENAME, BINDSTATUS_MIMETEXTPLAINMISMATCH, BINDSTATUS_PUBLISHERAVAILABLE, - BINDSTATUS_DISPLAYNAMEAVAILABLE + BINDSTATUS_DISPLAYNAMEAVAILABLE, + BINDSTATUS_SSLUX_NAVBLOCKED, + BINDSTATUS_SERVER_MIMETYPEAVAILABLE, + BINDSTATUS_SNIFFED_CLASSIDAVAILABLE, + BINDSTATUS_64BIT_PROGRESS, + BINDSTATUS_LAST = BINDSTATUS_64BIT_PROGRESS, + BINDSTATUS_RESERVED_0 = (BINDSTATUS_LAST+1), + BINDSTATUS_RESERVED_1 = (BINDSTATUS_RESERVED_0+1), + BINDSTATUS_RESERVED_2 = (BINDSTATUS_RESERVED_1+1), + BINDSTATUS_RESERVED_3 = (BINDSTATUS_RESERVED_2+1), + BINDSTATUS_RESERVED_4 = (BINDSTATUS_RESERVED_3+1), + BINDSTATUS_RESERVED_5 = (BINDSTATUS_RESERVED_4+1), + BINDSTATUS_RESERVED_6 = (BINDSTATUS_RESERVED_5+1), + BINDSTATUS_RESERVED_7 = (BINDSTATUS_RESERVED_6+1), + BINDSTATUS_RESERVED_8 = (BINDSTATUS_RESERVED_7+1), + BINDSTATUS_RESERVED_9 = (BINDSTATUS_RESERVED_8+1), + BINDSTATUS_LAST_PRIVATE = BINDSTATUS_RESERVED_9 } BINDSTATUS; @@ -706,7 +722,13 @@ interface IInternetBindInfo : IUnknown BINDSTRING_URL, BINDSTRING_IID, BINDSTRING_FLAG_BIND_TO_OBJECT, - BINDSTRING_PTR_BIND_CONTEXT + BINDSTRING_PTR_BIND_CONTEXT, + BINDSTRING_XDR_ORIGIN, + BINDSTRING_DOWNLOADPATH, + BINDSTRING_ROOTDOC_URL, + BINDSTRING_INITIAL_FILENAME, + BINDSTRING_PROXY_USERNAME, + BINDSTRING_PROXY_PASSWORD } BINDSTRING; HRESULT GetBindInfo( diff --git a/include/psdk/vfwmsgs.h b/include/psdk/vfwmsgs.h index 16b25c30033..b7b0fae273c 100644 --- a/include/psdk/vfwmsgs.h +++ b/include/psdk/vfwmsgs.h @@ -16,151 +16,162 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define VFW_S_NO_MORE_ITEMS ((HRESULT)0x00040103) -#define VFW_S_DUPLICATE_NAME ((HRESULT)0x0004022D) -#define VFW_S_STATE_INTERMEDIATE ((HRESULT)0x00040237) -#define VFW_S_PARTIAL_RENDER ((HRESULT)0x00040242) -#define VFW_S_SOME_DATA_IGNORED ((HRESULT)0x00040245) -#define VFW_S_CONNECTIONS_DEFERRED ((HRESULT)0x00040246) -#define VFW_S_RESOURCE_NOT_NEEDED ((HRESULT)0x00040250) -#define VFW_S_MEDIA_TYPE_IGNORED ((HRESULT)0x00040254) -#define VFW_S_VIDEO_NOT_RENDERED ((HRESULT)0x00040257) -#define VFW_S_AUDIO_NOT_RENDERED ((HRESULT)0x00040258) -#define VFW_S_RPZA ((HRESULT)0x0004025A) -#define VFW_S_ESTIMATED ((HRESULT)0x00040260) -#define VFW_S_RESERVED ((HRESULT)0x00040263) -#define VFW_S_STREAM_OFF ((HRESULT)0x00040267) -#define VFW_S_CANT_CUE ((HRESULT)0x00040268) -#define VFW_S_NO_STOP_TIME ((HRESULT)0x00040270) -#define VFW_S_NOPREVIEWPIN ((HRESULT)0x0004027E) -#define VFW_S_DVD_NON_ONE_SEQUENTIAL ((HRESULT)0x00040280) -#define VFW_S_DVD_CHANNEL_CONTENTS_NOT_AVAILABLE ((HRESULT)0x0004028C) -#define VFW_S_DVD_NOT_ACCURATE ((HRESULT)0x0004028D) -#define VFW_E_INVALIDMEDIATYPE ((HRESULT)0x80040200) -#define VFW_E_INVALIDSUBTYPE ((HRESULT)0x80040201) -#define VFW_E_NEED_OWNER ((HRESULT)0x80040202) -#define VFW_E_ENUM_OUT_OF_SYNC ((HRESULT)0x80040203) -#define VFW_E_ALREADY_CONNECTED ((HRESULT)0x80040204) -#define VFW_E_FILTER_ACTIVE ((HRESULT)0x80040205) -#define VFW_E_NO_TYPES ((HRESULT)0x80040206) -#define VFW_E_NO_ACCEPTABLE_TYPES ((HRESULT)0x80040207) -#define VFW_E_INVALID_DIRECTION ((HRESULT)0x80040208) -#define VFW_E_NOT_CONNECTED ((HRESULT)0x80040209) -#define VFW_E_NO_ALLOCATOR ((HRESULT)0x8004020A) -#define VFW_E_RUNTIME_ERROR ((HRESULT)0x8004020B) -#define VFW_E_BUFFER_NOTSET ((HRESULT)0x8004020C) -#define VFW_E_BUFFER_OVERFLOW ((HRESULT)0x8004020D) -#define VFW_E_BADALIGN ((HRESULT)0x8004020E) -#define VFW_E_ALREADY_COMMITTED ((HRESULT)0x8004020F) -#define VFW_E_BUFFERS_OUTSTANDING ((HRESULT)0x80040210) -#define VFW_E_NOT_COMMITTED ((HRESULT)0x80040211) -#define VFW_E_SIZENOTSET ((HRESULT)0x80040212) -#define VFW_E_NO_CLOCK ((HRESULT)0x80040213) -#define VFW_E_NO_SINK ((HRESULT)0x80040214) -#define VFW_E_NO_INTERFACE ((HRESULT)0x80040215) -#define VFW_E_NOT_FOUND ((HRESULT)0x80040216) -#define VFW_E_CANNOT_CONNECT ((HRESULT)0x80040217) -#define VFW_E_CANNOT_RENDER ((HRESULT)0x80040218) -#define VFW_E_CHANGING_FORMAT ((HRESULT)0x80040219) -#define VFW_E_NO_COLOR_KEY_SET ((HRESULT)0x8004021A) -#define VFW_E_NOT_OVERLAY_CONNECTION ((HRESULT)0x8004021B) -#define VFW_E_NOT_SAMPLE_CONNECTION ((HRESULT)0x8004021C) -#define VFW_E_PALETTE_SET ((HRESULT)0x8004021D) -#define VFW_E_COLOR_KEY_SET ((HRESULT)0x8004021E) -#define VFW_E_NO_COLOR_KEY_FOUND ((HRESULT)0x8004021F) -#define VFW_E_NO_PALETTE_AVAILABLE ((HRESULT)0x80040220) -#define VFW_E_NO_DISPLAY_PALETTE ((HRESULT)0x80040221) -#define VFW_E_TOO_MANY_COLORS ((HRESULT)0x80040222) -#define VFW_E_STATE_CHANGED ((HRESULT)0x80040223) -#define VFW_E_NOT_STOPPED ((HRESULT)0x80040224) -#define VFW_E_NOT_PAUSED ((HRESULT)0x80040225) -#define VFW_E_NOT_RUNNING ((HRESULT)0x80040226) -#define VFW_E_WRONG_STATE ((HRESULT)0x80040227) -#define VFW_E_START_TIME_AFTER_END ((HRESULT)0x80040228) -#define VFW_E_INVALID_RECT ((HRESULT)0x80040229) -#define VFW_E_TYPE_NOT_ACCEPTED ((HRESULT)0x8004022A) -#define VFW_E_SAMPLE_REJECTED ((HRESULT)0x8004022B) -#define VFW_E_SAMPLE_REJECTED_EOS ((HRESULT)0x8004022C) -#define VFW_E_DUPLICATE_NAME ((HRESULT)0x8004022D) -#define VFW_E_TIMEOUT ((HRESULT)0x8004022E) -#define VFW_E_INVALID_FILE_FORMAT ((HRESULT)0x8004022F) -#define VFW_E_ENUM_OUT_OF_RANGE ((HRESULT)0x80040230) -#define VFW_E_CIRCULAR_GRAPH ((HRESULT)0x80040231) -#define VFW_E_NOT_ALLOWED_TO_SAVE ((HRESULT)0x80040232) -#define VFW_E_TIME_ALREADY_PASSED ((HRESULT)0x80040233) -#define VFW_E_ALREADY_CANCELLED ((HRESULT)0x80040234) -#define VFW_E_CORRUPT_GRAPH_FILE ((HRESULT)0x80040235) -#define VFW_E_ADVISE_ALREADY_SET ((HRESULT)0x80040236) -#define VFW_E_NO_MODEX_AVAILABLE ((HRESULT)0x80040238) -#define VFW_E_NO_ADVISE_SET ((HRESULT)0x80040239) -#define VFW_E_NO_FULLSCREEN ((HRESULT)0x8004023A) -#define VFW_E_IN_FULLSCREEN_MODE ((HRESULT)0x8004023B) -#define VFW_E_UNKNOWN_FILE_TYPE ((HRESULT)0x80040240) -#define VFW_E_CANNOT_LOAD_SOURCE_FILTER ((HRESULT)0x80040241) -#define VFW_E_FILE_TOO_SHORT ((HRESULT)0x80040243) -#define VFW_E_INVALID_FILE_VERSION ((HRESULT)0x80040244) -#define VFW_E_INVALID_CLSID ((HRESULT)0x80040247) -#define VFW_E_INVALID_MEDIA_TYPE ((HRESULT)0x80040248) -#define VFW_E_SAMPLE_TIME_NOT_SET ((HRESULT)0x80040249) -#define VFW_E_MEDIA_TIME_NOT_SET ((HRESULT)0x80040251) -#define VFW_E_NO_TIME_FORMAT_SET ((HRESULT)0x80040252) -#define VFW_E_MONO_AUDIO_HW ((HRESULT)0x80040253) -#define VFW_E_NO_DECOMPRESSOR ((HRESULT)0x80040255) -#define VFW_E_NO_AUDIO_HARDWARE ((HRESULT)0x80040256) -#define VFW_E_RPZA ((HRESULT)0x80040259) -#define VFW_E_PROCESSOR_NOT_SUITABLE ((HRESULT)0x8004025B) -#define VFW_E_UNSUPPORTED_AUDIO ((HRESULT)0x8004025C) -#define VFW_E_UNSUPPORTED_VIDEO ((HRESULT)0x8004025D) -#define VFW_E_MPEG_NOT_CONSTRAINED ((HRESULT)0x8004025E) -#define VFW_E_NOT_IN_GRAPH ((HRESULT)0x8004025F) -#define VFW_E_NO_TIME_FORMAT ((HRESULT)0x80040261) -#define VFW_E_READ_ONLY ((HRESULT)0x80040262) -#define VFW_E_BUFFER_UNDERFLOW ((HRESULT)0x80040264) -#define VFW_E_UNSUPPORTED_STREAM ((HRESULT)0x80040265) -#define VFW_E_NO_TRANSPORT ((HRESULT)0x80040266) -#define VFW_E_BAD_VIDEOCD ((HRESULT)0x80040269) -#define VFW_E_OUT_OF_VIDEO_MEMORY ((HRESULT)0x80040271) -#define VFW_E_VP_NEGOTIATION_FAILED ((HRESULT)0x80040272) -#define VFW_E_DDRAW_CAPS_NOT_SUITABLE ((HRESULT)0x80040273) -#define VFW_E_NO_VP_HARDWARE ((HRESULT)0x80040274) -#define VFW_E_NO_CAPTURE_HARDWARE ((HRESULT)0x80040275) -#define VFW_E_DVD_OPERATION_INHIBITED ((HRESULT)0x80040276) -#define VFW_E_DVD_INVALIDDOMAIN ((HRESULT)0x80040277) -#define VFW_E_DVD_NO_BUTTON ((HRESULT)0x80040278) -#define VFW_E_DVD_GRAPHNOTREADY ((HRESULT)0x80040279) -#define VFW_E_DVD_RENDERFAIL ((HRESULT)0x8004027A) -#define VFW_E_DVD_DECNOTENOUGH ((HRESULT)0x8004027B) -#define VFW_E_DDRAW_VERSION_NOT_SUITABLE ((HRESULT)0x8004027C) -#define VFW_E_COPYPROT_FAILED ((HRESULT)0x8004027D) -#define VFW_E_TIME_EXPIRED ((HRESULT)0x8004027F) -#define VFW_E_DVD_WRONG_SPEED ((HRESULT)0x80040281) -#define VFW_E_DVD_MENU_DOES_NOT_EXIST ((HRESULT)0x80040282) -#define VFW_E_DVD_CMD_CANCELLED ((HRESULT)0x80040283) -#define VFW_E_DVD_STATE_WRONG_VERSION ((HRESULT)0x80040284) -#define VFW_E_DVD_STATE_CORRUPT ((HRESULT)0x80040285) -#define VFW_E_DVD_STATE_WRONG_DISC ((HRESULT)0x80040286) -#define VFW_E_DVD_INCOMPATIBLE_REGION ((HRESULT)0x80040287) -#define VFW_E_DVD_NO_ATTRIBUTES ((HRESULT)0x80040288) -#define VFW_E_DVD_NO_GOUP_PGC ((HRESULT)0x80040289) -#define VFW_E_DVD_LOW_PARENTAL_LEVEL ((HRESULT)0x8004028A) -#define VFW_E_DVD_NOT_IN_KARAOKE_MODE ((HRESULT)0x8004028B) -#define VFW_E_FRAME_STEP_UNSUPPORTED ((HRESULT)0x8004028E) -#define VFW_E_DVD_STREAM_DISABLED ((HRESULT)0x8004028F) -#define VFW_E_DVD_TITLE_UNKNOWN ((HRESULT)0x80040290) -#define VFW_E_DVD_INVALID_DISC ((HRESULT)0x80040291) -#define VFW_E_DVD_NO_RESUME_INFORMATION ((HRESULT)0x80040292) -#define VFW_E_PIN_ALREADY_BLOCKED_ON_THIS_THREAD ((HRESULT)0x80040293) -#define VFW_E_PIN_ALREADY_BLOCKED ((HRESULT)0x80040294) -#define VFW_E_CERTIFICATION_FAILURE ((HRESULT)0x80040295) -#define VFW_E_VMR_NOT_IN_MIXER_MODE ((HRESULT)0x80040296) -#define VFW_E_VMR_NO_AP_SUPPLIED ((HRESULT)0x80040297) -#define VFW_E_VMR_NO_DEINTERLACE_HW ((HRESULT)0x80040298) -#define VFW_E_DVD_VMR9_INCOMPATIBLEDEC ((HRESULT)0x8004029A) -#define VFW_E_BAD_KEY ((HRESULT)0x800403F2) +#define VFW_S_NO_MORE_ITEMS ((HRESULT)0x00040103) +#define VFW_S_DUPLICATE_NAME ((HRESULT)0x0004022D) +#define VFW_S_STATE_INTERMEDIATE ((HRESULT)0x00040237) +#define VFW_S_PARTIAL_RENDER ((HRESULT)0x00040242) +#define VFW_S_SOME_DATA_IGNORED ((HRESULT)0x00040245) +#define VFW_S_CONNECTIONS_DEFERRED ((HRESULT)0x00040246) +#define VFW_S_RESOURCE_NOT_NEEDED ((HRESULT)0x00040250) +#define VFW_S_MEDIA_TYPE_IGNORED ((HRESULT)0x00040254) +#define VFW_S_VIDEO_NOT_RENDERED ((HRESULT)0x00040257) +#define VFW_S_AUDIO_NOT_RENDERED ((HRESULT)0x00040258) +#define VFW_S_RPZA ((HRESULT)0x0004025A) +#define VFW_S_ESTIMATED ((HRESULT)0x00040260) +#define VFW_S_RESERVED ((HRESULT)0x00040263) +#define VFW_S_STREAM_OFF ((HRESULT)0x00040267) +#define VFW_S_CANT_CUE ((HRESULT)0x00040268) +#define VFW_S_NO_STOP_TIME ((HRESULT)0x00040270) +#define VFW_S_NOPREVIEWPIN ((HRESULT)0x0004027E) +#define VFW_S_DVD_NON_ONE_SEQUENTIAL ((HRESULT)0x00040280) +#define VFW_S_DVD_CHANNEL_CONTENTS_NOT_AVAILABLE ((HRESULT)0x0004028C) +#define VFW_S_DVD_NOT_ACCURATE ((HRESULT)0x0004028D) +#define VFW_E_INVALIDMEDIATYPE ((HRESULT)0x80040200) +#define VFW_E_INVALIDSUBTYPE ((HRESULT)0x80040201) +#define VFW_E_NEED_OWNER ((HRESULT)0x80040202) +#define VFW_E_ENUM_OUT_OF_SYNC ((HRESULT)0x80040203) +#define VFW_E_ALREADY_CONNECTED ((HRESULT)0x80040204) +#define VFW_E_FILTER_ACTIVE ((HRESULT)0x80040205) +#define VFW_E_NO_TYPES ((HRESULT)0x80040206) +#define VFW_E_NO_ACCEPTABLE_TYPES ((HRESULT)0x80040207) +#define VFW_E_INVALID_DIRECTION ((HRESULT)0x80040208) +#define VFW_E_NOT_CONNECTED ((HRESULT)0x80040209) +#define VFW_E_NO_ALLOCATOR ((HRESULT)0x8004020A) +#define VFW_E_RUNTIME_ERROR ((HRESULT)0x8004020B) +#define VFW_E_BUFFER_NOTSET ((HRESULT)0x8004020C) +#define VFW_E_BUFFER_OVERFLOW ((HRESULT)0x8004020D) +#define VFW_E_BADALIGN ((HRESULT)0x8004020E) +#define VFW_E_ALREADY_COMMITTED ((HRESULT)0x8004020F) +#define VFW_E_BUFFERS_OUTSTANDING ((HRESULT)0x80040210) +#define VFW_E_NOT_COMMITTED ((HRESULT)0x80040211) +#define VFW_E_SIZENOTSET ((HRESULT)0x80040212) +#define VFW_E_NO_CLOCK ((HRESULT)0x80040213) +#define VFW_E_NO_SINK ((HRESULT)0x80040214) +#define VFW_E_NO_INTERFACE ((HRESULT)0x80040215) +#define VFW_E_NOT_FOUND ((HRESULT)0x80040216) +#define VFW_E_CANNOT_CONNECT ((HRESULT)0x80040217) +#define VFW_E_CANNOT_RENDER ((HRESULT)0x80040218) +#define VFW_E_CHANGING_FORMAT ((HRESULT)0x80040219) +#define VFW_E_NO_COLOR_KEY_SET ((HRESULT)0x8004021A) +#define VFW_E_NOT_OVERLAY_CONNECTION ((HRESULT)0x8004021B) +#define VFW_E_NOT_SAMPLE_CONNECTION ((HRESULT)0x8004021C) +#define VFW_E_PALETTE_SET ((HRESULT)0x8004021D) +#define VFW_E_COLOR_KEY_SET ((HRESULT)0x8004021E) +#define VFW_E_NO_COLOR_KEY_FOUND ((HRESULT)0x8004021F) +#define VFW_E_NO_PALETTE_AVAILABLE ((HRESULT)0x80040220) +#define VFW_E_NO_DISPLAY_PALETTE ((HRESULT)0x80040221) +#define VFW_E_TOO_MANY_COLORS ((HRESULT)0x80040222) +#define VFW_E_STATE_CHANGED ((HRESULT)0x80040223) +#define VFW_E_NOT_STOPPED ((HRESULT)0x80040224) +#define VFW_E_NOT_PAUSED ((HRESULT)0x80040225) +#define VFW_E_NOT_RUNNING ((HRESULT)0x80040226) +#define VFW_E_WRONG_STATE ((HRESULT)0x80040227) +#define VFW_E_START_TIME_AFTER_END ((HRESULT)0x80040228) +#define VFW_E_INVALID_RECT ((HRESULT)0x80040229) +#define VFW_E_TYPE_NOT_ACCEPTED ((HRESULT)0x8004022A) +#define VFW_E_SAMPLE_REJECTED ((HRESULT)0x8004022B) +#define VFW_E_SAMPLE_REJECTED_EOS ((HRESULT)0x8004022C) +#define VFW_E_DUPLICATE_NAME ((HRESULT)0x8004022D) +#define VFW_E_TIMEOUT ((HRESULT)0x8004022E) +#define VFW_E_INVALID_FILE_FORMAT ((HRESULT)0x8004022F) +#define VFW_E_ENUM_OUT_OF_RANGE ((HRESULT)0x80040230) +#define VFW_E_CIRCULAR_GRAPH ((HRESULT)0x80040231) +#define VFW_E_NOT_ALLOWED_TO_SAVE ((HRESULT)0x80040232) +#define VFW_E_TIME_ALREADY_PASSED ((HRESULT)0x80040233) +#define VFW_E_ALREADY_CANCELLED ((HRESULT)0x80040234) +#define VFW_E_CORRUPT_GRAPH_FILE ((HRESULT)0x80040235) +#define VFW_E_ADVISE_ALREADY_SET ((HRESULT)0x80040236) +#define VFW_E_NO_MODEX_AVAILABLE ((HRESULT)0x80040238) +#define VFW_E_NO_ADVISE_SET ((HRESULT)0x80040239) +#define VFW_E_NO_FULLSCREEN ((HRESULT)0x8004023A) +#define VFW_E_IN_FULLSCREEN_MODE ((HRESULT)0x8004023B) +#define VFW_E_UNKNOWN_FILE_TYPE ((HRESULT)0x80040240) +#define VFW_E_CANNOT_LOAD_SOURCE_FILTER ((HRESULT)0x80040241) +#define VFW_E_FILE_TOO_SHORT ((HRESULT)0x80040243) +#define VFW_E_INVALID_FILE_VERSION ((HRESULT)0x80040244) +#define VFW_E_INVALID_CLSID ((HRESULT)0x80040247) +#define VFW_E_INVALID_MEDIA_TYPE ((HRESULT)0x80040248) +#define VFW_E_SAMPLE_TIME_NOT_SET ((HRESULT)0x80040249) +#define VFW_E_MEDIA_TIME_NOT_SET ((HRESULT)0x80040251) +#define VFW_E_NO_TIME_FORMAT_SET ((HRESULT)0x80040252) +#define VFW_E_MONO_AUDIO_HW ((HRESULT)0x80040253) +#define VFW_E_NO_DECOMPRESSOR ((HRESULT)0x80040255) +#define VFW_E_NO_AUDIO_HARDWARE ((HRESULT)0x80040256) +#define VFW_E_RPZA ((HRESULT)0x80040259) +#define VFW_E_PROCESSOR_NOT_SUITABLE ((HRESULT)0x8004025B) +#define VFW_E_UNSUPPORTED_AUDIO ((HRESULT)0x8004025C) +#define VFW_E_UNSUPPORTED_VIDEO ((HRESULT)0x8004025D) +#define VFW_E_MPEG_NOT_CONSTRAINED ((HRESULT)0x8004025E) +#define VFW_E_NOT_IN_GRAPH ((HRESULT)0x8004025F) +#define VFW_E_NO_TIME_FORMAT ((HRESULT)0x80040261) +#define VFW_E_READ_ONLY ((HRESULT)0x80040262) +#define VFW_E_BUFFER_UNDERFLOW ((HRESULT)0x80040264) +#define VFW_E_UNSUPPORTED_STREAM ((HRESULT)0x80040265) +#define VFW_E_NO_TRANSPORT ((HRESULT)0x80040266) +#define VFW_E_BAD_VIDEOCD ((HRESULT)0x80040269) +#define VFW_E_OUT_OF_VIDEO_MEMORY ((HRESULT)0x80040271) +#define VFW_E_VP_NEGOTIATION_FAILED ((HRESULT)0x80040272) +#define VFW_E_DDRAW_CAPS_NOT_SUITABLE ((HRESULT)0x80040273) +#define VFW_E_NO_VP_HARDWARE ((HRESULT)0x80040274) +#define VFW_E_NO_CAPTURE_HARDWARE ((HRESULT)0x80040275) +#define VFW_E_DVD_OPERATION_INHIBITED ((HRESULT)0x80040276) +#define VFW_E_DVD_INVALIDDOMAIN ((HRESULT)0x80040277) +#define VFW_E_DVD_NO_BUTTON ((HRESULT)0x80040278) +#define VFW_E_DVD_GRAPHNOTREADY ((HRESULT)0x80040279) +#define VFW_E_DVD_RENDERFAIL ((HRESULT)0x8004027A) +#define VFW_E_DVD_DECNOTENOUGH ((HRESULT)0x8004027B) +#define VFW_E_DDRAW_VERSION_NOT_SUITABLE ((HRESULT)0x8004027C) +#define VFW_E_COPYPROT_FAILED ((HRESULT)0x8004027D) +#define VFW_E_TIME_EXPIRED ((HRESULT)0x8004027F) +#define VFW_E_DVD_WRONG_SPEED ((HRESULT)0x80040281) +#define VFW_E_DVD_MENU_DOES_NOT_EXIST ((HRESULT)0x80040282) +#define VFW_E_DVD_CMD_CANCELLED ((HRESULT)0x80040283) +#define VFW_E_DVD_STATE_WRONG_VERSION ((HRESULT)0x80040284) +#define VFW_E_DVD_STATE_CORRUPT ((HRESULT)0x80040285) +#define VFW_E_DVD_STATE_WRONG_DISC ((HRESULT)0x80040286) +#define VFW_E_DVD_INCOMPATIBLE_REGION ((HRESULT)0x80040287) +#define VFW_E_DVD_NO_ATTRIBUTES ((HRESULT)0x80040288) +#define VFW_E_DVD_NO_GOUP_PGC ((HRESULT)0x80040289) +#define VFW_E_DVD_LOW_PARENTAL_LEVEL ((HRESULT)0x8004028A) +#define VFW_E_DVD_NOT_IN_KARAOKE_MODE ((HRESULT)0x8004028B) +#define VFW_E_FRAME_STEP_UNSUPPORTED ((HRESULT)0x8004028E) +#define VFW_E_DVD_STREAM_DISABLED ((HRESULT)0x8004028F) +#define VFW_E_DVD_TITLE_UNKNOWN ((HRESULT)0x80040290) +#define VFW_E_DVD_INVALID_DISC ((HRESULT)0x80040291) +#define VFW_E_DVD_NO_RESUME_INFORMATION ((HRESULT)0x80040292) +#define VFW_E_PIN_ALREADY_BLOCKED_ON_THIS_THREAD ((HRESULT)0x80040293) +#define VFW_E_PIN_ALREADY_BLOCKED ((HRESULT)0x80040294) +#define VFW_E_CERTIFICATION_FAILURE ((HRESULT)0x80040295) +#define VFW_E_VMR_NOT_IN_MIXER_MODE ((HRESULT)0x80040296) +#define VFW_E_VMR_NO_AP_SUPPLIED ((HRESULT)0x80040297) +#define VFW_E_VMR_NO_DEINTERLACE_HW ((HRESULT)0x80040298) +#define VFW_E_VMR_NO_PROCAMP_HW ((HRESULT)0x80040299) +#define VFW_E_DVD_VMR9_INCOMPATIBLEDEC ((HRESULT)0x8004029A) +#define VFW_E_NO_COPP_HW ((HRESULT)0x8004029B) +#define VFW_E_DVD_NONBLOCKING ((HRESULT)0x8004029C) +#define VFW_E_DVD_TOO_MANY_RENDERERS_IN_FILTER_GRAPH ((HRESULT)0x8004029D) +#define VFW_E_DVD_NON_EVR_RENDERER_IN_FILTER_GRAPH ((HRESULT)0x8004029E) +#define VFW_E_DVD_RESOLUTION_ERROR ((HRESULT)0x8004029F) +#define VFW_E_CODECAPI_LINEAR_RANGE ((HRESULT)0x80040310) +#define VFW_E_CODECAPI_ENUMERATED ((HRESULT)0x80040311) +#define VFW_E_CODECAPI_NO_DEFAULT ((HRESULT)0x80040313) +#define VFW_E_CODECAPI_NO_CURRENT_VALUE ((HRESULT)0x80040314) +#define VFW_E_DVD_CHAPTER_DOES_NOT_EXIST ((HRESULT)0x80040315) +#define VFW_E_BAD_KEY ((HRESULT)0x800403F2) #ifndef E_PROP_ID_UNSUPPORTED -#define E_PROP_ID_UNSUPPORTED ((HRESULT)0x80070490) +#define E_PROP_ID_UNSUPPORTED ((HRESULT)0x80070490) #endif #ifndef E_PROP_SET_UNSUPPORTED -#define E_PROP_SET_UNSUPPORTED ((HRESULT)0x80070492) +#define E_PROP_SET_UNSUPPORTED ((HRESULT)0x80070492) #endif diff --git a/include/psdk/winbase.h b/include/psdk/winbase.h index d826ec16ae6..d6f9da628a2 100644 --- a/include/psdk/winbase.h +++ b/include/psdk/winbase.h @@ -3641,6 +3641,124 @@ typedef BOOL _Inout_opt_ PVOID Parameter, _Outptr_opt_result_maybenull_ PVOID *Context); +#if _WIN32_WINNT >= 0x0601 + +#define COPYFILE2_MESSAGE_COPY_OFFLOAD 0x00000001L + +typedef enum _COPYFILE2_MESSAGE_TYPE { + COPYFILE2_CALLBACK_NONE = 0, + COPYFILE2_CALLBACK_CHUNK_STARTED, + COPYFILE2_CALLBACK_CHUNK_FINISHED, + COPYFILE2_CALLBACK_STREAM_STARTED, + COPYFILE2_CALLBACK_STREAM_FINISHED, + COPYFILE2_CALLBACK_POLL_CONTINUE, + COPYFILE2_CALLBACK_ERROR, + COPYFILE2_CALLBACK_MAX, +} COPYFILE2_MESSAGE_TYPE; + +typedef enum _COPYFILE2_MESSAGE_ACTION { + COPYFILE2_PROGRESS_CONTINUE = 0, + COPYFILE2_PROGRESS_CANCEL, + COPYFILE2_PROGRESS_STOP, + COPYFILE2_PROGRESS_QUIET, + COPYFILE2_PROGRESS_PAUSE, +} COPYFILE2_MESSAGE_ACTION; + +typedef enum _COPYFILE2_COPY_PHASE { + COPYFILE2_PHASE_NONE = 0, + COPYFILE2_PHASE_PREPARE_SOURCE, + COPYFILE2_PHASE_PREPARE_DEST, + COPYFILE2_PHASE_READ_SOURCE, + COPYFILE2_PHASE_WRITE_DESTINATION, + COPYFILE2_PHASE_SERVER_COPY, + COPYFILE2_PHASE_NAMEGRAFT_COPY, + COPYFILE2_PHASE_MAX, +} COPYFILE2_COPY_PHASE; + +typedef struct COPYFILE2_MESSAGE { + COPYFILE2_MESSAGE_TYPE Type; + DWORD dwPadding; + union { + struct { + DWORD dwStreamNumber; + DWORD dwReserved; + HANDLE hSourceFile; + HANDLE hDestinationFile; + ULARGE_INTEGER uliChunkNumber; + ULARGE_INTEGER uliChunkSize; + ULARGE_INTEGER uliStreamSize; + ULARGE_INTEGER uliTotalFileSize; + } ChunkStarted; + struct { + DWORD dwStreamNumber; + DWORD dwFlags; + HANDLE hSourceFile; + HANDLE hDestinationFile; + ULARGE_INTEGER uliChunkNumber; + ULARGE_INTEGER uliChunkSize; + ULARGE_INTEGER uliStreamSize; + ULARGE_INTEGER uliStreamBytesTransferred; + ULARGE_INTEGER uliTotalFileSize; + ULARGE_INTEGER uliTotalBytesTransferred; + } ChunkFinished; + struct { + DWORD dwStreamNumber; + DWORD dwReserved; + HANDLE hSourceFile; + HANDLE hDestinationFile; + ULARGE_INTEGER uliStreamSize; + ULARGE_INTEGER uliTotalFileSize; + } StreamStarted; + struct { + DWORD dwStreamNumber; + DWORD dwReserved; + HANDLE hSourceFile; + HANDLE hDestinationFile; + ULARGE_INTEGER uliStreamSize; + ULARGE_INTEGER uliStreamBytesTransferred; + ULARGE_INTEGER uliTotalFileSize; + ULARGE_INTEGER uliTotalBytesTransferred; + } StreamFinished; + struct { + DWORD dwReserved; + } PollContinue; + struct { + COPYFILE2_COPY_PHASE CopyPhase; + DWORD dwStreamNumber; + HRESULT hrFailure; + DWORD dwReserved; + ULARGE_INTEGER uliChunkNumber; + ULARGE_INTEGER uliStreamSize; + ULARGE_INTEGER uliStreamBytesTransferred; + ULARGE_INTEGER uliTotalFileSize; + ULARGE_INTEGER uliTotalBytesTransferred; + } Error; + } Info; +} COPYFILE2_MESSAGE; + +typedef COPYFILE2_MESSAGE_ACTION +(CALLBACK *PCOPYFILE2_PROGRESS_ROUTINE)( + _In_ const COPYFILE2_MESSAGE *pMessage, + _In_opt_ PVOID pvCallbackContext); + +typedef struct COPYFILE2_EXTENDED_PARAMETERS { + DWORD dwSize; + DWORD dwCopyFlags; + BOOL *pfCancel; + PCOPYFILE2_PROGRESS_ROUTINE pProgressRoutine; + PVOID pvCallbackContext; +} COPYFILE2_EXTENDED_PARAMETERS; + +WINBASEAPI +HRESULT +WINAPI +CopyFile2( + _In_ PCWSTR pwszExistingFileName, + _In_ PCWSTR pwszNewFileName, + _In_opt_ COPYFILE2_EXTENDED_PARAMETERS *pExtendedParameters); + +#endif /* _WIN32_WINNT >= 0x0601 */ + #ifdef _MSC_VER #pragma warning(pop) #endif diff --git a/include/psdk/wincon.h b/include/psdk/wincon.h index b36712c7911..c44e478dab0 100644 --- a/include/psdk/wincon.h +++ b/include/psdk/wincon.h @@ -65,11 +65,12 @@ extern "C" { /* * Control handler codes */ -#define CTRL_C_EVENT 0 -#define CTRL_BREAK_EVENT 1 -#define CTRL_CLOSE_EVENT 2 -#define CTRL_LOGOFF_EVENT 5 -#define CTRL_SHUTDOWN_EVENT 6 +#define CTRL_C_EVENT 0 +#define CTRL_BREAK_EVENT 1 +#define CTRL_CLOSE_EVENT 2 +#define CTRL_LAST_CLOSE_EVENT 3 /* Undocumented */ +#define CTRL_LOGOFF_EVENT 5 +#define CTRL_SHUTDOWN_EVENT 6 /* * Input mode flags diff --git a/include/psdk/wincrypt.h b/include/psdk/wincrypt.h index 0d4f0678cd5..0ad401c686c 100644 --- a/include/psdk/wincrypt.h +++ b/include/psdk/wincrypt.h @@ -4027,6 +4027,8 @@ typedef BOOL #define EXPORT_PRIVATE_KEYS 0x00000004 #define PKCS12_EXPORT_RESERVED_MASK 0xffff0000 +#define CRYPT_USERDATA 0x00000001 + /* function declarations */ /* advapi32.dll */ WINADVAPI diff --git a/include/psdk/winnls.h b/include/psdk/winnls.h index 4ef122053d6..7a9eb2b13a7 100644 --- a/include/psdk/winnls.h +++ b/include/psdk/winnls.h @@ -163,6 +163,8 @@ static const WCHAR LOCALE_NAME_SYSTEM_DEFAULT[] = {'!','s','y','s','-','d','e',' #define NORM_IGNORENONSPACE 2 #define NORM_IGNORESYMBOLS 4 #define NORM_IGNOREWIDTH 131072 +#define LINGUISTIC_IGNORECASE 0x00000010 +#define NORM_LINGUISTIC_CASING 0x08000000 #define SORT_STRINGSORT 4096 #define LCMAP_LOWERCASE 0x00000100 #define LCMAP_UPPERCASE 0x00000200 diff --git a/include/psdk/winnt.h b/include/psdk/winnt.h index 41f2ae14d18..3f7111ac5c3 100644 --- a/include/psdk/winnt.h +++ b/include/psdk/winnt.h @@ -1480,6 +1480,7 @@ typedef enum { #define MAXBYTE 0xff #define MAXWORD 0xffff #define MAXDWORD 0xffffffff +#define MAXLONGLONG (((LONGLONG)0x7fffffff << 32) | 0xffffffff) #define PROCESSOR_INTEL_386 386 #define PROCESSOR_INTEL_486 486 #define PROCESSOR_INTEL_PENTIUM 586 @@ -4638,6 +4639,25 @@ typedef struct _IMAGE_BOUND_FORWARDER_REF { WORD Reserved; } IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF; +typedef struct _IMAGE_DELAYLOAD_DESCRIPTOR { + union { + DWORD AllAttributes; + struct { + DWORD RvaBased:1; + DWORD ReservedAttributes:31; + }; + } Attributes; + DWORD DllNameRVA; + DWORD ModuleHandleRVA; + DWORD ImportAddressTableRVA; + DWORD ImportNameTableRVA; + DWORD BoundImportAddressTableRVA; + DWORD UnloadInformationTableRVA; + DWORD TimeDateStamp; +} IMAGE_DELAYLOAD_DESCRIPTOR, *PIMAGE_DELAYLOAD_DESCRIPTOR; + +typedef const IMAGE_DELAYLOAD_DESCRIPTOR *PCIMAGE_DELAYLOAD_DESCRIPTOR; + typedef struct _IMAGE_RESOURCE_DIRECTORY { DWORD Characteristics; DWORD TimeDateStamp; @@ -5695,6 +5715,78 @@ DbgRaiseAssertionFailure(VOID) #endif +typedef struct _TP_POOL TP_POOL, *PTP_POOL; +typedef struct _TP_WORK TP_WORK, *PTP_WORK; +typedef struct _TP_CALLBACK_INSTANCE TP_CALLBACK_INSTANCE, *PTP_CALLBACK_INSTANCE; + +typedef DWORD TP_VERSION, *PTP_VERSION; + +typedef enum _TP_CALLBACK_PRIORITY { + TP_CALLBACK_PRIORITY_HIGH, + TP_CALLBACK_PRIORITY_NORMAL, + TP_CALLBACK_PRIORITY_LOW, + TP_CALLBACK_PRIORITY_INVALID, + TP_CALLBACK_PRIORITY_COUNT = TP_CALLBACK_PRIORITY_INVALID +} TP_CALLBACK_PRIORITY; + +typedef VOID +(NTAPI *PTP_WORK_CALLBACK)( + _Inout_ PTP_CALLBACK_INSTANCE Instance, + _Inout_opt_ PVOID Context, + _Inout_ PTP_WORK Work); + +typedef struct _TP_CLEANUP_GROUP TP_CLEANUP_GROUP, *PTP_CLEANUP_GROUP; + +typedef VOID +(NTAPI *PTP_SIMPLE_CALLBACK)( + _Inout_ PTP_CALLBACK_INSTANCE Instance, + _Inout_opt_ PVOID Context); + +typedef VOID +(NTAPI *PTP_CLEANUP_GROUP_CANCEL_CALLBACK)( + _Inout_opt_ PVOID ObjectContext, + _Inout_opt_ PVOID CleanupContext); + +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN7) +typedef struct _TP_CALLBACK_ENVIRON_V3 { + TP_VERSION Version; + PTP_POOL Pool; + PTP_CLEANUP_GROUP CleanupGroup; + PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback; + PVOID RaceDll; + struct _ACTIVATION_CONTEXT *ActivationContext; + PTP_SIMPLE_CALLBACK FinalizationCallback; + union { + DWORD Flags; + struct { + DWORD LongFunction:1; + DWORD Persistent:1; + DWORD Private:30; + } s; + } u; + TP_CALLBACK_PRIORITY CallbackPriority; + DWORD Size; +} TP_CALLBACK_ENVIRON_V3, TP_CALLBACK_ENVIRON, *PTP_CALLBACK_ENVIRON; +#else +typedef struct _TP_CALLBACK_ENVIRON_V1 { + TP_VERSION Version; + PTP_POOL Pool; + PTP_CLEANUP_GROUP CleanupGroup; + PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback; + PVOID RaceDll; + struct _ACTIVATION_CONTEXT *ActivationContext; + PTP_SIMPLE_CALLBACK FinalizationCallback; + union { + DWORD Flags; + struct { + DWORD LongFunction:1; + DWORD Persistent:1; + DWORD Private:30; + } s; + } u; +} TP_CALLBACK_ENVIRON_V1, TP_CALLBACK_ENVIRON, *PTP_CALLBACK_ENVIRON; +#endif /* (_WIN32_WINNT >= _WIN32_WINNT_WIN7) */ + #ifdef _MSC_VER #pragma warning(pop) #endif diff --git a/include/psdk/winternl.h b/include/psdk/winternl.h index b3d59dc005d..ff1cdd3c9a7 100644 --- a/include/psdk/winternl.h +++ b/include/psdk/winternl.h @@ -1160,18 +1160,11 @@ typedef struct _SYSTEM_TIMEOFDAY_INFORMATION { /* System Information Class 0x08 */ typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION { -#ifdef __WINESRC__ - LARGE_INTEGER liIdleTime; - LARGE_INTEGER liKernelTime; - LARGE_INTEGER liUserTime; - DWORD dwSpare[5]; -#else LARGE_INTEGER IdleTime; LARGE_INTEGER KernelTime; LARGE_INTEGER UserTime; LARGE_INTEGER Reserved1[2]; ULONG Reserved2; -#endif } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION; /* System Information Class 0x0b */ @@ -2455,6 +2448,9 @@ typedef struct _LDR_MODULE #define LDR_DONT_RESOLVE_REFS 0x40000000 #define LDR_WINE_INTERNAL 0x80000000 +/* flag for LdrAddRefDll */ +#define LDR_ADDREF_DLL_PIN 0x00000001 + /* FIXME: to be checked */ #define MAXIMUM_FILENAME_LENGTH 256 diff --git a/include/psdk/wsnwlink.h b/include/psdk/wsnwlink.h new file mode 100644 index 00000000000..5a5bb8bb703 --- /dev/null +++ b/include/psdk/wsnwlink.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2003,2004 Roderick Colenbrander + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef _WSNWLINK_ +#define _WSNWLINK_ + +#define IPX_PTYPE 0x4000 +#define IPX_FILTERPTYPE 0x4001 +#define IPX_DSTYPE 0x4002 +#define IPX_STOPFILTERPTYPE 0x4003 +#define IPX_EXTENDED_ADDRESS 0x4004 +#define IPX_RECVHDR 0x4005 +#define IPX_MAXSIZE 0x4006 +#define IPX_ADDRESS 0x4007 +#define IPX_GETNETINFO 0x4008 +#define IPX_GETNETINFO_NORIP 0x4009 +#define IPX_SPXGETCONNECTIONSTATUS 0x400b +#define IPX_ADDRESS_NOTIFY 0x400c +#define IPX_MAX_ADAPTER_NUM 0x400d +#define IPX_RERIPNETNUMBER 0x400e +#define IPX_RECEIVE_BROADCAST 0x400f +#define IPX_IMMEDIATESPXACK 0x4010 + +typedef struct _IPX_ADDRESS_DATA { + INT adapternum; + UCHAR netnum[4]; + UCHAR nodenum[6]; + BOOLEAN wan; + BOOLEAN status; + INT maxpkt; + ULONG linkspeed; +} IPX_ADDRESS_DATA, *PIPX_ADDRESS_DATA; + +#endif /* _WSNWLINK_ */ diff --git a/include/psdk/xmllite.idl b/include/psdk/xmllite.idl index c1c0b8820cc..5dc0012aaa0 100644 --- a/include/psdk/xmllite.idl +++ b/include/psdk/xmllite.idl @@ -78,6 +78,21 @@ interface IXmlReader : IUnknown BOOL IsEOF(void); } +/* IXmlResolver */ +[ + local, + object, + uuid(7279fc82-709d-4095-b63d-69fe4b0d9030), + pointer_default(unique) +] +interface IXmlResolver : IUnknown +{ + HRESULT ResolveUri([in] LPCWSTR base_uri, + [in] LPCWSTR public_id, + [in] LPCWSTR system_id, + [out] IUnknown **input); +} + /* IXmlReader state */ typedef enum XmlReadState { @@ -278,3 +293,10 @@ interface IXmlWriter : IUnknown HRESULT WriteWhitespace([in] LPCWSTR pwszWhitespace); HRESULT Flush(); } + +/* IXmlWriter construction */ +cpp_quote("STDAPI CreateXmlWriter(REFIID riid, void **ppvObject, IMalloc *pMalloc);") + +cpp_quote("typedef IUnknown IXmlWriterOutput;") +cpp_quote("STDAPI CreateXmlWriterOutputWithEncodingName(IUnknown *stream, IMalloc *pMalloc,") +cpp_quote(" LPCWSTR encoding, IXmlWriterOutput **output);") diff --git a/include/reactos/libs/libxml/Makefile.am b/include/reactos/libs/libxml/Makefile.am deleted file mode 100644 index cf9297aad66..00000000000 --- a/include/reactos/libs/libxml/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -## Process this file with automake to produce Makefile.in - -xmlincdir = $(includedir)/libxml2/libxml - -xmlinc_HEADERS = \ - SAX.h \ - entities.h \ - encoding.h \ - parser.h \ - parserInternals.h \ - xmlerror.h \ - HTMLparser.h \ - HTMLtree.h \ - debugXML.h \ - tree.h \ - list.h \ - hash.h \ - xpath.h \ - xpathInternals.h \ - xpointer.h \ - xinclude.h \ - xmlIO.h \ - xmlmemory.h \ - nanohttp.h \ - nanoftp.h \ - uri.h \ - valid.h \ - xlink.h \ - xmlversion.h \ - DOCBparser.h \ - catalog.h \ - threads.h \ - globals.h \ - c14n.h \ - xmlautomata.h \ - xmlregexp.h \ - xmlmodule.h \ - xmlschemas.h \ - schemasInternals.h \ - xmlschemastypes.h \ - xmlstring.h \ - xmlunicode.h \ - xmlreader.h \ - relaxng.h \ - dict.h \ - SAX2.h \ - xmlexports.h \ - xmlwriter.h \ - chvalid.h \ - pattern.h \ - xmlsave.h \ - schematron.h - -EXTRA_DIST = xmlversion.h.in diff --git a/include/reactos/libs/libxml/Makefile.in b/include/reactos/libs/libxml/Makefile.in deleted file mode 100644 index 2c56fd4116e..00000000000 --- a/include/reactos/libs/libxml/Makefile.in +++ /dev/null @@ -1,631 +0,0 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = include/libxml -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/xmlversion.h.in $(xmlinc_HEADERS) -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = xmlversion.h -CONFIG_CLEAN_VPATH_FILES = -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -SOURCES = -DIST_SOURCES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(xmlincdir)" -HEADERS = $(xmlinc_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BASE_THREAD_LIBS = @BASE_THREAD_LIBS@ -C14N_OBJ = @C14N_OBJ@ -CATALOG_OBJ = @CATALOG_OBJ@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -CYGWIN_EXTRA_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ -CYGWIN_EXTRA_PYTHON_LIBADD = @CYGWIN_EXTRA_PYTHON_LIBADD@ -DEBUG_OBJ = @DEBUG_OBJ@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DOCB_OBJ = @DOCB_OBJ@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -FTP_OBJ = @FTP_OBJ@ -GREP = @GREP@ -HAVE_ISINF = @HAVE_ISINF@ -HAVE_ISNAN = @HAVE_ISNAN@ -HTML_DIR = @HTML_DIR@ -HTML_OBJ = @HTML_OBJ@ -HTTP_OBJ = @HTTP_OBJ@ -ICONV_LIBS = @ICONV_LIBS@ -ICU_LIBS = @ICU_LIBS@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_MAJOR_VERSION = @LIBXML_MAJOR_VERSION@ -LIBXML_MICRO_VERSION = @LIBXML_MICRO_VERSION@ -LIBXML_MINOR_VERSION = @LIBXML_MINOR_VERSION@ -LIBXML_VERSION = @LIBXML_VERSION@ -LIBXML_VERSION_EXTRA = @LIBXML_VERSION_EXTRA@ -LIBXML_VERSION_INFO = @LIBXML_VERSION_INFO@ -LIBXML_VERSION_NUMBER = @LIBXML_VERSION_NUMBER@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LZMA_CFLAGS = @LZMA_CFLAGS@ -LZMA_LIBS = @LZMA_LIBS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -MODULE_EXTENSION = @MODULE_EXTENSION@ -MODULE_PLATFORM_LIBS = @MODULE_PLATFORM_LIBS@ -MV = @MV@ -M_LIBS = @M_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PYTHON = @PYTHON@ -PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ -PYTHON_SITE_PACKAGES = @PYTHON_SITE_PACKAGES@ -PYTHON_SUBDIR = @PYTHON_SUBDIR@ -PYTHON_TESTS = @PYTHON_TESTS@ -PYTHON_VERSION = @PYTHON_VERSION@ -RANLIB = @RANLIB@ -RDL_LIBS = @RDL_LIBS@ -READER_TEST = @READER_TEST@ -RELDATE = @RELDATE@ -RM = @RM@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STATIC_BINARIES = @STATIC_BINARIES@ -STRIP = @STRIP@ -TAR = @TAR@ -TEST_C14N = @TEST_C14N@ -TEST_CATALOG = @TEST_CATALOG@ -TEST_DEBUG = @TEST_DEBUG@ -TEST_HTML = @TEST_HTML@ -TEST_MODULES = @TEST_MODULES@ -TEST_PATTERN = @TEST_PATTERN@ -TEST_PHTML = @TEST_PHTML@ -TEST_PUSH = @TEST_PUSH@ -TEST_REGEXPS = @TEST_REGEXPS@ -TEST_SAX = @TEST_SAX@ -TEST_SCHEMAS = @TEST_SCHEMAS@ -TEST_SCHEMATRON = @TEST_SCHEMATRON@ -TEST_THREADS = @TEST_THREADS@ -TEST_VALID = @TEST_VALID@ -TEST_VTIME = @TEST_VTIME@ -TEST_XINCLUDE = @TEST_XINCLUDE@ -TEST_XPATH = @TEST_XPATH@ -TEST_XPTR = @TEST_XPTR@ -THREAD_CFLAGS = @THREAD_CFLAGS@ -THREAD_LIBS = @THREAD_LIBS@ -VERSION = @VERSION@ -VERSION_SCRIPT_FLAGS = @VERSION_SCRIPT_FLAGS@ -WGET = @WGET@ -WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ -WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ -WIN32_EXTRA_PYTHON_LIBADD = @WIN32_EXTRA_PYTHON_LIBADD@ -WITH_C14N = @WITH_C14N@ -WITH_CATALOG = @WITH_CATALOG@ -WITH_DEBUG = @WITH_DEBUG@ -WITH_DOCB = @WITH_DOCB@ -WITH_FTP = @WITH_FTP@ -WITH_HTML = @WITH_HTML@ -WITH_HTTP = @WITH_HTTP@ -WITH_ICONV = @WITH_ICONV@ -WITH_ICU = @WITH_ICU@ -WITH_ISO8859X = @WITH_ISO8859X@ -WITH_LEGACY = @WITH_LEGACY@ -WITH_LZMA = @WITH_LZMA@ -WITH_MEM_DEBUG = @WITH_MEM_DEBUG@ -WITH_MODULES = @WITH_MODULES@ -WITH_OUTPUT = @WITH_OUTPUT@ -WITH_PATTERN = @WITH_PATTERN@ -WITH_PUSH = @WITH_PUSH@ -WITH_READER = @WITH_READER@ -WITH_REGEXPS = @WITH_REGEXPS@ -WITH_RUN_DEBUG = @WITH_RUN_DEBUG@ -WITH_SAX1 = @WITH_SAX1@ -WITH_SCHEMAS = @WITH_SCHEMAS@ -WITH_SCHEMATRON = @WITH_SCHEMATRON@ -WITH_THREADS = @WITH_THREADS@ -WITH_TREE = @WITH_TREE@ -WITH_TRIO = @WITH_TRIO@ -WITH_VALID = @WITH_VALID@ -WITH_WRITER = @WITH_WRITER@ -WITH_XINCLUDE = @WITH_XINCLUDE@ -WITH_XPATH = @WITH_XPATH@ -WITH_XPTR = @WITH_XPTR@ -WITH_ZLIB = @WITH_ZLIB@ -XINCLUDE_OBJ = @XINCLUDE_OBJ@ -XMLLINT = @XMLLINT@ -XML_CFLAGS = @XML_CFLAGS@ -XML_INCLUDEDIR = @XML_INCLUDEDIR@ -XML_LIBDIR = @XML_LIBDIR@ -XML_LIBS = @XML_LIBS@ -XML_LIBTOOLLIBS = @XML_LIBTOOLLIBS@ -XPATH_OBJ = @XPATH_OBJ@ -XPTR_OBJ = @XPTR_OBJ@ -XSLTPROC = @XSLTPROC@ -Z_CFLAGS = @Z_CFLAGS@ -Z_LIBS = @Z_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythondir = @pythondir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -xmlincdir = $(includedir)/libxml2/libxml -xmlinc_HEADERS = \ - SAX.h \ - entities.h \ - encoding.h \ - parser.h \ - parserInternals.h \ - xmlerror.h \ - HTMLparser.h \ - HTMLtree.h \ - debugXML.h \ - tree.h \ - list.h \ - hash.h \ - xpath.h \ - xpathInternals.h \ - xpointer.h \ - xinclude.h \ - xmlIO.h \ - xmlmemory.h \ - nanohttp.h \ - nanoftp.h \ - uri.h \ - valid.h \ - xlink.h \ - xmlversion.h \ - DOCBparser.h \ - catalog.h \ - threads.h \ - globals.h \ - c14n.h \ - xmlautomata.h \ - xmlregexp.h \ - xmlmodule.h \ - xmlschemas.h \ - schemasInternals.h \ - xmlschemastypes.h \ - xmlstring.h \ - xmlunicode.h \ - xmlreader.h \ - relaxng.h \ - dict.h \ - SAX2.h \ - xmlexports.h \ - xmlwriter.h \ - chvalid.h \ - pattern.h \ - xmlsave.h \ - schematron.h - -EXTRA_DIST = xmlversion.h.in -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/libxml/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu include/libxml/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -xmlversion.h: $(top_builddir)/config.status $(srcdir)/xmlversion.h.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-xmlincHEADERS: $(xmlinc_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(xmlincdir)" || $(MKDIR_P) "$(DESTDIR)$(xmlincdir)" - @list='$(xmlinc_HEADERS)'; test -n "$(xmlincdir)" || list=; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(xmlincdir)'"; \ - $(INSTALL_HEADER) $$files "$(DESTDIR)$(xmlincdir)" || exit $$?; \ - done - -uninstall-xmlincHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(xmlinc_HEADERS)'; test -n "$(xmlincdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(xmlincdir)'; $(am__uninstall_files_from_dir) - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(xmlincdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-xmlincHEADERS - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-xmlincHEADERS - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool ctags distclean distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip install-xmlincHEADERS \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-xmlincHEADERS - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/include/reactos/libs/libxml/entities.h b/include/reactos/libs/libxml/entities.h index cefb97f780d..1e9118975d7 100644 --- a/include/reactos/libs/libxml/entities.h +++ b/include/reactos/libs/libxml/entities.h @@ -58,7 +58,8 @@ struct _xmlEntity { int owner; /* does the entity own the childrens */ int checked; /* was the entity content checked */ /* this is also used to count entites - * references done from that entity */ + * references done from that entity + * and if it contains '<' */ }; /* diff --git a/include/reactos/libs/libxml/parser.h b/include/reactos/libs/libxml/parser.h index e1346e4a4d3..3f5730dc61b 100644 --- a/include/reactos/libs/libxml/parser.h +++ b/include/reactos/libs/libxml/parser.h @@ -310,6 +310,7 @@ struct _xmlParserCtxt { xmlParserNodeInfo *nodeInfoTab; /* array of nodeInfos */ int input_id; /* we need to label inputs */ + unsigned long sizeentcopy; /* volume of entity copy */ }; /** diff --git a/include/reactos/libs/libxml/tree.h b/include/reactos/libs/libxml/tree.h index da12daaecea..7e06686af3c 100644 --- a/include/reactos/libs/libxml/tree.h +++ b/include/reactos/libs/libxml/tree.h @@ -118,7 +118,7 @@ typedef xmlBuf *xmlBufPtr; */ XMLPUBFUN xmlChar* XMLCALL xmlBufContent (const xmlBufPtr buf); XMLPUBFUN xmlChar* XMLCALL xmlBufEnd (const xmlBufPtr buf); -XMLPUBFUN size_t XMLCALL xmlBufUse (xmlBufPtr buf); +XMLPUBFUN size_t XMLCALL xmlBufUse (const xmlBufPtr buf); XMLPUBFUN size_t XMLCALL xmlBufShrink (xmlBufPtr buf, size_t len); /* diff --git a/include/reactos/libs/libxml/xmlerror.h b/include/reactos/libs/libxml/xmlerror.h index 48ea145d9f7..537a396c6d8 100644 --- a/include/reactos/libs/libxml/xmlerror.h +++ b/include/reactos/libs/libxml/xmlerror.h @@ -208,6 +208,7 @@ typedef enum { XML_ERR_UNKNOWN_VERSION, /* 108 */ XML_ERR_VERSION_MISMATCH, /* 109 */ XML_ERR_NAME_TOO_LONG, /* 110 */ + XML_ERR_USER_STOP, /* 111 */ XML_NS_ERR_XML_NAMESPACE = 200, XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */ XML_NS_ERR_QNAME, /* 202 */ diff --git a/include/reactos/libs/libxml/xmlversion.h b/include/reactos/libs/libxml/xmlversion.h index 06d55f09c5f..26517419949 100644 --- a/include/reactos/libs/libxml/xmlversion.h +++ b/include/reactos/libs/libxml/xmlversion.h @@ -29,28 +29,28 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * the version string like "1.2.3" */ -#define LIBXML_DOTTED_VERSION "2.9.0" +#define LIBXML_DOTTED_VERSION "2.9.1" /** * LIBXML_VERSION: * * the version number: 1.2.3 value is 10203 */ -#define LIBXML_VERSION 20900 +#define LIBXML_VERSION 20901 /** * LIBXML_VERSION_STRING: * * the version number string, 1.2.3 value is "10203" */ -#define LIBXML_VERSION_STRING "20900" +#define LIBXML_VERSION_STRING "20901" /** * LIBXML_VERSION_EXTRA: * * extra version information, used to show a CVS compilation */ -#define LIBXML_VERSION_EXTRA "-GITv2.9.0-rc2-5-g7651606" +#define LIBXML_VERSION_EXTRA "" /** * LIBXML_TEST_VERSION: @@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * Macro to check that the libxml version in use is compatible with * the version the software has been compiled against */ -#define LIBXML_TEST_VERSION xmlCheckVersion(20900); +#define LIBXML_TEST_VERSION xmlCheckVersion(20901); #ifndef VMS #if 0 @@ -97,6 +97,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #endif #endif +/** + * LIBXML_THREAD_ALLOC_ENABLED: + * + * Whether the allocation hooks are per-thread + */ +#if 0 +#define LIBXML_THREAD_ALLOC_ENABLED +#endif + /** * LIBXML_TREE_ENABLED: * @@ -264,7 +273,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * Whether iconv support is available */ -#if 0 +#if 1 #define LIBXML_ICONV_ENABLED #endif @@ -282,7 +291,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * Whether ISO-8859-* support is made available in case iconv is not */ -#if 1 +#if 0 #define LIBXML_ISO8859X_ENABLED #endif @@ -300,7 +309,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * Whether the memory debugging is configured in */ -#if 1 +#if 0 #define DEBUG_MEMORY_LOCATION #endif @@ -309,7 +318,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * Whether the runtime debugging is configured in */ -#if 1 +#if 0 #define LIBXML_DEBUG_RUNTIME #endif @@ -379,7 +388,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * the string suffix used by dynamic modules (usually shared libraries) */ -#define LIBXML_MODULE_EXTENSION ".so" +#define LIBXML_MODULE_EXTENSION ".dll" #endif /** diff --git a/include/reactos/libs/libxml/xmlversion.h.in b/include/reactos/libs/libxml/xmlversion.h.in index c98e7ca76f9..00a836fb9bc 100644 --- a/include/reactos/libs/libxml/xmlversion.h.in +++ b/include/reactos/libs/libxml/xmlversion.h.in @@ -97,6 +97,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #endif #endif +/** + * LIBXML_THREAD_ALLOC_ENABLED: + * + * Whether the allocation hooks are per-thread + */ +#if @WITH_THREAD_ALLOC@ +#define LIBXML_THREAD_ALLOC_ENABLED +#endif + /** * LIBXML_TREE_ENABLED: * diff --git a/include/reactos/libs/libxml/xpath.h b/include/reactos/libs/libxml/xpath.h index 8819a290428..d96776c5183 100644 --- a/include/reactos/libs/libxml/xpath.h +++ b/include/reactos/libs/libxml/xpath.h @@ -508,6 +508,13 @@ XMLPUBFUN int XMLCALL */ XMLPUBFUN long XMLCALL xmlXPathOrderDocElems (xmlDocPtr doc); +XMLPUBFUN int XMLCALL + xmlXPathSetContextNode (xmlNodePtr node, + xmlXPathContextPtr ctx); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathNodeEval (xmlNodePtr node, + const xmlChar *str, + xmlXPathContextPtr ctx); XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathEval (const xmlChar *str, xmlXPathContextPtr ctx); diff --git a/dll/3rdparty/libxslt/functions.h b/include/reactos/libs/libxslt/functions.h similarity index 100% rename from dll/3rdparty/libxslt/functions.h rename to include/reactos/libs/libxslt/functions.h diff --git a/dll/3rdparty/libxslt/imports.h b/include/reactos/libs/libxslt/imports.h similarity index 100% rename from dll/3rdparty/libxslt/imports.h rename to include/reactos/libs/libxslt/imports.h diff --git a/dll/3rdparty/libxslt/variables.h b/include/reactos/libs/libxslt/variables.h similarity index 100% rename from dll/3rdparty/libxslt/variables.h rename to include/reactos/libs/libxslt/variables.h diff --git a/include/reactos/subsys/win/conmsg.h b/include/reactos/subsys/win/conmsg.h index 04bb3bd65b5..4d117a717b6 100644 --- a/include/reactos/subsys/win/conmsg.h +++ b/include/reactos/subsys/win/conmsg.h @@ -202,6 +202,20 @@ typedef struct PDWORD ProcessIdsList; } CONSOLE_GETPROCESSLIST, *PCONSOLE_GETPROCESSLIST; +typedef struct +{ + HANDLE ConsoleHandle; + DWORD CtrlEvent; + DWORD ProcessGroupId; +} CONSOLE_GENERATECTRLEVENT, *PCONSOLE_GENERATECTRLEVENT; + +typedef struct +{ + HANDLE ConsoleHandle; +} CONSOLE_NOTIFYLASTCLOSE, *PCONSOLE_NOTIFYLASTCLOSE; + + + typedef struct { HANDLE OutputHandle; @@ -274,8 +288,9 @@ typedef struct typedef struct { + HANDLE ConsoleHandle; HANDLE OutputHandle; - COORD Position; + COORD Position; } CONSOLE_SETCURSORPOSITION, *PCONSOLE_SETCURSORPOSITION; typedef struct @@ -295,20 +310,27 @@ typedef struct typedef struct { + HANDLE ConsoleHandle; HANDLE OutputHandle; CONSOLE_CURSOR_INFO Info; +/* + DWORD Size; + BOOLEAN Visible; +*/ } CONSOLE_GETSETCURSORINFO, *PCONSOLE_GETSETCURSORINFO; typedef struct { + HANDLE ConsoleHandle; HANDLE OutputHandle; - WORD Attrib; + WORD Attributes; } CONSOLE_SETTEXTATTRIB, *PCONSOLE_SETTEXTATTRIB; typedef struct { - HANDLE ConsoleHandle; /* A valid input or output console handle */ - DWORD ConsoleMode; + HANDLE ConsoleHandle; + HANDLE Handle; + DWORD Mode; } CONSOLE_GETSETCONSOLEMODE, *PCONSOLE_GETSETCONSOLEMODE; typedef struct @@ -341,23 +363,27 @@ typedef struct } CONSOLE_GETSETHWSTATE, *PCONSOLE_GETSETHWSTATE; + typedef struct { - HANDLE OutputHandle; /* Handle to newly created screen buffer */ + HANDLE ConsoleHandle; + DWORD DesiredAccess; + BOOL InheritHandle; + DWORD ShareMode; DWORD ScreenBufferType; /* Type of the screen buffer: CONSOLE_TEXTMODE_BUFFER or CONSOLE_GRAPHICS_BUFFER */ /* - * If we are creating a graphics screen buffer, - * this structure holds the initialization information. + * This structure holds the initialization information + * for graphics screen buffers. */ CONSOLE_GRAPHICS_BUFFER_INFO GraphicsBufferInfo; - - DWORD Access; - DWORD ShareMode; - BOOL Inheritable; + HANDLE hMutex; + PVOID lpBitMap; + HANDLE OutputHandle; /* Handle to newly created screen buffer */ } CONSOLE_CREATESCREENBUFFER, *PCONSOLE_CREATESCREENBUFFER; typedef struct { + HANDLE ConsoleHandle; HANDLE OutputHandle; /* Handle to screen buffer to switch to */ } CONSOLE_SETACTIVESCREENBUFFER, *PCONSOLE_SETACTIVESCREENBUFFER; @@ -378,8 +404,10 @@ typedef struct typedef struct { - DWORD Length; - PWCHAR Title; + HANDLE ConsoleHandle; + DWORD Length; + PVOID Title; + BOOLEAN Unicode; } CONSOLE_GETSETCONSOLETITLE, *PCONSOLE_GETSETCONSOLETITLE; typedef struct @@ -395,6 +423,7 @@ typedef struct typedef struct { + HANDLE ConsoleHandle; HANDLE InputHandle; } CONSOLE_FLUSHINPUTBUFFER, *PCONSOLE_FLUSHINPUTBUFFER; @@ -512,6 +541,15 @@ typedef struct BOOL AppendToEnd; } CONSOLE_WRITEINPUT, *PCONSOLE_WRITEINPUT; +typedef struct +{ + HANDLE ConsoleHandle; + HANDLE InputHandle; + DWORD NumberOfEvents; +} CONSOLE_GETNUMINPUTEVENTS, *PCONSOLE_GETNUMINPUTEVENTS; + + + typedef struct { HANDLE ConsoleHandle; @@ -527,12 +565,29 @@ typedef struct typedef struct { - HANDLE ConsoleHandle; - DWORD Access; - BOOL Inheritable; - DWORD Options; + HANDLE ConsoleHandle; + HANDLE SourceHandle; + DWORD DesiredAccess; + BOOLEAN InheritHandle; + DWORD Options; + HANDLE TargetHandle; } CONSOLE_DUPLICATEHANDLE, *PCONSOLE_DUPLICATEHANDLE; +typedef struct +{ + HANDLE ConsoleHandle; + HANDLE Handle; + DWORD Flags; +} CONSOLE_GETHANDLEINFO, *PCONSOLE_GETHANDLEINFO; + +typedef struct +{ + HANDLE ConsoleHandle; + HANDLE Handle; + DWORD Mask; + DWORD Flags; +} CONSOLE_SETHANDLEINFO, *PCONSOLE_SETHANDLEINFO; + /* * Type of handles. */ @@ -546,14 +601,17 @@ typedef struct { HANDLE ConsoleHandle; CONSOLE_HANDLE_TYPE HandleType; - DWORD Access; - BOOL Inheritable; - DWORD ShareMode; + DWORD DesiredAccess; + BOOL InheritHandle; + DWORD ShareMode; + HANDLE Handle; } CONSOLE_OPENCONSOLE, *PCONSOLE_OPENCONSOLE; + typedef struct { + HANDLE ConsoleHandle; HANDLE OutputHandle; COORD Size; } CONSOLE_GETLARGESTWINDOWSIZE, *PCONSOLE_GETLARGESTWINDOWSIZE; @@ -575,6 +633,7 @@ typedef struct typedef struct { + HANDLE ConsoleHandle; HANDLE OutputHandle; BOOL Absolute; SMALL_RECT WindowRect; // New console window position in the screen-buffer frame (Absolute == TRUE) @@ -668,20 +727,9 @@ typedef struct typedef struct { - DWORD Event; - DWORD ProcessGroup; -} CONSOLE_GENERATECTRLEVENT, *PCONSOLE_GENERATECTRLEVENT; - -typedef struct -{ - HANDLE InputHandle; - DWORD NumInputEvents; -} CONSOLE_GETNUMINPUTEVENTS, *PCONSOLE_GETNUMINPUTEVENTS; - -typedef struct -{ + HANDLE ConsoleHandle; HANDLE OutputHandle; - COORD Size; + COORD Size; } CONSOLE_SETSCREENBUFFERSIZE, *PCONSOLE_SETSCREENBUFFERSIZE; typedef struct @@ -720,14 +768,18 @@ typedef struct _CONSOLE_API_MESSAGE CONSOLE_ATTACHCONSOLE AttachConsoleRequest; CONSOLE_FREECONSOLE FreeConsoleRequest; - /* Process list */ + /* Processes */ CONSOLE_GETPROCESSLIST GetProcessListRequest; + CONSOLE_GENERATECTRLEVENT GenerateCtrlEventRequest; + CONSOLE_NOTIFYLASTCLOSE NotifyLastCloseRequest; /* Handles */ CONSOLE_OPENCONSOLE OpenConsoleRequest; CONSOLE_CLOSEHANDLE CloseHandleRequest; CONSOLE_VERIFYHANDLE VerifyHandleRequest; CONSOLE_DUPLICATEHANDLE DuplicateHandleRequest; + CONSOLE_GETHANDLEINFO GetHandleInfoRequest; + CONSOLE_SETHANDLEINFO SetHandleInfoRequest; /* Cursor */ CONSOLE_SHOWCURSOR ShowCursorRequest; @@ -767,6 +819,7 @@ typedef struct _CONSOLE_API_MESSAGE CONSOLE_GETINPUT GetInputRequest; // SrvGetConsoleInput / PeekConsoleInput & ReadConsoleInput CONSOLE_READOUTPUT ReadOutputRequest; // SrvReadConsoleOutput / ReadConsoleOutput CONSOLE_READOUTPUTCODE ReadOutputCodeRequest; // SrvReadConsoleOutputString / ReadConsoleOutputAttribute & ReadConsoleOutputCharacter + CONSOLE_GETNUMINPUTEVENTS GetNumInputEventsRequest; /* Write */ CONSOLE_WRITECONSOLE WriteConsoleRequest; // SrvWriteConsole / WriteConsole @@ -791,9 +844,6 @@ typedef struct _CONSOLE_API_MESSAGE CONSOLE_SETHISTORYNUMBERCOMMANDS SetHistoryNumberCommandsRequest; CONSOLE_GETSETHISTORYINFO HistoryInfoRequest; - CONSOLE_GENERATECTRLEVENT GenerateCtrlEventRequest; - CONSOLE_GETNUMINPUTEVENTS GetNumInputEventsRequest; - /* Input and Output Code Pages */ CONSOLE_GETINPUTOUTPUTCP GetConsoleCPRequest; CONSOLE_SETINPUTOUTPUTCP SetConsoleCPRequest; diff --git a/include/reactos/wine/commctrl.h b/include/reactos/wine/commctrl.h index b7dcba3eb53..ab4e957261b 100644 --- a/include/reactos/wine/commctrl.h +++ b/include/reactos/wine/commctrl.h @@ -85,6 +85,16 @@ typedef struct #define TB_UNKWN45D (WM_USER+93) #define TB_UNKWN464 (WM_USER+100) +#define TreeView_GetItemA(hwnd, pitem) \ + (BOOL)SNDMSGA((hwnd), TVM_GETITEMA, 0, (LPARAM) (TVITEMA *)(pitem)) + +#define TreeView_InsertItemA(hwnd, phdi) \ + (HTREEITEM)SNDMSGA((hwnd), TVM_INSERTITEMA, 0, \ + (LPARAM)(LPTVINSERTSTRUCTA)(phdi)) + +#define TreeView_SetItemA(hwnd, pitem) \ + (BOOL)SNDMSGA((hwnd), TVM_SETITEMA, 0, (LPARAM)(const TVITEMA *)(pitem)) + #ifdef __cplusplus } #endif diff --git a/include/reactos/wine/debug.h b/include/reactos/wine/debug.h index 54ac2c68ac7..6eeb12eea93 100644 --- a/include/reactos/wine/debug.h +++ b/include/reactos/wine/debug.h @@ -27,6 +27,12 @@ #include #endif +#include + +#if !defined(__RELFILE__) +#define __RELFILE__ __FILE__ +#endif + #ifdef __WINE_WINE_TEST_H #error This file should not be used in Wine tests #endif @@ -91,7 +97,7 @@ struct __wine_debug_channel __WINE_DBG_LOG #define __WINE_DBG_LOG(args...) \ - wine_dbg_log( __dbcl, __dbch, __FUNCTION__, args); } } while(0) + ros_dbg_log( __dbcl, __dbch, __RELFILE__, __FUNCTION__, __LINE__, args); } } while(0) #define __WINE_PRINTF_ATTR(fmt,args) /*__attribute__((format (printf,fmt,args)))*/ @@ -137,7 +143,7 @@ struct __wine_debug_channel #define __WINE_DPRINTF(dbcl,dbch) \ (!__WINE_GET_DEBUGGING(dbcl,(dbch)) || \ - (wine_dbg_log(__WINE_DBCL##dbcl,(dbch),__FILE__,"%d: ",__LINE__) == -1)) ? \ + (ros_dbg_log(__WINE_DBCL##dbcl,(dbch),__FILE__,"",__LINE__,"") == -1)) ? \ (void)0 : (void)wine_dbg_printf #define __WINE_PRINTF_ATTR(fmt, args) @@ -152,7 +158,7 @@ struct __wine_debug_functions const char * (*dbgstr_wn)( const WCHAR *s, int n ); int (*dbg_vprintf)( const char *format, va_list args ); int (*dbg_vlog)( enum __wine_debug_class cls, struct __wine_debug_channel *channel, - const char *function, const char *format, va_list args ); + const char *file, const char *function, const int line, const char *format, va_list args ); }; extern unsigned char __wine_dbg_get_channel_flags( struct __wine_debug_channel *channel ); @@ -175,6 +181,9 @@ extern const char *wine_dbg_sprintf( const char *format, ... ) __WINE_PRINTF_ATT extern int wine_dbg_printf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2); extern int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *ch, const char *func, const char *format, ... ) __WINE_PRINTF_ATTR(4,5); +/* ReactOS compliant debug format */ +extern int ros_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *ch, const char *file, + const char *func, const int line, const char *format, ... ) __WINE_PRINTF_ATTR(6,7); static __inline const char *wine_dbgstr_a( const char *s ) { diff --git a/include/reactos/wine/strmbase.h b/include/reactos/wine/strmbase.h index ecb53c41c6d..9727fb419e2 100644 --- a/include/reactos/wine/strmbase.h +++ b/include/reactos/wine/strmbase.h @@ -71,6 +71,8 @@ typedef HRESULT (WINAPI *BaseOutputPin_DecideAllocator)(BaseOutputPin *This, IMe typedef HRESULT (WINAPI *BaseOutputPin_BreakConnect)(BaseOutputPin * This); typedef struct BaseOutputPinFuncTable { + BasePinFuncTable base; + /* Required for BaseOutputPinImpl_DecideAllocator */ BaseOutputPin_DecideBufferSize pfnDecideBufferSize; /* Required for BaseOutputPinImpl_AttemptConnection */ @@ -94,6 +96,7 @@ typedef struct BaseInputPin typedef HRESULT (WINAPI *BaseInputPin_Receive)(BaseInputPin *This, IMediaSample *pSample); typedef struct BaseInputPinFuncTable { + BasePinFuncTable base; /* Optional */ BaseInputPin_Receive pfnReceive; } BaseInputPinFuncTable; @@ -132,7 +135,7 @@ HRESULT WINAPI BaseOutputPinImpl_InitAllocator(BaseOutputPin *This, IMemAllocato HRESULT WINAPI BaseOutputPinImpl_DecideAllocator(BaseOutputPin *This, IMemInputPin *pPin, IMemAllocator **pAlloc); HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BasePin *This, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt); -HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outputpin_size, const PIN_INFO * pPinInfo, const BasePinFuncTable* pBaseFuncsTable, const BaseOutputPinFuncTable* pBaseOutputFuncsTable, LPCRITICAL_SECTION pCritSec, IPin ** ppPin); +HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outputpin_size, const PIN_INFO * pPinInfo, const BaseOutputPinFuncTable* pBaseOutputFuncsTable, LPCRITICAL_SECTION pCritSec, IPin ** ppPin); /* Base Input Pin */ HRESULT WINAPI BaseInputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv); @@ -145,7 +148,9 @@ HRESULT WINAPI BaseInputPinImpl_BeginFlush(IPin * iface); HRESULT WINAPI BaseInputPinImpl_EndFlush(IPin * iface); HRESULT WINAPI BaseInputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate); -HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinInfo, const BasePinFuncTable* pBaseFuncsTable, const BaseInputPinFuncTable* pBaseInputFuncsTable, LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin); +HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, LONG inputpin_size, const PIN_INFO * pPinInfo, + const BaseInputPinFuncTable* pBaseInputFuncsTable, + LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin); typedef struct BaseFilter { diff --git a/include/reactos/wine/test.h b/include/reactos/wine/test.h index 04f9ab4fe15..fae1487bbd1 100644 --- a/include/reactos/wine/test.h +++ b/include/reactos/wine/test.h @@ -69,6 +69,7 @@ extern void winetest_add_failures( LONG new_failures ); extern void winetest_wait_child_process( HANDLE process ); extern const char *wine_dbgstr_wn( const WCHAR *str, int n ); +extern const char *wine_dbgstr_guid( const GUID *guid ); static inline const char *wine_dbgstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); } /* strcmpW is available for tests compiled under Wine, but not in standalone @@ -541,6 +542,19 @@ const char *wine_dbgstr_wn( const WCHAR *str, int n ) return res; } +const char *wine_dbgstr_guid( const GUID *guid ) +{ + char *res; + + if (!guid) return "(null)"; + res = get_temp_buffer( 39 ); /* CHARS_IN_GUID */ + sprintf( res, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", + guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], + guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4], + guid->Data4[5], guid->Data4[6], guid->Data4[7] ); + return res; +} + /* Find a test by name */ static const struct test *find_test( const char *name ) { diff --git a/include/reactos/wine/typeof.h b/include/reactos/wine/typeof.h index daefcc185af..b7ab75590b1 100644 --- a/include/reactos/wine/typeof.h +++ b/include/reactos/wine/typeof.h @@ -23,6 +23,9 @@ struct tagCANDIDATELIST; struct tagIMEMENUITEMINFOW; struct _xsltStylesheet; struct jpeg_decompress_struct; +struct _iobuf; +struct _xsltTransformContext; +struct _xmlOutputBuffer; typedef struct IWineD3D * (__stdcall typeof(WineDirect3DCreate))(unsigned int, struct IUnknown *); typedef struct IWineD3DClipper * (__stdcall typeof(WineDirect3DCreateClipper))(struct IUnknown *); @@ -44,6 +47,12 @@ typedef int (__stdcall typeof(ImeProcessKey))(void *, unsigned int, __typeof_lon typedef unsigned int (__stdcall typeof(ImeGetRegisterWordStyle))(unsigned int, struct tagSTYLEBUFW *); typedef unsigned int (__stdcall typeof(ImeGetImeMenuItems))(void *, unsigned int, unsigned int, struct tagIMEMENUITEMINFOW *, struct tagIMEMENUITEMINFOW *, unsigned int); typedef struct _xmlDoc * (__cdecl typeof(xsltApplyStylesheet))(struct _xsltStylesheet *, struct _xmlDoc *, const char **); +typedef struct _xmlDoc * (__cdecl typeof(xsltApplyStylesheetUser))(struct _xsltStylesheet *, struct _xmlDoc *, const char **, const char *, struct _iobuf *, struct _xsltTransformContext *); +typedef struct _xsltTransformContext * (__cdecl typeof(xsltNewTransformContext))(struct _xsltStylesheet *, struct _xmlDoc *); +typedef void (__cdecl typeof(xsltFreeTransformContext))(struct _xsltTransformContext *); +typedef int (__cdecl typeof(xsltQuoteUserParams))(struct _xsltTransformContext *, const char **); +typedef int (__cdecl typeof(xsltSaveResultTo))(struct _xmlOutputBuffer *, struct _xmlDoc *, struct _xsltStylesheet *); +typedef struct _xsltStylesheet * (__cdecl typeof(xsltNextImport))(struct _xsltStylesheet *); typedef void (__cdecl typeof(xsltCleanupGlobals))(void); typedef void (__cdecl typeof(xsltFreeStylesheet))(struct _xsltStylesheet *); typedef struct _xsltStylesheet * (__cdecl typeof(xsltParseStylesheetDoc))(struct _xmlDoc *); diff --git a/include/reactos/wine/wgl_driver.h b/include/reactos/wine/wgl_driver.h index 8d235017b84..7dbf6a14994 100644 --- a/include/reactos/wine/wgl_driver.h +++ b/include/reactos/wine/wgl_driver.h @@ -1,4 +1,4 @@ -/* Automatically generated from http://www.opengl.org/registry/api files; DO NOT EDIT! */ +/* Automatically generated from http://www.opengl.org/registry files; DO NOT EDIT! */ #ifndef __WINE_WGL_DRIVER_H #define __WINE_WGL_DRIVER_H @@ -7,7 +7,7 @@ #define WINE_GLAPI #endif -#define WINE_WGL_DRIVER_VERSION 10 +#define WINE_WGL_DRIVER_VERSION 11 struct wgl_context; struct wgl_pbuffer; @@ -39,7 +39,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glBitmap)(GLsizei,GLsizei,GLfloat,GLfloat,GLfloat,GLfloat,const GLubyte*); void (WINE_GLAPI *p_glBlendFunc)(GLenum,GLenum); void (WINE_GLAPI *p_glCallList)(GLuint); - void (WINE_GLAPI *p_glCallLists)(GLsizei,GLenum,const GLvoid*); + void (WINE_GLAPI *p_glCallLists)(GLsizei,GLenum,const void*); void (WINE_GLAPI *p_glClear)(GLbitfield); void (WINE_GLAPI *p_glClearAccum)(GLfloat,GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glClearColor)(GLfloat,GLfloat,GLfloat,GLfloat); @@ -81,7 +81,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glColor4usv)(const GLushort*); void (WINE_GLAPI *p_glColorMask)(GLboolean,GLboolean,GLboolean,GLboolean); void (WINE_GLAPI *p_glColorMaterial)(GLenum,GLenum); - void (WINE_GLAPI *p_glColorPointer)(GLint,GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glColorPointer)(GLint,GLenum,GLsizei,const void*); void (WINE_GLAPI *p_glCopyPixels)(GLint,GLint,GLsizei,GLsizei,GLenum); void (WINE_GLAPI *p_glCopyTexImage1D)(GLenum,GLint,GLenum,GLint,GLint,GLsizei,GLint); void (WINE_GLAPI *p_glCopyTexImage2D)(GLenum,GLint,GLenum,GLint,GLint,GLsizei,GLsizei,GLint); @@ -97,10 +97,10 @@ struct opengl_funcs void (WINE_GLAPI *p_glDisableClientState)(GLenum); void (WINE_GLAPI *p_glDrawArrays)(GLenum,GLint,GLsizei); void (WINE_GLAPI *p_glDrawBuffer)(GLenum); - void (WINE_GLAPI *p_glDrawElements)(GLenum,GLsizei,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glDrawPixels)(GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); + void (WINE_GLAPI *p_glDrawElements)(GLenum,GLsizei,GLenum,const void*); + void (WINE_GLAPI *p_glDrawPixels)(GLsizei,GLsizei,GLenum,GLenum,const void*); void (WINE_GLAPI *p_glEdgeFlag)(GLboolean); - void (WINE_GLAPI *p_glEdgeFlagPointer)(GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glEdgeFlagPointer)(GLsizei,const void*); void (WINE_GLAPI *p_glEdgeFlagv)(const GLboolean*); void (WINE_GLAPI *p_glEnable)(GLenum); void (WINE_GLAPI *p_glEnableClientState)(GLenum); @@ -145,22 +145,22 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetPixelMapfv)(GLenum,GLfloat*); void (WINE_GLAPI *p_glGetPixelMapuiv)(GLenum,GLuint*); void (WINE_GLAPI *p_glGetPixelMapusv)(GLenum,GLushort*); - void (WINE_GLAPI *p_glGetPointerv)(GLenum,GLvoid**); + void (WINE_GLAPI *p_glGetPointerv)(GLenum,void**); void (WINE_GLAPI *p_glGetPolygonStipple)(GLubyte*); - const GLubyte * (WINE_GLAPI *p_glGetString)(GLenum); + const GLubyte* (WINE_GLAPI *p_glGetString)(GLenum); void (WINE_GLAPI *p_glGetTexEnvfv)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetTexEnviv)(GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetTexGendv)(GLenum,GLenum,GLdouble*); void (WINE_GLAPI *p_glGetTexGenfv)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetTexGeniv)(GLenum,GLenum,GLint*); - void (WINE_GLAPI *p_glGetTexImage)(GLenum,GLint,GLenum,GLenum,GLvoid*); + void (WINE_GLAPI *p_glGetTexImage)(GLenum,GLint,GLenum,GLenum,void*); void (WINE_GLAPI *p_glGetTexLevelParameterfv)(GLenum,GLint,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetTexLevelParameteriv)(GLenum,GLint,GLenum,GLint*); void (WINE_GLAPI *p_glGetTexParameterfv)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetTexParameteriv)(GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glHint)(GLenum,GLenum); void (WINE_GLAPI *p_glIndexMask)(GLuint); - void (WINE_GLAPI *p_glIndexPointer)(GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glIndexPointer)(GLenum,GLsizei,const void*); void (WINE_GLAPI *p_glIndexd)(GLdouble); void (WINE_GLAPI *p_glIndexdv)(const GLdouble*); void (WINE_GLAPI *p_glIndexf)(GLfloat); @@ -172,7 +172,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glIndexub)(GLubyte); void (WINE_GLAPI *p_glIndexubv)(const GLubyte*); void (WINE_GLAPI *p_glInitNames)(void); - void (WINE_GLAPI *p_glInterleavedArrays)(GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glInterleavedArrays)(GLenum,GLsizei,const void*); GLboolean (WINE_GLAPI *p_glIsEnabled)(GLenum); GLboolean (WINE_GLAPI *p_glIsList)(GLuint); GLboolean (WINE_GLAPI *p_glIsTexture)(GLuint); @@ -218,12 +218,12 @@ struct opengl_funcs void (WINE_GLAPI *p_glNormal3iv)(const GLint*); void (WINE_GLAPI *p_glNormal3s)(GLshort,GLshort,GLshort); void (WINE_GLAPI *p_glNormal3sv)(const GLshort*); - void (WINE_GLAPI *p_glNormalPointer)(GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glNormalPointer)(GLenum,GLsizei,const void*); void (WINE_GLAPI *p_glOrtho)(GLdouble,GLdouble,GLdouble,GLdouble,GLdouble,GLdouble); void (WINE_GLAPI *p_glPassThrough)(GLfloat); - void (WINE_GLAPI *p_glPixelMapfv)(GLenum,GLint,const GLfloat*); - void (WINE_GLAPI *p_glPixelMapuiv)(GLenum,GLint,const GLuint*); - void (WINE_GLAPI *p_glPixelMapusv)(GLenum,GLint,const GLushort*); + void (WINE_GLAPI *p_glPixelMapfv)(GLenum,GLsizei,const GLfloat*); + void (WINE_GLAPI *p_glPixelMapuiv)(GLenum,GLsizei,const GLuint*); + void (WINE_GLAPI *p_glPixelMapusv)(GLenum,GLsizei,const GLushort*); void (WINE_GLAPI *p_glPixelStoref)(GLenum,GLfloat); void (WINE_GLAPI *p_glPixelStorei)(GLenum,GLint); void (WINE_GLAPI *p_glPixelTransferf)(GLenum,GLfloat); @@ -267,7 +267,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glRasterPos4s)(GLshort,GLshort,GLshort,GLshort); void (WINE_GLAPI *p_glRasterPos4sv)(const GLshort*); void (WINE_GLAPI *p_glReadBuffer)(GLenum); - void (WINE_GLAPI *p_glReadPixels)(GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,GLvoid*); + void (WINE_GLAPI *p_glReadPixels)(GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,void*); void (WINE_GLAPI *p_glRectd)(GLdouble,GLdouble,GLdouble,GLdouble); void (WINE_GLAPI *p_glRectdv)(const GLdouble*,const GLdouble*); void (WINE_GLAPI *p_glRectf)(GLfloat,GLfloat,GLfloat,GLfloat); @@ -319,7 +319,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glTexCoord4iv)(const GLint*); void (WINE_GLAPI *p_glTexCoord4s)(GLshort,GLshort,GLshort,GLshort); void (WINE_GLAPI *p_glTexCoord4sv)(const GLshort*); - void (WINE_GLAPI *p_glTexCoordPointer)(GLint,GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glTexCoordPointer)(GLint,GLenum,GLsizei,const void*); void (WINE_GLAPI *p_glTexEnvf)(GLenum,GLenum,GLfloat); void (WINE_GLAPI *p_glTexEnvfv)(GLenum,GLenum,const GLfloat*); void (WINE_GLAPI *p_glTexEnvi)(GLenum,GLenum,GLint); @@ -330,14 +330,14 @@ struct opengl_funcs void (WINE_GLAPI *p_glTexGenfv)(GLenum,GLenum,const GLfloat*); void (WINE_GLAPI *p_glTexGeni)(GLenum,GLenum,GLint); void (WINE_GLAPI *p_glTexGeniv)(GLenum,GLenum,const GLint*); - void (WINE_GLAPI *p_glTexImage1D)(GLenum,GLint,GLint,GLsizei,GLint,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glTexImage2D)(GLenum,GLint,GLint,GLsizei,GLsizei,GLint,GLenum,GLenum,const GLvoid*); + void (WINE_GLAPI *p_glTexImage1D)(GLenum,GLint,GLint,GLsizei,GLint,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glTexImage2D)(GLenum,GLint,GLint,GLsizei,GLsizei,GLint,GLenum,GLenum,const void*); void (WINE_GLAPI *p_glTexParameterf)(GLenum,GLenum,GLfloat); void (WINE_GLAPI *p_glTexParameterfv)(GLenum,GLenum,const GLfloat*); void (WINE_GLAPI *p_glTexParameteri)(GLenum,GLenum,GLint); void (WINE_GLAPI *p_glTexParameteriv)(GLenum,GLenum,const GLint*); - void (WINE_GLAPI *p_glTexSubImage1D)(GLenum,GLint,GLint,GLsizei,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glTexSubImage2D)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); + void (WINE_GLAPI *p_glTexSubImage1D)(GLenum,GLint,GLint,GLsizei,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glTexSubImage2D)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,const void*); void (WINE_GLAPI *p_glTranslated)(GLdouble,GLdouble,GLdouble); void (WINE_GLAPI *p_glTranslatef)(GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glVertex2d)(GLdouble,GLdouble); @@ -364,12 +364,13 @@ struct opengl_funcs void (WINE_GLAPI *p_glVertex4iv)(const GLint*); void (WINE_GLAPI *p_glVertex4s)(GLshort,GLshort,GLshort,GLshort); void (WINE_GLAPI *p_glVertex4sv)(const GLshort*); - void (WINE_GLAPI *p_glVertexPointer)(GLint,GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glVertexPointer)(GLint,GLenum,GLsizei,const void*); void (WINE_GLAPI *p_glViewport)(GLint,GLint,GLsizei,GLsizei); } gl; struct { + void (WINE_GLAPI *p_glAccumxOES)(GLenum,GLfixed); void (WINE_GLAPI *p_glActiveProgramEXT)(GLuint); void (WINE_GLAPI *p_glActiveShaderProgram)(GLuint,GLuint); void (WINE_GLAPI *p_glActiveStencilFaceEXT)(GLenum); @@ -379,6 +380,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glAlphaFragmentOp1ATI)(GLenum,GLuint,GLuint,GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glAlphaFragmentOp2ATI)(GLenum,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glAlphaFragmentOp3ATI)(GLenum,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint); + void (WINE_GLAPI *p_glAlphaFuncxOES)(GLenum,GLfixed); void (WINE_GLAPI *p_glApplyTextureEXT)(GLenum); GLboolean (WINE_GLAPI *p_glAreProgramsResidentNV)(GLsizei,const GLuint*,GLboolean*); GLboolean (WINE_GLAPI *p_glAreTexturesResidentEXT)(GLsizei,const GLuint*,GLboolean*); @@ -389,6 +391,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glAttachShader)(GLuint,GLuint); void (WINE_GLAPI *p_glBeginConditionalRender)(GLuint,GLenum); void (WINE_GLAPI *p_glBeginConditionalRenderNV)(GLuint,GLenum); + void (WINE_GLAPI *p_glBeginConditionalRenderNVX)(GLuint); void (WINE_GLAPI *p_glBeginFragmentShaderATI)(void); void (WINE_GLAPI *p_glBeginOcclusionQueryNV)(GLuint); void (WINE_GLAPI *p_glBeginPerfMonitorAMD)(GLuint); @@ -412,6 +415,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glBindBufferRange)(GLenum,GLuint,GLuint,GLintptr,GLsizeiptr); void (WINE_GLAPI *p_glBindBufferRangeEXT)(GLenum,GLuint,GLuint,GLintptr,GLsizeiptr); void (WINE_GLAPI *p_glBindBufferRangeNV)(GLenum,GLuint,GLuint,GLintptr,GLsizeiptr); + void (WINE_GLAPI *p_glBindBuffersBase)(GLenum,GLuint,GLsizei,const GLuint*); + void (WINE_GLAPI *p_glBindBuffersRange)(GLenum,GLuint,GLsizei,const GLuint*,const GLintptr*,const GLsizeiptr*); void (WINE_GLAPI *p_glBindFragDataLocation)(GLuint,GLuint,const GLchar*); void (WINE_GLAPI *p_glBindFragDataLocationEXT)(GLuint,GLuint,const GLchar*); void (WINE_GLAPI *p_glBindFragDataLocationIndexed)(GLuint,GLuint,GLuint,const GLchar*); @@ -420,6 +425,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glBindFramebufferEXT)(GLenum,GLuint); void (WINE_GLAPI *p_glBindImageTexture)(GLuint,GLuint,GLint,GLboolean,GLint,GLenum,GLenum); void (WINE_GLAPI *p_glBindImageTextureEXT)(GLuint,GLuint,GLint,GLboolean,GLint,GLenum,GLint); + void (WINE_GLAPI *p_glBindImageTextures)(GLuint,GLsizei,const GLuint*); GLuint (WINE_GLAPI *p_glBindLightParameterEXT)(GLenum,GLenum); GLuint (WINE_GLAPI *p_glBindMaterialParameterEXT)(GLenum,GLenum); void (WINE_GLAPI *p_glBindMultiTextureEXT)(GLenum,GLenum,GLuint); @@ -430,14 +436,17 @@ struct opengl_funcs void (WINE_GLAPI *p_glBindRenderbuffer)(GLenum,GLuint); void (WINE_GLAPI *p_glBindRenderbufferEXT)(GLenum,GLuint); void (WINE_GLAPI *p_glBindSampler)(GLuint,GLuint); + void (WINE_GLAPI *p_glBindSamplers)(GLuint,GLsizei,const GLuint*); GLuint (WINE_GLAPI *p_glBindTexGenParameterEXT)(GLenum,GLenum,GLenum); void (WINE_GLAPI *p_glBindTextureEXT)(GLenum,GLuint); GLuint (WINE_GLAPI *p_glBindTextureUnitParameterEXT)(GLenum,GLenum); + void (WINE_GLAPI *p_glBindTextures)(GLuint,GLsizei,const GLuint*); void (WINE_GLAPI *p_glBindTransformFeedback)(GLenum,GLuint); void (WINE_GLAPI *p_glBindTransformFeedbackNV)(GLenum,GLuint); void (WINE_GLAPI *p_glBindVertexArray)(GLuint); void (WINE_GLAPI *p_glBindVertexArrayAPPLE)(GLuint); void (WINE_GLAPI *p_glBindVertexBuffer)(GLuint,GLuint,GLintptr,GLsizei); + void (WINE_GLAPI *p_glBindVertexBuffers)(GLuint,GLsizei,const GLuint*,const GLintptr*,const GLsizei*); void (WINE_GLAPI *p_glBindVertexShaderEXT)(GLuint); void (WINE_GLAPI *p_glBindVideoCaptureStreamBufferNV)(GLuint,GLuint,GLenum,GLintptrARB); void (WINE_GLAPI *p_glBindVideoCaptureStreamTextureNV)(GLuint,GLuint,GLenum,GLenum,GLuint); @@ -451,9 +460,12 @@ struct opengl_funcs void (WINE_GLAPI *p_glBinormal3ivEXT)(const GLint*); void (WINE_GLAPI *p_glBinormal3sEXT)(GLshort,GLshort,GLshort); void (WINE_GLAPI *p_glBinormal3svEXT)(const GLshort*); - void (WINE_GLAPI *p_glBinormalPointerEXT)(GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glBinormalPointerEXT)(GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glBitmapxOES)(GLsizei,GLsizei,GLfixed,GLfixed,GLfixed,GLfixed,const GLubyte*); + void (WINE_GLAPI *p_glBlendBarrierNV)(void); void (WINE_GLAPI *p_glBlendColor)(GLfloat,GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glBlendColorEXT)(GLfloat,GLfloat,GLfloat,GLfloat); + void (WINE_GLAPI *p_glBlendColorxOES)(GLfixed,GLfixed,GLfixed,GLfixed); void (WINE_GLAPI *p_glBlendEquation)(GLenum); void (WINE_GLAPI *p_glBlendEquationEXT)(GLenum); void (WINE_GLAPI *p_glBlendEquationIndexedAMD)(GLuint,GLenum); @@ -473,20 +485,23 @@ struct opengl_funcs void (WINE_GLAPI *p_glBlendFuncSeparateiARB)(GLuint,GLenum,GLenum,GLenum,GLenum); void (WINE_GLAPI *p_glBlendFunci)(GLuint,GLenum,GLenum); void (WINE_GLAPI *p_glBlendFunciARB)(GLuint,GLenum,GLenum); + void (WINE_GLAPI *p_glBlendParameteriNV)(GLenum,GLint); void (WINE_GLAPI *p_glBlitFramebuffer)(GLint,GLint,GLint,GLint,GLint,GLint,GLint,GLint,GLbitfield,GLenum); void (WINE_GLAPI *p_glBlitFramebufferEXT)(GLint,GLint,GLint,GLint,GLint,GLint,GLint,GLint,GLbitfield,GLenum); - void (WINE_GLAPI *p_glBufferAddressRangeNV)(GLenum,GLuint,UINT64,GLsizeiptr); - void (WINE_GLAPI *p_glBufferData)(GLenum,GLsizeiptr,const GLvoid*,GLenum); - void (WINE_GLAPI *p_glBufferDataARB)(GLenum,GLsizeiptrARB,const GLvoid*,GLenum); + void (WINE_GLAPI *p_glBufferAddressRangeNV)(GLenum,GLuint,GLuint64EXT,GLsizeiptr); + void (WINE_GLAPI *p_glBufferData)(GLenum,GLsizeiptr,const void*,GLenum); + void (WINE_GLAPI *p_glBufferDataARB)(GLenum,GLsizeiptrARB,const void*,GLenum); void (WINE_GLAPI *p_glBufferParameteriAPPLE)(GLenum,GLenum,GLint); GLuint (WINE_GLAPI *p_glBufferRegionEnabled)(void); - void (WINE_GLAPI *p_glBufferSubData)(GLenum,GLintptr,GLsizeiptr,const GLvoid*); - void (WINE_GLAPI *p_glBufferSubDataARB)(GLenum,GLintptrARB,GLsizeiptrARB,const GLvoid*); + void (WINE_GLAPI *p_glBufferStorage)(GLenum,GLsizeiptr,const void*,GLbitfield); + void (WINE_GLAPI *p_glBufferSubData)(GLenum,GLintptr,GLsizeiptr,const void*); + void (WINE_GLAPI *p_glBufferSubDataARB)(GLenum,GLintptrARB,GLsizeiptrARB,const void*); GLenum (WINE_GLAPI *p_glCheckFramebufferStatus)(GLenum); GLenum (WINE_GLAPI *p_glCheckFramebufferStatusEXT)(GLenum); GLenum (WINE_GLAPI *p_glCheckNamedFramebufferStatusEXT)(GLuint,GLenum); void (WINE_GLAPI *p_glClampColor)(GLenum,GLenum); void (WINE_GLAPI *p_glClampColorARB)(GLenum,GLenum); + void (WINE_GLAPI *p_glClearAccumxOES)(GLfixed,GLfixed,GLfixed,GLfixed); void (WINE_GLAPI *p_glClearBufferData)(GLenum,GLenum,GLenum,GLenum,const void*); void (WINE_GLAPI *p_glClearBufferSubData)(GLenum,GLenum,GLintptr,GLsizeiptr,GLenum,GLenum,const void*); void (WINE_GLAPI *p_glClearBufferfi)(GLenum,GLint,GLfloat,GLint); @@ -495,19 +510,28 @@ struct opengl_funcs void (WINE_GLAPI *p_glClearBufferuiv)(GLenum,GLint,const GLuint*); void (WINE_GLAPI *p_glClearColorIiEXT)(GLint,GLint,GLint,GLint); void (WINE_GLAPI *p_glClearColorIuiEXT)(GLuint,GLuint,GLuint,GLuint); + void (WINE_GLAPI *p_glClearColorxOES)(GLfixed,GLfixed,GLfixed,GLfixed); void (WINE_GLAPI *p_glClearDepthdNV)(GLdouble); void (WINE_GLAPI *p_glClearDepthf)(GLfloat); + void (WINE_GLAPI *p_glClearDepthfOES)(GLclampf); + void (WINE_GLAPI *p_glClearDepthxOES)(GLfixed); void (WINE_GLAPI *p_glClearNamedBufferDataEXT)(GLuint,GLenum,GLenum,GLenum,const void*); void (WINE_GLAPI *p_glClearNamedBufferSubDataEXT)(GLuint,GLenum,GLenum,GLenum,GLsizeiptr,GLsizeiptr,const void*); + void (WINE_GLAPI *p_glClearTexImage)(GLuint,GLint,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glClearTexSubImage)(GLuint,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const void*); void (WINE_GLAPI *p_glClientActiveTexture)(GLenum); void (WINE_GLAPI *p_glClientActiveTextureARB)(GLenum); void (WINE_GLAPI *p_glClientActiveVertexStreamATI)(GLenum); void (WINE_GLAPI *p_glClientAttribDefaultEXT)(GLbitfield); - GLenum (WINE_GLAPI *p_glClientWaitSync)(GLvoid*,GLbitfield,UINT64); + GLenum (WINE_GLAPI *p_glClientWaitSync)(GLsync,GLbitfield,GLuint64); + void (WINE_GLAPI *p_glClipPlanefOES)(GLenum,const GLfloat*); + void (WINE_GLAPI *p_glClipPlanexOES)(GLenum,const GLfixed*); void (WINE_GLAPI *p_glColor3fVertex3fSUN)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glColor3fVertex3fvSUN)(const GLfloat*,const GLfloat*); void (WINE_GLAPI *p_glColor3hNV)(GLhalfNV,GLhalfNV,GLhalfNV); void (WINE_GLAPI *p_glColor3hvNV)(const GLhalfNV*); + void (WINE_GLAPI *p_glColor3xOES)(GLfixed,GLfixed,GLfixed); + void (WINE_GLAPI *p_glColor3xvOES)(const GLfixed*); void (WINE_GLAPI *p_glColor4fNormal3fVertex3fSUN)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glColor4fNormal3fVertex3fvSUN)(const GLfloat*,const GLfloat*,const GLfloat*); void (WINE_GLAPI *p_glColor4hNV)(GLhalfNV,GLhalfNV,GLhalfNV,GLhalfNV); @@ -516,6 +540,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glColor4ubVertex2fvSUN)(const GLubyte*,const GLfloat*); void (WINE_GLAPI *p_glColor4ubVertex3fSUN)(GLubyte,GLubyte,GLubyte,GLubyte,GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glColor4ubVertex3fvSUN)(const GLubyte*,const GLfloat*); + void (WINE_GLAPI *p_glColor4xOES)(GLfixed,GLfixed,GLfixed,GLfixed); + void (WINE_GLAPI *p_glColor4xvOES)(const GLfixed*); void (WINE_GLAPI *p_glColorFormatNV)(GLint,GLenum,GLsizei); void (WINE_GLAPI *p_glColorFragmentOp1ATI)(GLenum,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glColorFragmentOp2ATI)(GLenum,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint); @@ -526,18 +552,18 @@ struct opengl_funcs void (WINE_GLAPI *p_glColorP3uiv)(GLenum,const GLuint*); void (WINE_GLAPI *p_glColorP4ui)(GLenum,GLuint); void (WINE_GLAPI *p_glColorP4uiv)(GLenum,const GLuint*); - void (WINE_GLAPI *p_glColorPointerEXT)(GLint,GLenum,GLsizei,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glColorPointerListIBM)(GLint,GLenum,GLint,const GLvoid**,GLint); - void (WINE_GLAPI *p_glColorPointervINTEL)(GLint,GLenum,const GLvoid**); - void (WINE_GLAPI *p_glColorSubTable)(GLenum,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glColorSubTableEXT)(GLenum,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glColorTable)(GLenum,GLenum,GLsizei,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glColorTableEXT)(GLenum,GLenum,GLsizei,GLenum,GLenum,const GLvoid*); + void (WINE_GLAPI *p_glColorPointerEXT)(GLint,GLenum,GLsizei,GLsizei,const void*); + void (WINE_GLAPI *p_glColorPointerListIBM)(GLint,GLenum,GLint,const void**,GLint); + void (WINE_GLAPI *p_glColorPointervINTEL)(GLint,GLenum,const void**); + void (WINE_GLAPI *p_glColorSubTable)(GLenum,GLsizei,GLsizei,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glColorSubTableEXT)(GLenum,GLsizei,GLsizei,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glColorTable)(GLenum,GLenum,GLsizei,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glColorTableEXT)(GLenum,GLenum,GLsizei,GLenum,GLenum,const void*); void (WINE_GLAPI *p_glColorTableParameterfv)(GLenum,GLenum,const GLfloat*); void (WINE_GLAPI *p_glColorTableParameterfvSGI)(GLenum,GLenum,const GLfloat*); void (WINE_GLAPI *p_glColorTableParameteriv)(GLenum,GLenum,const GLint*); void (WINE_GLAPI *p_glColorTableParameterivSGI)(GLenum,GLenum,const GLint*); - void (WINE_GLAPI *p_glColorTableSGI)(GLenum,GLenum,GLsizei,GLenum,GLenum,const GLvoid*); + void (WINE_GLAPI *p_glColorTableSGI)(GLenum,GLenum,GLsizei,GLenum,GLenum,const void*); void (WINE_GLAPI *p_glCombinerInputNV)(GLenum,GLenum,GLenum,GLenum,GLenum,GLenum); void (WINE_GLAPI *p_glCombinerOutputNV)(GLenum,GLenum,GLenum,GLenum,GLenum,GLenum,GLenum,GLboolean,GLboolean,GLboolean); void (WINE_GLAPI *p_glCombinerParameterfNV)(GLenum,GLfloat); @@ -547,35 +573,35 @@ struct opengl_funcs void (WINE_GLAPI *p_glCombinerStageParameterfvNV)(GLenum,GLenum,const GLfloat*); void (WINE_GLAPI *p_glCompileShader)(GLuint); void (WINE_GLAPI *p_glCompileShaderARB)(GLhandleARB); - void (WINE_GLAPI *p_glCompileShaderIncludeARB)(GLuint,GLsizei,const GLchar**,const GLint*); - void (WINE_GLAPI *p_glCompressedMultiTexImage1DEXT)(GLenum,GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedMultiTexImage2DEXT)(GLenum,GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedMultiTexImage3DEXT)(GLenum,GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedMultiTexSubImage1DEXT)(GLenum,GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedMultiTexSubImage2DEXT)(GLenum,GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedMultiTexSubImage3DEXT)(GLenum,GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedTexImage1D)(GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedTexImage1DARB)(GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedTexImage2D)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedTexImage2DARB)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedTexImage3D)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedTexImage3DARB)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedTexSubImage1D)(GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedTexSubImage1DARB)(GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedTexSubImage2D)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedTexSubImage2DARB)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedTexSubImage3D)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedTexSubImage3DARB)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedTextureImage1DEXT)(GLuint,GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedTextureImage2DEXT)(GLuint,GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedTextureImage3DEXT)(GLuint,GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedTextureSubImage1DEXT)(GLuint,GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedTextureSubImage2DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glCompressedTextureSubImage3DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glConvolutionFilter1D)(GLenum,GLenum,GLsizei,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glConvolutionFilter1DEXT)(GLenum,GLenum,GLsizei,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glConvolutionFilter2D)(GLenum,GLenum,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glConvolutionFilter2DEXT)(GLenum,GLenum,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); + void (WINE_GLAPI *p_glCompileShaderIncludeARB)(GLuint,GLsizei,const GLchar*const*,const GLint*); + void (WINE_GLAPI *p_glCompressedMultiTexImage1DEXT)(GLenum,GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedMultiTexImage2DEXT)(GLenum,GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedMultiTexImage3DEXT)(GLenum,GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedMultiTexSubImage1DEXT)(GLenum,GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedMultiTexSubImage2DEXT)(GLenum,GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedMultiTexSubImage3DEXT)(GLenum,GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedTexImage1D)(GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedTexImage1DARB)(GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedTexImage2D)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedTexImage2DARB)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedTexImage3D)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedTexImage3DARB)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedTexSubImage1D)(GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedTexSubImage1DARB)(GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedTexSubImage2D)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedTexSubImage2DARB)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedTexSubImage3D)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedTexSubImage3DARB)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedTextureImage1DEXT)(GLuint,GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedTextureImage2DEXT)(GLuint,GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedTextureImage3DEXT)(GLuint,GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedTextureSubImage1DEXT)(GLuint,GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedTextureSubImage2DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glCompressedTextureSubImage3DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glConvolutionFilter1D)(GLenum,GLenum,GLsizei,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glConvolutionFilter1DEXT)(GLenum,GLenum,GLsizei,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glConvolutionFilter2D)(GLenum,GLenum,GLsizei,GLsizei,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glConvolutionFilter2DEXT)(GLenum,GLenum,GLsizei,GLsizei,GLenum,GLenum,const void*); void (WINE_GLAPI *p_glConvolutionParameterf)(GLenum,GLenum,GLfloat); void (WINE_GLAPI *p_glConvolutionParameterfEXT)(GLenum,GLenum,GLfloat); void (WINE_GLAPI *p_glConvolutionParameterfv)(GLenum,GLenum,const GLfloat*); @@ -584,6 +610,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glConvolutionParameteriEXT)(GLenum,GLenum,GLint); void (WINE_GLAPI *p_glConvolutionParameteriv)(GLenum,GLenum,const GLint*); void (WINE_GLAPI *p_glConvolutionParameterivEXT)(GLenum,GLenum,const GLint*); + void (WINE_GLAPI *p_glConvolutionParameterxOES)(GLenum,GLenum,GLfixed); + void (WINE_GLAPI *p_glConvolutionParameterxvOES)(GLenum,GLenum,const GLfixed*); void (WINE_GLAPI *p_glCopyBufferSubData)(GLenum,GLenum,GLintptr,GLintptr,GLsizeiptr); void (WINE_GLAPI *p_glCopyColorSubTable)(GLenum,GLsizei,GLint,GLint,GLsizei); void (WINE_GLAPI *p_glCopyColorSubTableEXT)(GLenum,GLsizei,GLint,GLint,GLsizei); @@ -612,23 +640,23 @@ struct opengl_funcs void (WINE_GLAPI *p_glCopyTextureSubImage1DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLint,GLsizei); void (WINE_GLAPI *p_glCopyTextureSubImage2DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLint,GLint,GLsizei,GLsizei); void (WINE_GLAPI *p_glCopyTextureSubImage3DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLint,GLint,GLint,GLsizei,GLsizei); - void (WINE_GLAPI *p_glCoverFillPathInstancedNV)(GLsizei,GLenum,const GLvoid*,GLuint,GLenum,GLenum,const GLfloat*); + void (WINE_GLAPI *p_glCoverFillPathInstancedNV)(GLsizei,GLenum,const void*,GLuint,GLenum,GLenum,const GLfloat*); void (WINE_GLAPI *p_glCoverFillPathNV)(GLuint,GLenum); - void (WINE_GLAPI *p_glCoverStrokePathInstancedNV)(GLsizei,GLenum,const GLvoid*,GLuint,GLenum,GLenum,const GLfloat*); + void (WINE_GLAPI *p_glCoverStrokePathInstancedNV)(GLsizei,GLenum,const void*,GLuint,GLenum,GLenum,const GLfloat*); void (WINE_GLAPI *p_glCoverStrokePathNV)(GLuint,GLenum); GLuint (WINE_GLAPI *p_glCreateProgram)(void); GLhandleARB (WINE_GLAPI *p_glCreateProgramObjectARB)(void); GLuint (WINE_GLAPI *p_glCreateShader)(GLenum); GLhandleARB (WINE_GLAPI *p_glCreateShaderObjectARB)(GLenum); GLuint (WINE_GLAPI *p_glCreateShaderProgramEXT)(GLenum,const GLchar*); - GLuint (WINE_GLAPI *p_glCreateShaderProgramv)(GLenum,GLsizei,const GLchar* const*); - GLvoid* (WINE_GLAPI *p_glCreateSyncFromCLeventARB)(void *,void *,GLbitfield); + GLuint (WINE_GLAPI *p_glCreateShaderProgramv)(GLenum,GLsizei,const GLchar*const*); + GLsync (WINE_GLAPI *p_glCreateSyncFromCLeventARB)(void*,void*,GLbitfield); void (WINE_GLAPI *p_glCullParameterdvEXT)(GLenum,GLdouble*); void (WINE_GLAPI *p_glCullParameterfvEXT)(GLenum,GLfloat*); void (WINE_GLAPI *p_glCurrentPaletteMatrixARB)(GLint); void (WINE_GLAPI *p_glDebugMessageCallback)(void *,const void*); - void (WINE_GLAPI *p_glDebugMessageCallbackAMD)(void *,GLvoid*); - void (WINE_GLAPI *p_glDebugMessageCallbackARB)(void *,const GLvoid*); + void (WINE_GLAPI *p_glDebugMessageCallbackAMD)(void *,void*); + void (WINE_GLAPI *p_glDebugMessageCallbackARB)(void *,const void*); void (WINE_GLAPI *p_glDebugMessageControl)(GLenum,GLenum,GLenum,GLsizei,const GLuint*,GLboolean); void (WINE_GLAPI *p_glDebugMessageControlARB)(GLenum,GLenum,GLenum,GLsizei,const GLuint*,GLboolean); void (WINE_GLAPI *p_glDebugMessageEnableAMD)(GLenum,GLenum,GLsizei,const GLuint*,GLboolean); @@ -664,7 +692,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glDeleteRenderbuffersEXT)(GLsizei,const GLuint*); void (WINE_GLAPI *p_glDeleteSamplers)(GLsizei,const GLuint*); void (WINE_GLAPI *p_glDeleteShader)(GLuint); - void (WINE_GLAPI *p_glDeleteSync)(GLvoid*); + void (WINE_GLAPI *p_glDeleteSync)(GLsync); void (WINE_GLAPI *p_glDeleteTexturesEXT)(GLsizei,const GLuint*); void (WINE_GLAPI *p_glDeleteTransformFeedbacks)(GLsizei,const GLuint*); void (WINE_GLAPI *p_glDeleteTransformFeedbacksNV)(GLsizei,const GLuint*); @@ -677,20 +705,26 @@ struct opengl_funcs void (WINE_GLAPI *p_glDepthRangeIndexed)(GLuint,GLdouble,GLdouble); void (WINE_GLAPI *p_glDepthRangedNV)(GLdouble,GLdouble); void (WINE_GLAPI *p_glDepthRangef)(GLfloat,GLfloat); + void (WINE_GLAPI *p_glDepthRangefOES)(GLclampf,GLclampf); + void (WINE_GLAPI *p_glDepthRangexOES)(GLfixed,GLfixed); void (WINE_GLAPI *p_glDetachObjectARB)(GLhandleARB,GLhandleARB); void (WINE_GLAPI *p_glDetachShader)(GLuint,GLuint); void (WINE_GLAPI *p_glDetailTexFuncSGIS)(GLenum,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glDisableClientStateIndexedEXT)(GLenum,GLuint); + void (WINE_GLAPI *p_glDisableClientStateiEXT)(GLenum,GLuint); void (WINE_GLAPI *p_glDisableIndexedEXT)(GLenum,GLuint); void (WINE_GLAPI *p_glDisableVariantClientStateEXT)(GLuint); + void (WINE_GLAPI *p_glDisableVertexArrayAttribEXT)(GLuint,GLuint); + void (WINE_GLAPI *p_glDisableVertexArrayEXT)(GLuint,GLenum); void (WINE_GLAPI *p_glDisableVertexAttribAPPLE)(GLuint,GLenum); void (WINE_GLAPI *p_glDisableVertexAttribArray)(GLuint); void (WINE_GLAPI *p_glDisableVertexAttribArrayARB)(GLuint); void (WINE_GLAPI *p_glDisablei)(GLenum,GLuint); void (WINE_GLAPI *p_glDispatchCompute)(GLuint,GLuint,GLuint); + void (WINE_GLAPI *p_glDispatchComputeGroupSizeARB)(GLuint,GLuint,GLuint,GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glDispatchComputeIndirect)(GLintptr); void (WINE_GLAPI *p_glDrawArraysEXT)(GLenum,GLint,GLsizei); - void (WINE_GLAPI *p_glDrawArraysIndirect)(GLenum,const GLvoid*); + void (WINE_GLAPI *p_glDrawArraysIndirect)(GLenum,const void*); void (WINE_GLAPI *p_glDrawArraysInstanced)(GLenum,GLint,GLsizei,GLsizei); void (WINE_GLAPI *p_glDrawArraysInstancedARB)(GLenum,GLint,GLsizei,GLsizei); void (WINE_GLAPI *p_glDrawArraysInstancedBaseInstance)(GLenum,GLint,GLsizei,GLsizei,GLuint); @@ -701,20 +735,21 @@ struct opengl_funcs void (WINE_GLAPI *p_glDrawBuffersATI)(GLsizei,const GLenum*); void (WINE_GLAPI *p_glDrawElementArrayAPPLE)(GLenum,GLint,GLsizei); void (WINE_GLAPI *p_glDrawElementArrayATI)(GLenum,GLsizei); - void (WINE_GLAPI *p_glDrawElementsBaseVertex)(GLenum,GLsizei,GLenum,const GLvoid*,GLint); - void (WINE_GLAPI *p_glDrawElementsIndirect)(GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glDrawElementsInstanced)(GLenum,GLsizei,GLenum,const GLvoid*,GLsizei); - void (WINE_GLAPI *p_glDrawElementsInstancedARB)(GLenum,GLsizei,GLenum,const GLvoid*,GLsizei); + void (WINE_GLAPI *p_glDrawElementsBaseVertex)(GLenum,GLsizei,GLenum,const void*,GLint); + void (WINE_GLAPI *p_glDrawElementsIndirect)(GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glDrawElementsInstanced)(GLenum,GLsizei,GLenum,const void*,GLsizei); + void (WINE_GLAPI *p_glDrawElementsInstancedARB)(GLenum,GLsizei,GLenum,const void*,GLsizei); void (WINE_GLAPI *p_glDrawElementsInstancedBaseInstance)(GLenum,GLsizei,GLenum,const void*,GLsizei,GLuint); - void (WINE_GLAPI *p_glDrawElementsInstancedBaseVertex)(GLenum,GLsizei,GLenum,const GLvoid*,GLsizei,GLint); + void (WINE_GLAPI *p_glDrawElementsInstancedBaseVertex)(GLenum,GLsizei,GLenum,const void*,GLsizei,GLint); void (WINE_GLAPI *p_glDrawElementsInstancedBaseVertexBaseInstance)(GLenum,GLsizei,GLenum,const void*,GLsizei,GLint,GLuint); - void (WINE_GLAPI *p_glDrawElementsInstancedEXT)(GLenum,GLsizei,GLenum,const GLvoid*,GLsizei); + void (WINE_GLAPI *p_glDrawElementsInstancedEXT)(GLenum,GLsizei,GLenum,const void*,GLsizei); void (WINE_GLAPI *p_glDrawMeshArraysSUN)(GLenum,GLint,GLsizei,GLsizei); void (WINE_GLAPI *p_glDrawRangeElementArrayAPPLE)(GLenum,GLuint,GLuint,GLint,GLsizei); void (WINE_GLAPI *p_glDrawRangeElementArrayATI)(GLenum,GLuint,GLuint,GLsizei); - void (WINE_GLAPI *p_glDrawRangeElements)(GLenum,GLuint,GLuint,GLsizei,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glDrawRangeElementsBaseVertex)(GLenum,GLuint,GLuint,GLsizei,GLenum,const GLvoid*,GLint); - void (WINE_GLAPI *p_glDrawRangeElementsEXT)(GLenum,GLuint,GLuint,GLsizei,GLenum,const GLvoid*); + void (WINE_GLAPI *p_glDrawRangeElements)(GLenum,GLuint,GLuint,GLsizei,GLenum,const void*); + void (WINE_GLAPI *p_glDrawRangeElementsBaseVertex)(GLenum,GLuint,GLuint,GLsizei,GLenum,const void*,GLint); + void (WINE_GLAPI *p_glDrawRangeElementsEXT)(GLenum,GLuint,GLuint,GLsizei,GLenum,const void*); + void (WINE_GLAPI *p_glDrawTextureNV)(GLuint,GLuint,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glDrawTransformFeedback)(GLenum,GLuint); void (WINE_GLAPI *p_glDrawTransformFeedbackInstanced)(GLenum,GLuint,GLsizei); void (WINE_GLAPI *p_glDrawTransformFeedbackNV)(GLenum,GLuint); @@ -723,17 +758,21 @@ struct opengl_funcs void (WINE_GLAPI *p_glEdgeFlagFormatNV)(GLsizei); void (WINE_GLAPI *p_glEdgeFlagPointerEXT)(GLsizei,GLsizei,const GLboolean*); void (WINE_GLAPI *p_glEdgeFlagPointerListIBM)(GLint,const GLboolean**,GLint); - void (WINE_GLAPI *p_glElementPointerAPPLE)(GLenum,const GLvoid*); - void (WINE_GLAPI *p_glElementPointerATI)(GLenum,const GLvoid*); + void (WINE_GLAPI *p_glElementPointerAPPLE)(GLenum,const void*); + void (WINE_GLAPI *p_glElementPointerATI)(GLenum,const void*); void (WINE_GLAPI *p_glEnableClientStateIndexedEXT)(GLenum,GLuint); + void (WINE_GLAPI *p_glEnableClientStateiEXT)(GLenum,GLuint); void (WINE_GLAPI *p_glEnableIndexedEXT)(GLenum,GLuint); void (WINE_GLAPI *p_glEnableVariantClientStateEXT)(GLuint); + void (WINE_GLAPI *p_glEnableVertexArrayAttribEXT)(GLuint,GLuint); + void (WINE_GLAPI *p_glEnableVertexArrayEXT)(GLuint,GLenum); void (WINE_GLAPI *p_glEnableVertexAttribAPPLE)(GLuint,GLenum); void (WINE_GLAPI *p_glEnableVertexAttribArray)(GLuint); void (WINE_GLAPI *p_glEnableVertexAttribArrayARB)(GLuint); void (WINE_GLAPI *p_glEnablei)(GLenum,GLuint); void (WINE_GLAPI *p_glEndConditionalRender)(void); void (WINE_GLAPI *p_glEndConditionalRenderNV)(void); + void (WINE_GLAPI *p_glEndConditionalRenderNVX)(void); void (WINE_GLAPI *p_glEndFragmentShaderATI)(void); void (WINE_GLAPI *p_glEndOcclusionQueryNV)(void); void (WINE_GLAPI *p_glEndPerfMonitorAMD)(GLuint); @@ -745,10 +784,15 @@ struct opengl_funcs void (WINE_GLAPI *p_glEndTransformFeedbackNV)(void); void (WINE_GLAPI *p_glEndVertexShaderEXT)(void); void (WINE_GLAPI *p_glEndVideoCaptureNV)(GLuint); + void (WINE_GLAPI *p_glEvalCoord1xOES)(GLfixed); + void (WINE_GLAPI *p_glEvalCoord1xvOES)(const GLfixed*); + void (WINE_GLAPI *p_glEvalCoord2xOES)(GLfixed,GLfixed); + void (WINE_GLAPI *p_glEvalCoord2xvOES)(const GLfixed*); void (WINE_GLAPI *p_glEvalMapsNV)(GLenum,GLenum); void (WINE_GLAPI *p_glExecuteProgramNV)(GLenum,GLuint,const GLfloat*); void (WINE_GLAPI *p_glExtractComponentEXT)(GLuint,GLuint,GLuint); - GLvoid* (WINE_GLAPI *p_glFenceSync)(GLenum,GLbitfield); + void (WINE_GLAPI *p_glFeedbackBufferxOES)(GLsizei,GLenum,const GLfixed*); + GLsync (WINE_GLAPI *p_glFenceSync)(GLenum,GLbitfield); void (WINE_GLAPI *p_glFinalCombinerInputNV)(GLenum,GLenum,GLenum,GLenum); GLint (WINE_GLAPI *p_glFinishAsyncSGIX)(GLuint*); void (WINE_GLAPI *p_glFinishFenceAPPLE)(GLuint); @@ -760,12 +804,13 @@ struct opengl_funcs void (WINE_GLAPI *p_glFlushMappedNamedBufferRangeEXT)(GLuint,GLintptr,GLsizeiptr); void (WINE_GLAPI *p_glFlushPixelDataRangeNV)(GLenum); void (WINE_GLAPI *p_glFlushRasterSGIX)(void); - void (WINE_GLAPI *p_glFlushVertexArrayRangeAPPLE)(GLsizei,GLvoid*); + void (WINE_GLAPI *p_glFlushStaticDataIBM)(GLenum); + void (WINE_GLAPI *p_glFlushVertexArrayRangeAPPLE)(GLsizei,void*); void (WINE_GLAPI *p_glFlushVertexArrayRangeNV)(void); void (WINE_GLAPI *p_glFogCoordFormatNV)(GLenum,GLsizei); - void (WINE_GLAPI *p_glFogCoordPointer)(GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glFogCoordPointerEXT)(GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glFogCoordPointerListIBM)(GLenum,GLint,const GLvoid**,GLint); + void (WINE_GLAPI *p_glFogCoordPointer)(GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glFogCoordPointerEXT)(GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glFogCoordPointerListIBM)(GLenum,GLint,const void**,GLint); void (WINE_GLAPI *p_glFogCoordd)(GLdouble); void (WINE_GLAPI *p_glFogCoorddEXT)(GLdouble); void (WINE_GLAPI *p_glFogCoorddv)(const GLdouble*); @@ -777,6 +822,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glFogCoordhNV)(GLhalfNV); void (WINE_GLAPI *p_glFogCoordhvNV)(const GLhalfNV*); void (WINE_GLAPI *p_glFogFuncSGIS)(GLsizei,const GLfloat*); + void (WINE_GLAPI *p_glFogxOES)(GLenum,GLfixed); + void (WINE_GLAPI *p_glFogxvOES)(GLenum,const GLfixed*); void (WINE_GLAPI *p_glFragmentColorMaterialSGIX)(GLenum,GLenum); void (WINE_GLAPI *p_glFragmentLightModelfSGIX)(GLenum,GLfloat); void (WINE_GLAPI *p_glFragmentLightModelfvSGIX)(GLenum,const GLfloat*); @@ -813,6 +860,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glFramebufferTextureLayerARB)(GLenum,GLenum,GLuint,GLint,GLint); void (WINE_GLAPI *p_glFramebufferTextureLayerEXT)(GLenum,GLenum,GLuint,GLint,GLint); void (WINE_GLAPI *p_glFreeObjectBufferATI)(GLuint); + void (WINE_GLAPI *p_glFrustumfOES)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); + void (WINE_GLAPI *p_glFrustumxOES)(GLfixed,GLfixed,GLfixed,GLfixed,GLfixed,GLfixed); GLuint (WINE_GLAPI *p_glGenAsyncMarkersSGIX)(GLsizei); void (WINE_GLAPI *p_glGenBuffers)(GLsizei,GLuint*); void (WINE_GLAPI *p_glGenBuffersARB)(GLsizei,GLuint*); @@ -865,49 +914,55 @@ struct opengl_funcs GLint (WINE_GLAPI *p_glGetAttribLocationARB)(GLhandleARB,const GLcharARB*); void (WINE_GLAPI *p_glGetBooleanIndexedvEXT)(GLenum,GLuint,GLboolean*); void (WINE_GLAPI *p_glGetBooleani_v)(GLenum,GLuint,GLboolean*); - void (WINE_GLAPI *p_glGetBufferParameteri64v)(GLenum,GLenum,INT64*); + void (WINE_GLAPI *p_glGetBufferParameteri64v)(GLenum,GLenum,GLint64*); void (WINE_GLAPI *p_glGetBufferParameteriv)(GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetBufferParameterivARB)(GLenum,GLenum,GLint*); - void (WINE_GLAPI *p_glGetBufferParameterui64vNV)(GLenum,GLenum,UINT64*); - void (WINE_GLAPI *p_glGetBufferPointerv)(GLenum,GLenum,GLvoid**); - void (WINE_GLAPI *p_glGetBufferPointervARB)(GLenum,GLenum,GLvoid**); - void (WINE_GLAPI *p_glGetBufferSubData)(GLenum,GLintptr,GLsizeiptr,GLvoid*); - void (WINE_GLAPI *p_glGetBufferSubDataARB)(GLenum,GLintptrARB,GLsizeiptrARB,GLvoid*); - void (WINE_GLAPI *p_glGetColorTable)(GLenum,GLenum,GLenum,GLvoid*); - void (WINE_GLAPI *p_glGetColorTableEXT)(GLenum,GLenum,GLenum,GLvoid*); + void (WINE_GLAPI *p_glGetBufferParameterui64vNV)(GLenum,GLenum,GLuint64EXT*); + void (WINE_GLAPI *p_glGetBufferPointerv)(GLenum,GLenum,void**); + void (WINE_GLAPI *p_glGetBufferPointervARB)(GLenum,GLenum,void**); + void (WINE_GLAPI *p_glGetBufferSubData)(GLenum,GLintptr,GLsizeiptr,void*); + void (WINE_GLAPI *p_glGetBufferSubDataARB)(GLenum,GLintptrARB,GLsizeiptrARB,void*); + void (WINE_GLAPI *p_glGetClipPlanefOES)(GLenum,GLfloat*); + void (WINE_GLAPI *p_glGetClipPlanexOES)(GLenum,GLfixed*); + void (WINE_GLAPI *p_glGetColorTable)(GLenum,GLenum,GLenum,void*); + void (WINE_GLAPI *p_glGetColorTableEXT)(GLenum,GLenum,GLenum,void*); void (WINE_GLAPI *p_glGetColorTableParameterfv)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetColorTableParameterfvEXT)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetColorTableParameterfvSGI)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetColorTableParameteriv)(GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetColorTableParameterivEXT)(GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetColorTableParameterivSGI)(GLenum,GLenum,GLint*); - void (WINE_GLAPI *p_glGetColorTableSGI)(GLenum,GLenum,GLenum,GLvoid*); + void (WINE_GLAPI *p_glGetColorTableSGI)(GLenum,GLenum,GLenum,void*); void (WINE_GLAPI *p_glGetCombinerInputParameterfvNV)(GLenum,GLenum,GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetCombinerInputParameterivNV)(GLenum,GLenum,GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetCombinerOutputParameterfvNV)(GLenum,GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetCombinerOutputParameterivNV)(GLenum,GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetCombinerStageParameterfvNV)(GLenum,GLenum,GLfloat*); - void (WINE_GLAPI *p_glGetCompressedMultiTexImageEXT)(GLenum,GLenum,GLint,GLvoid*); - void (WINE_GLAPI *p_glGetCompressedTexImage)(GLenum,GLint,GLvoid*); - void (WINE_GLAPI *p_glGetCompressedTexImageARB)(GLenum,GLint,GLvoid*); - void (WINE_GLAPI *p_glGetCompressedTextureImageEXT)(GLuint,GLenum,GLint,GLvoid*); - void (WINE_GLAPI *p_glGetConvolutionFilter)(GLenum,GLenum,GLenum,GLvoid*); - void (WINE_GLAPI *p_glGetConvolutionFilterEXT)(GLenum,GLenum,GLenum,GLvoid*); + void (WINE_GLAPI *p_glGetCompressedMultiTexImageEXT)(GLenum,GLenum,GLint,void*); + void (WINE_GLAPI *p_glGetCompressedTexImage)(GLenum,GLint,void*); + void (WINE_GLAPI *p_glGetCompressedTexImageARB)(GLenum,GLint,void*); + void (WINE_GLAPI *p_glGetCompressedTextureImageEXT)(GLuint,GLenum,GLint,void*); + void (WINE_GLAPI *p_glGetConvolutionFilter)(GLenum,GLenum,GLenum,void*); + void (WINE_GLAPI *p_glGetConvolutionFilterEXT)(GLenum,GLenum,GLenum,void*); void (WINE_GLAPI *p_glGetConvolutionParameterfv)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetConvolutionParameterfvEXT)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetConvolutionParameteriv)(GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetConvolutionParameterivEXT)(GLenum,GLenum,GLint*); + void (WINE_GLAPI *p_glGetConvolutionParameterxvOES)(GLenum,GLenum,GLfixed*); GLuint (WINE_GLAPI *p_glGetDebugMessageLog)(GLuint,GLsizei,GLenum*,GLenum*,GLuint*,GLenum*,GLsizei*,GLchar*); GLuint (WINE_GLAPI *p_glGetDebugMessageLogAMD)(GLuint,GLsizei,GLenum*,GLuint*,GLuint*,GLsizei*,GLchar*); GLuint (WINE_GLAPI *p_glGetDebugMessageLogARB)(GLuint,GLsizei,GLenum*,GLenum*,GLuint*,GLenum*,GLsizei*,GLchar*); void (WINE_GLAPI *p_glGetDetailTexFuncSGIS)(GLenum,GLfloat*); void (WINE_GLAPI *p_glGetDoubleIndexedvEXT)(GLenum,GLuint,GLdouble*); void (WINE_GLAPI *p_glGetDoublei_v)(GLenum,GLuint,GLdouble*); + void (WINE_GLAPI *p_glGetDoublei_vEXT)(GLenum,GLuint,GLdouble*); void (WINE_GLAPI *p_glGetFenceivNV)(GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetFinalCombinerInputParameterfvNV)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetFinalCombinerInputParameterivNV)(GLenum,GLenum,GLint*); + void (WINE_GLAPI *p_glGetFixedvOES)(GLenum,GLfixed*); void (WINE_GLAPI *p_glGetFloatIndexedvEXT)(GLenum,GLuint,GLfloat*); void (WINE_GLAPI *p_glGetFloati_v)(GLenum,GLuint,GLfloat*); + void (WINE_GLAPI *p_glGetFloati_vEXT)(GLenum,GLuint,GLfloat*); void (WINE_GLAPI *p_glGetFogFuncSGIS)(GLfloat*); GLint (WINE_GLAPI *p_glGetFragDataIndex)(GLuint,const GLchar*); GLint (WINE_GLAPI *p_glGetFragDataLocation)(GLuint,const GLchar*); @@ -922,28 +977,31 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetFramebufferParameterivEXT)(GLuint,GLenum,GLint*); GLenum (WINE_GLAPI *p_glGetGraphicsResetStatusARB)(void); GLhandleARB (WINE_GLAPI *p_glGetHandleARB)(GLenum); - void (WINE_GLAPI *p_glGetHistogram)(GLenum,GLboolean,GLenum,GLenum,GLvoid*); - void (WINE_GLAPI *p_glGetHistogramEXT)(GLenum,GLboolean,GLenum,GLenum,GLvoid*); + void (WINE_GLAPI *p_glGetHistogram)(GLenum,GLboolean,GLenum,GLenum,void*); + void (WINE_GLAPI *p_glGetHistogramEXT)(GLenum,GLboolean,GLenum,GLenum,void*); void (WINE_GLAPI *p_glGetHistogramParameterfv)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetHistogramParameterfvEXT)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetHistogramParameteriv)(GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetHistogramParameterivEXT)(GLenum,GLenum,GLint*); - UINT64 (WINE_GLAPI *p_glGetImageHandleNV)(GLuint,GLint,GLboolean,GLint,GLenum); + void (WINE_GLAPI *p_glGetHistogramParameterxvOES)(GLenum,GLenum,GLfixed*); + GLuint64 (WINE_GLAPI *p_glGetImageHandleARB)(GLuint,GLint,GLboolean,GLint,GLenum); + GLuint64 (WINE_GLAPI *p_glGetImageHandleNV)(GLuint,GLint,GLboolean,GLint,GLenum); void (WINE_GLAPI *p_glGetImageTransformParameterfvHP)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetImageTransformParameterivHP)(GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetInfoLogARB)(GLhandleARB,GLsizei,GLsizei*,GLcharARB*); GLint (WINE_GLAPI *p_glGetInstrumentsSGIX)(void); - void (WINE_GLAPI *p_glGetInteger64i_v)(GLenum,GLuint,INT64*); - void (WINE_GLAPI *p_glGetInteger64v)(GLenum,INT64*); + void (WINE_GLAPI *p_glGetInteger64i_v)(GLenum,GLuint,GLint64*); + void (WINE_GLAPI *p_glGetInteger64v)(GLenum,GLint64*); void (WINE_GLAPI *p_glGetIntegerIndexedvEXT)(GLenum,GLuint,GLint*); void (WINE_GLAPI *p_glGetIntegeri_v)(GLenum,GLuint,GLint*); - void (WINE_GLAPI *p_glGetIntegerui64i_vNV)(GLenum,GLuint,UINT64*); - void (WINE_GLAPI *p_glGetIntegerui64vNV)(GLenum,UINT64*); - void (WINE_GLAPI *p_glGetInternalformati64v)(GLenum,GLenum,GLenum,GLsizei,INT64*); + void (WINE_GLAPI *p_glGetIntegerui64i_vNV)(GLenum,GLuint,GLuint64EXT*); + void (WINE_GLAPI *p_glGetIntegerui64vNV)(GLenum,GLuint64EXT*); + void (WINE_GLAPI *p_glGetInternalformati64v)(GLenum,GLenum,GLenum,GLsizei,GLint64*); void (WINE_GLAPI *p_glGetInternalformativ)(GLenum,GLenum,GLenum,GLsizei,GLint*); void (WINE_GLAPI *p_glGetInvariantBooleanvEXT)(GLuint,GLenum,GLboolean*); void (WINE_GLAPI *p_glGetInvariantFloatvEXT)(GLuint,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetInvariantIntegervEXT)(GLuint,GLenum,GLint*); + void (WINE_GLAPI *p_glGetLightxOES)(GLenum,GLenum,GLfixed*); void (WINE_GLAPI *p_glGetListParameterfvSGIX)(GLuint,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetListParameterivSGIX)(GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetLocalConstantBooleanvEXT)(GLuint,GLenum,GLboolean*); @@ -951,11 +1009,13 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetLocalConstantIntegervEXT)(GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetMapAttribParameterfvNV)(GLenum,GLuint,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetMapAttribParameterivNV)(GLenum,GLuint,GLenum,GLint*); - void (WINE_GLAPI *p_glGetMapControlPointsNV)(GLenum,GLuint,GLenum,GLsizei,GLsizei,GLboolean,GLvoid*); + void (WINE_GLAPI *p_glGetMapControlPointsNV)(GLenum,GLuint,GLenum,GLsizei,GLsizei,GLboolean,void*); void (WINE_GLAPI *p_glGetMapParameterfvNV)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetMapParameterivNV)(GLenum,GLenum,GLint*); - void (WINE_GLAPI *p_glGetMinmax)(GLenum,GLboolean,GLenum,GLenum,GLvoid*); - void (WINE_GLAPI *p_glGetMinmaxEXT)(GLenum,GLboolean,GLenum,GLenum,GLvoid*); + void (WINE_GLAPI *p_glGetMapxvOES)(GLenum,GLenum,GLfixed*); + void (WINE_GLAPI *p_glGetMaterialxOES)(GLenum,GLenum,GLfixed); + void (WINE_GLAPI *p_glGetMinmax)(GLenum,GLboolean,GLenum,GLenum,void*); + void (WINE_GLAPI *p_glGetMinmaxEXT)(GLenum,GLboolean,GLenum,GLenum,void*); void (WINE_GLAPI *p_glGetMinmaxParameterfv)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetMinmaxParameterfvEXT)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetMinmaxParameteriv)(GLenum,GLenum,GLint*); @@ -965,7 +1025,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetMultiTexGendvEXT)(GLenum,GLenum,GLenum,GLdouble*); void (WINE_GLAPI *p_glGetMultiTexGenfvEXT)(GLenum,GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetMultiTexGenivEXT)(GLenum,GLenum,GLenum,GLint*); - void (WINE_GLAPI *p_glGetMultiTexImageEXT)(GLenum,GLenum,GLint,GLenum,GLenum,GLvoid*); + void (WINE_GLAPI *p_glGetMultiTexImageEXT)(GLenum,GLenum,GLint,GLenum,GLenum,void*); void (WINE_GLAPI *p_glGetMultiTexLevelParameterfvEXT)(GLenum,GLenum,GLint,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetMultiTexLevelParameterivEXT)(GLenum,GLenum,GLint,GLenum,GLint*); void (WINE_GLAPI *p_glGetMultiTexParameterIivEXT)(GLenum,GLenum,GLenum,GLint*); @@ -975,16 +1035,16 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetMultisamplefv)(GLenum,GLuint,GLfloat*); void (WINE_GLAPI *p_glGetMultisamplefvNV)(GLenum,GLuint,GLfloat*); void (WINE_GLAPI *p_glGetNamedBufferParameterivEXT)(GLuint,GLenum,GLint*); - void (WINE_GLAPI *p_glGetNamedBufferParameterui64vNV)(GLuint,GLenum,UINT64*); - void (WINE_GLAPI *p_glGetNamedBufferPointervEXT)(GLuint,GLenum,GLvoid**); - void (WINE_GLAPI *p_glGetNamedBufferSubDataEXT)(GLuint,GLintptr,GLsizeiptr,GLvoid*); + void (WINE_GLAPI *p_glGetNamedBufferParameterui64vNV)(GLuint,GLenum,GLuint64EXT*); + void (WINE_GLAPI *p_glGetNamedBufferPointervEXT)(GLuint,GLenum,void**); + void (WINE_GLAPI *p_glGetNamedBufferSubDataEXT)(GLuint,GLintptr,GLsizeiptr,void*); void (WINE_GLAPI *p_glGetNamedFramebufferAttachmentParameterivEXT)(GLuint,GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetNamedFramebufferParameterivEXT)(GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetNamedProgramLocalParameterIivEXT)(GLuint,GLenum,GLuint,GLint*); void (WINE_GLAPI *p_glGetNamedProgramLocalParameterIuivEXT)(GLuint,GLenum,GLuint,GLuint*); void (WINE_GLAPI *p_glGetNamedProgramLocalParameterdvEXT)(GLuint,GLenum,GLuint,GLdouble*); void (WINE_GLAPI *p_glGetNamedProgramLocalParameterfvEXT)(GLuint,GLenum,GLuint,GLfloat*); - void (WINE_GLAPI *p_glGetNamedProgramStringEXT)(GLuint,GLenum,GLenum,GLvoid*); + void (WINE_GLAPI *p_glGetNamedProgramStringEXT)(GLuint,GLenum,GLenum,void*); void (WINE_GLAPI *p_glGetNamedProgramivEXT)(GLuint,GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetNamedRenderbufferParameterivEXT)(GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetNamedStringARB)(GLint,const GLchar*,GLsizei,GLint*,GLchar*); @@ -992,6 +1052,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetObjectBufferfvATI)(GLuint,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetObjectBufferivATI)(GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetObjectLabel)(GLenum,GLuint,GLsizei,GLsizei*,GLchar*); + void (WINE_GLAPI *p_glGetObjectLabelEXT)(GLenum,GLuint,GLsizei,GLsizei*,GLchar*); void (WINE_GLAPI *p_glGetObjectParameterfvARB)(GLhandleARB,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetObjectParameterivAPPLE)(GLenum,GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetObjectParameterivARB)(GLhandleARB,GLenum,GLint*); @@ -1005,25 +1066,27 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetPathDashArrayNV)(GLuint,GLfloat*); GLfloat (WINE_GLAPI *p_glGetPathLengthNV)(GLuint,GLsizei,GLsizei); void (WINE_GLAPI *p_glGetPathMetricRangeNV)(GLbitfield,GLuint,GLsizei,GLsizei,GLfloat*); - void (WINE_GLAPI *p_glGetPathMetricsNV)(GLbitfield,GLsizei,GLenum,const GLvoid*,GLuint,GLsizei,GLfloat*); + void (WINE_GLAPI *p_glGetPathMetricsNV)(GLbitfield,GLsizei,GLenum,const void*,GLuint,GLsizei,GLfloat*); void (WINE_GLAPI *p_glGetPathParameterfvNV)(GLuint,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetPathParameterivNV)(GLuint,GLenum,GLint*); - void (WINE_GLAPI *p_glGetPathSpacingNV)(GLenum,GLsizei,GLenum,const GLvoid*,GLuint,GLfloat,GLfloat,GLenum,GLfloat*); + void (WINE_GLAPI *p_glGetPathSpacingNV)(GLenum,GLsizei,GLenum,const void*,GLuint,GLfloat,GLfloat,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetPathTexGenfvNV)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetPathTexGenivNV)(GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetPerfMonitorCounterDataAMD)(GLuint,GLenum,GLsizei,GLuint*,GLint*); - void (WINE_GLAPI *p_glGetPerfMonitorCounterInfoAMD)(GLuint,GLuint,GLenum,GLvoid*); + void (WINE_GLAPI *p_glGetPerfMonitorCounterInfoAMD)(GLuint,GLuint,GLenum,void*); void (WINE_GLAPI *p_glGetPerfMonitorCounterStringAMD)(GLuint,GLuint,GLsizei,GLsizei*,GLchar*); void (WINE_GLAPI *p_glGetPerfMonitorCountersAMD)(GLuint,GLint*,GLint*,GLsizei,GLuint*); void (WINE_GLAPI *p_glGetPerfMonitorGroupStringAMD)(GLuint,GLsizei,GLsizei*,GLchar*); void (WINE_GLAPI *p_glGetPerfMonitorGroupsAMD)(GLint*,GLsizei,GLuint*); + void (WINE_GLAPI *p_glGetPixelMapxv)(GLenum,GLint,GLfixed*); void (WINE_GLAPI *p_glGetPixelTexGenParameterfvSGIS)(GLenum,GLfloat*); void (WINE_GLAPI *p_glGetPixelTexGenParameterivSGIS)(GLenum,GLint*); void (WINE_GLAPI *p_glGetPixelTransformParameterfvEXT)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetPixelTransformParameterivEXT)(GLenum,GLenum,GLint*); - void (WINE_GLAPI *p_glGetPointerIndexedvEXT)(GLenum,GLuint,GLvoid**); - void (WINE_GLAPI *p_glGetPointervEXT)(GLenum,GLvoid**); - void (WINE_GLAPI *p_glGetProgramBinary)(GLuint,GLsizei,GLsizei*,GLenum*,GLvoid*); + void (WINE_GLAPI *p_glGetPointerIndexedvEXT)(GLenum,GLuint,void**); + void (WINE_GLAPI *p_glGetPointeri_vEXT)(GLenum,GLuint,void**); + void (WINE_GLAPI *p_glGetPointervEXT)(GLenum,void**); + void (WINE_GLAPI *p_glGetProgramBinary)(GLuint,GLsizei,GLsizei*,GLenum*,void*); void (WINE_GLAPI *p_glGetProgramEnvParameterIivNV)(GLenum,GLuint,GLint*); void (WINE_GLAPI *p_glGetProgramEnvParameterIuivNV)(GLenum,GLuint,GLuint*); void (WINE_GLAPI *p_glGetProgramEnvParameterdvARB)(GLenum,GLuint,GLdouble*); @@ -1046,19 +1109,19 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetProgramResourceName)(GLuint,GLenum,GLuint,GLsizei,GLsizei*,GLchar*); void (WINE_GLAPI *p_glGetProgramResourceiv)(GLuint,GLenum,GLuint,GLsizei,const GLenum*,GLsizei,GLsizei*,GLint*); void (WINE_GLAPI *p_glGetProgramStageiv)(GLuint,GLenum,GLenum,GLint*); - void (WINE_GLAPI *p_glGetProgramStringARB)(GLenum,GLenum,GLvoid*); + void (WINE_GLAPI *p_glGetProgramStringARB)(GLenum,GLenum,void*); void (WINE_GLAPI *p_glGetProgramStringNV)(GLuint,GLenum,GLubyte*); void (WINE_GLAPI *p_glGetProgramSubroutineParameteruivNV)(GLenum,GLuint,GLuint*); void (WINE_GLAPI *p_glGetProgramiv)(GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetProgramivARB)(GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetProgramivNV)(GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetQueryIndexediv)(GLenum,GLuint,GLenum,GLint*); - void (WINE_GLAPI *p_glGetQueryObjecti64v)(GLuint,GLenum,INT64*); - void (WINE_GLAPI *p_glGetQueryObjecti64vEXT)(GLuint,GLenum,INT64*); + void (WINE_GLAPI *p_glGetQueryObjecti64v)(GLuint,GLenum,GLint64*); + void (WINE_GLAPI *p_glGetQueryObjecti64vEXT)(GLuint,GLenum,GLint64*); void (WINE_GLAPI *p_glGetQueryObjectiv)(GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetQueryObjectivARB)(GLuint,GLenum,GLint*); - void (WINE_GLAPI *p_glGetQueryObjectui64v)(GLuint,GLenum,UINT64*); - void (WINE_GLAPI *p_glGetQueryObjectui64vEXT)(GLuint,GLenum,UINT64*); + void (WINE_GLAPI *p_glGetQueryObjectui64v)(GLuint,GLenum,GLuint64*); + void (WINE_GLAPI *p_glGetQueryObjectui64vEXT)(GLuint,GLenum,GLuint64*); void (WINE_GLAPI *p_glGetQueryObjectuiv)(GLuint,GLenum,GLuint*); void (WINE_GLAPI *p_glGetQueryObjectuivARB)(GLuint,GLenum,GLuint*); void (WINE_GLAPI *p_glGetQueryiv)(GLenum,GLenum,GLint*); @@ -1069,42 +1132,48 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetSamplerParameterIuiv)(GLuint,GLenum,GLuint*); void (WINE_GLAPI *p_glGetSamplerParameterfv)(GLuint,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetSamplerParameteriv)(GLuint,GLenum,GLint*); - void (WINE_GLAPI *p_glGetSeparableFilter)(GLenum,GLenum,GLenum,GLvoid*,GLvoid*,GLvoid*); - void (WINE_GLAPI *p_glGetSeparableFilterEXT)(GLenum,GLenum,GLenum,GLvoid*,GLvoid*,GLvoid*); + void (WINE_GLAPI *p_glGetSeparableFilter)(GLenum,GLenum,GLenum,void*,void*,void*); + void (WINE_GLAPI *p_glGetSeparableFilterEXT)(GLenum,GLenum,GLenum,void*,void*,void*); void (WINE_GLAPI *p_glGetShaderInfoLog)(GLuint,GLsizei,GLsizei*,GLchar*); void (WINE_GLAPI *p_glGetShaderPrecisionFormat)(GLenum,GLenum,GLint*,GLint*); void (WINE_GLAPI *p_glGetShaderSource)(GLuint,GLsizei,GLsizei*,GLchar*); void (WINE_GLAPI *p_glGetShaderSourceARB)(GLhandleARB,GLsizei,GLsizei*,GLcharARB*); void (WINE_GLAPI *p_glGetShaderiv)(GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetSharpenTexFuncSGIS)(GLenum,GLfloat*); - const GLubyte * (WINE_GLAPI *p_glGetStringi)(GLenum,GLuint); + const GLubyte* (WINE_GLAPI *p_glGetStringi)(GLenum,GLuint); GLuint (WINE_GLAPI *p_glGetSubroutineIndex)(GLuint,GLenum,const GLchar*); GLint (WINE_GLAPI *p_glGetSubroutineUniformLocation)(GLuint,GLenum,const GLchar*); - void (WINE_GLAPI *p_glGetSynciv)(GLvoid*,GLenum,GLsizei,GLsizei*,GLint*); + void (WINE_GLAPI *p_glGetSynciv)(GLsync,GLenum,GLsizei,GLsizei*,GLint*); void (WINE_GLAPI *p_glGetTexBumpParameterfvATI)(GLenum,GLfloat*); void (WINE_GLAPI *p_glGetTexBumpParameterivATI)(GLenum,GLint*); + void (WINE_GLAPI *p_glGetTexEnvxvOES)(GLenum,GLenum,GLfixed*); void (WINE_GLAPI *p_glGetTexFilterFuncSGIS)(GLenum,GLenum,GLfloat*); + void (WINE_GLAPI *p_glGetTexGenxvOES)(GLenum,GLenum,GLfixed*); + void (WINE_GLAPI *p_glGetTexLevelParameterxvOES)(GLenum,GLint,GLenum,GLfixed*); void (WINE_GLAPI *p_glGetTexParameterIiv)(GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetTexParameterIivEXT)(GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetTexParameterIuiv)(GLenum,GLenum,GLuint*); void (WINE_GLAPI *p_glGetTexParameterIuivEXT)(GLenum,GLenum,GLuint*); - void (WINE_GLAPI *p_glGetTexParameterPointervAPPLE)(GLenum,GLenum,GLvoid**); - UINT64 (WINE_GLAPI *p_glGetTextureHandleNV)(GLuint); - void (WINE_GLAPI *p_glGetTextureImageEXT)(GLuint,GLenum,GLint,GLenum,GLenum,GLvoid*); + void (WINE_GLAPI *p_glGetTexParameterPointervAPPLE)(GLenum,GLenum,void**); + void (WINE_GLAPI *p_glGetTexParameterxvOES)(GLenum,GLenum,GLfixed*); + GLuint64 (WINE_GLAPI *p_glGetTextureHandleARB)(GLuint); + GLuint64 (WINE_GLAPI *p_glGetTextureHandleNV)(GLuint); + void (WINE_GLAPI *p_glGetTextureImageEXT)(GLuint,GLenum,GLint,GLenum,GLenum,void*); void (WINE_GLAPI *p_glGetTextureLevelParameterfvEXT)(GLuint,GLenum,GLint,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetTextureLevelParameterivEXT)(GLuint,GLenum,GLint,GLenum,GLint*); void (WINE_GLAPI *p_glGetTextureParameterIivEXT)(GLuint,GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetTextureParameterIuivEXT)(GLuint,GLenum,GLenum,GLuint*); void (WINE_GLAPI *p_glGetTextureParameterfvEXT)(GLuint,GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetTextureParameterivEXT)(GLuint,GLenum,GLenum,GLint*); - UINT64 (WINE_GLAPI *p_glGetTextureSamplerHandleNV)(GLuint,GLuint); + GLuint64 (WINE_GLAPI *p_glGetTextureSamplerHandleARB)(GLuint,GLuint); + GLuint64 (WINE_GLAPI *p_glGetTextureSamplerHandleNV)(GLuint,GLuint); void (WINE_GLAPI *p_glGetTrackMatrixivNV)(GLenum,GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetTransformFeedbackVarying)(GLuint,GLuint,GLsizei,GLsizei*,GLsizei*,GLenum*,GLchar*); void (WINE_GLAPI *p_glGetTransformFeedbackVaryingEXT)(GLuint,GLuint,GLsizei,GLsizei*,GLsizei*,GLenum*,GLchar*); void (WINE_GLAPI *p_glGetTransformFeedbackVaryingNV)(GLuint,GLuint,GLint*); GLuint (WINE_GLAPI *p_glGetUniformBlockIndex)(GLuint,const GLchar*); GLint (WINE_GLAPI *p_glGetUniformBufferSizeEXT)(GLuint,GLint); - void (WINE_GLAPI *p_glGetUniformIndices)(GLuint,GLsizei,const GLchar* const*,GLuint*); + void (WINE_GLAPI *p_glGetUniformIndices)(GLuint,GLsizei,const GLchar*const*,GLuint*); GLint (WINE_GLAPI *p_glGetUniformLocation)(GLuint,const GLchar*); GLint (WINE_GLAPI *p_glGetUniformLocationARB)(GLhandleARB,const GLcharARB*); GLintptr (WINE_GLAPI *p_glGetUniformOffsetEXT)(GLuint,GLint); @@ -1112,10 +1181,10 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetUniformdv)(GLuint,GLint,GLdouble*); void (WINE_GLAPI *p_glGetUniformfv)(GLuint,GLint,GLfloat*); void (WINE_GLAPI *p_glGetUniformfvARB)(GLhandleARB,GLint,GLfloat*); - void (WINE_GLAPI *p_glGetUniformi64vNV)(GLuint,GLint,INT64*); + void (WINE_GLAPI *p_glGetUniformi64vNV)(GLuint,GLint,GLint64EXT*); void (WINE_GLAPI *p_glGetUniformiv)(GLuint,GLint,GLint*); void (WINE_GLAPI *p_glGetUniformivARB)(GLhandleARB,GLint,GLint*); - void (WINE_GLAPI *p_glGetUniformui64vNV)(GLuint,GLint,UINT64*); + void (WINE_GLAPI *p_glGetUniformui64vNV)(GLuint,GLint,GLuint64EXT*); void (WINE_GLAPI *p_glGetUniformuiv)(GLuint,GLint,GLuint*); void (WINE_GLAPI *p_glGetUniformuivEXT)(GLuint,GLint,GLuint*); void (WINE_GLAPI *p_glGetVariantArrayObjectfvATI)(GLuint,GLenum,GLfloat*); @@ -1123,8 +1192,12 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetVariantBooleanvEXT)(GLuint,GLenum,GLboolean*); void (WINE_GLAPI *p_glGetVariantFloatvEXT)(GLuint,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetVariantIntegervEXT)(GLuint,GLenum,GLint*); - void (WINE_GLAPI *p_glGetVariantPointervEXT)(GLuint,GLenum,GLvoid**); + void (WINE_GLAPI *p_glGetVariantPointervEXT)(GLuint,GLenum,void**); GLint (WINE_GLAPI *p_glGetVaryingLocationNV)(GLuint,const GLchar*); + void (WINE_GLAPI *p_glGetVertexArrayIntegeri_vEXT)(GLuint,GLuint,GLenum,GLint*); + void (WINE_GLAPI *p_glGetVertexArrayIntegervEXT)(GLuint,GLenum,GLint*); + void (WINE_GLAPI *p_glGetVertexArrayPointeri_vEXT)(GLuint,GLuint,GLenum,void**); + void (WINE_GLAPI *p_glGetVertexArrayPointervEXT)(GLuint,GLenum,void**); void (WINE_GLAPI *p_glGetVertexAttribArrayObjectfvATI)(GLuint,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetVertexAttribArrayObjectivATI)(GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetVertexAttribIiv)(GLuint,GLenum,GLint*); @@ -1133,11 +1206,12 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetVertexAttribIuivEXT)(GLuint,GLenum,GLuint*); void (WINE_GLAPI *p_glGetVertexAttribLdv)(GLuint,GLenum,GLdouble*); void (WINE_GLAPI *p_glGetVertexAttribLdvEXT)(GLuint,GLenum,GLdouble*); - void (WINE_GLAPI *p_glGetVertexAttribLi64vNV)(GLuint,GLenum,INT64*); - void (WINE_GLAPI *p_glGetVertexAttribLui64vNV)(GLuint,GLenum,UINT64*); - void (WINE_GLAPI *p_glGetVertexAttribPointerv)(GLuint,GLenum,GLvoid**); - void (WINE_GLAPI *p_glGetVertexAttribPointervARB)(GLuint,GLenum,GLvoid**); - void (WINE_GLAPI *p_glGetVertexAttribPointervNV)(GLuint,GLenum,GLvoid**); + void (WINE_GLAPI *p_glGetVertexAttribLi64vNV)(GLuint,GLenum,GLint64EXT*); + void (WINE_GLAPI *p_glGetVertexAttribLui64vARB)(GLuint,GLenum,GLuint64EXT*); + void (WINE_GLAPI *p_glGetVertexAttribLui64vNV)(GLuint,GLenum,GLuint64EXT*); + void (WINE_GLAPI *p_glGetVertexAttribPointerv)(GLuint,GLenum,void**); + void (WINE_GLAPI *p_glGetVertexAttribPointervARB)(GLuint,GLenum,void**); + void (WINE_GLAPI *p_glGetVertexAttribPointervNV)(GLuint,GLenum,void**); void (WINE_GLAPI *p_glGetVertexAttribdv)(GLuint,GLenum,GLdouble*); void (WINE_GLAPI *p_glGetVertexAttribdvARB)(GLuint,GLenum,GLdouble*); void (WINE_GLAPI *p_glGetVertexAttribdvNV)(GLuint,GLenum,GLdouble*); @@ -1151,24 +1225,24 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetVideoCaptureStreamfvNV)(GLuint,GLuint,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetVideoCaptureStreamivNV)(GLuint,GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetVideoCaptureivNV)(GLuint,GLenum,GLint*); - void (WINE_GLAPI *p_glGetVideoi64vNV)(GLuint,GLenum,INT64*); + void (WINE_GLAPI *p_glGetVideoi64vNV)(GLuint,GLenum,GLint64EXT*); void (WINE_GLAPI *p_glGetVideoivNV)(GLuint,GLenum,GLint*); - void (WINE_GLAPI *p_glGetVideoui64vNV)(GLuint,GLenum,UINT64*); + void (WINE_GLAPI *p_glGetVideoui64vNV)(GLuint,GLenum,GLuint64EXT*); void (WINE_GLAPI *p_glGetVideouivNV)(GLuint,GLenum,GLuint*); - void (WINE_GLAPI *p_glGetnColorTableARB)(GLenum,GLenum,GLenum,GLsizei,GLvoid*); - void (WINE_GLAPI *p_glGetnCompressedTexImageARB)(GLenum,GLint,GLsizei,GLvoid*); - void (WINE_GLAPI *p_glGetnConvolutionFilterARB)(GLenum,GLenum,GLenum,GLsizei,GLvoid*); - void (WINE_GLAPI *p_glGetnHistogramARB)(GLenum,GLboolean,GLenum,GLenum,GLsizei,GLvoid*); + void (WINE_GLAPI *p_glGetnColorTableARB)(GLenum,GLenum,GLenum,GLsizei,void*); + void (WINE_GLAPI *p_glGetnCompressedTexImageARB)(GLenum,GLint,GLsizei,void*); + void (WINE_GLAPI *p_glGetnConvolutionFilterARB)(GLenum,GLenum,GLenum,GLsizei,void*); + void (WINE_GLAPI *p_glGetnHistogramARB)(GLenum,GLboolean,GLenum,GLenum,GLsizei,void*); void (WINE_GLAPI *p_glGetnMapdvARB)(GLenum,GLenum,GLsizei,GLdouble*); void (WINE_GLAPI *p_glGetnMapfvARB)(GLenum,GLenum,GLsizei,GLfloat*); void (WINE_GLAPI *p_glGetnMapivARB)(GLenum,GLenum,GLsizei,GLint*); - void (WINE_GLAPI *p_glGetnMinmaxARB)(GLenum,GLboolean,GLenum,GLenum,GLsizei,GLvoid*); + void (WINE_GLAPI *p_glGetnMinmaxARB)(GLenum,GLboolean,GLenum,GLenum,GLsizei,void*); void (WINE_GLAPI *p_glGetnPixelMapfvARB)(GLenum,GLsizei,GLfloat*); void (WINE_GLAPI *p_glGetnPixelMapuivARB)(GLenum,GLsizei,GLuint*); void (WINE_GLAPI *p_glGetnPixelMapusvARB)(GLenum,GLsizei,GLushort*); void (WINE_GLAPI *p_glGetnPolygonStippleARB)(GLsizei,GLubyte*); - void (WINE_GLAPI *p_glGetnSeparableFilterARB)(GLenum,GLenum,GLenum,GLsizei,GLvoid*,GLsizei,GLvoid*,GLvoid*); - void (WINE_GLAPI *p_glGetnTexImageARB)(GLenum,GLint,GLenum,GLenum,GLsizei,GLvoid*); + void (WINE_GLAPI *p_glGetnSeparableFilterARB)(GLenum,GLenum,GLenum,GLsizei,void*,GLsizei,void*,void*); + void (WINE_GLAPI *p_glGetnTexImageARB)(GLenum,GLint,GLenum,GLenum,GLsizei,void*); void (WINE_GLAPI *p_glGetnUniformdvARB)(GLuint,GLint,GLsizei,GLdouble*); void (WINE_GLAPI *p_glGetnUniformfvARB)(GLuint,GLint,GLsizei,GLfloat*); void (WINE_GLAPI *p_glGetnUniformivARB)(GLuint,GLint,GLsizei,GLint*); @@ -1184,18 +1258,21 @@ struct opengl_funcs void (WINE_GLAPI *p_glHintPGI)(GLenum,GLint); void (WINE_GLAPI *p_glHistogram)(GLenum,GLsizei,GLenum,GLboolean); void (WINE_GLAPI *p_glHistogramEXT)(GLenum,GLsizei,GLenum,GLboolean); - void (WINE_GLAPI *p_glIglooInterfaceSGIX)(GLenum,const GLvoid*); + void (WINE_GLAPI *p_glIglooInterfaceSGIX)(GLenum,const void*); void (WINE_GLAPI *p_glImageTransformParameterfHP)(GLenum,GLenum,GLfloat); void (WINE_GLAPI *p_glImageTransformParameterfvHP)(GLenum,GLenum,const GLfloat*); void (WINE_GLAPI *p_glImageTransformParameteriHP)(GLenum,GLenum,GLint); void (WINE_GLAPI *p_glImageTransformParameterivHP)(GLenum,GLenum,const GLint*); - GLvoid* (WINE_GLAPI *p_glImportSyncEXT)(GLenum,GLintptr,GLbitfield); + GLsync (WINE_GLAPI *p_glImportSyncEXT)(GLenum,GLintptr,GLbitfield); void (WINE_GLAPI *p_glIndexFormatNV)(GLenum,GLsizei); void (WINE_GLAPI *p_glIndexFuncEXT)(GLenum,GLclampf); void (WINE_GLAPI *p_glIndexMaterialEXT)(GLenum,GLenum); - void (WINE_GLAPI *p_glIndexPointerEXT)(GLenum,GLsizei,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glIndexPointerListIBM)(GLenum,GLint,const GLvoid**,GLint); + void (WINE_GLAPI *p_glIndexPointerEXT)(GLenum,GLsizei,GLsizei,const void*); + void (WINE_GLAPI *p_glIndexPointerListIBM)(GLenum,GLint,const void**,GLint); + void (WINE_GLAPI *p_glIndexxOES)(GLfixed); + void (WINE_GLAPI *p_glIndexxvOES)(const GLfixed*); void (WINE_GLAPI *p_glInsertComponentEXT)(GLuint,GLuint,GLuint); + void (WINE_GLAPI *p_glInsertEventMarkerEXT)(GLsizei,const GLchar*); void (WINE_GLAPI *p_glInstrumentsBufferSGIX)(GLsizei,GLint*); void (WINE_GLAPI *p_glInterpolatePathsNV)(GLuint,GLuint,GLuint,GLfloat); void (WINE_GLAPI *p_glInvalidateBufferData)(GLuint); @@ -1214,7 +1291,8 @@ struct opengl_funcs GLboolean (WINE_GLAPI *p_glIsFenceNV)(GLuint); GLboolean (WINE_GLAPI *p_glIsFramebuffer)(GLuint); GLboolean (WINE_GLAPI *p_glIsFramebufferEXT)(GLuint); - GLboolean (WINE_GLAPI *p_glIsImageHandleResidentNV)(UINT64); + GLboolean (WINE_GLAPI *p_glIsImageHandleResidentARB)(GLuint64); + GLboolean (WINE_GLAPI *p_glIsImageHandleResidentNV)(GLuint64); GLboolean (WINE_GLAPI *p_glIsNameAMD)(GLenum,GLuint); GLboolean (WINE_GLAPI *p_glIsNamedBufferResidentNV)(GLuint); GLboolean (WINE_GLAPI *p_glIsNamedStringARB)(GLint,const GLchar*); @@ -1233,16 +1311,23 @@ struct opengl_funcs GLboolean (WINE_GLAPI *p_glIsRenderbufferEXT)(GLuint); GLboolean (WINE_GLAPI *p_glIsSampler)(GLuint); GLboolean (WINE_GLAPI *p_glIsShader)(GLuint); - GLboolean (WINE_GLAPI *p_glIsSync)(GLvoid*); + GLboolean (WINE_GLAPI *p_glIsSync)(GLsync); GLboolean (WINE_GLAPI *p_glIsTextureEXT)(GLuint); - GLboolean (WINE_GLAPI *p_glIsTextureHandleResidentNV)(UINT64); + GLboolean (WINE_GLAPI *p_glIsTextureHandleResidentARB)(GLuint64); + GLboolean (WINE_GLAPI *p_glIsTextureHandleResidentNV)(GLuint64); GLboolean (WINE_GLAPI *p_glIsTransformFeedback)(GLuint); GLboolean (WINE_GLAPI *p_glIsTransformFeedbackNV)(GLuint); GLboolean (WINE_GLAPI *p_glIsVariantEnabledEXT)(GLuint,GLenum); GLboolean (WINE_GLAPI *p_glIsVertexArray)(GLuint); GLboolean (WINE_GLAPI *p_glIsVertexArrayAPPLE)(GLuint); GLboolean (WINE_GLAPI *p_glIsVertexAttribEnabledAPPLE)(GLuint,GLenum); + void (WINE_GLAPI *p_glLabelObjectEXT)(GLenum,GLuint,GLsizei,const GLchar*); void (WINE_GLAPI *p_glLightEnviSGIX)(GLenum,GLint); + void (WINE_GLAPI *p_glLightModelxOES)(GLenum,GLfixed); + void (WINE_GLAPI *p_glLightModelxvOES)(GLenum,const GLfixed*); + void (WINE_GLAPI *p_glLightxOES)(GLenum,GLenum,GLfixed); + void (WINE_GLAPI *p_glLightxvOES)(GLenum,GLenum,const GLfixed*); + void (WINE_GLAPI *p_glLineWidthxOES)(GLfixed); void (WINE_GLAPI *p_glLinkProgram)(GLuint); void (WINE_GLAPI *p_glLinkProgramARB)(GLhandleARB); void (WINE_GLAPI *p_glListParameterfSGIX)(GLuint,GLenum,GLfloat); @@ -1250,37 +1335,50 @@ struct opengl_funcs void (WINE_GLAPI *p_glListParameteriSGIX)(GLuint,GLenum,GLint); void (WINE_GLAPI *p_glListParameterivSGIX)(GLuint,GLenum,const GLint*); void (WINE_GLAPI *p_glLoadIdentityDeformationMapSGIX)(GLbitfield); + void (WINE_GLAPI *p_glLoadMatrixxOES)(const GLfixed*); void (WINE_GLAPI *p_glLoadProgramNV)(GLenum,GLuint,GLsizei,const GLubyte*); void (WINE_GLAPI *p_glLoadTransposeMatrixd)(const GLdouble*); void (WINE_GLAPI *p_glLoadTransposeMatrixdARB)(const GLdouble*); void (WINE_GLAPI *p_glLoadTransposeMatrixf)(const GLfloat*); void (WINE_GLAPI *p_glLoadTransposeMatrixfARB)(const GLfloat*); + void (WINE_GLAPI *p_glLoadTransposeMatrixxOES)(const GLfixed*); void (WINE_GLAPI *p_glLockArraysEXT)(GLint,GLsizei); void (WINE_GLAPI *p_glMTexCoord2fSGIS)(GLenum,GLfloat,GLfloat); void (WINE_GLAPI *p_glMTexCoord2fvSGIS)(GLenum,GLfloat *); void (WINE_GLAPI *p_glMakeBufferNonResidentNV)(GLenum); void (WINE_GLAPI *p_glMakeBufferResidentNV)(GLenum,GLenum); - void (WINE_GLAPI *p_glMakeImageHandleNonResidentNV)(UINT64); - void (WINE_GLAPI *p_glMakeImageHandleResidentNV)(UINT64,GLenum); + void (WINE_GLAPI *p_glMakeImageHandleNonResidentARB)(GLuint64); + void (WINE_GLAPI *p_glMakeImageHandleNonResidentNV)(GLuint64); + void (WINE_GLAPI *p_glMakeImageHandleResidentARB)(GLuint64,GLenum); + void (WINE_GLAPI *p_glMakeImageHandleResidentNV)(GLuint64,GLenum); void (WINE_GLAPI *p_glMakeNamedBufferNonResidentNV)(GLuint); void (WINE_GLAPI *p_glMakeNamedBufferResidentNV)(GLuint,GLenum); - void (WINE_GLAPI *p_glMakeTextureHandleNonResidentNV)(UINT64); - void (WINE_GLAPI *p_glMakeTextureHandleResidentNV)(UINT64); - GLvoid* (WINE_GLAPI *p_glMapBuffer)(GLenum,GLenum); - GLvoid* (WINE_GLAPI *p_glMapBufferARB)(GLenum,GLenum); - GLvoid* (WINE_GLAPI *p_glMapBufferRange)(GLenum,GLintptr,GLsizeiptr,GLbitfield); - void (WINE_GLAPI *p_glMapControlPointsNV)(GLenum,GLuint,GLenum,GLsizei,GLsizei,GLint,GLint,GLboolean,const GLvoid*); - GLvoid* (WINE_GLAPI *p_glMapNamedBufferEXT)(GLuint,GLenum); - GLvoid* (WINE_GLAPI *p_glMapNamedBufferRangeEXT)(GLuint,GLintptr,GLsizeiptr,GLbitfield); - GLvoid* (WINE_GLAPI *p_glMapObjectBufferATI)(GLuint); + void (WINE_GLAPI *p_glMakeTextureHandleNonResidentARB)(GLuint64); + void (WINE_GLAPI *p_glMakeTextureHandleNonResidentNV)(GLuint64); + void (WINE_GLAPI *p_glMakeTextureHandleResidentARB)(GLuint64); + void (WINE_GLAPI *p_glMakeTextureHandleResidentNV)(GLuint64); + void (WINE_GLAPI *p_glMap1xOES)(GLenum,GLfixed,GLfixed,GLint,GLint,GLfixed); + void (WINE_GLAPI *p_glMap2xOES)(GLenum,GLfixed,GLfixed,GLint,GLint,GLfixed,GLfixed,GLint,GLint,GLfixed); + void* (WINE_GLAPI *p_glMapBuffer)(GLenum,GLenum); + void* (WINE_GLAPI *p_glMapBufferARB)(GLenum,GLenum); + void* (WINE_GLAPI *p_glMapBufferRange)(GLenum,GLintptr,GLsizeiptr,GLbitfield); + void (WINE_GLAPI *p_glMapControlPointsNV)(GLenum,GLuint,GLenum,GLsizei,GLsizei,GLint,GLint,GLboolean,const void*); + void (WINE_GLAPI *p_glMapGrid1xOES)(GLint,GLfixed,GLfixed); + void (WINE_GLAPI *p_glMapGrid2xOES)(GLint,GLfixed,GLfixed,GLfixed,GLfixed); + void* (WINE_GLAPI *p_glMapNamedBufferEXT)(GLuint,GLenum); + void* (WINE_GLAPI *p_glMapNamedBufferRangeEXT)(GLuint,GLintptr,GLsizeiptr,GLbitfield); + void* (WINE_GLAPI *p_glMapObjectBufferATI)(GLuint); void (WINE_GLAPI *p_glMapParameterfvNV)(GLenum,GLenum,const GLfloat*); void (WINE_GLAPI *p_glMapParameterivNV)(GLenum,GLenum,const GLint*); + void* (WINE_GLAPI *p_glMapTexture2DINTEL)(GLuint,GLint,GLbitfield,GLint*,GLenum*); void (WINE_GLAPI *p_glMapVertexAttrib1dAPPLE)(GLuint,GLuint,GLdouble,GLdouble,GLint,GLint,const GLdouble*); void (WINE_GLAPI *p_glMapVertexAttrib1fAPPLE)(GLuint,GLuint,GLfloat,GLfloat,GLint,GLint,const GLfloat*); void (WINE_GLAPI *p_glMapVertexAttrib2dAPPLE)(GLuint,GLuint,GLdouble,GLdouble,GLint,GLint,GLdouble,GLdouble,GLint,GLint,const GLdouble*); void (WINE_GLAPI *p_glMapVertexAttrib2fAPPLE)(GLuint,GLuint,GLfloat,GLfloat,GLint,GLint,GLfloat,GLfloat,GLint,GLint,const GLfloat*); + void (WINE_GLAPI *p_glMaterialxOES)(GLenum,GLenum,GLfixed); + void (WINE_GLAPI *p_glMaterialxvOES)(GLenum,GLenum,const GLfixed*); void (WINE_GLAPI *p_glMatrixFrustumEXT)(GLenum,GLdouble,GLdouble,GLdouble,GLdouble,GLdouble,GLdouble); - void (WINE_GLAPI *p_glMatrixIndexPointerARB)(GLint,GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glMatrixIndexPointerARB)(GLint,GLenum,GLsizei,const void*); void (WINE_GLAPI *p_glMatrixIndexubvARB)(GLint,const GLubyte*); void (WINE_GLAPI *p_glMatrixIndexuivARB)(GLint,const GLuint*); void (WINE_GLAPI *p_glMatrixIndexusvARB)(GLint,const GLushort*); @@ -1308,24 +1406,32 @@ struct opengl_funcs void (WINE_GLAPI *p_glMinSampleShadingARB)(GLfloat); void (WINE_GLAPI *p_glMinmax)(GLenum,GLenum,GLboolean); void (WINE_GLAPI *p_glMinmaxEXT)(GLenum,GLenum,GLboolean); + void (WINE_GLAPI *p_glMultMatrixxOES)(const GLfixed*); void (WINE_GLAPI *p_glMultTransposeMatrixd)(const GLdouble*); void (WINE_GLAPI *p_glMultTransposeMatrixdARB)(const GLdouble*); void (WINE_GLAPI *p_glMultTransposeMatrixf)(const GLfloat*); void (WINE_GLAPI *p_glMultTransposeMatrixfARB)(const GLfloat*); + void (WINE_GLAPI *p_glMultTransposeMatrixxOES)(const GLfixed*); void (WINE_GLAPI *p_glMultiDrawArrays)(GLenum,const GLint*,const GLsizei*,GLsizei); void (WINE_GLAPI *p_glMultiDrawArraysEXT)(GLenum,const GLint*,const GLsizei*,GLsizei); void (WINE_GLAPI *p_glMultiDrawArraysIndirect)(GLenum,const void*,GLsizei,GLsizei); - void (WINE_GLAPI *p_glMultiDrawArraysIndirectAMD)(GLenum,const GLvoid*,GLsizei,GLsizei); + void (WINE_GLAPI *p_glMultiDrawArraysIndirectAMD)(GLenum,const void*,GLsizei,GLsizei); + void (WINE_GLAPI *p_glMultiDrawArraysIndirectBindlessNV)(GLenum,const void*,GLsizei,GLsizei,GLint); + void (WINE_GLAPI *p_glMultiDrawArraysIndirectCountARB)(GLenum,GLintptr,GLintptr,GLsizei,GLsizei); void (WINE_GLAPI *p_glMultiDrawElementArrayAPPLE)(GLenum,const GLint*,const GLsizei*,GLsizei); - void (WINE_GLAPI *p_glMultiDrawElements)(GLenum,const GLsizei*,GLenum,const GLvoid* const*,GLsizei); - void (WINE_GLAPI *p_glMultiDrawElementsBaseVertex)(GLenum,const GLsizei*,GLenum,const GLvoid* const*,GLsizei,const GLint*); - void (WINE_GLAPI *p_glMultiDrawElementsEXT)(GLenum,const GLsizei*,GLenum,const GLvoid**,GLsizei); + void (WINE_GLAPI *p_glMultiDrawElements)(GLenum,const GLsizei*,GLenum,const void*const*,GLsizei); + void (WINE_GLAPI *p_glMultiDrawElementsBaseVertex)(GLenum,const GLsizei*,GLenum,const void*const*,GLsizei,const GLint*); + void (WINE_GLAPI *p_glMultiDrawElementsEXT)(GLenum,const GLsizei*,GLenum,const void*const*,GLsizei); void (WINE_GLAPI *p_glMultiDrawElementsIndirect)(GLenum,GLenum,const void*,GLsizei,GLsizei); - void (WINE_GLAPI *p_glMultiDrawElementsIndirectAMD)(GLenum,GLenum,const GLvoid*,GLsizei,GLsizei); + void (WINE_GLAPI *p_glMultiDrawElementsIndirectAMD)(GLenum,GLenum,const void*,GLsizei,GLsizei); + void (WINE_GLAPI *p_glMultiDrawElementsIndirectBindlessNV)(GLenum,GLenum,const void*,GLsizei,GLsizei,GLint); + void (WINE_GLAPI *p_glMultiDrawElementsIndirectCountARB)(GLenum,GLenum,GLintptr,GLintptr,GLsizei,GLsizei); void (WINE_GLAPI *p_glMultiDrawRangeElementArrayAPPLE)(GLenum,GLuint,GLuint,const GLint*,const GLsizei*,GLsizei); void (WINE_GLAPI *p_glMultiModeDrawArraysIBM)(const GLenum*,const GLint*,const GLsizei*,GLsizei,GLint); - void (WINE_GLAPI *p_glMultiModeDrawElementsIBM)(const GLenum*,const GLsizei*,GLenum,const GLvoid* const*,GLsizei,GLint); + void (WINE_GLAPI *p_glMultiModeDrawElementsIBM)(const GLenum*,const GLsizei*,GLenum,const void*const*,GLsizei,GLint); void (WINE_GLAPI *p_glMultiTexBufferEXT)(GLenum,GLenum,GLenum,GLuint); + void (WINE_GLAPI *p_glMultiTexCoord1bOES)(GLenum,GLbyte); + void (WINE_GLAPI *p_glMultiTexCoord1bvOES)(GLenum,const GLbyte*); void (WINE_GLAPI *p_glMultiTexCoord1d)(GLenum,GLdouble); void (WINE_GLAPI *p_glMultiTexCoord1dARB)(GLenum,GLdouble); void (WINE_GLAPI *p_glMultiTexCoord1dSGIS)(GLenum,GLdouble); @@ -1352,6 +1458,10 @@ struct opengl_funcs void (WINE_GLAPI *p_glMultiTexCoord1sv)(GLenum,const GLshort*); void (WINE_GLAPI *p_glMultiTexCoord1svARB)(GLenum,const GLshort*); void (WINE_GLAPI *p_glMultiTexCoord1svSGIS)(GLenum,GLshort *); + void (WINE_GLAPI *p_glMultiTexCoord1xOES)(GLenum,GLfixed); + void (WINE_GLAPI *p_glMultiTexCoord1xvOES)(GLenum,const GLfixed*); + void (WINE_GLAPI *p_glMultiTexCoord2bOES)(GLenum,GLbyte,GLbyte); + void (WINE_GLAPI *p_glMultiTexCoord2bvOES)(GLenum,const GLbyte*); void (WINE_GLAPI *p_glMultiTexCoord2d)(GLenum,GLdouble,GLdouble); void (WINE_GLAPI *p_glMultiTexCoord2dARB)(GLenum,GLdouble,GLdouble); void (WINE_GLAPI *p_glMultiTexCoord2dSGIS)(GLenum,GLdouble,GLdouble); @@ -1378,6 +1488,10 @@ struct opengl_funcs void (WINE_GLAPI *p_glMultiTexCoord2sv)(GLenum,const GLshort*); void (WINE_GLAPI *p_glMultiTexCoord2svARB)(GLenum,const GLshort*); void (WINE_GLAPI *p_glMultiTexCoord2svSGIS)(GLenum,GLshort *); + void (WINE_GLAPI *p_glMultiTexCoord2xOES)(GLenum,GLfixed,GLfixed); + void (WINE_GLAPI *p_glMultiTexCoord2xvOES)(GLenum,const GLfixed*); + void (WINE_GLAPI *p_glMultiTexCoord3bOES)(GLenum,GLbyte,GLbyte,GLbyte); + void (WINE_GLAPI *p_glMultiTexCoord3bvOES)(GLenum,const GLbyte*); void (WINE_GLAPI *p_glMultiTexCoord3d)(GLenum,GLdouble,GLdouble,GLdouble); void (WINE_GLAPI *p_glMultiTexCoord3dARB)(GLenum,GLdouble,GLdouble,GLdouble); void (WINE_GLAPI *p_glMultiTexCoord3dSGIS)(GLenum,GLdouble,GLdouble,GLdouble); @@ -1404,6 +1518,10 @@ struct opengl_funcs void (WINE_GLAPI *p_glMultiTexCoord3sv)(GLenum,const GLshort*); void (WINE_GLAPI *p_glMultiTexCoord3svARB)(GLenum,const GLshort*); void (WINE_GLAPI *p_glMultiTexCoord3svSGIS)(GLenum,GLshort *); + void (WINE_GLAPI *p_glMultiTexCoord3xOES)(GLenum,GLfixed,GLfixed,GLfixed); + void (WINE_GLAPI *p_glMultiTexCoord3xvOES)(GLenum,const GLfixed*); + void (WINE_GLAPI *p_glMultiTexCoord4bOES)(GLenum,GLbyte,GLbyte,GLbyte,GLbyte); + void (WINE_GLAPI *p_glMultiTexCoord4bvOES)(GLenum,const GLbyte*); void (WINE_GLAPI *p_glMultiTexCoord4d)(GLenum,GLdouble,GLdouble,GLdouble,GLdouble); void (WINE_GLAPI *p_glMultiTexCoord4dARB)(GLenum,GLdouble,GLdouble,GLdouble,GLdouble); void (WINE_GLAPI *p_glMultiTexCoord4dSGIS)(GLenum,GLdouble,GLdouble,GLdouble,GLdouble); @@ -1430,6 +1548,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glMultiTexCoord4sv)(GLenum,const GLshort*); void (WINE_GLAPI *p_glMultiTexCoord4svARB)(GLenum,const GLshort*); void (WINE_GLAPI *p_glMultiTexCoord4svSGIS)(GLenum,GLshort *); + void (WINE_GLAPI *p_glMultiTexCoord4xOES)(GLenum,GLfixed,GLfixed,GLfixed,GLfixed); + void (WINE_GLAPI *p_glMultiTexCoord4xvOES)(GLenum,const GLfixed*); void (WINE_GLAPI *p_glMultiTexCoordP1ui)(GLenum,GLenum,GLuint); void (WINE_GLAPI *p_glMultiTexCoordP1uiv)(GLenum,GLenum,const GLuint*); void (WINE_GLAPI *p_glMultiTexCoordP2ui)(GLenum,GLenum,GLuint); @@ -1438,7 +1558,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glMultiTexCoordP3uiv)(GLenum,GLenum,const GLuint*); void (WINE_GLAPI *p_glMultiTexCoordP4ui)(GLenum,GLenum,GLuint); void (WINE_GLAPI *p_glMultiTexCoordP4uiv)(GLenum,GLenum,const GLuint*); - void (WINE_GLAPI *p_glMultiTexCoordPointerEXT)(GLenum,GLint,GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glMultiTexCoordPointerEXT)(GLenum,GLint,GLenum,GLsizei,const void*); void (WINE_GLAPI *p_glMultiTexCoordPointerSGIS)(GLenum,GLint,GLenum,GLsizei,GLvoid *); void (WINE_GLAPI *p_glMultiTexEnvfEXT)(GLenum,GLenum,GLenum,GLfloat); void (WINE_GLAPI *p_glMultiTexEnvfvEXT)(GLenum,GLenum,GLenum,const GLfloat*); @@ -1450,9 +1570,9 @@ struct opengl_funcs void (WINE_GLAPI *p_glMultiTexGenfvEXT)(GLenum,GLenum,GLenum,const GLfloat*); void (WINE_GLAPI *p_glMultiTexGeniEXT)(GLenum,GLenum,GLenum,GLint); void (WINE_GLAPI *p_glMultiTexGenivEXT)(GLenum,GLenum,GLenum,const GLint*); - void (WINE_GLAPI *p_glMultiTexImage1DEXT)(GLenum,GLenum,GLint,GLenum,GLsizei,GLint,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glMultiTexImage2DEXT)(GLenum,GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glMultiTexImage3DEXT)(GLenum,GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLenum,GLenum,const GLvoid*); + void (WINE_GLAPI *p_glMultiTexImage1DEXT)(GLenum,GLenum,GLint,GLint,GLsizei,GLint,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glMultiTexImage2DEXT)(GLenum,GLenum,GLint,GLint,GLsizei,GLsizei,GLint,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glMultiTexImage3DEXT)(GLenum,GLenum,GLint,GLint,GLsizei,GLsizei,GLsizei,GLint,GLenum,GLenum,const void*); void (WINE_GLAPI *p_glMultiTexParameterIivEXT)(GLenum,GLenum,GLenum,const GLint*); void (WINE_GLAPI *p_glMultiTexParameterIuivEXT)(GLenum,GLenum,GLenum,const GLuint*); void (WINE_GLAPI *p_glMultiTexParameterfEXT)(GLenum,GLenum,GLenum,GLfloat); @@ -1460,11 +1580,12 @@ struct opengl_funcs void (WINE_GLAPI *p_glMultiTexParameteriEXT)(GLenum,GLenum,GLenum,GLint); void (WINE_GLAPI *p_glMultiTexParameterivEXT)(GLenum,GLenum,GLenum,const GLint*); void (WINE_GLAPI *p_glMultiTexRenderbufferEXT)(GLenum,GLenum,GLuint); - void (WINE_GLAPI *p_glMultiTexSubImage1DEXT)(GLenum,GLenum,GLint,GLint,GLsizei,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glMultiTexSubImage2DEXT)(GLenum,GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glMultiTexSubImage3DEXT)(GLenum,GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glNamedBufferDataEXT)(GLuint,GLsizeiptr,const GLvoid*,GLenum); - void (WINE_GLAPI *p_glNamedBufferSubDataEXT)(GLuint,GLintptr,GLsizeiptr,const GLvoid*); + void (WINE_GLAPI *p_glMultiTexSubImage1DEXT)(GLenum,GLenum,GLint,GLint,GLsizei,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glMultiTexSubImage2DEXT)(GLenum,GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glMultiTexSubImage3DEXT)(GLenum,GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glNamedBufferDataEXT)(GLuint,GLsizeiptr,const void*,GLenum); + void (WINE_GLAPI *p_glNamedBufferStorageEXT)(GLuint,GLsizeiptr,const void*,GLbitfield); + void (WINE_GLAPI *p_glNamedBufferSubDataEXT)(GLuint,GLintptr,GLsizeiptr,const void*); void (WINE_GLAPI *p_glNamedCopyBufferSubDataEXT)(GLuint,GLuint,GLintptr,GLintptr,GLsizeiptr); void (WINE_GLAPI *p_glNamedFramebufferParameteriEXT)(GLuint,GLenum,GLint); void (WINE_GLAPI *p_glNamedFramebufferRenderbufferEXT)(GLuint,GLenum,GLenum,GLuint); @@ -1485,23 +1606,25 @@ struct opengl_funcs void (WINE_GLAPI *p_glNamedProgramLocalParameters4fvEXT)(GLuint,GLenum,GLuint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glNamedProgramLocalParametersI4ivEXT)(GLuint,GLenum,GLuint,GLsizei,const GLint*); void (WINE_GLAPI *p_glNamedProgramLocalParametersI4uivEXT)(GLuint,GLenum,GLuint,GLsizei,const GLuint*); - void (WINE_GLAPI *p_glNamedProgramStringEXT)(GLuint,GLenum,GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glNamedProgramStringEXT)(GLuint,GLenum,GLenum,GLsizei,const void*); void (WINE_GLAPI *p_glNamedRenderbufferStorageEXT)(GLuint,GLenum,GLsizei,GLsizei); void (WINE_GLAPI *p_glNamedRenderbufferStorageMultisampleCoverageEXT)(GLuint,GLsizei,GLsizei,GLenum,GLsizei,GLsizei); void (WINE_GLAPI *p_glNamedRenderbufferStorageMultisampleEXT)(GLuint,GLsizei,GLenum,GLsizei,GLsizei); void (WINE_GLAPI *p_glNamedStringARB)(GLenum,GLint,const GLchar*,GLint,const GLchar*); GLuint (WINE_GLAPI *p_glNewBufferRegion)(GLenum); - GLuint (WINE_GLAPI *p_glNewObjectBufferATI)(GLsizei,const GLvoid*,GLenum); + GLuint (WINE_GLAPI *p_glNewObjectBufferATI)(GLsizei,const void*,GLenum); void (WINE_GLAPI *p_glNormal3fVertex3fSUN)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glNormal3fVertex3fvSUN)(const GLfloat*,const GLfloat*); void (WINE_GLAPI *p_glNormal3hNV)(GLhalfNV,GLhalfNV,GLhalfNV); void (WINE_GLAPI *p_glNormal3hvNV)(const GLhalfNV*); + void (WINE_GLAPI *p_glNormal3xOES)(GLfixed,GLfixed,GLfixed); + void (WINE_GLAPI *p_glNormal3xvOES)(const GLfixed*); void (WINE_GLAPI *p_glNormalFormatNV)(GLenum,GLsizei); void (WINE_GLAPI *p_glNormalP3ui)(GLenum,GLuint); void (WINE_GLAPI *p_glNormalP3uiv)(GLenum,const GLuint*); - void (WINE_GLAPI *p_glNormalPointerEXT)(GLenum,GLsizei,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glNormalPointerListIBM)(GLenum,GLint,const GLvoid**,GLint); - void (WINE_GLAPI *p_glNormalPointervINTEL)(GLenum,const GLvoid**); + void (WINE_GLAPI *p_glNormalPointerEXT)(GLenum,GLsizei,GLsizei,const void*); + void (WINE_GLAPI *p_glNormalPointerListIBM)(GLenum,GLint,const void**,GLint); + void (WINE_GLAPI *p_glNormalPointervINTEL)(GLenum,const void**); void (WINE_GLAPI *p_glNormalStream3bATI)(GLenum,GLbyte,GLbyte,GLbyte); void (WINE_GLAPI *p_glNormalStream3bvATI)(GLenum,const GLbyte*); void (WINE_GLAPI *p_glNormalStream3dATI)(GLenum,GLdouble,GLdouble,GLdouble); @@ -1516,41 +1639,48 @@ struct opengl_funcs void (WINE_GLAPI *p_glObjectPtrLabel)(const void*,GLsizei,const GLchar*); GLenum (WINE_GLAPI *p_glObjectPurgeableAPPLE)(GLenum,GLuint,GLenum); GLenum (WINE_GLAPI *p_glObjectUnpurgeableAPPLE)(GLenum,GLuint,GLenum); + void (WINE_GLAPI *p_glOrthofOES)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); + void (WINE_GLAPI *p_glOrthoxOES)(GLfixed,GLfixed,GLfixed,GLfixed,GLfixed,GLfixed); void (WINE_GLAPI *p_glPNTrianglesfATI)(GLenum,GLfloat); void (WINE_GLAPI *p_glPNTrianglesiATI)(GLenum,GLint); void (WINE_GLAPI *p_glPassTexCoordATI)(GLuint,GLuint,GLenum); + void (WINE_GLAPI *p_glPassThroughxOES)(GLfixed); void (WINE_GLAPI *p_glPatchParameterfv)(GLenum,const GLfloat*); void (WINE_GLAPI *p_glPatchParameteri)(GLenum,GLint); void (WINE_GLAPI *p_glPathColorGenNV)(GLenum,GLenum,GLenum,const GLfloat*); - void (WINE_GLAPI *p_glPathCommandsNV)(GLuint,GLsizei,const GLubyte*,GLsizei,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glPathCoordsNV)(GLuint,GLsizei,GLenum,const GLvoid*); + void (WINE_GLAPI *p_glPathCommandsNV)(GLuint,GLsizei,const GLubyte*,GLsizei,GLenum,const void*); + void (WINE_GLAPI *p_glPathCoordsNV)(GLuint,GLsizei,GLenum,const void*); void (WINE_GLAPI *p_glPathCoverDepthFuncNV)(GLenum); void (WINE_GLAPI *p_glPathDashArrayNV)(GLuint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glPathFogGenNV)(GLenum); - void (WINE_GLAPI *p_glPathGlyphRangeNV)(GLuint,GLenum,const GLvoid*,GLbitfield,GLuint,GLsizei,GLenum,GLuint,GLfloat); - void (WINE_GLAPI *p_glPathGlyphsNV)(GLuint,GLenum,const GLvoid*,GLbitfield,GLsizei,GLenum,const GLvoid*,GLenum,GLuint,GLfloat); + void (WINE_GLAPI *p_glPathGlyphRangeNV)(GLuint,GLenum,const void*,GLbitfield,GLuint,GLsizei,GLenum,GLuint,GLfloat); + void (WINE_GLAPI *p_glPathGlyphsNV)(GLuint,GLenum,const void*,GLbitfield,GLsizei,GLenum,const void*,GLenum,GLuint,GLfloat); void (WINE_GLAPI *p_glPathParameterfNV)(GLuint,GLenum,GLfloat); void (WINE_GLAPI *p_glPathParameterfvNV)(GLuint,GLenum,const GLfloat*); void (WINE_GLAPI *p_glPathParameteriNV)(GLuint,GLenum,GLint); void (WINE_GLAPI *p_glPathParameterivNV)(GLuint,GLenum,const GLint*); void (WINE_GLAPI *p_glPathStencilDepthOffsetNV)(GLfloat,GLfloat); void (WINE_GLAPI *p_glPathStencilFuncNV)(GLenum,GLint,GLuint); - void (WINE_GLAPI *p_glPathStringNV)(GLuint,GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glPathSubCommandsNV)(GLuint,GLsizei,GLsizei,GLsizei,const GLubyte*,GLsizei,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glPathSubCoordsNV)(GLuint,GLsizei,GLsizei,GLenum,const GLvoid*); + void (WINE_GLAPI *p_glPathStringNV)(GLuint,GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glPathSubCommandsNV)(GLuint,GLsizei,GLsizei,GLsizei,const GLubyte*,GLsizei,GLenum,const void*); + void (WINE_GLAPI *p_glPathSubCoordsNV)(GLuint,GLsizei,GLsizei,GLenum,const void*); void (WINE_GLAPI *p_glPathTexGenNV)(GLenum,GLenum,GLint,const GLfloat*); void (WINE_GLAPI *p_glPauseTransformFeedback)(void); void (WINE_GLAPI *p_glPauseTransformFeedbackNV)(void); - void (WINE_GLAPI *p_glPixelDataRangeNV)(GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glPixelDataRangeNV)(GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glPixelMapx)(GLenum,GLint,const GLfixed*); + void (WINE_GLAPI *p_glPixelStorex)(GLenum,GLfixed); void (WINE_GLAPI *p_glPixelTexGenParameterfSGIS)(GLenum,GLfloat); void (WINE_GLAPI *p_glPixelTexGenParameterfvSGIS)(GLenum,const GLfloat*); void (WINE_GLAPI *p_glPixelTexGenParameteriSGIS)(GLenum,GLint); void (WINE_GLAPI *p_glPixelTexGenParameterivSGIS)(GLenum,const GLint*); void (WINE_GLAPI *p_glPixelTexGenSGIX)(GLenum); + void (WINE_GLAPI *p_glPixelTransferxOES)(GLenum,GLfixed); void (WINE_GLAPI *p_glPixelTransformParameterfEXT)(GLenum,GLenum,GLfloat); void (WINE_GLAPI *p_glPixelTransformParameterfvEXT)(GLenum,GLenum,const GLfloat*); void (WINE_GLAPI *p_glPixelTransformParameteriEXT)(GLenum,GLenum,GLint); void (WINE_GLAPI *p_glPixelTransformParameterivEXT)(GLenum,GLenum,const GLint*); + void (WINE_GLAPI *p_glPixelZoomxOES)(GLfixed,GLfixed); GLboolean (WINE_GLAPI *p_glPointAlongPathNV)(GLuint,GLsizei,GLsizei,GLfloat,GLfloat*,GLfloat*,GLfloat*,GLfloat*); void (WINE_GLAPI *p_glPointParameterf)(GLenum,GLfloat); void (WINE_GLAPI *p_glPointParameterfARB)(GLenum,GLfloat); @@ -1564,17 +1694,22 @@ struct opengl_funcs void (WINE_GLAPI *p_glPointParameteriNV)(GLenum,GLint); void (WINE_GLAPI *p_glPointParameteriv)(GLenum,const GLint*); void (WINE_GLAPI *p_glPointParameterivNV)(GLenum,const GLint*); + void (WINE_GLAPI *p_glPointParameterxvOES)(GLenum,const GLfixed*); + void (WINE_GLAPI *p_glPointSizexOES)(GLfixed); GLint (WINE_GLAPI *p_glPollAsyncSGIX)(GLuint*); GLint (WINE_GLAPI *p_glPollInstrumentsSGIX)(GLint*); void (WINE_GLAPI *p_glPolygonOffsetEXT)(GLfloat,GLfloat); + void (WINE_GLAPI *p_glPolygonOffsetxOES)(GLfixed,GLfixed); void (WINE_GLAPI *p_glPopDebugGroup)(void); - void (WINE_GLAPI *p_glPresentFrameDualFillNV)(GLuint,UINT64,GLuint,GLuint,GLenum,GLenum,GLuint,GLenum,GLuint,GLenum,GLuint,GLenum,GLuint); - void (WINE_GLAPI *p_glPresentFrameKeyedNV)(GLuint,UINT64,GLuint,GLuint,GLenum,GLenum,GLuint,GLuint,GLenum,GLuint,GLuint); + void (WINE_GLAPI *p_glPopGroupMarkerEXT)(void); + void (WINE_GLAPI *p_glPresentFrameDualFillNV)(GLuint,GLuint64EXT,GLuint,GLuint,GLenum,GLenum,GLuint,GLenum,GLuint,GLenum,GLuint,GLenum,GLuint); + void (WINE_GLAPI *p_glPresentFrameKeyedNV)(GLuint,GLuint64EXT,GLuint,GLuint,GLenum,GLenum,GLuint,GLuint,GLenum,GLuint,GLuint); void (WINE_GLAPI *p_glPrimitiveRestartIndex)(GLuint); void (WINE_GLAPI *p_glPrimitiveRestartIndexNV)(GLuint); void (WINE_GLAPI *p_glPrimitiveRestartNV)(void); void (WINE_GLAPI *p_glPrioritizeTexturesEXT)(GLsizei,const GLuint*,const GLclampf*); - void (WINE_GLAPI *p_glProgramBinary)(GLuint,GLenum,const GLvoid*,GLsizei); + void (WINE_GLAPI *p_glPrioritizeTexturesxOES)(GLsizei,const GLuint*,const GLfixed*); + void (WINE_GLAPI *p_glProgramBinary)(GLuint,GLenum,const void*,GLsizei); void (WINE_GLAPI *p_glProgramBufferParametersIivNV)(GLenum,GLuint,GLuint,GLsizei,const GLint*); void (WINE_GLAPI *p_glProgramBufferParametersIuivNV)(GLenum,GLuint,GLuint,GLsizei,const GLuint*); void (WINE_GLAPI *p_glProgramBufferParametersfvNV)(GLenum,GLuint,GLuint,GLsizei,const GLfloat*); @@ -1613,7 +1748,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glProgramParameteriEXT)(GLuint,GLenum,GLint); void (WINE_GLAPI *p_glProgramParameters4dvNV)(GLenum,GLuint,GLsizei,const GLdouble*); void (WINE_GLAPI *p_glProgramParameters4fvNV)(GLenum,GLuint,GLsizei,const GLfloat*); - void (WINE_GLAPI *p_glProgramStringARB)(GLenum,GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glProgramStringARB)(GLenum,GLenum,GLsizei,const void*); void (WINE_GLAPI *p_glProgramSubroutineParametersuivNV)(GLenum,GLsizei,const GLuint*); void (WINE_GLAPI *p_glProgramUniform1d)(GLuint,GLint,GLdouble); void (WINE_GLAPI *p_glProgramUniform1dEXT)(GLuint,GLint,GLdouble); @@ -1624,14 +1759,14 @@ struct opengl_funcs void (WINE_GLAPI *p_glProgramUniform1fv)(GLuint,GLint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glProgramUniform1fvEXT)(GLuint,GLint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glProgramUniform1i)(GLuint,GLint,GLint); - void (WINE_GLAPI *p_glProgramUniform1i64NV)(GLuint,GLint,INT64); - void (WINE_GLAPI *p_glProgramUniform1i64vNV)(GLuint,GLint,GLsizei,const INT64*); + void (WINE_GLAPI *p_glProgramUniform1i64NV)(GLuint,GLint,GLint64EXT); + void (WINE_GLAPI *p_glProgramUniform1i64vNV)(GLuint,GLint,GLsizei,const GLint64EXT*); void (WINE_GLAPI *p_glProgramUniform1iEXT)(GLuint,GLint,GLint); void (WINE_GLAPI *p_glProgramUniform1iv)(GLuint,GLint,GLsizei,const GLint*); void (WINE_GLAPI *p_glProgramUniform1ivEXT)(GLuint,GLint,GLsizei,const GLint*); void (WINE_GLAPI *p_glProgramUniform1ui)(GLuint,GLint,GLuint); - void (WINE_GLAPI *p_glProgramUniform1ui64NV)(GLuint,GLint,UINT64); - void (WINE_GLAPI *p_glProgramUniform1ui64vNV)(GLuint,GLint,GLsizei,const UINT64*); + void (WINE_GLAPI *p_glProgramUniform1ui64NV)(GLuint,GLint,GLuint64EXT); + void (WINE_GLAPI *p_glProgramUniform1ui64vNV)(GLuint,GLint,GLsizei,const GLuint64EXT*); void (WINE_GLAPI *p_glProgramUniform1uiEXT)(GLuint,GLint,GLuint); void (WINE_GLAPI *p_glProgramUniform1uiv)(GLuint,GLint,GLsizei,const GLuint*); void (WINE_GLAPI *p_glProgramUniform1uivEXT)(GLuint,GLint,GLsizei,const GLuint*); @@ -1644,14 +1779,14 @@ struct opengl_funcs void (WINE_GLAPI *p_glProgramUniform2fv)(GLuint,GLint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glProgramUniform2fvEXT)(GLuint,GLint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glProgramUniform2i)(GLuint,GLint,GLint,GLint); - void (WINE_GLAPI *p_glProgramUniform2i64NV)(GLuint,GLint,INT64,INT64); - void (WINE_GLAPI *p_glProgramUniform2i64vNV)(GLuint,GLint,GLsizei,const INT64*); + void (WINE_GLAPI *p_glProgramUniform2i64NV)(GLuint,GLint,GLint64EXT,GLint64EXT); + void (WINE_GLAPI *p_glProgramUniform2i64vNV)(GLuint,GLint,GLsizei,const GLint64EXT*); void (WINE_GLAPI *p_glProgramUniform2iEXT)(GLuint,GLint,GLint,GLint); void (WINE_GLAPI *p_glProgramUniform2iv)(GLuint,GLint,GLsizei,const GLint*); void (WINE_GLAPI *p_glProgramUniform2ivEXT)(GLuint,GLint,GLsizei,const GLint*); void (WINE_GLAPI *p_glProgramUniform2ui)(GLuint,GLint,GLuint,GLuint); - void (WINE_GLAPI *p_glProgramUniform2ui64NV)(GLuint,GLint,UINT64,UINT64); - void (WINE_GLAPI *p_glProgramUniform2ui64vNV)(GLuint,GLint,GLsizei,const UINT64*); + void (WINE_GLAPI *p_glProgramUniform2ui64NV)(GLuint,GLint,GLuint64EXT,GLuint64EXT); + void (WINE_GLAPI *p_glProgramUniform2ui64vNV)(GLuint,GLint,GLsizei,const GLuint64EXT*); void (WINE_GLAPI *p_glProgramUniform2uiEXT)(GLuint,GLint,GLuint,GLuint); void (WINE_GLAPI *p_glProgramUniform2uiv)(GLuint,GLint,GLsizei,const GLuint*); void (WINE_GLAPI *p_glProgramUniform2uivEXT)(GLuint,GLint,GLsizei,const GLuint*); @@ -1664,14 +1799,14 @@ struct opengl_funcs void (WINE_GLAPI *p_glProgramUniform3fv)(GLuint,GLint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glProgramUniform3fvEXT)(GLuint,GLint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glProgramUniform3i)(GLuint,GLint,GLint,GLint,GLint); - void (WINE_GLAPI *p_glProgramUniform3i64NV)(GLuint,GLint,INT64,INT64,INT64); - void (WINE_GLAPI *p_glProgramUniform3i64vNV)(GLuint,GLint,GLsizei,const INT64*); + void (WINE_GLAPI *p_glProgramUniform3i64NV)(GLuint,GLint,GLint64EXT,GLint64EXT,GLint64EXT); + void (WINE_GLAPI *p_glProgramUniform3i64vNV)(GLuint,GLint,GLsizei,const GLint64EXT*); void (WINE_GLAPI *p_glProgramUniform3iEXT)(GLuint,GLint,GLint,GLint,GLint); void (WINE_GLAPI *p_glProgramUniform3iv)(GLuint,GLint,GLsizei,const GLint*); void (WINE_GLAPI *p_glProgramUniform3ivEXT)(GLuint,GLint,GLsizei,const GLint*); void (WINE_GLAPI *p_glProgramUniform3ui)(GLuint,GLint,GLuint,GLuint,GLuint); - void (WINE_GLAPI *p_glProgramUniform3ui64NV)(GLuint,GLint,UINT64,UINT64,UINT64); - void (WINE_GLAPI *p_glProgramUniform3ui64vNV)(GLuint,GLint,GLsizei,const UINT64*); + void (WINE_GLAPI *p_glProgramUniform3ui64NV)(GLuint,GLint,GLuint64EXT,GLuint64EXT,GLuint64EXT); + void (WINE_GLAPI *p_glProgramUniform3ui64vNV)(GLuint,GLint,GLsizei,const GLuint64EXT*); void (WINE_GLAPI *p_glProgramUniform3uiEXT)(GLuint,GLint,GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glProgramUniform3uiv)(GLuint,GLint,GLsizei,const GLuint*); void (WINE_GLAPI *p_glProgramUniform3uivEXT)(GLuint,GLint,GLsizei,const GLuint*); @@ -1684,19 +1819,21 @@ struct opengl_funcs void (WINE_GLAPI *p_glProgramUniform4fv)(GLuint,GLint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glProgramUniform4fvEXT)(GLuint,GLint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glProgramUniform4i)(GLuint,GLint,GLint,GLint,GLint,GLint); - void (WINE_GLAPI *p_glProgramUniform4i64NV)(GLuint,GLint,INT64,INT64,INT64,INT64); - void (WINE_GLAPI *p_glProgramUniform4i64vNV)(GLuint,GLint,GLsizei,const INT64*); + void (WINE_GLAPI *p_glProgramUniform4i64NV)(GLuint,GLint,GLint64EXT,GLint64EXT,GLint64EXT,GLint64EXT); + void (WINE_GLAPI *p_glProgramUniform4i64vNV)(GLuint,GLint,GLsizei,const GLint64EXT*); void (WINE_GLAPI *p_glProgramUniform4iEXT)(GLuint,GLint,GLint,GLint,GLint,GLint); void (WINE_GLAPI *p_glProgramUniform4iv)(GLuint,GLint,GLsizei,const GLint*); void (WINE_GLAPI *p_glProgramUniform4ivEXT)(GLuint,GLint,GLsizei,const GLint*); void (WINE_GLAPI *p_glProgramUniform4ui)(GLuint,GLint,GLuint,GLuint,GLuint,GLuint); - void (WINE_GLAPI *p_glProgramUniform4ui64NV)(GLuint,GLint,UINT64,UINT64,UINT64,UINT64); - void (WINE_GLAPI *p_glProgramUniform4ui64vNV)(GLuint,GLint,GLsizei,const UINT64*); + void (WINE_GLAPI *p_glProgramUniform4ui64NV)(GLuint,GLint,GLuint64EXT,GLuint64EXT,GLuint64EXT,GLuint64EXT); + void (WINE_GLAPI *p_glProgramUniform4ui64vNV)(GLuint,GLint,GLsizei,const GLuint64EXT*); void (WINE_GLAPI *p_glProgramUniform4uiEXT)(GLuint,GLint,GLuint,GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glProgramUniform4uiv)(GLuint,GLint,GLsizei,const GLuint*); void (WINE_GLAPI *p_glProgramUniform4uivEXT)(GLuint,GLint,GLsizei,const GLuint*); - void (WINE_GLAPI *p_glProgramUniformHandleui64NV)(GLuint,GLint,UINT64); - void (WINE_GLAPI *p_glProgramUniformHandleui64vNV)(GLuint,GLint,GLsizei,const UINT64*); + void (WINE_GLAPI *p_glProgramUniformHandleui64ARB)(GLuint,GLint,GLuint64); + void (WINE_GLAPI *p_glProgramUniformHandleui64NV)(GLuint,GLint,GLuint64); + void (WINE_GLAPI *p_glProgramUniformHandleui64vARB)(GLuint,GLint,GLsizei,const GLuint64*); + void (WINE_GLAPI *p_glProgramUniformHandleui64vNV)(GLuint,GLint,GLsizei,const GLuint64*); void (WINE_GLAPI *p_glProgramUniformMatrix2dv)(GLuint,GLint,GLsizei,GLboolean,const GLdouble*); void (WINE_GLAPI *p_glProgramUniformMatrix2dvEXT)(GLuint,GLint,GLsizei,GLboolean,const GLdouble*); void (WINE_GLAPI *p_glProgramUniformMatrix2fv)(GLuint,GLint,GLsizei,GLboolean,const GLfloat*); @@ -1733,17 +1870,27 @@ struct opengl_funcs void (WINE_GLAPI *p_glProgramUniformMatrix4x3dvEXT)(GLuint,GLint,GLsizei,GLboolean,const GLdouble*); void (WINE_GLAPI *p_glProgramUniformMatrix4x3fv)(GLuint,GLint,GLsizei,GLboolean,const GLfloat*); void (WINE_GLAPI *p_glProgramUniformMatrix4x3fvEXT)(GLuint,GLint,GLsizei,GLboolean,const GLfloat*); - void (WINE_GLAPI *p_glProgramUniformui64NV)(GLuint,GLint,UINT64); - void (WINE_GLAPI *p_glProgramUniformui64vNV)(GLuint,GLint,GLsizei,const UINT64*); + void (WINE_GLAPI *p_glProgramUniformui64NV)(GLuint,GLint,GLuint64EXT); + void (WINE_GLAPI *p_glProgramUniformui64vNV)(GLuint,GLint,GLsizei,const GLuint64EXT*); void (WINE_GLAPI *p_glProgramVertexLimitNV)(GLenum,GLint); void (WINE_GLAPI *p_glProvokingVertex)(GLenum); void (WINE_GLAPI *p_glProvokingVertexEXT)(GLenum); void (WINE_GLAPI *p_glPushClientAttribDefaultEXT)(GLbitfield); void (WINE_GLAPI *p_glPushDebugGroup)(GLenum,GLuint,GLsizei,const GLchar*); + void (WINE_GLAPI *p_glPushGroupMarkerEXT)(GLsizei,const GLchar*); void (WINE_GLAPI *p_glQueryCounter)(GLuint,GLenum); + GLbitfield (WINE_GLAPI *p_glQueryMatrixxOES)(GLfixed*,GLint*); + void (WINE_GLAPI *p_glRasterPos2xOES)(GLfixed,GLfixed); + void (WINE_GLAPI *p_glRasterPos2xvOES)(const GLfixed*); + void (WINE_GLAPI *p_glRasterPos3xOES)(GLfixed,GLfixed,GLfixed); + void (WINE_GLAPI *p_glRasterPos3xvOES)(const GLfixed*); + void (WINE_GLAPI *p_glRasterPos4xOES)(GLfixed,GLfixed,GLfixed,GLfixed); + void (WINE_GLAPI *p_glRasterPos4xvOES)(const GLfixed*); void (WINE_GLAPI *p_glReadBufferRegion)(GLenum,GLint,GLint,GLsizei,GLsizei); void (WINE_GLAPI *p_glReadInstrumentsSGIX)(GLint); - void (WINE_GLAPI *p_glReadnPixelsARB)(GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,GLsizei,GLvoid*); + void (WINE_GLAPI *p_glReadnPixelsARB)(GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,GLsizei,void*); + void (WINE_GLAPI *p_glRectxOES)(GLfixed,GLfixed,GLfixed,GLfixed); + void (WINE_GLAPI *p_glRectxvOES)(const GLfixed*,const GLfixed*); void (WINE_GLAPI *p_glReferencePlaneSGIX)(const GLdouble*); void (WINE_GLAPI *p_glReleaseShaderCompiler)(void); void (WINE_GLAPI *p_glRenderbufferStorage)(GLenum,GLenum,GLsizei,GLsizei); @@ -1751,7 +1898,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glRenderbufferStorageMultisample)(GLenum,GLsizei,GLenum,GLsizei,GLsizei); void (WINE_GLAPI *p_glRenderbufferStorageMultisampleCoverageNV)(GLenum,GLsizei,GLsizei,GLenum,GLsizei,GLsizei); void (WINE_GLAPI *p_glRenderbufferStorageMultisampleEXT)(GLenum,GLsizei,GLenum,GLsizei,GLsizei); - void (WINE_GLAPI *p_glReplacementCodePointerSUN)(GLenum,GLsizei,const GLvoid**); + void (WINE_GLAPI *p_glReplacementCodePointerSUN)(GLenum,GLsizei,const void**); void (WINE_GLAPI *p_glReplacementCodeubSUN)(GLubyte); void (WINE_GLAPI *p_glReplacementCodeubvSUN)(const GLubyte*); void (WINE_GLAPI *p_glReplacementCodeuiColor3fVertex3fSUN)(GLuint,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); @@ -1782,8 +1929,10 @@ struct opengl_funcs void (WINE_GLAPI *p_glResizeBuffersMESA)(void); void (WINE_GLAPI *p_glResumeTransformFeedback)(void); void (WINE_GLAPI *p_glResumeTransformFeedbackNV)(void); + void (WINE_GLAPI *p_glRotatexOES)(GLfixed,GLfixed,GLfixed,GLfixed); void (WINE_GLAPI *p_glSampleCoverage)(GLfloat,GLboolean); void (WINE_GLAPI *p_glSampleCoverageARB)(GLfloat,GLboolean); + void (WINE_GLAPI *p_glSampleCoverageOES)(GLfixed,GLboolean); void (WINE_GLAPI *p_glSampleMapATI)(GLuint,GLuint,GLenum); void (WINE_GLAPI *p_glSampleMaskEXT)(GLclampf,GLboolean); void (WINE_GLAPI *p_glSampleMaskIndexedNV)(GLuint,GLbitfield); @@ -1797,6 +1946,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glSamplerParameterfv)(GLuint,GLenum,const GLfloat*); void (WINE_GLAPI *p_glSamplerParameteri)(GLuint,GLenum,GLint); void (WINE_GLAPI *p_glSamplerParameteriv)(GLuint,GLenum,const GLint*); + void (WINE_GLAPI *p_glScalexOES)(GLfixed,GLfixed,GLfixed); void (WINE_GLAPI *p_glScissorArrayv)(GLuint,GLsizei,const GLint*); void (WINE_GLAPI *p_glScissorIndexed)(GLuint,GLint,GLint,GLsizei,GLsizei); void (WINE_GLAPI *p_glScissorIndexedv)(GLuint,const GLint*); @@ -1837,25 +1987,25 @@ struct opengl_funcs void (WINE_GLAPI *p_glSecondaryColorFormatNV)(GLint,GLenum,GLsizei); void (WINE_GLAPI *p_glSecondaryColorP3ui)(GLenum,GLuint); void (WINE_GLAPI *p_glSecondaryColorP3uiv)(GLenum,const GLuint*); - void (WINE_GLAPI *p_glSecondaryColorPointer)(GLint,GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glSecondaryColorPointerEXT)(GLint,GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glSecondaryColorPointerListIBM)(GLint,GLenum,GLint,const GLvoid**,GLint); + void (WINE_GLAPI *p_glSecondaryColorPointer)(GLint,GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glSecondaryColorPointerEXT)(GLint,GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glSecondaryColorPointerListIBM)(GLint,GLenum,GLint,const void**,GLint); void (WINE_GLAPI *p_glSelectPerfMonitorCountersAMD)(GLuint,GLboolean,GLuint,GLint,GLuint*); void (WINE_GLAPI *p_glSelectTextureCoordSetSGIS)(GLenum); void (WINE_GLAPI *p_glSelectTextureSGIS)(GLenum); - void (WINE_GLAPI *p_glSeparableFilter2D)(GLenum,GLenum,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*,const GLvoid*); - void (WINE_GLAPI *p_glSeparableFilter2DEXT)(GLenum,GLenum,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*,const GLvoid*); + void (WINE_GLAPI *p_glSeparableFilter2D)(GLenum,GLenum,GLsizei,GLsizei,GLenum,GLenum,const void*,const void*); + void (WINE_GLAPI *p_glSeparableFilter2DEXT)(GLenum,GLenum,GLsizei,GLsizei,GLenum,GLenum,const void*,const void*); void (WINE_GLAPI *p_glSetFenceAPPLE)(GLuint); void (WINE_GLAPI *p_glSetFenceNV)(GLuint,GLenum); void (WINE_GLAPI *p_glSetFragmentShaderConstantATI)(GLuint,const GLfloat*); - void (WINE_GLAPI *p_glSetInvariantEXT)(GLuint,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glSetLocalConstantEXT)(GLuint,GLenum,const GLvoid*); + void (WINE_GLAPI *p_glSetInvariantEXT)(GLuint,GLenum,const void*); + void (WINE_GLAPI *p_glSetLocalConstantEXT)(GLuint,GLenum,const void*); void (WINE_GLAPI *p_glSetMultisamplefvAMD)(GLenum,GLuint,const GLfloat*); - void (WINE_GLAPI *p_glShaderBinary)(GLsizei,const GLuint*,GLenum,const GLvoid*,GLsizei); + void (WINE_GLAPI *p_glShaderBinary)(GLsizei,const GLuint*,GLenum,const void*,GLsizei); void (WINE_GLAPI *p_glShaderOp1EXT)(GLenum,GLuint,GLuint); void (WINE_GLAPI *p_glShaderOp2EXT)(GLenum,GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glShaderOp3EXT)(GLenum,GLuint,GLuint,GLuint,GLuint); - void (WINE_GLAPI *p_glShaderSource)(GLuint,GLsizei,const GLchar* const*,const GLint*); + void (WINE_GLAPI *p_glShaderSource)(GLuint,GLsizei,const GLchar*const*,const GLint*); void (WINE_GLAPI *p_glShaderSourceARB)(GLhandleARB,GLsizei,const GLcharARB**,const GLint*); void (WINE_GLAPI *p_glShaderStorageBlockBinding)(GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glSharpenTexFuncSGIS)(GLenum,GLsizei,const GLfloat*); @@ -1865,7 +2015,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glSpriteParameterivSGIX)(GLenum,const GLint*); void (WINE_GLAPI *p_glStartInstrumentsSGIX)(void); void (WINE_GLAPI *p_glStencilClearTagEXT)(GLsizei,GLuint); - void (WINE_GLAPI *p_glStencilFillPathInstancedNV)(GLsizei,GLenum,const GLvoid*,GLuint,GLenum,GLuint,GLenum,const GLfloat*); + void (WINE_GLAPI *p_glStencilFillPathInstancedNV)(GLsizei,GLenum,const void*,GLuint,GLenum,GLuint,GLenum,const GLfloat*); void (WINE_GLAPI *p_glStencilFillPathNV)(GLuint,GLenum,GLuint); void (WINE_GLAPI *p_glStencilFuncSeparate)(GLenum,GLenum,GLint,GLuint); void (WINE_GLAPI *p_glStencilFuncSeparateATI)(GLenum,GLenum,GLint,GLuint); @@ -1873,11 +2023,12 @@ struct opengl_funcs void (WINE_GLAPI *p_glStencilOpSeparate)(GLenum,GLenum,GLenum,GLenum); void (WINE_GLAPI *p_glStencilOpSeparateATI)(GLenum,GLenum,GLenum,GLenum); void (WINE_GLAPI *p_glStencilOpValueAMD)(GLenum,GLuint); - void (WINE_GLAPI *p_glStencilStrokePathInstancedNV)(GLsizei,GLenum,const GLvoid*,GLuint,GLint,GLuint,GLenum,const GLfloat*); + void (WINE_GLAPI *p_glStencilStrokePathInstancedNV)(GLsizei,GLenum,const void*,GLuint,GLint,GLuint,GLenum,const GLfloat*); void (WINE_GLAPI *p_glStencilStrokePathNV)(GLuint,GLint,GLuint); void (WINE_GLAPI *p_glStopInstrumentsSGIX)(GLint); - void (WINE_GLAPI *p_glStringMarkerGREMEDY)(GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glStringMarkerGREMEDY)(GLsizei,const void*); void (WINE_GLAPI *p_glSwizzleEXT)(GLuint,GLuint,GLenum,GLenum,GLenum,GLenum); + void (WINE_GLAPI *p_glSyncTextureINTEL)(GLuint); void (WINE_GLAPI *p_glTagSampleBufferSGIX)(void); void (WINE_GLAPI *p_glTangent3bEXT)(GLbyte,GLbyte,GLbyte); void (WINE_GLAPI *p_glTangent3bvEXT)(const GLbyte*); @@ -1889,7 +2040,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glTangent3ivEXT)(const GLint*); void (WINE_GLAPI *p_glTangent3sEXT)(GLshort,GLshort,GLshort); void (WINE_GLAPI *p_glTangent3svEXT)(const GLshort*); - void (WINE_GLAPI *p_glTangentPointerEXT)(GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glTangentPointerEXT)(GLenum,GLsizei,const void*); void (WINE_GLAPI *p_glTbufferMask3DFX)(GLuint); void (WINE_GLAPI *p_glTessellationFactorAMD)(GLfloat); void (WINE_GLAPI *p_glTessellationModeAMD)(GLenum); @@ -1902,8 +2053,14 @@ struct opengl_funcs void (WINE_GLAPI *p_glTexBufferRange)(GLenum,GLenum,GLuint,GLintptr,GLsizeiptr); void (WINE_GLAPI *p_glTexBumpParameterfvATI)(GLenum,const GLfloat*); void (WINE_GLAPI *p_glTexBumpParameterivATI)(GLenum,const GLint*); + void (WINE_GLAPI *p_glTexCoord1bOES)(GLbyte); + void (WINE_GLAPI *p_glTexCoord1bvOES)(const GLbyte*); void (WINE_GLAPI *p_glTexCoord1hNV)(GLhalfNV); void (WINE_GLAPI *p_glTexCoord1hvNV)(const GLhalfNV*); + void (WINE_GLAPI *p_glTexCoord1xOES)(GLfixed); + void (WINE_GLAPI *p_glTexCoord1xvOES)(const GLfixed*); + void (WINE_GLAPI *p_glTexCoord2bOES)(GLbyte,GLbyte); + void (WINE_GLAPI *p_glTexCoord2bvOES)(const GLbyte*); void (WINE_GLAPI *p_glTexCoord2fColor3fVertex3fSUN)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glTexCoord2fColor3fVertex3fvSUN)(const GLfloat*,const GLfloat*,const GLfloat*); void (WINE_GLAPI *p_glTexCoord2fColor4fNormal3fVertex3fSUN)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); @@ -1916,14 +2073,24 @@ struct opengl_funcs void (WINE_GLAPI *p_glTexCoord2fVertex3fvSUN)(const GLfloat*,const GLfloat*); void (WINE_GLAPI *p_glTexCoord2hNV)(GLhalfNV,GLhalfNV); void (WINE_GLAPI *p_glTexCoord2hvNV)(const GLhalfNV*); + void (WINE_GLAPI *p_glTexCoord2xOES)(GLfixed,GLfixed); + void (WINE_GLAPI *p_glTexCoord2xvOES)(const GLfixed*); + void (WINE_GLAPI *p_glTexCoord3bOES)(GLbyte,GLbyte,GLbyte); + void (WINE_GLAPI *p_glTexCoord3bvOES)(const GLbyte*); void (WINE_GLAPI *p_glTexCoord3hNV)(GLhalfNV,GLhalfNV,GLhalfNV); void (WINE_GLAPI *p_glTexCoord3hvNV)(const GLhalfNV*); + void (WINE_GLAPI *p_glTexCoord3xOES)(GLfixed,GLfixed,GLfixed); + void (WINE_GLAPI *p_glTexCoord3xvOES)(const GLfixed*); + void (WINE_GLAPI *p_glTexCoord4bOES)(GLbyte,GLbyte,GLbyte,GLbyte); + void (WINE_GLAPI *p_glTexCoord4bvOES)(const GLbyte*); void (WINE_GLAPI *p_glTexCoord4fColor4fNormal3fVertex4fSUN)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glTexCoord4fColor4fNormal3fVertex4fvSUN)(const GLfloat*,const GLfloat*,const GLfloat*,const GLfloat*); void (WINE_GLAPI *p_glTexCoord4fVertex4fSUN)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glTexCoord4fVertex4fvSUN)(const GLfloat*,const GLfloat*); void (WINE_GLAPI *p_glTexCoord4hNV)(GLhalfNV,GLhalfNV,GLhalfNV,GLhalfNV); void (WINE_GLAPI *p_glTexCoord4hvNV)(const GLhalfNV*); + void (WINE_GLAPI *p_glTexCoord4xOES)(GLfixed,GLfixed,GLfixed,GLfixed); + void (WINE_GLAPI *p_glTexCoord4xvOES)(const GLfixed*); void (WINE_GLAPI *p_glTexCoordFormatNV)(GLint,GLenum,GLsizei); void (WINE_GLAPI *p_glTexCoordP1ui)(GLenum,GLuint); void (WINE_GLAPI *p_glTexCoordP1uiv)(GLenum,const GLuint*); @@ -1933,21 +2100,28 @@ struct opengl_funcs void (WINE_GLAPI *p_glTexCoordP3uiv)(GLenum,const GLuint*); void (WINE_GLAPI *p_glTexCoordP4ui)(GLenum,GLuint); void (WINE_GLAPI *p_glTexCoordP4uiv)(GLenum,const GLuint*); - void (WINE_GLAPI *p_glTexCoordPointerEXT)(GLint,GLenum,GLsizei,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glTexCoordPointerListIBM)(GLint,GLenum,GLint,const GLvoid**,GLint); - void (WINE_GLAPI *p_glTexCoordPointervINTEL)(GLint,GLenum,const GLvoid**); + void (WINE_GLAPI *p_glTexCoordPointerEXT)(GLint,GLenum,GLsizei,GLsizei,const void*); + void (WINE_GLAPI *p_glTexCoordPointerListIBM)(GLint,GLenum,GLint,const void**,GLint); + void (WINE_GLAPI *p_glTexCoordPointervINTEL)(GLint,GLenum,const void**); + void (WINE_GLAPI *p_glTexEnvxOES)(GLenum,GLenum,GLfixed); + void (WINE_GLAPI *p_glTexEnvxvOES)(GLenum,GLenum,const GLfixed*); void (WINE_GLAPI *p_glTexFilterFuncSGIS)(GLenum,GLenum,GLsizei,const GLfloat*); - void (WINE_GLAPI *p_glTexImage2DMultisample)(GLenum,GLsizei,GLint,GLsizei,GLsizei,GLboolean); + void (WINE_GLAPI *p_glTexGenxOES)(GLenum,GLenum,GLfixed); + void (WINE_GLAPI *p_glTexGenxvOES)(GLenum,GLenum,const GLfixed*); + void (WINE_GLAPI *p_glTexImage2DMultisample)(GLenum,GLsizei,GLenum,GLsizei,GLsizei,GLboolean); void (WINE_GLAPI *p_glTexImage2DMultisampleCoverageNV)(GLenum,GLsizei,GLsizei,GLint,GLsizei,GLsizei,GLboolean); - void (WINE_GLAPI *p_glTexImage3D)(GLenum,GLint,GLint,GLsizei,GLsizei,GLsizei,GLint,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glTexImage3DEXT)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glTexImage3DMultisample)(GLenum,GLsizei,GLint,GLsizei,GLsizei,GLsizei,GLboolean); + void (WINE_GLAPI *p_glTexImage3D)(GLenum,GLint,GLint,GLsizei,GLsizei,GLsizei,GLint,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glTexImage3DEXT)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glTexImage3DMultisample)(GLenum,GLsizei,GLenum,GLsizei,GLsizei,GLsizei,GLboolean); void (WINE_GLAPI *p_glTexImage3DMultisampleCoverageNV)(GLenum,GLsizei,GLsizei,GLint,GLsizei,GLsizei,GLsizei,GLboolean); - void (WINE_GLAPI *p_glTexImage4DSGIS)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLsizei,GLint,GLenum,GLenum,const GLvoid*); + void (WINE_GLAPI *p_glTexImage4DSGIS)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLsizei,GLint,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glTexPageCommitmentARB)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLboolean); void (WINE_GLAPI *p_glTexParameterIiv)(GLenum,GLenum,const GLint*); void (WINE_GLAPI *p_glTexParameterIivEXT)(GLenum,GLenum,const GLint*); void (WINE_GLAPI *p_glTexParameterIuiv)(GLenum,GLenum,const GLuint*); void (WINE_GLAPI *p_glTexParameterIuivEXT)(GLenum,GLenum,const GLuint*); + void (WINE_GLAPI *p_glTexParameterxOES)(GLenum,GLenum,GLfixed); + void (WINE_GLAPI *p_glTexParameterxvOES)(GLenum,GLenum,const GLfixed*); void (WINE_GLAPI *p_glTexRenderbufferNV)(GLenum,GLuint); void (WINE_GLAPI *p_glTexStorage1D)(GLenum,GLsizei,GLenum,GLsizei); void (WINE_GLAPI *p_glTexStorage2D)(GLenum,GLsizei,GLenum,GLsizei,GLsizei); @@ -1955,32 +2129,33 @@ struct opengl_funcs void (WINE_GLAPI *p_glTexStorage3D)(GLenum,GLsizei,GLenum,GLsizei,GLsizei,GLsizei); void (WINE_GLAPI *p_glTexStorage3DMultisample)(GLenum,GLsizei,GLenum,GLsizei,GLsizei,GLsizei,GLboolean); void (WINE_GLAPI *p_glTexStorageSparseAMD)(GLenum,GLenum,GLsizei,GLsizei,GLsizei,GLsizei,GLbitfield); - void (WINE_GLAPI *p_glTexSubImage1DEXT)(GLenum,GLint,GLint,GLsizei,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glTexSubImage2DEXT)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glTexSubImage3D)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glTexSubImage3DEXT)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glTexSubImage4DSGIS)(GLenum,GLint,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); + void (WINE_GLAPI *p_glTexSubImage1DEXT)(GLenum,GLint,GLint,GLsizei,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glTexSubImage2DEXT)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glTexSubImage3D)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glTexSubImage3DEXT)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glTexSubImage4DSGIS)(GLenum,GLint,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const void*); void (WINE_GLAPI *p_glTextureBarrierNV)(void); void (WINE_GLAPI *p_glTextureBufferEXT)(GLuint,GLenum,GLenum,GLuint); void (WINE_GLAPI *p_glTextureBufferRangeEXT)(GLuint,GLenum,GLenum,GLuint,GLintptr,GLsizeiptr); void (WINE_GLAPI *p_glTextureColorMaskSGIS)(GLboolean,GLboolean,GLboolean,GLboolean); - void (WINE_GLAPI *p_glTextureImage1DEXT)(GLuint,GLenum,GLint,GLenum,GLsizei,GLint,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glTextureImage2DEXT)(GLuint,GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLenum,GLenum,const GLvoid*); + void (WINE_GLAPI *p_glTextureImage1DEXT)(GLuint,GLenum,GLint,GLint,GLsizei,GLint,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glTextureImage2DEXT)(GLuint,GLenum,GLint,GLint,GLsizei,GLsizei,GLint,GLenum,GLenum,const void*); void (WINE_GLAPI *p_glTextureImage2DMultisampleCoverageNV)(GLuint,GLenum,GLsizei,GLsizei,GLint,GLsizei,GLsizei,GLboolean); void (WINE_GLAPI *p_glTextureImage2DMultisampleNV)(GLuint,GLenum,GLsizei,GLint,GLsizei,GLsizei,GLboolean); - void (WINE_GLAPI *p_glTextureImage3DEXT)(GLuint,GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLenum,GLenum,const GLvoid*); + void (WINE_GLAPI *p_glTextureImage3DEXT)(GLuint,GLenum,GLint,GLint,GLsizei,GLsizei,GLsizei,GLint,GLenum,GLenum,const void*); void (WINE_GLAPI *p_glTextureImage3DMultisampleCoverageNV)(GLuint,GLenum,GLsizei,GLsizei,GLint,GLsizei,GLsizei,GLsizei,GLboolean); void (WINE_GLAPI *p_glTextureImage3DMultisampleNV)(GLuint,GLenum,GLsizei,GLint,GLsizei,GLsizei,GLsizei,GLboolean); void (WINE_GLAPI *p_glTextureLightEXT)(GLenum); void (WINE_GLAPI *p_glTextureMaterialEXT)(GLenum,GLenum); void (WINE_GLAPI *p_glTextureNormalEXT)(GLenum); + void (WINE_GLAPI *p_glTexturePageCommitmentEXT)(GLuint,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLboolean); void (WINE_GLAPI *p_glTextureParameterIivEXT)(GLuint,GLenum,GLenum,const GLint*); void (WINE_GLAPI *p_glTextureParameterIuivEXT)(GLuint,GLenum,GLenum,const GLuint*); void (WINE_GLAPI *p_glTextureParameterfEXT)(GLuint,GLenum,GLenum,GLfloat); void (WINE_GLAPI *p_glTextureParameterfvEXT)(GLuint,GLenum,GLenum,const GLfloat*); void (WINE_GLAPI *p_glTextureParameteriEXT)(GLuint,GLenum,GLenum,GLint); void (WINE_GLAPI *p_glTextureParameterivEXT)(GLuint,GLenum,GLenum,const GLint*); - void (WINE_GLAPI *p_glTextureRangeAPPLE)(GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glTextureRangeAPPLE)(GLenum,GLsizei,const void*); void (WINE_GLAPI *p_glTextureRenderbufferEXT)(GLuint,GLenum,GLuint); void (WINE_GLAPI *p_glTextureStorage1DEXT)(GLuint,GLenum,GLsizei,GLenum,GLsizei); void (WINE_GLAPI *p_glTextureStorage2DEXT)(GLuint,GLenum,GLsizei,GLenum,GLsizei,GLsizei); @@ -1988,17 +2163,18 @@ struct opengl_funcs void (WINE_GLAPI *p_glTextureStorage3DEXT)(GLuint,GLenum,GLsizei,GLenum,GLsizei,GLsizei,GLsizei); void (WINE_GLAPI *p_glTextureStorage3DMultisampleEXT)(GLuint,GLenum,GLsizei,GLenum,GLsizei,GLsizei,GLsizei,GLboolean); void (WINE_GLAPI *p_glTextureStorageSparseAMD)(GLuint,GLenum,GLenum,GLsizei,GLsizei,GLsizei,GLsizei,GLbitfield); - void (WINE_GLAPI *p_glTextureSubImage1DEXT)(GLuint,GLenum,GLint,GLint,GLsizei,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glTextureSubImage2DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glTextureSubImage3DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); + void (WINE_GLAPI *p_glTextureSubImage1DEXT)(GLuint,GLenum,GLint,GLint,GLsizei,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glTextureSubImage2DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glTextureSubImage3DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const void*); void (WINE_GLAPI *p_glTextureView)(GLuint,GLenum,GLuint,GLenum,GLuint,GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glTrackMatrixNV)(GLenum,GLuint,GLenum,GLenum); void (WINE_GLAPI *p_glTransformFeedbackAttribsNV)(GLuint,const GLint*,GLenum); void (WINE_GLAPI *p_glTransformFeedbackStreamAttribsNV)(GLsizei,const GLint*,GLsizei,const GLint*,GLenum); - void (WINE_GLAPI *p_glTransformFeedbackVaryings)(GLuint,GLsizei,const GLchar* const*,GLenum); - void (WINE_GLAPI *p_glTransformFeedbackVaryingsEXT)(GLuint,GLsizei,const GLchar**,GLenum); + void (WINE_GLAPI *p_glTransformFeedbackVaryings)(GLuint,GLsizei,const GLchar*const*,GLenum); + void (WINE_GLAPI *p_glTransformFeedbackVaryingsEXT)(GLuint,GLsizei,const GLchar*const*,GLenum); void (WINE_GLAPI *p_glTransformFeedbackVaryingsNV)(GLuint,GLsizei,const GLint*,GLenum); void (WINE_GLAPI *p_glTransformPathNV)(GLuint,GLuint,GLenum,const GLfloat*); + void (WINE_GLAPI *p_glTranslatexOES)(GLfixed,GLfixed,GLfixed); void (WINE_GLAPI *p_glUniform1d)(GLint,GLdouble); void (WINE_GLAPI *p_glUniform1dv)(GLint,GLsizei,const GLdouble*); void (WINE_GLAPI *p_glUniform1f)(GLint,GLfloat); @@ -2006,14 +2182,14 @@ struct opengl_funcs void (WINE_GLAPI *p_glUniform1fv)(GLint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glUniform1fvARB)(GLint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glUniform1i)(GLint,GLint); - void (WINE_GLAPI *p_glUniform1i64NV)(GLint,INT64); - void (WINE_GLAPI *p_glUniform1i64vNV)(GLint,GLsizei,const INT64*); + void (WINE_GLAPI *p_glUniform1i64NV)(GLint,GLint64EXT); + void (WINE_GLAPI *p_glUniform1i64vNV)(GLint,GLsizei,const GLint64EXT*); void (WINE_GLAPI *p_glUniform1iARB)(GLint,GLint); void (WINE_GLAPI *p_glUniform1iv)(GLint,GLsizei,const GLint*); void (WINE_GLAPI *p_glUniform1ivARB)(GLint,GLsizei,const GLint*); void (WINE_GLAPI *p_glUniform1ui)(GLint,GLuint); - void (WINE_GLAPI *p_glUniform1ui64NV)(GLint,UINT64); - void (WINE_GLAPI *p_glUniform1ui64vNV)(GLint,GLsizei,const UINT64*); + void (WINE_GLAPI *p_glUniform1ui64NV)(GLint,GLuint64EXT); + void (WINE_GLAPI *p_glUniform1ui64vNV)(GLint,GLsizei,const GLuint64EXT*); void (WINE_GLAPI *p_glUniform1uiEXT)(GLint,GLuint); void (WINE_GLAPI *p_glUniform1uiv)(GLint,GLsizei,const GLuint*); void (WINE_GLAPI *p_glUniform1uivEXT)(GLint,GLsizei,const GLuint*); @@ -2024,14 +2200,14 @@ struct opengl_funcs void (WINE_GLAPI *p_glUniform2fv)(GLint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glUniform2fvARB)(GLint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glUniform2i)(GLint,GLint,GLint); - void (WINE_GLAPI *p_glUniform2i64NV)(GLint,INT64,INT64); - void (WINE_GLAPI *p_glUniform2i64vNV)(GLint,GLsizei,const INT64*); + void (WINE_GLAPI *p_glUniform2i64NV)(GLint,GLint64EXT,GLint64EXT); + void (WINE_GLAPI *p_glUniform2i64vNV)(GLint,GLsizei,const GLint64EXT*); void (WINE_GLAPI *p_glUniform2iARB)(GLint,GLint,GLint); void (WINE_GLAPI *p_glUniform2iv)(GLint,GLsizei,const GLint*); void (WINE_GLAPI *p_glUniform2ivARB)(GLint,GLsizei,const GLint*); void (WINE_GLAPI *p_glUniform2ui)(GLint,GLuint,GLuint); - void (WINE_GLAPI *p_glUniform2ui64NV)(GLint,UINT64,UINT64); - void (WINE_GLAPI *p_glUniform2ui64vNV)(GLint,GLsizei,const UINT64*); + void (WINE_GLAPI *p_glUniform2ui64NV)(GLint,GLuint64EXT,GLuint64EXT); + void (WINE_GLAPI *p_glUniform2ui64vNV)(GLint,GLsizei,const GLuint64EXT*); void (WINE_GLAPI *p_glUniform2uiEXT)(GLint,GLuint,GLuint); void (WINE_GLAPI *p_glUniform2uiv)(GLint,GLsizei,const GLuint*); void (WINE_GLAPI *p_glUniform2uivEXT)(GLint,GLsizei,const GLuint*); @@ -2042,14 +2218,14 @@ struct opengl_funcs void (WINE_GLAPI *p_glUniform3fv)(GLint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glUniform3fvARB)(GLint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glUniform3i)(GLint,GLint,GLint,GLint); - void (WINE_GLAPI *p_glUniform3i64NV)(GLint,INT64,INT64,INT64); - void (WINE_GLAPI *p_glUniform3i64vNV)(GLint,GLsizei,const INT64*); + void (WINE_GLAPI *p_glUniform3i64NV)(GLint,GLint64EXT,GLint64EXT,GLint64EXT); + void (WINE_GLAPI *p_glUniform3i64vNV)(GLint,GLsizei,const GLint64EXT*); void (WINE_GLAPI *p_glUniform3iARB)(GLint,GLint,GLint,GLint); void (WINE_GLAPI *p_glUniform3iv)(GLint,GLsizei,const GLint*); void (WINE_GLAPI *p_glUniform3ivARB)(GLint,GLsizei,const GLint*); void (WINE_GLAPI *p_glUniform3ui)(GLint,GLuint,GLuint,GLuint); - void (WINE_GLAPI *p_glUniform3ui64NV)(GLint,UINT64,UINT64,UINT64); - void (WINE_GLAPI *p_glUniform3ui64vNV)(GLint,GLsizei,const UINT64*); + void (WINE_GLAPI *p_glUniform3ui64NV)(GLint,GLuint64EXT,GLuint64EXT,GLuint64EXT); + void (WINE_GLAPI *p_glUniform3ui64vNV)(GLint,GLsizei,const GLuint64EXT*); void (WINE_GLAPI *p_glUniform3uiEXT)(GLint,GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glUniform3uiv)(GLint,GLsizei,const GLuint*); void (WINE_GLAPI *p_glUniform3uivEXT)(GLint,GLsizei,const GLuint*); @@ -2060,21 +2236,23 @@ struct opengl_funcs void (WINE_GLAPI *p_glUniform4fv)(GLint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glUniform4fvARB)(GLint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glUniform4i)(GLint,GLint,GLint,GLint,GLint); - void (WINE_GLAPI *p_glUniform4i64NV)(GLint,INT64,INT64,INT64,INT64); - void (WINE_GLAPI *p_glUniform4i64vNV)(GLint,GLsizei,const INT64*); + void (WINE_GLAPI *p_glUniform4i64NV)(GLint,GLint64EXT,GLint64EXT,GLint64EXT,GLint64EXT); + void (WINE_GLAPI *p_glUniform4i64vNV)(GLint,GLsizei,const GLint64EXT*); void (WINE_GLAPI *p_glUniform4iARB)(GLint,GLint,GLint,GLint,GLint); void (WINE_GLAPI *p_glUniform4iv)(GLint,GLsizei,const GLint*); void (WINE_GLAPI *p_glUniform4ivARB)(GLint,GLsizei,const GLint*); void (WINE_GLAPI *p_glUniform4ui)(GLint,GLuint,GLuint,GLuint,GLuint); - void (WINE_GLAPI *p_glUniform4ui64NV)(GLint,UINT64,UINT64,UINT64,UINT64); - void (WINE_GLAPI *p_glUniform4ui64vNV)(GLint,GLsizei,const UINT64*); + void (WINE_GLAPI *p_glUniform4ui64NV)(GLint,GLuint64EXT,GLuint64EXT,GLuint64EXT,GLuint64EXT); + void (WINE_GLAPI *p_glUniform4ui64vNV)(GLint,GLsizei,const GLuint64EXT*); void (WINE_GLAPI *p_glUniform4uiEXT)(GLint,GLuint,GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glUniform4uiv)(GLint,GLsizei,const GLuint*); void (WINE_GLAPI *p_glUniform4uivEXT)(GLint,GLsizei,const GLuint*); void (WINE_GLAPI *p_glUniformBlockBinding)(GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glUniformBufferEXT)(GLuint,GLint,GLuint); - void (WINE_GLAPI *p_glUniformHandleui64NV)(GLint,UINT64); - void (WINE_GLAPI *p_glUniformHandleui64vNV)(GLint,GLsizei,const UINT64*); + void (WINE_GLAPI *p_glUniformHandleui64ARB)(GLint,GLuint64); + void (WINE_GLAPI *p_glUniformHandleui64NV)(GLint,GLuint64); + void (WINE_GLAPI *p_glUniformHandleui64vARB)(GLint,GLsizei,const GLuint64*); + void (WINE_GLAPI *p_glUniformHandleui64vNV)(GLint,GLsizei,const GLuint64*); void (WINE_GLAPI *p_glUniformMatrix2dv)(GLint,GLsizei,GLboolean,const GLdouble*); void (WINE_GLAPI *p_glUniformMatrix2fv)(GLint,GLsizei,GLboolean,const GLfloat*); void (WINE_GLAPI *p_glUniformMatrix2fvARB)(GLint,GLsizei,GLboolean,const GLfloat*); @@ -2097,25 +2275,26 @@ struct opengl_funcs void (WINE_GLAPI *p_glUniformMatrix4x3dv)(GLint,GLsizei,GLboolean,const GLdouble*); void (WINE_GLAPI *p_glUniformMatrix4x3fv)(GLint,GLsizei,GLboolean,const GLfloat*); void (WINE_GLAPI *p_glUniformSubroutinesuiv)(GLenum,GLsizei,const GLuint*); - void (WINE_GLAPI *p_glUniformui64NV)(GLint,UINT64); - void (WINE_GLAPI *p_glUniformui64vNV)(GLint,GLsizei,const UINT64*); + void (WINE_GLAPI *p_glUniformui64NV)(GLint,GLuint64EXT); + void (WINE_GLAPI *p_glUniformui64vNV)(GLint,GLsizei,const GLuint64EXT*); void (WINE_GLAPI *p_glUnlockArraysEXT)(void); GLboolean (WINE_GLAPI *p_glUnmapBuffer)(GLenum); GLboolean (WINE_GLAPI *p_glUnmapBufferARB)(GLenum); GLboolean (WINE_GLAPI *p_glUnmapNamedBufferEXT)(GLuint); void (WINE_GLAPI *p_glUnmapObjectBufferATI)(GLuint); - void (WINE_GLAPI *p_glUpdateObjectBufferATI)(GLuint,GLuint,GLsizei,const GLvoid*,GLenum); + void (WINE_GLAPI *p_glUnmapTexture2DINTEL)(GLuint,GLint); + void (WINE_GLAPI *p_glUpdateObjectBufferATI)(GLuint,GLuint,GLsizei,const void*,GLenum); void (WINE_GLAPI *p_glUseProgram)(GLuint); void (WINE_GLAPI *p_glUseProgramObjectARB)(GLhandleARB); void (WINE_GLAPI *p_glUseProgramStages)(GLuint,GLbitfield,GLuint); void (WINE_GLAPI *p_glUseShaderProgramEXT)(GLenum,GLuint); void (WINE_GLAPI *p_glVDPAUFiniNV)(void); void (WINE_GLAPI *p_glVDPAUGetSurfaceivNV)(GLvdpauSurfaceNV,GLenum,GLsizei,GLsizei*,GLint*); - void (WINE_GLAPI *p_glVDPAUInitNV)(const GLvoid*,const GLvoid*); + void (WINE_GLAPI *p_glVDPAUInitNV)(const void*,const void*); void (WINE_GLAPI *p_glVDPAUIsSurfaceNV)(GLvdpauSurfaceNV); void (WINE_GLAPI *p_glVDPAUMapSurfacesNV)(GLsizei,const GLvdpauSurfaceNV*); - GLvdpauSurfaceNV (WINE_GLAPI *p_glVDPAURegisterOutputSurfaceNV)(GLvoid*,GLenum,GLsizei,const GLuint*); - GLvdpauSurfaceNV (WINE_GLAPI *p_glVDPAURegisterVideoSurfaceNV)(const GLvoid*,GLenum,GLsizei,const GLuint*); + GLvdpauSurfaceNV (WINE_GLAPI *p_glVDPAURegisterOutputSurfaceNV)(const void*,GLenum,GLsizei,const GLuint*); + GLvdpauSurfaceNV (WINE_GLAPI *p_glVDPAURegisterVideoSurfaceNV)(const void*,GLenum,GLsizei,const GLuint*); void (WINE_GLAPI *p_glVDPAUSurfaceAccessNV)(GLvdpauSurfaceNV,GLenum); void (WINE_GLAPI *p_glVDPAUUnmapSurfacesNV)(GLsizei,const GLvdpauSurfaceNV*); void (WINE_GLAPI *p_glVDPAUUnregisterSurfaceNV)(GLvdpauSurfaceNV); @@ -2123,7 +2302,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glValidateProgramARB)(GLhandleARB); void (WINE_GLAPI *p_glValidateProgramPipeline)(GLuint); void (WINE_GLAPI *p_glVariantArrayObjectATI)(GLuint,GLenum,GLsizei,GLuint,GLuint); - void (WINE_GLAPI *p_glVariantPointerEXT)(GLuint,GLenum,GLuint,const GLvoid*); + void (WINE_GLAPI *p_glVariantPointerEXT)(GLuint,GLenum,GLuint,const void*); void (WINE_GLAPI *p_glVariantbvEXT)(GLuint,const GLbyte*); void (WINE_GLAPI *p_glVariantdvEXT)(GLuint,const GLdouble*); void (WINE_GLAPI *p_glVariantfvEXT)(GLuint,const GLfloat*); @@ -2132,22 +2311,46 @@ struct opengl_funcs void (WINE_GLAPI *p_glVariantubvEXT)(GLuint,const GLubyte*); void (WINE_GLAPI *p_glVariantuivEXT)(GLuint,const GLuint*); void (WINE_GLAPI *p_glVariantusvEXT)(GLuint,const GLushort*); + void (WINE_GLAPI *p_glVertex2bOES)(GLbyte); + void (WINE_GLAPI *p_glVertex2bvOES)(const GLbyte*); void (WINE_GLAPI *p_glVertex2hNV)(GLhalfNV,GLhalfNV); void (WINE_GLAPI *p_glVertex2hvNV)(const GLhalfNV*); + void (WINE_GLAPI *p_glVertex2xOES)(GLfixed); + void (WINE_GLAPI *p_glVertex2xvOES)(const GLfixed*); + void (WINE_GLAPI *p_glVertex3bOES)(GLbyte,GLbyte); + void (WINE_GLAPI *p_glVertex3bvOES)(const GLbyte*); void (WINE_GLAPI *p_glVertex3hNV)(GLhalfNV,GLhalfNV,GLhalfNV); void (WINE_GLAPI *p_glVertex3hvNV)(const GLhalfNV*); + void (WINE_GLAPI *p_glVertex3xOES)(GLfixed,GLfixed); + void (WINE_GLAPI *p_glVertex3xvOES)(const GLfixed*); + void (WINE_GLAPI *p_glVertex4bOES)(GLbyte,GLbyte,GLbyte); + void (WINE_GLAPI *p_glVertex4bvOES)(const GLbyte*); void (WINE_GLAPI *p_glVertex4hNV)(GLhalfNV,GLhalfNV,GLhalfNV,GLhalfNV); void (WINE_GLAPI *p_glVertex4hvNV)(const GLhalfNV*); + void (WINE_GLAPI *p_glVertex4xOES)(GLfixed,GLfixed,GLfixed); + void (WINE_GLAPI *p_glVertex4xvOES)(const GLfixed*); void (WINE_GLAPI *p_glVertexArrayBindVertexBufferEXT)(GLuint,GLuint,GLuint,GLintptr,GLsizei); + void (WINE_GLAPI *p_glVertexArrayColorOffsetEXT)(GLuint,GLuint,GLint,GLenum,GLsizei,GLintptr); + void (WINE_GLAPI *p_glVertexArrayEdgeFlagOffsetEXT)(GLuint,GLuint,GLsizei,GLintptr); + void (WINE_GLAPI *p_glVertexArrayFogCoordOffsetEXT)(GLuint,GLuint,GLenum,GLsizei,GLintptr); + void (WINE_GLAPI *p_glVertexArrayIndexOffsetEXT)(GLuint,GLuint,GLenum,GLsizei,GLintptr); + void (WINE_GLAPI *p_glVertexArrayMultiTexCoordOffsetEXT)(GLuint,GLuint,GLenum,GLint,GLenum,GLsizei,GLintptr); + void (WINE_GLAPI *p_glVertexArrayNormalOffsetEXT)(GLuint,GLuint,GLenum,GLsizei,GLintptr); void (WINE_GLAPI *p_glVertexArrayParameteriAPPLE)(GLenum,GLint); - void (WINE_GLAPI *p_glVertexArrayRangeAPPLE)(GLsizei,GLvoid*); - void (WINE_GLAPI *p_glVertexArrayRangeNV)(GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glVertexArrayRangeAPPLE)(GLsizei,void*); + void (WINE_GLAPI *p_glVertexArrayRangeNV)(GLsizei,const void*); + void (WINE_GLAPI *p_glVertexArraySecondaryColorOffsetEXT)(GLuint,GLuint,GLint,GLenum,GLsizei,GLintptr); + void (WINE_GLAPI *p_glVertexArrayTexCoordOffsetEXT)(GLuint,GLuint,GLint,GLenum,GLsizei,GLintptr); void (WINE_GLAPI *p_glVertexArrayVertexAttribBindingEXT)(GLuint,GLuint,GLuint); + void (WINE_GLAPI *p_glVertexArrayVertexAttribDivisorEXT)(GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glVertexArrayVertexAttribFormatEXT)(GLuint,GLuint,GLint,GLenum,GLboolean,GLuint); void (WINE_GLAPI *p_glVertexArrayVertexAttribIFormatEXT)(GLuint,GLuint,GLint,GLenum,GLuint); + void (WINE_GLAPI *p_glVertexArrayVertexAttribIOffsetEXT)(GLuint,GLuint,GLuint,GLint,GLenum,GLsizei,GLintptr); void (WINE_GLAPI *p_glVertexArrayVertexAttribLFormatEXT)(GLuint,GLuint,GLint,GLenum,GLuint); void (WINE_GLAPI *p_glVertexArrayVertexAttribLOffsetEXT)(GLuint,GLuint,GLuint,GLint,GLenum,GLsizei,GLintptr); + void (WINE_GLAPI *p_glVertexArrayVertexAttribOffsetEXT)(GLuint,GLuint,GLuint,GLint,GLenum,GLboolean,GLsizei,GLintptr); void (WINE_GLAPI *p_glVertexArrayVertexBindingDivisorEXT)(GLuint,GLuint,GLuint); + void (WINE_GLAPI *p_glVertexArrayVertexOffsetEXT)(GLuint,GLuint,GLint,GLenum,GLsizei,GLintptr); void (WINE_GLAPI *p_glVertexAttrib1d)(GLuint,GLdouble); void (WINE_GLAPI *p_glVertexAttrib1dARB)(GLuint,GLdouble); void (WINE_GLAPI *p_glVertexAttrib1dNV)(GLuint,GLdouble); @@ -2302,44 +2505,46 @@ struct opengl_funcs void (WINE_GLAPI *p_glVertexAttribI4usvEXT)(GLuint,const GLushort*); void (WINE_GLAPI *p_glVertexAttribIFormat)(GLuint,GLint,GLenum,GLuint); void (WINE_GLAPI *p_glVertexAttribIFormatNV)(GLuint,GLint,GLenum,GLsizei); - void (WINE_GLAPI *p_glVertexAttribIPointer)(GLuint,GLint,GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glVertexAttribIPointerEXT)(GLuint,GLint,GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glVertexAttribIPointer)(GLuint,GLint,GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glVertexAttribIPointerEXT)(GLuint,GLint,GLenum,GLsizei,const void*); void (WINE_GLAPI *p_glVertexAttribL1d)(GLuint,GLdouble); void (WINE_GLAPI *p_glVertexAttribL1dEXT)(GLuint,GLdouble); void (WINE_GLAPI *p_glVertexAttribL1dv)(GLuint,const GLdouble*); void (WINE_GLAPI *p_glVertexAttribL1dvEXT)(GLuint,const GLdouble*); - void (WINE_GLAPI *p_glVertexAttribL1i64NV)(GLuint,INT64); - void (WINE_GLAPI *p_glVertexAttribL1i64vNV)(GLuint,const INT64*); - void (WINE_GLAPI *p_glVertexAttribL1ui64NV)(GLuint,UINT64); - void (WINE_GLAPI *p_glVertexAttribL1ui64vNV)(GLuint,const UINT64*); + void (WINE_GLAPI *p_glVertexAttribL1i64NV)(GLuint,GLint64EXT); + void (WINE_GLAPI *p_glVertexAttribL1i64vNV)(GLuint,const GLint64EXT*); + void (WINE_GLAPI *p_glVertexAttribL1ui64ARB)(GLuint,GLuint64EXT); + void (WINE_GLAPI *p_glVertexAttribL1ui64NV)(GLuint,GLuint64EXT); + void (WINE_GLAPI *p_glVertexAttribL1ui64vARB)(GLuint,const GLuint64EXT*); + void (WINE_GLAPI *p_glVertexAttribL1ui64vNV)(GLuint,const GLuint64EXT*); void (WINE_GLAPI *p_glVertexAttribL2d)(GLuint,GLdouble,GLdouble); void (WINE_GLAPI *p_glVertexAttribL2dEXT)(GLuint,GLdouble,GLdouble); void (WINE_GLAPI *p_glVertexAttribL2dv)(GLuint,const GLdouble*); void (WINE_GLAPI *p_glVertexAttribL2dvEXT)(GLuint,const GLdouble*); - void (WINE_GLAPI *p_glVertexAttribL2i64NV)(GLuint,INT64,INT64); - void (WINE_GLAPI *p_glVertexAttribL2i64vNV)(GLuint,const INT64*); - void (WINE_GLAPI *p_glVertexAttribL2ui64NV)(GLuint,UINT64,UINT64); - void (WINE_GLAPI *p_glVertexAttribL2ui64vNV)(GLuint,const UINT64*); + void (WINE_GLAPI *p_glVertexAttribL2i64NV)(GLuint,GLint64EXT,GLint64EXT); + void (WINE_GLAPI *p_glVertexAttribL2i64vNV)(GLuint,const GLint64EXT*); + void (WINE_GLAPI *p_glVertexAttribL2ui64NV)(GLuint,GLuint64EXT,GLuint64EXT); + void (WINE_GLAPI *p_glVertexAttribL2ui64vNV)(GLuint,const GLuint64EXT*); void (WINE_GLAPI *p_glVertexAttribL3d)(GLuint,GLdouble,GLdouble,GLdouble); void (WINE_GLAPI *p_glVertexAttribL3dEXT)(GLuint,GLdouble,GLdouble,GLdouble); void (WINE_GLAPI *p_glVertexAttribL3dv)(GLuint,const GLdouble*); void (WINE_GLAPI *p_glVertexAttribL3dvEXT)(GLuint,const GLdouble*); - void (WINE_GLAPI *p_glVertexAttribL3i64NV)(GLuint,INT64,INT64,INT64); - void (WINE_GLAPI *p_glVertexAttribL3i64vNV)(GLuint,const INT64*); - void (WINE_GLAPI *p_glVertexAttribL3ui64NV)(GLuint,UINT64,UINT64,UINT64); - void (WINE_GLAPI *p_glVertexAttribL3ui64vNV)(GLuint,const UINT64*); + void (WINE_GLAPI *p_glVertexAttribL3i64NV)(GLuint,GLint64EXT,GLint64EXT,GLint64EXT); + void (WINE_GLAPI *p_glVertexAttribL3i64vNV)(GLuint,const GLint64EXT*); + void (WINE_GLAPI *p_glVertexAttribL3ui64NV)(GLuint,GLuint64EXT,GLuint64EXT,GLuint64EXT); + void (WINE_GLAPI *p_glVertexAttribL3ui64vNV)(GLuint,const GLuint64EXT*); void (WINE_GLAPI *p_glVertexAttribL4d)(GLuint,GLdouble,GLdouble,GLdouble,GLdouble); void (WINE_GLAPI *p_glVertexAttribL4dEXT)(GLuint,GLdouble,GLdouble,GLdouble,GLdouble); void (WINE_GLAPI *p_glVertexAttribL4dv)(GLuint,const GLdouble*); void (WINE_GLAPI *p_glVertexAttribL4dvEXT)(GLuint,const GLdouble*); - void (WINE_GLAPI *p_glVertexAttribL4i64NV)(GLuint,INT64,INT64,INT64,INT64); - void (WINE_GLAPI *p_glVertexAttribL4i64vNV)(GLuint,const INT64*); - void (WINE_GLAPI *p_glVertexAttribL4ui64NV)(GLuint,UINT64,UINT64,UINT64,UINT64); - void (WINE_GLAPI *p_glVertexAttribL4ui64vNV)(GLuint,const UINT64*); + void (WINE_GLAPI *p_glVertexAttribL4i64NV)(GLuint,GLint64EXT,GLint64EXT,GLint64EXT,GLint64EXT); + void (WINE_GLAPI *p_glVertexAttribL4i64vNV)(GLuint,const GLint64EXT*); + void (WINE_GLAPI *p_glVertexAttribL4ui64NV)(GLuint,GLuint64EXT,GLuint64EXT,GLuint64EXT,GLuint64EXT); + void (WINE_GLAPI *p_glVertexAttribL4ui64vNV)(GLuint,const GLuint64EXT*); void (WINE_GLAPI *p_glVertexAttribLFormat)(GLuint,GLint,GLenum,GLuint); void (WINE_GLAPI *p_glVertexAttribLFormatNV)(GLuint,GLint,GLenum,GLsizei); - void (WINE_GLAPI *p_glVertexAttribLPointer)(GLuint,GLint,GLenum,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glVertexAttribLPointerEXT)(GLuint,GLint,GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glVertexAttribLPointer)(GLuint,GLint,GLenum,GLsizei,const void*); + void (WINE_GLAPI *p_glVertexAttribLPointerEXT)(GLuint,GLint,GLenum,GLsizei,const void*); void (WINE_GLAPI *p_glVertexAttribP1ui)(GLuint,GLenum,GLboolean,GLuint); void (WINE_GLAPI *p_glVertexAttribP1uiv)(GLuint,GLenum,GLboolean,const GLuint*); void (WINE_GLAPI *p_glVertexAttribP2ui)(GLuint,GLenum,GLboolean,GLuint); @@ -2348,9 +2553,10 @@ struct opengl_funcs void (WINE_GLAPI *p_glVertexAttribP3uiv)(GLuint,GLenum,GLboolean,const GLuint*); void (WINE_GLAPI *p_glVertexAttribP4ui)(GLuint,GLenum,GLboolean,GLuint); void (WINE_GLAPI *p_glVertexAttribP4uiv)(GLuint,GLenum,GLboolean,const GLuint*); - void (WINE_GLAPI *p_glVertexAttribPointer)(GLuint,GLint,GLenum,GLboolean,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glVertexAttribPointerARB)(GLuint,GLint,GLenum,GLboolean,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glVertexAttribPointerNV)(GLuint,GLint,GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glVertexAttribParameteriAMD)(GLuint,GLenum,GLint); + void (WINE_GLAPI *p_glVertexAttribPointer)(GLuint,GLint,GLenum,GLboolean,GLsizei,const void*); + void (WINE_GLAPI *p_glVertexAttribPointerARB)(GLuint,GLint,GLenum,GLboolean,GLsizei,const void*); + void (WINE_GLAPI *p_glVertexAttribPointerNV)(GLuint,GLint,GLenum,GLsizei,const void*); void (WINE_GLAPI *p_glVertexAttribs1dvNV)(GLuint,GLsizei,const GLdouble*); void (WINE_GLAPI *p_glVertexAttribs1fvNV)(GLuint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glVertexAttribs1hvNV)(GLuint,GLsizei,const GLhalfNV*); @@ -2379,9 +2585,9 @@ struct opengl_funcs void (WINE_GLAPI *p_glVertexP3uiv)(GLenum,const GLuint*); void (WINE_GLAPI *p_glVertexP4ui)(GLenum,GLuint); void (WINE_GLAPI *p_glVertexP4uiv)(GLenum,const GLuint*); - void (WINE_GLAPI *p_glVertexPointerEXT)(GLint,GLenum,GLsizei,GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glVertexPointerListIBM)(GLint,GLenum,GLint,const GLvoid**,GLint); - void (WINE_GLAPI *p_glVertexPointervINTEL)(GLint,GLenum,const GLvoid**); + void (WINE_GLAPI *p_glVertexPointerEXT)(GLint,GLenum,GLsizei,GLsizei,const void*); + void (WINE_GLAPI *p_glVertexPointerListIBM)(GLint,GLenum,GLint,const void**,GLint); + void (WINE_GLAPI *p_glVertexPointervINTEL)(GLint,GLenum,const void**); void (WINE_GLAPI *p_glVertexStream1dATI)(GLenum,GLdouble); void (WINE_GLAPI *p_glVertexStream1dvATI)(GLenum,const GLdouble*); void (WINE_GLAPI *p_glVertexStream1fATI)(GLenum,GLfloat); @@ -2414,21 +2620,21 @@ struct opengl_funcs void (WINE_GLAPI *p_glVertexStream4ivATI)(GLenum,const GLint*); void (WINE_GLAPI *p_glVertexStream4sATI)(GLenum,GLshort,GLshort,GLshort,GLshort); void (WINE_GLAPI *p_glVertexStream4svATI)(GLenum,const GLshort*); - void (WINE_GLAPI *p_glVertexWeightPointerEXT)(GLint,GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glVertexWeightPointerEXT)(GLint,GLenum,GLsizei,const void*); void (WINE_GLAPI *p_glVertexWeightfEXT)(GLfloat); void (WINE_GLAPI *p_glVertexWeightfvEXT)(const GLfloat*); void (WINE_GLAPI *p_glVertexWeighthNV)(GLhalfNV); void (WINE_GLAPI *p_glVertexWeighthvNV)(const GLhalfNV*); - GLenum (WINE_GLAPI *p_glVideoCaptureNV)(GLuint,GLuint*,UINT64*); + GLenum (WINE_GLAPI *p_glVideoCaptureNV)(GLuint,GLuint*,GLuint64EXT*); void (WINE_GLAPI *p_glVideoCaptureStreamParameterdvNV)(GLuint,GLuint,GLenum,const GLdouble*); void (WINE_GLAPI *p_glVideoCaptureStreamParameterfvNV)(GLuint,GLuint,GLenum,const GLfloat*); void (WINE_GLAPI *p_glVideoCaptureStreamParameterivNV)(GLuint,GLuint,GLenum,const GLint*); void (WINE_GLAPI *p_glViewportArrayv)(GLuint,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glViewportIndexedf)(GLuint,GLfloat,GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glViewportIndexedfv)(GLuint,const GLfloat*); - void (WINE_GLAPI *p_glWaitSync)(GLvoid*,GLbitfield,UINT64); + void (WINE_GLAPI *p_glWaitSync)(GLsync,GLbitfield,GLuint64); void (WINE_GLAPI *p_glWeightPathsNV)(GLuint,GLsizei,const GLuint*,const GLfloat*); - void (WINE_GLAPI *p_glWeightPointerARB)(GLint,GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glWeightPointerARB)(GLint,GLenum,GLsizei,const void*); void (WINE_GLAPI *p_glWeightbvARB)(GLint,const GLbyte*); void (WINE_GLAPI *p_glWeightdvARB)(GLint,const GLdouble*); void (WINE_GLAPI *p_glWeightfvARB)(GLint,const GLfloat*); @@ -2494,7 +2700,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glWindowPos4sMESA)(GLshort,GLshort,GLshort,GLshort); void (WINE_GLAPI *p_glWindowPos4svMESA)(const GLshort*); void (WINE_GLAPI *p_glWriteMaskEXT)(GLuint,GLuint,GLenum,GLenum,GLenum,GLenum); - GLvoid* (WINE_GLAPI *p_wglAllocateMemoryNV)(GLsizei,GLfloat,GLfloat,GLfloat); + void* (WINE_GLAPI *p_wglAllocateMemoryNV)(GLsizei,GLfloat,GLfloat,GLfloat); BOOL (WINE_GLAPI *p_wglBindTexImageARB)(struct wgl_pbuffer *,int); BOOL (WINE_GLAPI *p_wglChoosePixelFormatARB)(HDC,const int*,const FLOAT*,UINT,int*,UINT*); struct wgl_context * (WINE_GLAPI *p_wglCreateContextAttribsARB)(HDC,struct wgl_context *,const int*); @@ -2502,8 +2708,8 @@ struct opengl_funcs BOOL (WINE_GLAPI *p_wglDestroyPbufferARB)(struct wgl_pbuffer *); void (WINE_GLAPI *p_wglFreeMemoryNV)(void*); HDC (WINE_GLAPI *p_wglGetCurrentReadDCARB)(void); - const GLubyte * (WINE_GLAPI *p_wglGetExtensionsStringARB)(HDC); - const GLubyte * (WINE_GLAPI *p_wglGetExtensionsStringEXT)(void); + const char* (WINE_GLAPI *p_wglGetExtensionsStringARB)(HDC); + const char* (WINE_GLAPI *p_wglGetExtensionsStringEXT)(void); HDC (WINE_GLAPI *p_wglGetPbufferDCARB)(struct wgl_pbuffer *); BOOL (WINE_GLAPI *p_wglGetPixelFormatAttribfvARB)(HDC,int,int,UINT,const int*,FLOAT*); BOOL (WINE_GLAPI *p_wglGetPixelFormatAttribivARB)(HDC,int,int,UINT,const int*,int*); diff --git a/include/reactos/wine/wined3d.h b/include/reactos/wine/wined3d.h index 7ddd4664bff..50bacdd59c1 100644 --- a/include/reactos/wine/wined3d.h +++ b/include/reactos/wine/wined3d.h @@ -26,6 +26,8 @@ #ifndef __WINE_WINED3D_H #define __WINE_WINED3D_H +#include + #define WINED3D_OK S_OK #define _FACWINED3D 0x876 @@ -249,6 +251,7 @@ enum wined3d_format_id WINED3DFMT_NULL = WINEMAKEFOURCC('N','U','L','L'), WINED3DFMT_R16 = WINEMAKEFOURCC(' ','R','1','6'), WINED3DFMT_AL16 = WINEMAKEFOURCC('A','L','1','6'), + WINED3DFMT_NV12 = WINEMAKEFOURCC('N','V','1','2'), WINED3DFMT_FORCE_DWORD = 0xffffffff }; @@ -707,6 +710,12 @@ enum wined3d_query_type WINED3D_QUERY_TYPE_CACHE_UTILIZATION = 18 }; +struct wined3d_query_data_timestamp_disjoint +{ + UINT64 frequency; + BOOL disjoint; +}; + #define WINED3DISSUE_BEGIN (1 << 1) #define WINED3DISSUE_END (1 << 0) #define WINED3DGETDATA_FLUSH (1 << 0) @@ -1217,6 +1226,7 @@ enum wined3d_display_rotation #define WINED3D_LEGACY_DEPTH_BIAS 0x00000001 #define WINED3D_NO3D 0x00000002 #define WINED3D_VIDMEM_ACCOUNTING 0x00000004 +#define WINED3D_PRESENT_CONVERSION 0x00000008 #define WINED3D_RESZ_CODE 0x7fa05000 @@ -1981,6 +1991,25 @@ struct wined3d_device_parent_ops struct wined3d_swapchain_desc *desc, struct wined3d_swapchain **swapchain); }; +struct wined3d_private_store +{ + struct list content; +}; + +struct wined3d_private_data +{ + struct list entry; + + GUID tag; + DWORD flags; /* DDSPD_* */ + DWORD size; + union + { + BYTE data[1]; + IUnknown *object; + } content; +}; + typedef HRESULT (CDECL *wined3d_device_reset_cb)(struct wined3d_resource *resource); void __stdcall wined3d_mutex_lock(void); @@ -2001,7 +2030,7 @@ HRESULT __cdecl wined3d_check_device_multisample_type(const struct wined3d *wine HRESULT __cdecl wined3d_check_device_type(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id display_format_id, enum wined3d_format_id backbuffer_format_id, BOOL windowed); -struct wined3d * __cdecl wined3d_create(UINT version, DWORD flags); +struct wined3d * __cdecl wined3d_create(DWORD flags); ULONG __cdecl wined3d_decref(struct wined3d *wined3d); HRESULT __cdecl wined3d_enum_adapter_modes(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_format_id format_id, enum wined3d_scanline_ordering scanline_ordering, @@ -2243,15 +2272,84 @@ enum wined3d_query_type __cdecl wined3d_query_get_type(const struct wined3d_quer ULONG __cdecl wined3d_query_incref(struct wined3d_query *query); HRESULT __cdecl wined3d_query_issue(struct wined3d_query *query, DWORD flags); -HRESULT __cdecl wined3d_resource_free_private_data(struct wined3d_resource *resource, REFGUID guid); +static inline void wined3d_private_store_init(struct wined3d_private_store *store) +{ + list_init(&store->content); +} + +static inline struct wined3d_private_data *wined3d_private_store_get_private_data( + const struct wined3d_private_store *store, const GUID *tag) +{ + struct wined3d_private_data *data; + struct list *entry; + + LIST_FOR_EACH(entry, &store->content) + { + data = LIST_ENTRY(entry, struct wined3d_private_data, entry); + if (IsEqualGUID(&data->tag, tag)) + return data; + } + return NULL; +} + +static inline void wined3d_private_store_free_private_data(struct wined3d_private_store *store, + struct wined3d_private_data *entry) +{ + if (entry->flags & WINED3DSPD_IUNKNOWN) + IUnknown_Release(entry->content.object); + list_remove(&entry->entry); + HeapFree(GetProcessHeap(), 0, entry); +} + +static inline void wined3d_private_store_cleanup(struct wined3d_private_store *store) +{ + struct wined3d_private_data *data; + struct list *e1, *e2; + + LIST_FOR_EACH_SAFE(e1, e2, &store->content) + { + data = LIST_ENTRY(e1, struct wined3d_private_data, entry); + wined3d_private_store_free_private_data(store, data); + } +} + +static inline HRESULT wined3d_private_store_set_private_data(struct wined3d_private_store *store, + const GUID *guid, const void *data, DWORD data_size, DWORD flags) +{ + struct wined3d_private_data *d, *old; + const void *ptr = data; + + if (flags & WINED3DSPD_IUNKNOWN) + { + if (data_size != sizeof(IUnknown *)) + return WINED3DERR_INVALIDCALL; + ptr = &data; + } + + if (!(d = HeapAlloc(GetProcessHeap(), 0, + FIELD_OFFSET(struct wined3d_private_data, content.data[data_size])))) + return E_OUTOFMEMORY; + + d->tag = *guid; + d->flags = flags; + d->size = data_size; + + memcpy(d->content.data, ptr, data_size); + if (flags & WINED3DSPD_IUNKNOWN) + IUnknown_AddRef(d->content.object); + + old = wined3d_private_store_get_private_data(store, guid); + if (old) + wined3d_private_store_free_private_data(store, old); + list_add_tail(&store->content, &d->entry); + + return WINED3D_OK; +} + void __cdecl wined3d_resource_get_desc(const struct wined3d_resource *resource, struct wined3d_resource_desc *desc); void * __cdecl wined3d_resource_get_parent(const struct wined3d_resource *resource); -HRESULT __cdecl wined3d_resource_get_private_data(const struct wined3d_resource *resource, - REFGUID guid, void *data, DWORD *data_size); void __cdecl wined3d_resource_set_parent(struct wined3d_resource *resource, void *parent); -HRESULT __cdecl wined3d_resource_set_private_data(struct wined3d_resource *resource, - REFGUID guid, const void *data, DWORD data_size, DWORD flags); HRESULT __cdecl wined3d_rendertarget_view_create(struct wined3d_resource *resource, void *parent, struct wined3d_rendertarget_view **rendertarget_view); diff --git a/include/reactos/wine/winedxgi.idl b/include/reactos/wine/winedxgi.idl index 363030a0018..26f29e385fd 100644 --- a/include/reactos/wine/winedxgi.idl +++ b/include/reactos/wine/winedxgi.idl @@ -23,7 +23,7 @@ import "dxgi.idl"; local, uuid(a07ad9ab-fb01-4574-8bfb-0a70a7373f04) ] -interface IWineDXGIFactory : IDXGIFactory +interface IWineDXGIFactory : IDXGIFactory1 { struct wined3d *get_wined3d(); } @@ -33,7 +33,7 @@ interface IWineDXGIFactory : IDXGIFactory local, uuid(ab1de34c-2963-4ffd-8493-40f580e510e5) ] -interface IWineDXGIAdapter : IDXGIAdapter +interface IWineDXGIAdapter : IDXGIAdapter1 { UINT get_ordinal(); } diff --git a/lib/3rdparty/libwine/debug.c b/lib/3rdparty/libwine/debug.c index b95249cbacc..1bf8dc1c133 100644 --- a/lib/3rdparty/libwine/debug.c +++ b/lib/3rdparty/libwine/debug.c @@ -247,7 +247,23 @@ int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *chan if (!(__wine_dbg_get_channel_flags( channel ) & (1 << cls))) return -1; va_start(valist, format); - ret = funcs.dbg_vlog( cls, channel, func, format, valist ); + ret = funcs.dbg_vlog( cls, channel, NULL, func, 0, format, valist ); + va_end(valist); + return ret; +} + + +/* ReactOS compliant debug format wrapper for funcs.dbg_vlog */ +int ros_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *channel, + const char *file, const char *func, const int line, const char *format, ... ) +{ + int ret; + va_list valist; + + if (!(__wine_dbg_get_channel_flags( channel ) & (1 << cls))) return -1; + + va_start(valist, format); + ret = funcs.dbg_vlog( cls, channel, file, func, line, format, valist ); va_end(valist); return ret; } @@ -396,12 +412,18 @@ static int default_dbg_vprintf( const char *format, va_list args ) /* default implementation of wine_dbg_vlog */ static int default_dbg_vlog( enum __wine_debug_class cls, struct __wine_debug_channel *channel, - const char *func, const char *format, va_list args ) + const char *file, const char *func, const int line, const char *format, va_list args ) { int ret = 0; if (cls < sizeof(debug_classes)/sizeof(debug_classes[0])) - ret += wine_dbg_printf( "%s:%s:%s ", debug_classes[cls], channel->name, func ); + ret += wine_dbg_printf( "%s:", debug_classes[cls] ); + + if (file && line) + ret += wine_dbg_printf ( "(%s:%d) ", file, line ); + else + ret += wine_dbg_printf( "%s:%s: ", channel->name, func ); + if (format) ret += funcs.dbg_vprintf( format, args ); return ret; diff --git a/lib/3rdparty/libxml2/CMakeLists.txt b/lib/3rdparty/libxml2/CMakeLists.txt index a983a3659d8..b0062c36feb 100644 --- a/lib/3rdparty/libxml2/CMakeLists.txt +++ b/lib/3rdparty/libxml2/CMakeLists.txt @@ -1,7 +1,8 @@ include_directories( include - ${REACTOS_SOURCE_DIR}/lib/3rdparty/libwin-iconv) + ${REACTOS_SOURCE_DIR}/lib/3rdparty/libwin-iconv + ${REACTOS_SOURCE_DIR}/include/reactos/libs/zlib) add_definitions( -D__MINGW32__ @@ -12,7 +13,6 @@ add_definitions( -D_WINDOWS -DWIN32 -DHAVE_CONFIG_H - -DLIBXML_ICONV_ENABLED -DICONV_CONST=const -D_DLL -D__USE_CRTIMP) diff --git a/lib/3rdparty/libxml2/Copyright b/lib/3rdparty/libxml2/Copyright index 417e95531fd..d61318502ca 100644 --- a/lib/3rdparty/libxml2/Copyright +++ b/lib/3rdparty/libxml2/Copyright @@ -2,7 +2,7 @@ Except where otherwise noted in the source code (e.g. the files hash.c, list.c and the trio files, which are covered by a similar licence but with different Copyright notices) all the files are: - Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved. + Copyright (C) 1998-2012 Daniel Veillard. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -17,11 +17,7 @@ all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- -NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Daniel Veillard shall not -be used in advertising or otherwise to promote the sale, use or other deal- -ings in this Software without prior written authorization from him. - +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/lib/3rdparty/libxml2/HTMLparser.c b/lib/3rdparty/libxml2/HTMLparser.c index a533f375c4b..dd0c1ead910 100644 --- a/lib/3rdparty/libxml2/HTMLparser.c +++ b/lib/3rdparty/libxml2/HTMLparser.c @@ -3561,7 +3561,7 @@ htmlCheckEncodingDirect(htmlParserCtxtPtr ctxt, const xmlChar *encoding) { */ processed = ctxt->input->cur - ctxt->input->base; xmlBufShrink(ctxt->input->buf->buffer, processed); - nbchars = xmlCharEncInput(ctxt->input->buf); + nbchars = xmlCharEncInput(ctxt->input->buf, 1); if (nbchars < 0) { htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, "htmlCheckEncoding: encoder error\n", @@ -6054,13 +6054,16 @@ htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size, if ((in->encoder != NULL) && (in->buffer != NULL) && (in->raw != NULL)) { int nbchars; + size_t base = xmlBufGetInputBase(in->buffer, ctxt->input); + size_t current = ctxt->input->cur - ctxt->input->base; - nbchars = xmlCharEncInput(in); + nbchars = xmlCharEncInput(in, terminate); if (nbchars < 0) { htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, "encoder error\n", NULL, NULL); return(XML_ERR_INVALID_ENCODING); } + xmlBufSetInputBaseCur(in->buffer, ctxt->input, base, current); } } } diff --git a/lib/3rdparty/libxml2/INSTALL b/lib/3rdparty/libxml2/INSTALL deleted file mode 100644 index a1e89e18ad2..00000000000 --- a/lib/3rdparty/libxml2/INSTALL +++ /dev/null @@ -1,370 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, -Inc. - - Copying and distribution of this file, with or without modification, -are permitted in any medium without royalty provided the copyright -notice and this notice are preserved. This file is offered as-is, -without warranty of any kind. - -Basic Installation -================== - - Briefly, the shell commands `./configure; make; make install' should -configure, build, and install this package. The following -more-detailed instructions are generic; see the `README' file for -instructions specific to this package. Some packages provide this -`INSTALL' file but do not implement all of the features documented -below. The lack of an optional feature in a given package is not -necessarily a bug. More recommendations for GNU packages can be found -in *note Makefile Conventions: (standards)Makefile Conventions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. Caching is -disabled by default to prevent problems with accidental use of stale -cache files. - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You need `configure.ac' if -you want to change it or regenerate `configure' using a newer version -of `autoconf'. - - The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. - - Running `configure' might take a while. While running, it prints - some messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package, generally using the just-built uninstalled binaries. - - 4. Type `make install' to install the programs and any data files and - documentation. When installing into a prefix owned by root, it is - recommended that the package be configured and built as a regular - user, and only the `make install' phase executed with root - privileges. - - 5. Optionally, type `make installcheck' to repeat any self-tests, but - this time using the binaries in their final installed location. - This target does not install anything. Running this target as a - regular user, particularly if the prior `make install' required - root privileges, verifies that the installation completed - correctly. - - 6. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - - 7. Often, you can also type `make uninstall' to remove the installed - files again. In practice, not all packages have tested that - uninstallation works correctly, even though it is required by the - GNU Coding Standards. - - 8. Some packages, particularly those that use Automake, provide `make - distcheck', which can by used by developers to test that all other - targets like `make install' and `make uninstall' work correctly. - This target is generally not run by end users. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. Run `./configure --help' -for details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c99 CFLAGS=-g LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. This -is known as a "VPATH" build. - - With a non-GNU `make', it is safer to compile the package for one -architecture at a time in the source code directory. After you have -installed the package for one architecture, use `make distclean' before -reconfiguring for another architecture. - - On MacOS X 10.5 and later systems, you can create libraries and -executables that work on multiple system types--known as "fat" or -"universal" binaries--by specifying multiple `-arch' options to the -compiler but only a single `-arch' option to the preprocessor. Like -this: - - ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CPP="gcc -E" CXXCPP="g++ -E" - - This is not guaranteed to produce working output in all cases, you -may have to build one architecture at a time and combine the results -using the `lipo' tool if you have problems. - -Installation Names -================== - - By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX', where PREFIX must be an -absolute file name. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. In general, the -default for these options is expressed in terms of `${prefix}', so that -specifying just `--prefix' will affect all of the other directory -specifications that were not explicitly provided. - - The most portable way to affect installation locations is to pass the -correct locations to `configure'; however, many packages provide one or -both of the following shortcuts of passing variable assignments to the -`make install' command line to change installation locations without -having to reconfigure or recompile. - - The first method involves providing an override variable for each -affected directory. For example, `make install -prefix=/alternate/directory' will choose an alternate location for all -directory configuration variables that were expressed in terms of -`${prefix}'. Any directories that were specified during `configure', -but not in terms of `${prefix}', must each be overridden at install -time for the entire installation to be relocated. The approach of -makefile variable overrides for each directory variable is required by -the GNU Coding Standards, and ideally causes no recompilation. -However, some platforms have known limitations with the semantics of -shared libraries that end up requiring recompilation when using this -method, particularly noticeable in packages that use GNU Libtool. - - The second method involves providing the `DESTDIR' variable. For -example, `make install DESTDIR=/alternate/directory' will prepend -`/alternate/directory' before all installation names. The approach of -`DESTDIR' overrides is not required by the GNU Coding Standards, and -does not work on platforms that have drive letters. On the other hand, -it does better at avoiding recompilation issues, and works well even -when some directory options were not specified in terms of `${prefix}' -at `configure' time. - -Optional Features -================= - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - - Some packages offer the ability to configure how verbose the -execution of `make' will be. For these packages, running `./configure ---enable-silent-rules' sets the default to minimal output, which can be -overridden with `make V=1'; while running `./configure ---disable-silent-rules' sets the default to verbose, which can be -overridden with `make V=0'. - -Particular systems -================== - - On HP-UX, the default C compiler is not ANSI C compatible. If GNU -CC is not installed, it is recommended to use the following options in -order to use an ANSI C compiler: - - ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" - -and if that doesn't work, install pre-built binaries of GCC for HP-UX. - - HP-UX `make' updates targets which have the same time stamps as -their prerequisites, which makes it generally unusable when shipped -generated files such as `configure' are involved. Use GNU `make' -instead. - - On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot -parse its `' header file. The option `-nodtk' can be used as -a workaround. If GNU CC is not installed, it is therefore recommended -to try - - ./configure CC="cc" - -and if that doesn't work, try - - ./configure CC="cc -nodtk" - - On Solaris, don't put `/usr/ucb' early in your `PATH'. This -directory contains several dysfunctional programs; working variants of -these programs are available in `/usr/bin'. So, if you need `/usr/ucb' -in your `PATH', put it _after_ `/usr/bin'. - - On Haiku, software installed for all users goes in `/boot/common', -not `/usr/local'. It is recommended to use the following options: - - ./configure --prefix=/boot/common - -Specifying the System Type -========================== - - There may be some features `configure' cannot figure out -automatically, but needs to determine by the type of machine the package -will run on. Usually, assuming the package is built to be run on the -_same_ architectures, `configure' can figure that out, but if it prints -a message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS - KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - - Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). - -Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf bug. Until the bug is fixed you can use this workaround: - - CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash - -`configure' Invocation -====================== - - `configure' recognizes the following options to control how it -operates. - -`--help' -`-h' - Print a summary of all of the options to `configure', and exit. - -`--help=short' -`--help=recursive' - Print a summary of the options unique to this package's - `configure', and exit. The `short' variant lists options used - only in the top level, while the `recursive' variant lists options - also present in any nested packages. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--prefix=DIR' - Use DIR as the installation prefix. *note Installation Names:: - for more details, including other options available for fine-tuning - the installation locations. - -`--no-create' -`-n' - Run the configure checks, but stop before creating any output - files. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/lib/3rdparty/libxml2/Makefile.am b/lib/3rdparty/libxml2/Makefile.am deleted file mode 100644 index a4a9f87c12c..00000000000 --- a/lib/3rdparty/libxml2/Makefile.am +++ /dev/null @@ -1,1275 +0,0 @@ -## Process this file with automake to produce Makefile.in - -ACLOCAL_AMFLAGS = -I m4 - -SUBDIRS = include . doc example xstc $(PYTHON_SUBDIR) - -DIST_SUBDIRS = include . doc example python xstc - -AM_CPPFLAGS = -I$(top_builddir)/include -I$(srcdir)/include - -AM_CFLAGS = $(THREAD_CFLAGS) $(Z_CFLAGS) $(LZMA_CFLAGS) - -noinst_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \ - testThreads testC14N testAutomata testRegexp \ - testReader testapi testModule runtest runsuite testchar \ - testdict runxmlconf testrecurse testlimits - -bin_PROGRAMS = xmllint xmlcatalog - -bin_SCRIPTS=xml2-config - -lib_LTLIBRARIES = libxml2.la -libxml2_la_LIBADD = $(ICU_LIBS) $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) $(WIN32_EXTRA_LIBADD) - -if USE_VERSION_SCRIPT -LIBXML2_VERSION_SCRIPT = $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxml2.syms -else -LIBXML2_VERSION_SCRIPT = -endif - -libxml2_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) \ - $(LIBXML2_VERSION_SCRIPT) \ - -version-info $(LIBXML_VERSION_INFO) \ - $(MODULE_PLATFORM_LIBS) - -if WITH_SAX1_SOURCES -docb_sources = DOCBparser.c -else -docb_sources = -endif - -if WITH_TRIO_SOURCES -trio_sources = triostr.c trio.c -else -trio_sources = -endif - -libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \ - parser.c tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c \ - valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c xpath.c \ - xpointer.c xinclude.c nanohttp.c nanoftp.c \ - $(docb_sources) \ - catalog.c globals.c threads.c c14n.c xmlstring.c buf.c \ - xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \ - $(trio_sources) \ - xmlreader.c relaxng.c dict.c SAX2.c \ - xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c \ - xmlmodule.c schematron.c xzlib.c - -DEPS = $(top_builddir)/libxml2.la -LDADDS = $(STATIC_BINARIES) $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) $(WIN32_EXTRA_LIBADD) - - -man_MANS = xml2-config.1 libxml.3 - -m4datadir = $(datadir)/aclocal -m4data_DATA = libxml.m4 - -runtest_SOURCES=runtest.c -runtest_LDFLAGS = -runtest_DEPENDENCIES = $(DEPS) -runtest_LDADD= $(BASE_THREAD_LIBS) $(RDL_LIBS) $(LDADDS) - -testrecurse_SOURCES=testrecurse.c -testrecurse_LDFLAGS = -testrecurse_DEPENDENCIES = $(DEPS) -testrecurse_LDADD= $(BASE_THREAD_LIBS) $(RDL_LIBS) $(LDADDS) - -testlimits_SOURCES=testlimits.c -testlimits_LDFLAGS = -testlimits_DEPENDENCIES = $(DEPS) -testlimits_LDADD= $(BASE_THREAD_LIBS) $(RDL_LIBS) $(LDADDS) - -testchar_SOURCES=testchar.c -testchar_LDFLAGS = -testchar_DEPENDENCIES = $(DEPS) -testchar_LDADD= $(RDL_LIBS) $(LDADDS) - -testdict_SOURCES=testdict.c -testdict_LDFLAGS = -testdict_DEPENDENCIES = $(DEPS) -testdict_LDADD= $(RDL_LIBS) $(LDADDS) - -runsuite_SOURCES=runsuite.c -runsuite_LDFLAGS = -runsuite_DEPENDENCIES = $(DEPS) -runsuite_LDADD= $(RDL_LIBS) $(LDADDS) - -xmllint_SOURCES=xmllint.c -xmllint_LDFLAGS = -xmllint_DEPENDENCIES = $(DEPS) -xmllint_LDADD= $(RDL_LIBS) $(LDADDS) - -testSAX_SOURCES=testSAX.c -testSAX_LDFLAGS = -testSAX_DEPENDENCIES = $(DEPS) -testSAX_LDADD= $(LDADDS) - -testHTML_SOURCES=testHTML.c -testHTML_LDFLAGS = -testHTML_DEPENDENCIES = $(DEPS) -testHTML_LDADD= $(LDADDS) - -xmlcatalog_SOURCES=xmlcatalog.c -xmlcatalog_LDFLAGS = -xmlcatalog_DEPENDENCIES = $(DEPS) -xmlcatalog_LDADD = $(RDL_LIBS) $(LDADDS) - -testXPath_SOURCES=testXPath.c -testXPath_LDFLAGS = -testXPath_DEPENDENCIES = $(DEPS) -testXPath_LDADD= $(LDADDS) - -testC14N_SOURCES=testC14N.c -testC14N_LDFLAGS = -testC14N_DEPENDENCIES = $(DEPS) -testC14N_LDADD= $(LDADDS) - -if THREADS_W32 -testThreads_SOURCES = testThreadsWin32.c -else -testThreads_SOURCES = testThreads.c -endif -testThreads_LDFLAGS = -testThreads_DEPENDENCIES = $(DEPS) -testThreads_LDADD= $(BASE_THREAD_LIBS) $(LDADDS) - -testURI_SOURCES=testURI.c -testURI_LDFLAGS = -testURI_DEPENDENCIES = $(DEPS) -testURI_LDADD= $(LDADDS) - -testRegexp_SOURCES=testRegexp.c -testRegexp_LDFLAGS = -testRegexp_DEPENDENCIES = $(DEPS) -testRegexp_LDADD= $(LDADDS) - -testAutomata_SOURCES=testAutomata.c -testAutomata_LDFLAGS = -testAutomata_DEPENDENCIES = $(DEPS) -testAutomata_LDADD= $(LDADDS) - -testSchemas_SOURCES=testSchemas.c -testSchemas_LDFLAGS = -testSchemas_DEPENDENCIES = $(DEPS) -testSchemas_LDADD= $(LDADDS) - -testRelax_SOURCES=testRelax.c -testRelax_LDFLAGS = -testRelax_DEPENDENCIES = $(DEPS) -testRelax_LDADD= $(LDADDS) - -testReader_SOURCES=testReader.c -testReader_LDFLAGS = -testReader_DEPENDENCIES = $(DEPS) -testReader_LDADD= $(LDADDS) - -testModule_SOURCES=testModule.c -testModule_LDFLAGS = -testModule_DEPENDENCIES = $(DEPS) -testModule_LDADD= $(LDADDS) - -noinst_LTLIBRARIES = testdso.la -testdso_la_SOURCES = testdso.c -testdso_la_LDFLAGS = -module -no-undefined -avoid-version -rpath $(libdir) - -# that one forces the rebuild when "make rebuild" is run on doc/ -rebuild_testapi: - -@(if [ "$(PYTHON)" != "" ] ; then \ - $(PYTHON) $(srcdir)/gentest.py $(srcdir) ; fi ) - -# that one is just to make sure it is rebuilt if missing -# but adding the dependances generate mess -testapi.c: $(srcdir)/gentest.py - -@(if [ "$(PYTHON)" != "" ] ; then \ - $(PYTHON) $(srcdir)/gentest.py $(srcdir) ; fi ) - -BUILT_SOURCES = testapi.c - -testapi_SOURCES=testapi.c -testapi_LDFLAGS = -testapi_DEPENDENCIES = $(DEPS) -testapi_LDADD= $(LDADDS) - -runxmlconf_SOURCES=runxmlconf.c -runxmlconf_LDFLAGS = -runxmlconf_DEPENDENCIES = $(DEPS) -runxmlconf_LDADD= $(LDADDS) - -#testOOM_SOURCES=testOOM.c testOOMlib.h testOOMlib.c -#testOOM_LDFLAGS = -#testOOM_DEPENDENCIES = $(DEPS) -#testOOM_LDADD= $(LDADDS) - -runtests: - [ -d test ] || $(LN_S) $(srcdir)/test . - [ -d result ] || $(LN_S) $(srcdir)/result . - $(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testrecurse$(EXEEXT) &&$(CHECKER) ./testapi$(EXEEXT) && $(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT) - @(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \ - $(MAKE) tests ; fi) - -check: all runtests - -check-valgrind valgrind: all - @echo '## Running the regression tests under Valgrind' - @echo '## Go get a cup of coffee it is gonna take a while ...' - $(MAKE) CHECKER='valgrind -q' runtests - -testall : tests SVGtests SAXtests - -tests: XMLtests XMLenttests NStests IDtests Errtests APItests $(READER_TEST) $(TEST_SAX) $(TEST_PUSH) $(TEST_HTML) $(TEST_PHTML) $(TEST_VALID) URItests $(TEST_PATTERN) $(TEST_XPATH) $(TEST_XPTR) $(TEST_XINCLUDE) $(TEST_C14N) $(TEST_DEBUG) $(TEST_CATALOG) $(TEST_REGEXPS) $(TEST_SCHEMAS) $(TEST_SCHEMATRON) $(TEST_THREADS) Timingtests $(TEST_VTIME) $(PYTHON_TESTS) $(TEST_MODULES) - @(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \ - $(MAKE) tests ; fi) - @(cd doc/examples ; $(MAKE) tests) - -APItests: testapi$(EXEEXT) - @echo "## Running the API regression tests this may take a little while" - -@($(CHECKER) $(top_builddir)/testapi -q) - -HTMLtests : testHTML$(EXEEXT) - @(echo > .memdump) - @echo "## HTML regression tests" - -@(for i in $(srcdir)/test/HTML/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testHTML $$i > $(srcdir)/result/HTML/$$name 2>$(srcdir)/result/HTML/$$name.err ; \ - else \ - log=`$(CHECKER) $(top_builddir)/testHTML $$i > result.$$name 2> error.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/HTML/$$name result.$$name ; \ - diff -b $(srcdir)/result/HTML/$$name.err error.$$name ; \ - $(CHECKER) $(top_builddir)/testHTML result.$$name > result2.$$name 2>error.$$name ; \ - diff result.$$name result2.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name result2.$$name error.$$name ; \ - fi ; fi ; done) - -HTMLPushtests : testHTML$(EXEEXT) - @echo "## Push HTML regression tests" - -@(for i in $(srcdir)/test/HTML/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testHTML --push $$i > $(srcdir)/result/HTML/$$name 2>$(srcdir)/result/HTML/$$name.err ; \ - else \ - log=`$(CHECKER) $(top_builddir)/testHTML --push $$i > result.$$name 2> error.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/HTML/$$name result.$$name ; \ - cut -b 1-15 $(srcdir)/result/HTML/$$name.err > errorcut.$$name; \ - cut -b 1-15 error.$$name > errorcut2.$$name; \ - diff -b errorcut.$$name errorcut2.$$name ; \ - $(CHECKER) $(top_builddir)/testHTML --push result.$$name > result2.$$name 2>error.$$name ; \ - diff result.$$name result2.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name result2.$$name error.$$name errorcut.$$name errorcut2.$$name ; \ - fi ; fi ; done) - @echo "## HTML SAX regression tests" - -@(for i in $(srcdir)/test/HTML/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/HTML/$$name.sax ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testHTML --sax $$i > $(srcdir)/result/HTML/$$name.sax ; \ - else \ - log=`$(CHECKER) $(top_builddir)/testHTML --sax $$i > result.$$name.sax ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/HTML/$$name.sax result.$$name.sax` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name.sax ; \ - fi ; fi ; done) - @echo "## Push HTML SAX regression tests" - -@(for i in $(srcdir)/test/HTML/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testHTML --push --sax $$i > $(srcdir)/result/HTML/$$name.sax ; \ - else \ - log=`$(CHECKER) $(top_builddir)/testHTML --push --sax $$i 2>&1 > result.$$name.sax ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/HTML/$$name.sax result.$$name.sax` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name.sax ; \ - fi ; fi ; done) - -XMLtests : xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## XML regression tests" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint $$i > $(srcdir)/result/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff $(srcdir)/result/$$name result.$$name ; \ - $(CHECKER) $(top_builddir)/xmllint result.$$name 2>&1 > result2.$$name | grep -v 'failed to load external entity' ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff result.$$name result2.$$name` ;\ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name result2.$$name ; \ - fi ; fi ; done) - @echo "## XML regression tests on memory" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --memory $$i > $(srcdir)/result/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --memory $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/$$name result.$$name ; \ - $(CHECKER) $(top_builddir)/xmllint --memory result.$$name 2>&1 > result2.$$name | grep -v 'failed to load external entity' ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"`; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - diff result.$$name result2.$$name ; \ - rm result.$$name result2.$$name ; \ - fi ; fi ; done) - -XMLPushtests: xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## XML push regression tests" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --push $$i > $(srcdir)/result/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --push $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff $(srcdir)/result/$$name result.$$name ; \ - $(CHECKER) $(top_builddir)/xmllint --push result.$$name 2>&1 > result2.$$name | grep -v 'failed to load external entity' ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff result.$$name result2.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name result2.$$name ; \ - fi ; fi ; done) - -NStests : xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## XML Namespaces regression tests" - -@(for i in $(srcdir)/test/namespaces/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/namespaces/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint $$i \ - 2> $(srcdir)/result/namespaces/$$name.err \ - > $(srcdir)/result/namespaces/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint $$i 2> error.$$name > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff $(srcdir)/result/namespaces/$$name result.$$name ; \ - diff $(srcdir)/result/namespaces/$$name.err error.$$name`; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name error.$$name ; \ - fi ; fi ; done) - -IDtests : xmllint$(EXEEXT) testXPath$(EXEEXT) - @(echo > .memdump) - @echo "## xml:id regression tests" - -@(for i in $(srcdir)/test/xmlid/id_*.xml ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/xmlid/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testXPath -i $$i "id('bar')" \ - 2> $(srcdir)/result/xmlid/$$name.err \ - > $(srcdir)/result/xmlid/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/testXPath -i $$i "id('bar')" 2> error.$$name > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff $(srcdir)/result/xmlid/$$name result.$$name ; \ - diff $(srcdir)/result/xmlid/$$name.err error.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name error.$$name ; \ - fi ; fi ; done) - -Errtests : xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## Error cases regression tests" - -@(for i in $(srcdir)/test/errors/*.xml ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/errors/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint $$i \ - 2> $(srcdir)/result/errors/$$name.err \ - > $(srcdir)/result/errors/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint $$i 2> error.$$name > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff $(srcdir)/result/errors/$$name result.$$name ; \ - diff $(srcdir)/result/errors/$$name.err error.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name error.$$name ; \ - fi ; fi ; done) - @echo "## Error cases stream regression tests" - -@(for i in $(srcdir)/test/errors/*.xml ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/errors/$$name.str ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --stream $$i \ - 2> $(srcdir)/result/errors/$$name.str \ - > /dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --stream $$i 2> error.$$name > /dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff $(srcdir)/result/errors/$$name.str error.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm error.$$name ; \ - fi ; fi ; done) - -Docbtests : xmllint$(EXEEXT) - -XMLenttests : xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## XML entity subst regression tests" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/noent/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --noent $$i > $(srcdir)/result/noent/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --noent $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff $(srcdir)/result/noent/$$name result.$$name ; \ - $(CHECKER) $(top_builddir)/xmllint --noent result.$$name 2>&1 > result2.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff result.$$name result2.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name result2.$$name ; \ - fi ; fi ; done) - -URItests : testURI$(EXEEXT) - @(echo > .memdump) - @echo "## URI module regression tests" - -@(for i in $(srcdir)/test/URI/*.data ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/URI/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testURI -base 'http://foo.com/path/to/index.html?orig#help' < $$i > $(srcdir)/result/URI/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/testURI -base 'http://foo.com/path/to/index.html?orig#help' < $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/URI/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - -@(for i in $(srcdir)/test/URI/*.uri ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/URI/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testURI < $$i > $(srcdir)/result/URI/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/testURI < $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/URI/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - -XPathtests : testXPath$(EXEEXT) - @(echo > .memdump) - @echo "## XPath regression tests" - -@(if [ "`$(top_builddir)/testXPath | grep 'support not compiled in'`" != "" ] ; \ - then echo Skipping debug not compiled in ; exit 0 ; fi ; \ - for i in $(srcdir)/test/XPath/expr/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/XPath/expr/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testXPath -f --expr $$i > $(srcdir)/result/XPath/expr/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/testXPath -f --expr $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/XPath/expr/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done ; \ - for i in $(srcdir)/test/XPath/docs/* ; do \ - if [ ! -d $$i ] ; then \ - doc=`basename $$i`; \ - for j in $(srcdir)/test/XPath/tests/$$doc* ; do \ - if [ ! -f $$j ] ; then continue ; fi ; \ - name=`basename $$j`; \ - if [ ! -d $$j ] ; then \ - if [ ! -f $(srcdir)/result/XPath/tests/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testXPath -f -i $$i $$j > $(srcdir)/result/XPath/tests/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/testXPath -f -i $$i $$j 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/XPath/tests/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done ; fi ; done) - -XPtrtests : testXPath$(EXEEXT) - @(echo > .memdump) - @echo "## XPointer regression tests" - -@(if [ "`$(top_builddir)/testXPath | grep 'support not compiled in'`" != "" ] ; \ - then echo Skipping debug not compiled in ; exit 0 ; fi ; \ - for i in $(srcdir)/test/XPath/docs/* ; do \ - if [ ! -d $$i ] ; then \ - doc=`basename $$i`; \ - for j in $(srcdir)/test/XPath/xptr/$$doc* ; do \ - if [ ! -f $$j ] ; then continue ; fi ; \ - name=`basename $$j`; \ - if [ ! -d $$j ] ; then \ - if [ ! -f $(srcdir)/result/XPath/xptr/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testXPath -xptr -f -i $$i $$j > $(srcdir)/result/XPath/xptr/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/testXPath -xptr -f -i $$i $$j 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/XPath/xptr/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done ; fi ; done) - -XIncludetests : xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## XInclude regression tests" - -@(for i in $(srcdir)/test/XInclude/docs/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/XInclude/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude $$i > $(srcdir)/result/XInclude/$$name 2> $(srcdir)/result/XInclude/$$name.err ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude $$i > result.$$name 2>error.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/XInclude/$$name result.$$name ; \ - diff $(srcdir)/result/XInclude/$$name.err error.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name error.$$name ; \ - fi ; fi ; done) - -@(for i in $(srcdir)/test/XInclude/docs/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/XInclude/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --nowarning --noxincludenode $$i > $(srcdir)/result/XInclude/$$name 2> $(srcdir)/result/XInclude/$$name.err ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --noxincludenode $$i > result.$$name 2>error.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/XInclude/$$name result.$$name ; \ - diff $(srcdir)/result/XInclude/$$name.err error.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name error.$$name ; \ - fi ; fi ; done) - @(echo > .memdump) - @echo "## XInclude xmlReader regression tests" - -@(for i in $(srcdir)/test/XInclude/docs/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/XInclude/$$name.rdr ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude --stream --debug $$i > $(srcdir)/result/XInclude/$$name.rdr ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude --stream --debug $$i > result.$$name 2>error.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/XInclude/$$name.err error.$$name ; \ - diff $(srcdir)/result/XInclude/$$name.rdr result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name error.$$name ; \ - fi ; fi ; done) - -@(for i in $(srcdir)/test/XInclude/docs/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/XInclude/$$name.rdr ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --nowarning --noxincludenode --stream --debug $$i > $(srcdir)/result/XInclude/$$name.rdr ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude --stream --debug $$i > result.$$name 2>error.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/XInclude/$$name.err error.$$name ; \ - diff $(srcdir)/result/XInclude/$$name.rdr result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name error.$$name ; \ - fi ; fi ; done) - -Scripttests : xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## Scripts regression tests" - @echo "## Some of the base computations may be different if srcdir != ." - -@(for i in $(srcdir)/test/scripts/*.script ; do \ - name=`basename $$i .script`; \ - xml=$(srcdir)/test/scripts/`basename $$i .script`.xml; \ - if [ -f $$xml ] ; then \ - if [ ! -f $(srcdir)/result/scripts/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --shell $$xml < $$i > $(srcdir)/result/scripts/$$name 2> $(srcdir)/result/scripts/$$name.err ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --shell $$xml < $$i > result.$$name 2> result.$$name.err ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/scripts/$$name result.$$name ; \ - diff $(srcdir)/result/scripts/$$name.err result.$$name.err` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name result.$$name.err ; \ - fi ; fi ; done) - -Catatests : xmlcatalog$(EXEEXT) - @(echo > .memdump) - @echo "## Catalog regression tests" - -@(for i in $(srcdir)/test/catalogs/*.script ; do \ - name=`basename $$i .script`; \ - xml=$(srcdir)/test/catalogs/`basename $$i .script`.xml; \ - if [ -f $$xml ] ; then \ - if [ ! -f $(srcdir)/result/catalogs/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmlcatalog --shell $$xml < $$i 2>&1 > $(srcdir)/result/catalogs/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmlcatalog --shell $$xml < $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/catalogs/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - -@(for i in $(srcdir)/test/catalogs/*.script ; do \ - name=`basename $$i .script`; \ - sgml=$(srcdir)/test/catalogs/`basename $$i .script`.sgml; \ - if [ -f $$sgml ] ; then \ - if [ ! -f $(srcdir)/result/catalogs/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmlcatalog --shell $$sgml < $$i > $(srcdir)/result/catalogs/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmlcatalog --shell $$sgml < $$i > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/catalogs/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - @echo "## Add and del operations on XML Catalogs" - -@($(CHECKER) $(top_builddir)/xmlcatalog --create --noout $(srcdir)/result/catalogs/mycatalog; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - $(CHECKER) $(top_builddir)/xmlcatalog --noout --add public Pubid sysid $(srcdir)/result/catalogs/mycatalog; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - $(CHECKER) $(top_builddir)/xmlcatalog --noout --add public Pubid2 sysid2 $(srcdir)/result/catalogs/mycatalog; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - $(CHECKER) $(top_builddir)/xmlcatalog --noout --add public Pubid3 sysid3 $(srcdir)/result/catalogs/mycatalog; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff result/catalogs/mycatalog.full $(srcdir)/result/catalogs/mycatalog; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - $(CHECKER) $(top_builddir)/xmlcatalog --noout --del sysid $(srcdir)/result/catalogs/mycatalog; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - $(CHECKER) $(top_builddir)/xmlcatalog --noout --del sysid3 $(srcdir)/result/catalogs/mycatalog; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - $(CHECKER) $(top_builddir)/xmlcatalog --noout --del sysid2 $(srcdir)/result/catalogs/mycatalog; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff result/catalogs/mycatalog.empty $(srcdir)/result/catalogs/mycatalog; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - rm -f $(srcdir)/result/catalogs/mycatalog) - -SVGtests : xmllint$(EXEEXT) - @echo "## SVG parsing regression tests" - -@(for i in $(srcdir)/test/SVG/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/SVG/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint $$i > $(srcdir)/result/SVG/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - echo Testing $$name ; \ - $(CHECKER) $(top_builddir)/xmllint $$i > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/SVG/$$name result.$$name ; \ - $(CHECKER) $(top_builddir)/xmllint result.$$name > result2.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff result.$$name result2.$$name ; \ - rm result.$$name result2.$$name ; \ - fi ; fi ; done) - -Threadtests : testThreads$(EXEEXT) - @echo "## Threaded regression tests" - -@($(CHECKER) $(top_builddir)/testThreads ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - exit 0) - -Readertests : xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## Reader regression tests" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/$$name.rdr ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --nonet --debug --stream $$i > $(srcdir)/result/$$name.rdr 2>/dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/$$name.rdr result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - @echo "## Reader on memory regression tests" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/$$name.rdr ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --memory --nonet --debug --stream $$i > $(srcdir)/result/$$name.rdr 2>/dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --memory --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/$$name.rdr result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - @(echo > .memdump) - @echo "## Walker regression tests" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/$$name.rdr ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --nonet --debug --walker $$i > $(srcdir)/result/$$name.rdr 2>/dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --nonet --debug --walker $$i > result.$$name 2>/dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/$$name.rdr result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - @echo "## Reader entities substitution regression tests" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/$$name.rde ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --noent --nonet --debug --stream $$i > $(srcdir)/result/$$name.rde 2>/dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --noent --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/$$name.rde result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - -SAXtests : testSAX$(EXEEXT) - @(echo > .memdump) - @echo "## SAX1 callbacks regression tests" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/$$name.sax ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testSAX $$i > $(srcdir)/result/$$name.sax 2> /dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/testSAX $$i > result.$$name 2> /dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/$$name.sax result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - @echo "## SAX2 callbacks regression tests" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/$$name.sax2 ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testSAX --sax2 $$i > $(srcdir)/result/$$name.sax2 2> /dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/testSAX --sax2 $$i > result.$$name 2> /dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/$$name.sax2 result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - -Validtests : xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## Valid documents regression tests" - -@(for i in $(srcdir)/test/VCM/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - log=`$(CHECKER) $(top_builddir)/xmllint --valid --noout --nowarning $$i ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"`;\ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - fi ; done ; exit 0) - @echo "## Validity checking regression tests" - -@(for i in $(srcdir)/test/VC/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/VC/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --noout --valid $$i 2> $(srcdir)/result/VC/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --noout --valid $$i 2> result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/VC/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - @echo "## General documents valid regression tests" - -@(for i in $(srcdir)/test/valid/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/valid/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --valid $$i > $(srcdir)/result/valid/$$name 2>$(srcdir)/result/valid/$$name.err ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --valid $$i > result.$$name 2>error.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/valid/$$name result.$$name ; \ - diff $(srcdir)/result/valid/$$name.err error.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name error.$$name ; \ - fi ; fi ; done) - -Regexptests: testRegexp$(EXEEXT) - @(echo > .memdump) - @echo "## Regexp regression tests" - -@(for i in $(srcdir)/test/regexp/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/regexp/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testRegexp -i $$i > $(srcdir)/result/regexp/$$name; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/testRegexp -i $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/regexp/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - @echo "## Formal expresssions regression tests" - -@(for i in $(srcdir)/test/expr/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/expr/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testRegexp --expr -i $$i > $(srcdir)/result/expr/$$name; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/testRegexp --expr -i $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/expr/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - -Automatatests: testAutomata$(EXEEXT) - @(echo > .memdump) - @echo "## Automata regression tests" - -@(for i in $(srcdir)/test/automata/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/automata/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testAutomata $$i > $(srcdir)/result/automata/$$name; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/testAutomata $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/automata/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - -dba100000.xml: dbgenattr.pl - @echo "## generating dba100000.xml" - @($(PERL) $(top_srcdir)/dbgenattr.pl 100000 > dba100000.xml) - -Timingtests: xmllint$(EXEEXT) dba100000.xml - @echo "## Timing tests to try to detect performance" - @echo "## as well a memory usage breakage when streaming" - @echo "## 1/ using the file interface" - @echo "## 2/ using the memory interface" - @echo "## 3/ repeated DOM parsing" - @echo "## 4/ repeated DOM validation" - -@($(top_builddir)/xmllint --stream --timing dba100000.xml; \ - MEM=`cat .memdump | grep "MEMORY ALLOCATED" | awk '{ print $$7}'`;\ - if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - exit 0) - -@($(top_builddir)/xmllint --stream --timing --memory dba100000.xml; \ - MEM=`cat .memdump | grep "MEMORY ALLOCATED" | awk '{ print $$7}'`;\ - if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - exit 0) - -@($(top_builddir)/xmllint --noout --timing --repeat $(srcdir)/test/valid/REC-xml-19980210.xml; \ - MEM=`cat .memdump | grep "MEMORY ALLOCATED" | awk '{ print $$7}'`;\ - if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - exit 0) - -VTimingtests: xmllint$(EXEEXT) - -@($(top_builddir)/xmllint --noout --timing --valid --repeat $(srcdir)/test/valid/REC-xml-19980210.xml; \ - MEM=`cat .memdump | grep "MEMORY ALLOCATED" | awk '{ print $$7}'`;\ - if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - exit 0) - -C14Ntests : testC14N$(EXEEXT) - @echo "## C14N and XPath regression tests" - -@(for m in with-comments without-comments 1-1-without-comments exc-without-comments ; do \ - for i in $(srcdir)/test/c14n/$$m/*.xml ; do \ - if [ ! -d $$i ] ; then \ - name=`basename $$i .xml`; \ - cmdline="$(CHECKER) $(top_builddir)/testC14N --$$m $$i"; \ - if [ -f $(srcdir)/test/c14n/$$m/$$name.xpath ] ; then \ - cmdline="$$cmdline $(srcdir)/test/c14n/$$m/$$name.xpath"; \ - if [ -f $(srcdir)/test/c14n/$$m/$$name.ns ] ; then \ - cmdline="$$cmdline '`cat $(srcdir)/test/c14n/$$m/$$name.ns`'"; \ - fi; \ - fi; \ - $$cmdline > $(srcdir)/test/c14n/test.tmp; \ - if [ $$? -eq 0 ]; then \ - diff $(srcdir)/result/c14n/$$m/$$name $(srcdir)/test/c14n/test.tmp; \ - if [ $$? -ne 0 ]; then \ - echo "Test $$m/$$name failed"; \ - cat $(srcdir)/test/c14n/test.tmp; \ - fi; \ - else \ - echo "C14N failed"; \ - fi; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - fi; \ - rm -f $(srcdir)/test/c14n/test.tmp; \ - done; \ - done) - -Schemastests: testSchemas$(EXEEXT) - @(echo > .memdump) - @echo "## Schemas regression tests" - -@(for i in $(srcdir)/test/schemas/*_*.xsd ; do \ - name=`basename $$i | sed 's+_.*++'`; \ - sno=`basename $$i | sed 's+.*_\(.*\).xsd+\1+'`; \ - for j in $(srcdir)/test/schemas/"$$name"_*.xml ; do \ - if [ -f $$j ] ; then \ - xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \ - if [ ! -f $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" ]; \ - then \ - echo New test file "$$name"_"$$sno"_"$$xno" ; \ - $(CHECKER) $(top_builddir)/testSchemas $$i $$j \ - > $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" \ - 2> $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno".err; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/testSchemas $$i $$j \ - > res.$$name 2> err.$$name;\ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" \ - res.$$name;\ - diff $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno".err \ - err.$$name;\ - grep Unimplemented err.$$name`; \ - if [ -n "$$log" ] ; then echo "$$name"_"$$sno"_"$$xno" result ; echo $$log ; fi ; \ - rm res.$$name err.$$name ; \ - fi ; fi ;\ - done; done) - -Relaxtests: xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## Relax-NG regression tests" - -@(for i in $(srcdir)/test/relaxng/*.rng ; do \ - name=`basename $$i | sed 's+\.rng++'`; \ - if [ ! -f $(srcdir)/result/relaxng/"$$name"_valid ] ; then \ - echo New schemas $$name ; \ - $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $(srcdir)/test/relaxng/tutorA.rng $$i \ - > $(srcdir)/result/relaxng/"$$name"_valid \ - 2> $(srcdir)/result/relaxng/"$$name"_err; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $(srcdir)/test/relaxng/tutorA.rng $$i \ - > res.$$name 2> err.$$name;\ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/relaxng/"$$name"_valid \ - res.$$name;\ - diff $(srcdir)/result/relaxng/"$$name"_err \ - err.$$name | grep -v "error detected at";\ - grep Unimplemented err.$$name`; \ - if [ -n "$$log" ] ; then echo schemas $$name result ; echo $$log ; fi ; \ - rm res.$$name err.$$name ; \ - fi; \ - for j in $(srcdir)/test/relaxng/"$$name"_*.xml ; do \ - if [ -f $$j ] ; then \ - xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \ - if [ ! -f $(srcdir)/result/relaxng/"$$name"_"$$xno" ]; \ - then \ - echo New test file "$$name"_"$$xno" ; \ - $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $$i $$j \ - > $(srcdir)/result/relaxng/"$$name"_"$$xno" \ - 2> $(srcdir)/result/relaxng/"$$name"_"$$xno".err; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $$i $$j \ - > res.$$name 2> err.$$name;\ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/relaxng/"$$name"_"$$xno" \ - res.$$name;\ - diff $(srcdir)/result/relaxng/"$$name"_"$$xno".err \ - err.$$name | grep -v "error detected at";\ - grep Unimplemented err.$$name`; \ - if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo $$log ; fi ; \ - rm res.$$name err.$$name ; \ - fi ; fi ; \ - done; done) - @echo "## Relax-NG streaming regression tests" - -@(for i in $(srcdir)/test/relaxng/*.rng ; do \ - name=`basename $$i | sed 's+\.rng++'`; \ - for j in $(srcdir)/test/relaxng/"$$name"_*.xml ; do \ - if [ -f $$j ] ; then \ - xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \ - if [ ! -f $(srcdir)/result/relaxng/"$$name"_"$$xno" ]; \ - then \ - echo New test file "$$name"_"$$xno" ; \ - $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $$i $$j \ - > $(srcdir)/result/relaxng/"$$name"_"$$xno" \ - 2> $(srcdir)/result/relaxng/"$$name"_"$$xno".err; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --stream --relaxng $$i $$j \ - > res.$$name 2> err.$$name;\ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/relaxng/"$$name"_"$$xno" res.$$name;\ - if [ "$$name" != "tutor10_1" -a "$$name" != "tutor10_2" -a "$$name" != "tutor3_2" -a "$$name" != "307377" -a "$$name" != "tutor8_2" ] ; then \ - diff $(srcdir)/result/relaxng/"$$name"_"$$xno".err \ - err.$$name | grep -v "error detected at";\ - fi ; grep Unimplemented err.$$name`; \ - if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo $$log ; fi ; \ - rm res.$$name err.$$name ; \ - fi ; fi ; \ - done; done) - -Schematrontests: xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## Schematron regression tests" - -@(for i in $(srcdir)/test/schematron/*.sct ; do \ - name=`basename $$i | sed 's+\.sct++'`; \ - for j in $(srcdir)/test/schematron/"$$name"_*.xml ; do \ - if [ -f $$j ] ; then \ - xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \ - if [ ! -f $(srcdir)/result/schematron/"$$name"_"$$xno" ]; \ - then \ - echo New test file "$$name"_"$$xno" ; \ - $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --schematron $$i $$j \ - > $(srcdir)/result/schematron/"$$name"_"$$xno" \ - 2> $(srcdir)/result/schematron/"$$name"_"$$xno".err; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --schematron $$i $$j \ - > res.$$name 2> err.$$name;\ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/schematron/"$$name"_"$$xno" \ - res.$$name;\ - diff $(srcdir)/result/schematron/"$$name"_"$$xno".err \ - err.$$name | grep -v "error detected at";\ - grep Unimplemented err.$$name`; \ - if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo $$log ; fi ; \ - rm res.$$name err.$$name ; \ - fi ; fi ; \ - done; done) - -RelaxNGPythonTests: - @(if [ -x $(PYTHON) ] ; then \ - PYTHONPATH=$(top_builddir)/python:$(top_builddir)/python/.libs:$$PYTHONPATH ; \ - export PYTHONPATH; \ - LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \ - export LD_LIBRARY_PATH; \ - echo "## Relax-NG Python based test suite 1" ; \ - $(CHECKER) $(PYTHON) $(srcdir)/check-relaxng-test-suite.py ; \ - echo "## Relax-NG Python based test suite 2" ; \ - $(CHECKER) $(PYTHON) $(srcdir)/check-relaxng-test-suite2.py ; \ - fi) - -SchemasPythonTests: - @(if [ -x $(PYTHON) ] ; then \ - PYTHONPATH=$(top_builddir)/python:$(top_builddir)/python/.libs:$$PYTHONPATH; \ - export PYTHONPATH; \ - LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \ - export LD_LIBRARY_PATH; \ - echo "## XML Schemas datatypes Python based test suite" ; \ - echo "## It is normal to see 11 errors reported" ; \ - $(CHECKER) $(PYTHON) $(srcdir)/check-xsddata-test-suite.py ; \ - fi) - @(if [ -x $(PYTHON) -a -d xstc ] ; then cd xstc ; $(MAKE) CHECKER="$(CHECKER)" pytests ; fi) - -Patterntests: xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## Pattern regression tests" - -@(for i in $(srcdir)/test/pattern/*.pat ; do \ - name=`basename $$i .pat`; \ - if [ -f $(srcdir)/test/pattern/$$name.xml ] ; then \ - if [ ! -f $(srcdir)/result/pattern/$$name ] ; then \ - rm -f result.$$name ; \ - echo New test file $$name ; \ - for pat in `cat $$i` ; do \ - $(CHECKER) $(top_builddir)/xmllint --walker --pattern $$pat $(srcdir)/test/pattern/$$name.xml >> $(srcdir)/result/pattern/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - done ;\ - else \ - rm -f result.$$name ; \ - lst=`cat $$i` ; \ - log=`for pat in $$lst ; do $(CHECKER) $(top_builddir)/xmllint --walker --pattern $$pat $(srcdir)/test/pattern/$$name.xml 2>&1 >> result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - done ;\ - diff $(srcdir)/result/pattern/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done ;) - -ModuleTests: testModule$(EXEEXT) testdso.la - @echo "## Module tests" - @(./testModule$(EXEEXT)) - -cleanup: - -@(find . -name .\#\* -exec rm {} \;) - -@(find . -name \*.gcda -o -name \*.gcno -exec rm -f {} \;) - -@(find . -name \*.orig -o -name \*.rej -o -name \*.old -exec rm -f {} \;) - -dist-hook: cleanup libxml2.spec - -cp libxml2.spec $(distdir) - (cd $(srcdir) ; tar -cf - --exclude CVS --exclude .svn --exclude .git win32 macos vms VxWorks bakefile test result) | (cd $(distdir); tar xf -) - -dist-source: distdir - $(AMTAR) -chof - --exclude Tests --exclude test --exclude result $(distdir) | GZIP=$(GZIP_ENV) gzip -c >`echo "$(distdir)" | sed "s+libxml2+libxml2-sources+"`.tar.gz - -dist-test: distdir - (mkdir -p $(distdir)) - (cd $(srcdir) ; tar -cf - --exclude CVS --exclude .svn --exclude .git xstc/Tests) | (cd $(distdir); tar xf -) - tar -cf - $(distdir)/test $(distdir)/result $(distdir)/xstc/Tests $(distdir)/Makefile.tests $(distdir)/README $(distdir)/README.tests $(distdir)/AUTHORS $(distdir)/testapi.c $(distdir)/runtest.c $(distdir)/runsuite.c | GZIP=$(GZIP_ENV) gzip -c >`echo "$(distdir)" | sed "s+libxml2+libxml2-tests+"`.tar.gz - @(rm -rf $(distdir)/xstc/Test) - -cleantar: - @(rm -f libxml*.tar.gz COPYING.LIB) - -rpm: cleanup cleantar - @(unset CDPATH ; $(MAKE) dist-source dist && rpmbuild -ta $(distdir).tar.gz) - -## We create xml2Conf.sh here and not from configure because we want -## to get the paths expanded correctly. Macros like srcdir are given -## the value NONE in configure if the user doesn't specify them (this -## is an autoconf feature, not a bug). - -xml2Conf.sh: xml2Conf.sh.in Makefile -## Use sed and then mv to avoid problems if the user interrupts. - sed -e 's?\@XML_LIBDIR\@?$(XML_LIBDIR)?g' \ - -e 's?\@XML_INCLUDEDIR\@?$(XML_INCLUDEDIR)?g' \ - -e 's?\@VERSION\@?$(VERSION)?g' \ - -e 's?\@XML_LIBS\@?$(XML_LIBS)?g' \ - < $(srcdir)/xml2Conf.sh.in > xml2Conf.tmp \ - && mv xml2Conf.tmp xml2Conf.sh - -CLEANFILES = runxmlconf.log test.out xml2Conf.sh *.gcda *.gcno *.res -DISTCLEANFILES = COPYING missing.lst - -confexecdir=$(libdir) -confexec_DATA = xml2Conf.sh -CVS_EXTRA_DIST= -EXTRA_DIST = xml2-config.in xml2Conf.sh.in libxml.spec.in libxml2.spec \ - libxml.m4 Copyright check-xml-test-suite.py gentest.py \ - check-relaxng-test-suite.py check-relaxng-test-suite2.py \ - check-xsddata-test-suite.py check-xinclude-test-suite.py \ - example/Makefile.am example/gjobread.c example/gjobs.xml \ - $(man_MANS) libxml-2.0.pc.in libxml-2.0-uninstalled.pc.in \ - trionan.c trionan.h triostr.c triostr.h trio.c trio.h \ - triop.h triodef.h libxml.h elfgcchack.h xzlib.h buf.h \ - enc.h save.h testThreadsWin32.c genUnicode.py TODO_SCHEMAS \ - dbgen.pl dbgenattr.pl regressions.py regressions.xml \ - README.tests Makefile.tests libxml2.syms timsort.h \ - $(CVS_EXTRA_DIST) - - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libxml-2.0.pc - -# -# Install the tests program sources as examples -# -BASE_DIR=$(datadir)/doc -DOC_MODULE=libxml2-$(VERSION) -EXAMPLES_DIR=$(BASE_DIR)/$(DOC_MODULE)/examples - -install-data-local: - $(MKDIR_P) $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE) - -$(INSTALL) -m 0644 $(srcdir)/Copyright $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE) - $(MKDIR_P) $(DESTDIR)$(EXAMPLES_DIR) - -$(INSTALL) -m 0644 $(srcdir)/xmllint.c $(DESTDIR)$(EXAMPLES_DIR) - -$(INSTALL) -m 0644 $(srcdir)/testSAX.c $(DESTDIR)$(EXAMPLES_DIR) - -$(INSTALL) -m 0644 $(srcdir)/testHTML.c $(DESTDIR)$(EXAMPLES_DIR) - -$(INSTALL) -m 0644 $(srcdir)/testXPath.c $(DESTDIR)$(EXAMPLES_DIR) - -uninstall-local: - rm -f $(DESTDIR)$(EXAMPLES_DIR)/testXPath.c - rm -f $(DESTDIR)$(EXAMPLES_DIR)/testHTML.c - rm -f $(DESTDIR)$(EXAMPLES_DIR)/testSAX.c - rm -f $(DESTDIR)$(EXAMPLES_DIR)/xmllint.c - rm -rf $(DESTDIR)$(EXAMPLES_DIR) - rm -f $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)/Copyright - rm -rf $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE) - -tst: tst.c - $(CC) $(CFLAGS) -Iinclude -o tst tst.c .libs/libxml2.a -lpthread -lm -lz -llzma - -sparse: clean - $(MAKE) CC=cgcc - -# -# Coverage support, largely borrowed from libvirt -# Both binaries comes from the lcov package in Fedora -# -LCOV = /usr/bin/lcov -GENHTML = /usr/bin/genhtml - -cov: clean-cov - if [ "`echo $(LDFLAGS) | grep coverage`" = "" ] ; then \ - echo not configured with coverage; exit 1 ; fi - if [ ! -x $(LCOV) -o ! -x $(GENHTML) ] ; then \ - echo Need $(LCOV) and $(GENHTML) excecutables; exit 1 ; fi - -@($(MAKE) check) - -@(./runsuite$(EXEEXT)) - mkdir $(top_builddir)/coverage - $(LCOV) -c -o $(top_builddir)/coverage/libxml2.info.tmp -d $(top_srcdir) - $(LCOV) -r $(top_builddir)/coverage/libxml2.info.tmp -o $(top_builddir)/coverage/libxml2.info *usr* - rm $(top_builddir)/coverage/libxml2.info.tmp - $(GENHTML) -s -t "libxml2" -o $(top_builddir)/coverage --legend $(top_builddir)/coverage/libxml2.info - echo "Coverage report is in $(top_builddir)/coverage/index.html" - -clean-cov: - rm -rf $(top_builddir)/coverage - diff --git a/lib/3rdparty/libxml2/Makefile.in b/lib/3rdparty/libxml2/Makefile.in deleted file mode 100644 index 63d82280286..00000000000 --- a/lib/3rdparty/libxml2/Makefile.in +++ /dev/null @@ -1,2791 +0,0 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - - - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -noinst_PROGRAMS = testSchemas$(EXEEXT) testRelax$(EXEEXT) \ - testSAX$(EXEEXT) testHTML$(EXEEXT) testXPath$(EXEEXT) \ - testURI$(EXEEXT) testThreads$(EXEEXT) testC14N$(EXEEXT) \ - testAutomata$(EXEEXT) testRegexp$(EXEEXT) testReader$(EXEEXT) \ - testapi$(EXEEXT) testModule$(EXEEXT) runtest$(EXEEXT) \ - runsuite$(EXEEXT) testchar$(EXEEXT) testdict$(EXEEXT) \ - runxmlconf$(EXEEXT) testrecurse$(EXEEXT) testlimits$(EXEEXT) -bin_PROGRAMS = xmllint$(EXEEXT) xmlcatalog$(EXEEXT) -subdir = . -DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(srcdir)/libxml-2.0-uninstalled.pc.in \ - $(srcdir)/libxml-2.0.pc.in $(srcdir)/libxml.spec.in \ - $(srcdir)/xml2-config.in $(top_srcdir)/configure AUTHORS \ - COPYING ChangeLog INSTALL NEWS TODO config.guess config.sub \ - depcomp install-sh ltmain.sh missing -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno config.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = libxml2.spec xml2-config libxml-2.0.pc \ - libxml-2.0-uninstalled.pc -CONFIG_CLEAN_VPATH_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ - "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \ - "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(confexecdir)" \ - "$(DESTDIR)$(m4datadir)" "$(DESTDIR)$(pkgconfigdir)" -LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) -am__DEPENDENCIES_1 = -libxml2_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) -am__libxml2_la_SOURCES_DIST = SAX.c entities.c encoding.c error.c \ - parserInternals.c parser.c tree.c hash.c list.c xmlIO.c \ - xmlmemory.c uri.c valid.c xlink.c HTMLparser.c HTMLtree.c \ - debugXML.c xpath.c xpointer.c xinclude.c nanohttp.c nanoftp.c \ - DOCBparser.c catalog.c globals.c threads.c c14n.c xmlstring.c \ - buf.c xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \ - triostr.c trio.c xmlreader.c relaxng.c dict.c SAX2.c \ - xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c xmlmodule.c \ - schematron.c xzlib.c -@WITH_SAX1_SOURCES_TRUE@am__objects_1 = DOCBparser.lo -@WITH_TRIO_SOURCES_TRUE@am__objects_2 = triostr.lo trio.lo -am_libxml2_la_OBJECTS = SAX.lo entities.lo encoding.lo error.lo \ - parserInternals.lo parser.lo tree.lo hash.lo list.lo xmlIO.lo \ - xmlmemory.lo uri.lo valid.lo xlink.lo HTMLparser.lo \ - HTMLtree.lo debugXML.lo xpath.lo xpointer.lo xinclude.lo \ - nanohttp.lo nanoftp.lo $(am__objects_1) catalog.lo globals.lo \ - threads.lo c14n.lo xmlstring.lo buf.lo xmlregexp.lo \ - xmlschemas.lo xmlschemastypes.lo xmlunicode.lo \ - $(am__objects_2) xmlreader.lo relaxng.lo dict.lo SAX2.lo \ - xmlwriter.lo legacy.lo chvalid.lo pattern.lo xmlsave.lo \ - xmlmodule.lo schematron.lo xzlib.lo -libxml2_la_OBJECTS = $(am_libxml2_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -libxml2_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(libxml2_la_LDFLAGS) $(LDFLAGS) -o $@ -testdso_la_LIBADD = -am_testdso_la_OBJECTS = testdso.lo -testdso_la_OBJECTS = $(am_testdso_la_OBJECTS) -testdso_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(testdso_la_LDFLAGS) $(LDFLAGS) -o $@ -PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) -am_runsuite_OBJECTS = runsuite.$(OBJEXT) -runsuite_OBJECTS = $(am_runsuite_OBJECTS) -am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(top_builddir)/libxml2.la \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) -runsuite_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(runsuite_LDFLAGS) $(LDFLAGS) -o $@ -am_runtest_OBJECTS = runtest.$(OBJEXT) -runtest_OBJECTS = $(am_runtest_OBJECTS) -runtest_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(runtest_LDFLAGS) $(LDFLAGS) -o $@ -am_runxmlconf_OBJECTS = runxmlconf.$(OBJEXT) -runxmlconf_OBJECTS = $(am_runxmlconf_OBJECTS) -runxmlconf_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(runxmlconf_LDFLAGS) $(LDFLAGS) -o $@ -am_testAutomata_OBJECTS = testAutomata.$(OBJEXT) -testAutomata_OBJECTS = $(am_testAutomata_OBJECTS) -testAutomata_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(testAutomata_LDFLAGS) $(LDFLAGS) -o $@ -am_testC14N_OBJECTS = testC14N.$(OBJEXT) -testC14N_OBJECTS = $(am_testC14N_OBJECTS) -testC14N_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(testC14N_LDFLAGS) $(LDFLAGS) -o $@ -am_testHTML_OBJECTS = testHTML.$(OBJEXT) -testHTML_OBJECTS = $(am_testHTML_OBJECTS) -testHTML_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(testHTML_LDFLAGS) $(LDFLAGS) -o $@ -am_testModule_OBJECTS = testModule.$(OBJEXT) -testModule_OBJECTS = $(am_testModule_OBJECTS) -testModule_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(testModule_LDFLAGS) $(LDFLAGS) -o $@ -am_testReader_OBJECTS = testReader.$(OBJEXT) -testReader_OBJECTS = $(am_testReader_OBJECTS) -testReader_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(testReader_LDFLAGS) $(LDFLAGS) -o $@ -am_testRegexp_OBJECTS = testRegexp.$(OBJEXT) -testRegexp_OBJECTS = $(am_testRegexp_OBJECTS) -testRegexp_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(testRegexp_LDFLAGS) $(LDFLAGS) -o $@ -am_testRelax_OBJECTS = testRelax.$(OBJEXT) -testRelax_OBJECTS = $(am_testRelax_OBJECTS) -testRelax_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(testRelax_LDFLAGS) $(LDFLAGS) -o $@ -am_testSAX_OBJECTS = testSAX.$(OBJEXT) -testSAX_OBJECTS = $(am_testSAX_OBJECTS) -testSAX_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(testSAX_LDFLAGS) $(LDFLAGS) -o $@ -am_testSchemas_OBJECTS = testSchemas.$(OBJEXT) -testSchemas_OBJECTS = $(am_testSchemas_OBJECTS) -testSchemas_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(testSchemas_LDFLAGS) $(LDFLAGS) -o $@ -am__testThreads_SOURCES_DIST = testThreads.c testThreadsWin32.c -@THREADS_W32_FALSE@am_testThreads_OBJECTS = testThreads.$(OBJEXT) -@THREADS_W32_TRUE@am_testThreads_OBJECTS = testThreadsWin32.$(OBJEXT) -testThreads_OBJECTS = $(am_testThreads_OBJECTS) -testThreads_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(testThreads_LDFLAGS) $(LDFLAGS) -o $@ -am_testURI_OBJECTS = testURI.$(OBJEXT) -testURI_OBJECTS = $(am_testURI_OBJECTS) -testURI_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(testURI_LDFLAGS) $(LDFLAGS) -o $@ -am_testXPath_OBJECTS = testXPath.$(OBJEXT) -testXPath_OBJECTS = $(am_testXPath_OBJECTS) -testXPath_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(testXPath_LDFLAGS) $(LDFLAGS) -o $@ -am_testapi_OBJECTS = testapi.$(OBJEXT) -testapi_OBJECTS = $(am_testapi_OBJECTS) -testapi_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(testapi_LDFLAGS) $(LDFLAGS) -o $@ -am_testchar_OBJECTS = testchar.$(OBJEXT) -testchar_OBJECTS = $(am_testchar_OBJECTS) -testchar_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(testchar_LDFLAGS) $(LDFLAGS) -o $@ -am_testdict_OBJECTS = testdict.$(OBJEXT) -testdict_OBJECTS = $(am_testdict_OBJECTS) -testdict_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(testdict_LDFLAGS) $(LDFLAGS) -o $@ -am_testlimits_OBJECTS = testlimits.$(OBJEXT) -testlimits_OBJECTS = $(am_testlimits_OBJECTS) -testlimits_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(testlimits_LDFLAGS) $(LDFLAGS) -o $@ -am_testrecurse_OBJECTS = testrecurse.$(OBJEXT) -testrecurse_OBJECTS = $(am_testrecurse_OBJECTS) -testrecurse_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(testrecurse_LDFLAGS) $(LDFLAGS) -o $@ -am_xmlcatalog_OBJECTS = xmlcatalog.$(OBJEXT) -xmlcatalog_OBJECTS = $(am_xmlcatalog_OBJECTS) -xmlcatalog_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(xmlcatalog_LDFLAGS) $(LDFLAGS) -o $@ -am_xmllint_OBJECTS = xmllint.$(OBJEXT) -xmllint_OBJECTS = $(am_xmllint_OBJECTS) -xmllint_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(xmllint_LDFLAGS) $(LDFLAGS) -o $@ -SCRIPTS = $(bin_SCRIPTS) -DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -SOURCES = $(libxml2_la_SOURCES) $(testdso_la_SOURCES) \ - $(runsuite_SOURCES) $(runtest_SOURCES) $(runxmlconf_SOURCES) \ - $(testAutomata_SOURCES) $(testC14N_SOURCES) \ - $(testHTML_SOURCES) $(testModule_SOURCES) \ - $(testReader_SOURCES) $(testRegexp_SOURCES) \ - $(testRelax_SOURCES) $(testSAX_SOURCES) $(testSchemas_SOURCES) \ - $(testThreads_SOURCES) $(testURI_SOURCES) $(testXPath_SOURCES) \ - $(testapi_SOURCES) $(testchar_SOURCES) $(testdict_SOURCES) \ - $(testlimits_SOURCES) $(testrecurse_SOURCES) \ - $(xmlcatalog_SOURCES) $(xmllint_SOURCES) -DIST_SOURCES = $(am__libxml2_la_SOURCES_DIST) $(testdso_la_SOURCES) \ - $(runsuite_SOURCES) $(runtest_SOURCES) $(runxmlconf_SOURCES) \ - $(testAutomata_SOURCES) $(testC14N_SOURCES) \ - $(testHTML_SOURCES) $(testModule_SOURCES) \ - $(testReader_SOURCES) $(testRegexp_SOURCES) \ - $(testRelax_SOURCES) $(testSAX_SOURCES) $(testSchemas_SOURCES) \ - $(am__testThreads_SOURCES_DIST) $(testURI_SOURCES) \ - $(testXPath_SOURCES) $(testapi_SOURCES) $(testchar_SOURCES) \ - $(testdict_SOURCES) $(testlimits_SOURCES) \ - $(testrecurse_SOURCES) $(xmlcatalog_SOURCES) \ - $(xmllint_SOURCES) -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive -man1dir = $(mandir)/man1 -man3dir = $(mandir)/man3 -NROFF = nroff -MANS = $(man_MANS) -DATA = $(confexec_DATA) $(m4data_DATA) $(pkgconfig_DATA) -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ - $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ - distdir dist dist-all distcheck -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - if test -d "$(distdir)"; then \ - find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -rf "$(distdir)" \ - || { sleep 5 && rm -rf "$(distdir)"; }; \ - else :; fi -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ - | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' -distcleancheck_listfiles = find . -type f -print -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BASE_THREAD_LIBS = @BASE_THREAD_LIBS@ -C14N_OBJ = @C14N_OBJ@ -CATALOG_OBJ = @CATALOG_OBJ@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -CYGWIN_EXTRA_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ -CYGWIN_EXTRA_PYTHON_LIBADD = @CYGWIN_EXTRA_PYTHON_LIBADD@ -DEBUG_OBJ = @DEBUG_OBJ@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DOCB_OBJ = @DOCB_OBJ@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -FTP_OBJ = @FTP_OBJ@ -GREP = @GREP@ -HAVE_ISINF = @HAVE_ISINF@ -HAVE_ISNAN = @HAVE_ISNAN@ -HTML_DIR = @HTML_DIR@ -HTML_OBJ = @HTML_OBJ@ -HTTP_OBJ = @HTTP_OBJ@ -ICONV_LIBS = @ICONV_LIBS@ -ICU_LIBS = @ICU_LIBS@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_MAJOR_VERSION = @LIBXML_MAJOR_VERSION@ -LIBXML_MICRO_VERSION = @LIBXML_MICRO_VERSION@ -LIBXML_MINOR_VERSION = @LIBXML_MINOR_VERSION@ -LIBXML_VERSION = @LIBXML_VERSION@ -LIBXML_VERSION_EXTRA = @LIBXML_VERSION_EXTRA@ -LIBXML_VERSION_INFO = @LIBXML_VERSION_INFO@ -LIBXML_VERSION_NUMBER = @LIBXML_VERSION_NUMBER@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LZMA_CFLAGS = @LZMA_CFLAGS@ -LZMA_LIBS = @LZMA_LIBS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -MODULE_EXTENSION = @MODULE_EXTENSION@ -MODULE_PLATFORM_LIBS = @MODULE_PLATFORM_LIBS@ -MV = @MV@ -M_LIBS = @M_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PYTHON = @PYTHON@ -PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ -PYTHON_SITE_PACKAGES = @PYTHON_SITE_PACKAGES@ -PYTHON_SUBDIR = @PYTHON_SUBDIR@ -PYTHON_TESTS = @PYTHON_TESTS@ -PYTHON_VERSION = @PYTHON_VERSION@ -RANLIB = @RANLIB@ -RDL_LIBS = @RDL_LIBS@ -READER_TEST = @READER_TEST@ -RELDATE = @RELDATE@ -RM = @RM@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STATIC_BINARIES = @STATIC_BINARIES@ -STRIP = @STRIP@ -TAR = @TAR@ -TEST_C14N = @TEST_C14N@ -TEST_CATALOG = @TEST_CATALOG@ -TEST_DEBUG = @TEST_DEBUG@ -TEST_HTML = @TEST_HTML@ -TEST_MODULES = @TEST_MODULES@ -TEST_PATTERN = @TEST_PATTERN@ -TEST_PHTML = @TEST_PHTML@ -TEST_PUSH = @TEST_PUSH@ -TEST_REGEXPS = @TEST_REGEXPS@ -TEST_SAX = @TEST_SAX@ -TEST_SCHEMAS = @TEST_SCHEMAS@ -TEST_SCHEMATRON = @TEST_SCHEMATRON@ -TEST_THREADS = @TEST_THREADS@ -TEST_VALID = @TEST_VALID@ -TEST_VTIME = @TEST_VTIME@ -TEST_XINCLUDE = @TEST_XINCLUDE@ -TEST_XPATH = @TEST_XPATH@ -TEST_XPTR = @TEST_XPTR@ -THREAD_CFLAGS = @THREAD_CFLAGS@ -THREAD_LIBS = @THREAD_LIBS@ -VERSION = @VERSION@ -VERSION_SCRIPT_FLAGS = @VERSION_SCRIPT_FLAGS@ -WGET = @WGET@ -WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ -WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ -WIN32_EXTRA_PYTHON_LIBADD = @WIN32_EXTRA_PYTHON_LIBADD@ -WITH_C14N = @WITH_C14N@ -WITH_CATALOG = @WITH_CATALOG@ -WITH_DEBUG = @WITH_DEBUG@ -WITH_DOCB = @WITH_DOCB@ -WITH_FTP = @WITH_FTP@ -WITH_HTML = @WITH_HTML@ -WITH_HTTP = @WITH_HTTP@ -WITH_ICONV = @WITH_ICONV@ -WITH_ICU = @WITH_ICU@ -WITH_ISO8859X = @WITH_ISO8859X@ -WITH_LEGACY = @WITH_LEGACY@ -WITH_LZMA = @WITH_LZMA@ -WITH_MEM_DEBUG = @WITH_MEM_DEBUG@ -WITH_MODULES = @WITH_MODULES@ -WITH_OUTPUT = @WITH_OUTPUT@ -WITH_PATTERN = @WITH_PATTERN@ -WITH_PUSH = @WITH_PUSH@ -WITH_READER = @WITH_READER@ -WITH_REGEXPS = @WITH_REGEXPS@ -WITH_RUN_DEBUG = @WITH_RUN_DEBUG@ -WITH_SAX1 = @WITH_SAX1@ -WITH_SCHEMAS = @WITH_SCHEMAS@ -WITH_SCHEMATRON = @WITH_SCHEMATRON@ -WITH_THREADS = @WITH_THREADS@ -WITH_TREE = @WITH_TREE@ -WITH_TRIO = @WITH_TRIO@ -WITH_VALID = @WITH_VALID@ -WITH_WRITER = @WITH_WRITER@ -WITH_XINCLUDE = @WITH_XINCLUDE@ -WITH_XPATH = @WITH_XPATH@ -WITH_XPTR = @WITH_XPTR@ -WITH_ZLIB = @WITH_ZLIB@ -XINCLUDE_OBJ = @XINCLUDE_OBJ@ -XMLLINT = @XMLLINT@ -XML_CFLAGS = @XML_CFLAGS@ -XML_INCLUDEDIR = @XML_INCLUDEDIR@ -XML_LIBDIR = @XML_LIBDIR@ -XML_LIBS = @XML_LIBS@ -XML_LIBTOOLLIBS = @XML_LIBTOOLLIBS@ -XPATH_OBJ = @XPATH_OBJ@ -XPTR_OBJ = @XPTR_OBJ@ -XSLTPROC = @XSLTPROC@ -Z_CFLAGS = @Z_CFLAGS@ -Z_LIBS = @Z_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythondir = @pythondir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = include . doc example xstc $(PYTHON_SUBDIR) -DIST_SUBDIRS = include . doc example python xstc -AM_CPPFLAGS = -I$(top_builddir)/include -I$(srcdir)/include -AM_CFLAGS = $(THREAD_CFLAGS) $(Z_CFLAGS) $(LZMA_CFLAGS) -bin_SCRIPTS = xml2-config -lib_LTLIBRARIES = libxml2.la -libxml2_la_LIBADD = $(ICU_LIBS) $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) $(WIN32_EXTRA_LIBADD) -@USE_VERSION_SCRIPT_FALSE@LIBXML2_VERSION_SCRIPT = -@USE_VERSION_SCRIPT_TRUE@LIBXML2_VERSION_SCRIPT = $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxml2.syms -libxml2_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) \ - $(LIBXML2_VERSION_SCRIPT) \ - -version-info $(LIBXML_VERSION_INFO) \ - $(MODULE_PLATFORM_LIBS) - -@WITH_SAX1_SOURCES_FALSE@docb_sources = -@WITH_SAX1_SOURCES_TRUE@docb_sources = DOCBparser.c -@WITH_TRIO_SOURCES_FALSE@trio_sources = -@WITH_TRIO_SOURCES_TRUE@trio_sources = triostr.c trio.c -libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \ - parser.c tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c \ - valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c xpath.c \ - xpointer.c xinclude.c nanohttp.c nanoftp.c \ - $(docb_sources) \ - catalog.c globals.c threads.c c14n.c xmlstring.c buf.c \ - xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \ - $(trio_sources) \ - xmlreader.c relaxng.c dict.c SAX2.c \ - xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c \ - xmlmodule.c schematron.c xzlib.c - -DEPS = $(top_builddir)/libxml2.la -LDADDS = $(STATIC_BINARIES) $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) $(WIN32_EXTRA_LIBADD) -man_MANS = xml2-config.1 libxml.3 -m4datadir = $(datadir)/aclocal -m4data_DATA = libxml.m4 -runtest_SOURCES = runtest.c -runtest_LDFLAGS = -runtest_DEPENDENCIES = $(DEPS) -runtest_LDADD = $(BASE_THREAD_LIBS) $(RDL_LIBS) $(LDADDS) -testrecurse_SOURCES = testrecurse.c -testrecurse_LDFLAGS = -testrecurse_DEPENDENCIES = $(DEPS) -testrecurse_LDADD = $(BASE_THREAD_LIBS) $(RDL_LIBS) $(LDADDS) -testlimits_SOURCES = testlimits.c -testlimits_LDFLAGS = -testlimits_DEPENDENCIES = $(DEPS) -testlimits_LDADD = $(BASE_THREAD_LIBS) $(RDL_LIBS) $(LDADDS) -testchar_SOURCES = testchar.c -testchar_LDFLAGS = -testchar_DEPENDENCIES = $(DEPS) -testchar_LDADD = $(RDL_LIBS) $(LDADDS) -testdict_SOURCES = testdict.c -testdict_LDFLAGS = -testdict_DEPENDENCIES = $(DEPS) -testdict_LDADD = $(RDL_LIBS) $(LDADDS) -runsuite_SOURCES = runsuite.c -runsuite_LDFLAGS = -runsuite_DEPENDENCIES = $(DEPS) -runsuite_LDADD = $(RDL_LIBS) $(LDADDS) -xmllint_SOURCES = xmllint.c -xmllint_LDFLAGS = -xmllint_DEPENDENCIES = $(DEPS) -xmllint_LDADD = $(RDL_LIBS) $(LDADDS) -testSAX_SOURCES = testSAX.c -testSAX_LDFLAGS = -testSAX_DEPENDENCIES = $(DEPS) -testSAX_LDADD = $(LDADDS) -testHTML_SOURCES = testHTML.c -testHTML_LDFLAGS = -testHTML_DEPENDENCIES = $(DEPS) -testHTML_LDADD = $(LDADDS) -xmlcatalog_SOURCES = xmlcatalog.c -xmlcatalog_LDFLAGS = -xmlcatalog_DEPENDENCIES = $(DEPS) -xmlcatalog_LDADD = $(RDL_LIBS) $(LDADDS) -testXPath_SOURCES = testXPath.c -testXPath_LDFLAGS = -testXPath_DEPENDENCIES = $(DEPS) -testXPath_LDADD = $(LDADDS) -testC14N_SOURCES = testC14N.c -testC14N_LDFLAGS = -testC14N_DEPENDENCIES = $(DEPS) -testC14N_LDADD = $(LDADDS) -@THREADS_W32_FALSE@testThreads_SOURCES = testThreads.c -@THREADS_W32_TRUE@testThreads_SOURCES = testThreadsWin32.c -testThreads_LDFLAGS = -testThreads_DEPENDENCIES = $(DEPS) -testThreads_LDADD = $(BASE_THREAD_LIBS) $(LDADDS) -testURI_SOURCES = testURI.c -testURI_LDFLAGS = -testURI_DEPENDENCIES = $(DEPS) -testURI_LDADD = $(LDADDS) -testRegexp_SOURCES = testRegexp.c -testRegexp_LDFLAGS = -testRegexp_DEPENDENCIES = $(DEPS) -testRegexp_LDADD = $(LDADDS) -testAutomata_SOURCES = testAutomata.c -testAutomata_LDFLAGS = -testAutomata_DEPENDENCIES = $(DEPS) -testAutomata_LDADD = $(LDADDS) -testSchemas_SOURCES = testSchemas.c -testSchemas_LDFLAGS = -testSchemas_DEPENDENCIES = $(DEPS) -testSchemas_LDADD = $(LDADDS) -testRelax_SOURCES = testRelax.c -testRelax_LDFLAGS = -testRelax_DEPENDENCIES = $(DEPS) -testRelax_LDADD = $(LDADDS) -testReader_SOURCES = testReader.c -testReader_LDFLAGS = -testReader_DEPENDENCIES = $(DEPS) -testReader_LDADD = $(LDADDS) -testModule_SOURCES = testModule.c -testModule_LDFLAGS = -testModule_DEPENDENCIES = $(DEPS) -testModule_LDADD = $(LDADDS) -noinst_LTLIBRARIES = testdso.la -testdso_la_SOURCES = testdso.c -testdso_la_LDFLAGS = -module -no-undefined -avoid-version -rpath $(libdir) -BUILT_SOURCES = testapi.c -testapi_SOURCES = testapi.c -testapi_LDFLAGS = -testapi_DEPENDENCIES = $(DEPS) -testapi_LDADD = $(LDADDS) -runxmlconf_SOURCES = runxmlconf.c -runxmlconf_LDFLAGS = -runxmlconf_DEPENDENCIES = $(DEPS) -runxmlconf_LDADD = $(LDADDS) -CLEANFILES = runxmlconf.log test.out xml2Conf.sh *.gcda *.gcno *.res -DISTCLEANFILES = COPYING missing.lst -confexecdir = $(libdir) -confexec_DATA = xml2Conf.sh -CVS_EXTRA_DIST = -EXTRA_DIST = xml2-config.in xml2Conf.sh.in libxml.spec.in libxml2.spec \ - libxml.m4 Copyright check-xml-test-suite.py gentest.py \ - check-relaxng-test-suite.py check-relaxng-test-suite2.py \ - check-xsddata-test-suite.py check-xinclude-test-suite.py \ - example/Makefile.am example/gjobread.c example/gjobs.xml \ - $(man_MANS) libxml-2.0.pc.in libxml-2.0-uninstalled.pc.in \ - trionan.c trionan.h triostr.c triostr.h trio.c trio.h \ - triop.h triodef.h libxml.h elfgcchack.h xzlib.h buf.h \ - enc.h save.h testThreadsWin32.c genUnicode.py TODO_SCHEMAS \ - dbgen.pl dbgenattr.pl regressions.py regressions.xml \ - README.tests Makefile.tests libxml2.syms timsort.h \ - $(CVS_EXTRA_DIST) - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libxml-2.0.pc - -# -# Install the tests program sources as examples -# -BASE_DIR = $(datadir)/doc -DOC_MODULE = libxml2-$(VERSION) -EXAMPLES_DIR = $(BASE_DIR)/$(DOC_MODULE)/examples - -# -# Coverage support, largely borrowed from libvirt -# Both binaries comes from the lcov package in Fedora -# -LCOV = /usr/bin/lcov -GENHTML = /usr/bin/genhtml -all: $(BUILT_SOURCES) config.h - $(MAKE) $(AM_MAKEFLAGS) all-recursive - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -am--refresh: Makefile - @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ - $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: $(am__configure_deps) - $(am__cd) $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -$(am__aclocal_m4_deps): - -config.h: stamp-h1 - @if test ! -f $@; then rm -f stamp-h1; else :; fi - @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi - -stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: $(am__configure_deps) - ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) - rm -f stamp-h1 - touch $@ - -distclean-hdr: - -rm -f config.h stamp-h1 -libxml2.spec: $(top_builddir)/config.status $(srcdir)/libxml.spec.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -xml2-config: $(top_builddir)/config.status $(srcdir)/xml2-config.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -libxml-2.0.pc: $(top_builddir)/config.status $(srcdir)/libxml-2.0.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -libxml-2.0-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/libxml-2.0-uninstalled.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ - } - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libxml2.la: $(libxml2_la_OBJECTS) $(libxml2_la_DEPENDENCIES) $(EXTRA_libxml2_la_DEPENDENCIES) - $(AM_V_CCLD)$(libxml2_la_LINK) -rpath $(libdir) $(libxml2_la_OBJECTS) $(libxml2_la_LIBADD) $(LIBS) -testdso.la: $(testdso_la_OBJECTS) $(testdso_la_DEPENDENCIES) $(EXTRA_testdso_la_DEPENDENCIES) - $(AM_V_CCLD)$(testdso_la_LINK) $(testdso_la_OBJECTS) $(testdso_la_LIBADD) $(LIBS) -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p || test -f $$p1; \ - then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files - -clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list -runsuite$(EXEEXT): $(runsuite_OBJECTS) $(runsuite_DEPENDENCIES) $(EXTRA_runsuite_DEPENDENCIES) - @rm -f runsuite$(EXEEXT) - $(AM_V_CCLD)$(runsuite_LINK) $(runsuite_OBJECTS) $(runsuite_LDADD) $(LIBS) -runtest$(EXEEXT): $(runtest_OBJECTS) $(runtest_DEPENDENCIES) $(EXTRA_runtest_DEPENDENCIES) - @rm -f runtest$(EXEEXT) - $(AM_V_CCLD)$(runtest_LINK) $(runtest_OBJECTS) $(runtest_LDADD) $(LIBS) -runxmlconf$(EXEEXT): $(runxmlconf_OBJECTS) $(runxmlconf_DEPENDENCIES) $(EXTRA_runxmlconf_DEPENDENCIES) - @rm -f runxmlconf$(EXEEXT) - $(AM_V_CCLD)$(runxmlconf_LINK) $(runxmlconf_OBJECTS) $(runxmlconf_LDADD) $(LIBS) -testAutomata$(EXEEXT): $(testAutomata_OBJECTS) $(testAutomata_DEPENDENCIES) $(EXTRA_testAutomata_DEPENDENCIES) - @rm -f testAutomata$(EXEEXT) - $(AM_V_CCLD)$(testAutomata_LINK) $(testAutomata_OBJECTS) $(testAutomata_LDADD) $(LIBS) -testC14N$(EXEEXT): $(testC14N_OBJECTS) $(testC14N_DEPENDENCIES) $(EXTRA_testC14N_DEPENDENCIES) - @rm -f testC14N$(EXEEXT) - $(AM_V_CCLD)$(testC14N_LINK) $(testC14N_OBJECTS) $(testC14N_LDADD) $(LIBS) -testHTML$(EXEEXT): $(testHTML_OBJECTS) $(testHTML_DEPENDENCIES) $(EXTRA_testHTML_DEPENDENCIES) - @rm -f testHTML$(EXEEXT) - $(AM_V_CCLD)$(testHTML_LINK) $(testHTML_OBJECTS) $(testHTML_LDADD) $(LIBS) -testModule$(EXEEXT): $(testModule_OBJECTS) $(testModule_DEPENDENCIES) $(EXTRA_testModule_DEPENDENCIES) - @rm -f testModule$(EXEEXT) - $(AM_V_CCLD)$(testModule_LINK) $(testModule_OBJECTS) $(testModule_LDADD) $(LIBS) -testReader$(EXEEXT): $(testReader_OBJECTS) $(testReader_DEPENDENCIES) $(EXTRA_testReader_DEPENDENCIES) - @rm -f testReader$(EXEEXT) - $(AM_V_CCLD)$(testReader_LINK) $(testReader_OBJECTS) $(testReader_LDADD) $(LIBS) -testRegexp$(EXEEXT): $(testRegexp_OBJECTS) $(testRegexp_DEPENDENCIES) $(EXTRA_testRegexp_DEPENDENCIES) - @rm -f testRegexp$(EXEEXT) - $(AM_V_CCLD)$(testRegexp_LINK) $(testRegexp_OBJECTS) $(testRegexp_LDADD) $(LIBS) -testRelax$(EXEEXT): $(testRelax_OBJECTS) $(testRelax_DEPENDENCIES) $(EXTRA_testRelax_DEPENDENCIES) - @rm -f testRelax$(EXEEXT) - $(AM_V_CCLD)$(testRelax_LINK) $(testRelax_OBJECTS) $(testRelax_LDADD) $(LIBS) -testSAX$(EXEEXT): $(testSAX_OBJECTS) $(testSAX_DEPENDENCIES) $(EXTRA_testSAX_DEPENDENCIES) - @rm -f testSAX$(EXEEXT) - $(AM_V_CCLD)$(testSAX_LINK) $(testSAX_OBJECTS) $(testSAX_LDADD) $(LIBS) -testSchemas$(EXEEXT): $(testSchemas_OBJECTS) $(testSchemas_DEPENDENCIES) $(EXTRA_testSchemas_DEPENDENCIES) - @rm -f testSchemas$(EXEEXT) - $(AM_V_CCLD)$(testSchemas_LINK) $(testSchemas_OBJECTS) $(testSchemas_LDADD) $(LIBS) -testThreads$(EXEEXT): $(testThreads_OBJECTS) $(testThreads_DEPENDENCIES) $(EXTRA_testThreads_DEPENDENCIES) - @rm -f testThreads$(EXEEXT) - $(AM_V_CCLD)$(testThreads_LINK) $(testThreads_OBJECTS) $(testThreads_LDADD) $(LIBS) -testURI$(EXEEXT): $(testURI_OBJECTS) $(testURI_DEPENDENCIES) $(EXTRA_testURI_DEPENDENCIES) - @rm -f testURI$(EXEEXT) - $(AM_V_CCLD)$(testURI_LINK) $(testURI_OBJECTS) $(testURI_LDADD) $(LIBS) -testXPath$(EXEEXT): $(testXPath_OBJECTS) $(testXPath_DEPENDENCIES) $(EXTRA_testXPath_DEPENDENCIES) - @rm -f testXPath$(EXEEXT) - $(AM_V_CCLD)$(testXPath_LINK) $(testXPath_OBJECTS) $(testXPath_LDADD) $(LIBS) -testapi$(EXEEXT): $(testapi_OBJECTS) $(testapi_DEPENDENCIES) $(EXTRA_testapi_DEPENDENCIES) - @rm -f testapi$(EXEEXT) - $(AM_V_CCLD)$(testapi_LINK) $(testapi_OBJECTS) $(testapi_LDADD) $(LIBS) -testchar$(EXEEXT): $(testchar_OBJECTS) $(testchar_DEPENDENCIES) $(EXTRA_testchar_DEPENDENCIES) - @rm -f testchar$(EXEEXT) - $(AM_V_CCLD)$(testchar_LINK) $(testchar_OBJECTS) $(testchar_LDADD) $(LIBS) -testdict$(EXEEXT): $(testdict_OBJECTS) $(testdict_DEPENDENCIES) $(EXTRA_testdict_DEPENDENCIES) - @rm -f testdict$(EXEEXT) - $(AM_V_CCLD)$(testdict_LINK) $(testdict_OBJECTS) $(testdict_LDADD) $(LIBS) -testlimits$(EXEEXT): $(testlimits_OBJECTS) $(testlimits_DEPENDENCIES) $(EXTRA_testlimits_DEPENDENCIES) - @rm -f testlimits$(EXEEXT) - $(AM_V_CCLD)$(testlimits_LINK) $(testlimits_OBJECTS) $(testlimits_LDADD) $(LIBS) -testrecurse$(EXEEXT): $(testrecurse_OBJECTS) $(testrecurse_DEPENDENCIES) $(EXTRA_testrecurse_DEPENDENCIES) - @rm -f testrecurse$(EXEEXT) - $(AM_V_CCLD)$(testrecurse_LINK) $(testrecurse_OBJECTS) $(testrecurse_LDADD) $(LIBS) -xmlcatalog$(EXEEXT): $(xmlcatalog_OBJECTS) $(xmlcatalog_DEPENDENCIES) $(EXTRA_xmlcatalog_DEPENDENCIES) - @rm -f xmlcatalog$(EXEEXT) - $(AM_V_CCLD)$(xmlcatalog_LINK) $(xmlcatalog_OBJECTS) $(xmlcatalog_LDADD) $(LIBS) -xmllint$(EXEEXT): $(xmllint_OBJECTS) $(xmllint_DEPENDENCIES) $(EXTRA_xmllint_DEPENDENCIES) - @rm -f xmllint$(EXEEXT) - $(AM_V_CCLD)$(xmllint_LINK) $(xmllint_OBJECTS) $(xmllint_LDADD) $(LIBS) -install-binSCRIPTS: $(bin_SCRIPTS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" - @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n' \ - -e 'h;s|.*|.|' \ - -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) { files[d] = files[d] " " $$1; \ - if (++n[d] == $(am__install_max)) { \ - print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ - else { print "f", d "/" $$4, $$1 } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 's,.*/,,;$(transform)'`; \ - dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DOCBparser.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HTMLparser.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HTMLtree.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SAX.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SAX2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buf.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c14n.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/catalog.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chvalid.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debugXML.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dict.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoding.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/entities.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/globals.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/legacy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nanoftp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nanohttp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parserInternals.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pattern.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/relaxng.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runsuite.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runtest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runxmlconf.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/schematron.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testAutomata.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testC14N.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testHTML.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testModule.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testReader.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testRegexp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testRelax.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testSAX.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testSchemas.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testThreads.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testThreadsWin32.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testURI.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testXPath.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testapi.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testchar.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testdict.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testdso.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testlimits.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testrecurse.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threads.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tree.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trio.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/triostr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uri.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/valid.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xinclude.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xlink.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlIO.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlcatalog.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmllint.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlmemory.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlmodule.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlreader.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlregexp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlsave.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlschemas.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlschemastypes.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlstring.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlunicode.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwriter.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xpath.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xpointer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xzlib.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool config.lt -install-man1: $(man_MANS) - @$(NORMAL_INSTALL) - test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" - @list=''; test -n "$(man1dir)" || exit 0; \ - { for i in $$list; do echo "$$i"; done; \ - l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.1[a-z]*$$/p'; \ - } | while read p; do \ - if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; echo "$$p"; \ - done | \ - sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ - sed 'N;N;s,\n, ,g' | { \ - list=; while read file base inst; do \ - if test "$$base" = "$$inst"; then list="$$list $$file"; else \ - echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ - $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ - fi; \ - done; \ - for i in $$list; do echo "$$i"; done | $(am__base_list) | \ - while read files; do \ - test -z "$$files" || { \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ - done; } - -uninstall-man1: - @$(NORMAL_UNINSTALL) - @list=''; test -n "$(man1dir)" || exit 0; \ - files=`{ for i in $$list; do echo "$$i"; done; \ - l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.1[a-z]*$$/p'; \ - } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ - dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) -install-man3: $(man_MANS) - @$(NORMAL_INSTALL) - test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)" - @list=''; test -n "$(man3dir)" || exit 0; \ - { for i in $$list; do echo "$$i"; done; \ - l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.3[a-z]*$$/p'; \ - } | while read p; do \ - if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; echo "$$p"; \ - done | \ - sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ - sed 'N;N;s,\n, ,g' | { \ - list=; while read file base inst; do \ - if test "$$base" = "$$inst"; then list="$$list $$file"; else \ - echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \ - $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \ - fi; \ - done; \ - for i in $$list; do echo "$$i"; done | $(am__base_list) | \ - while read files; do \ - test -z "$$files" || { \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \ - done; } - -uninstall-man3: - @$(NORMAL_UNINSTALL) - @list=''; test -n "$(man3dir)" || exit 0; \ - files=`{ for i in $$list; do echo "$$i"; done; \ - l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.3[a-z]*$$/p'; \ - } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ - dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir) -install-confexecDATA: $(confexec_DATA) - @$(NORMAL_INSTALL) - test -z "$(confexecdir)" || $(MKDIR_P) "$(DESTDIR)$(confexecdir)" - @list='$(confexec_DATA)'; test -n "$(confexecdir)" || list=; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(confexecdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(confexecdir)" || exit $$?; \ - done - -uninstall-confexecDATA: - @$(NORMAL_UNINSTALL) - @list='$(confexec_DATA)'; test -n "$(confexecdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(confexecdir)'; $(am__uninstall_files_from_dir) -install-m4dataDATA: $(m4data_DATA) - @$(NORMAL_INSTALL) - test -z "$(m4datadir)" || $(MKDIR_P) "$(DESTDIR)$(m4datadir)" - @list='$(m4data_DATA)'; test -n "$(m4datadir)" || list=; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(m4datadir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(m4datadir)" || exit $$?; \ - done - -uninstall-m4dataDATA: - @$(NORMAL_UNINSTALL) - @list='$(m4data_DATA)'; test -n "$(m4datadir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(m4datadir)'; $(am__uninstall_files_from_dir) -install-pkgconfigDATA: $(pkgconfig_DATA) - @$(NORMAL_INSTALL) - test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" - @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ - done - -uninstall-pkgconfigDATA: - @$(NORMAL_UNINSTALL) - @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @list='$(MANS)'; if test -n "$$list"; then \ - list=`for p in $$list; do \ - if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ - if test -n "$$list" && \ - grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ - echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ - grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ - echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ - echo " typically \`make maintainer-clean' will remove them" >&2; \ - exit 1; \ - else :; fi; \ - else :; fi - $(am__remove_distdir) - test -d "$(distdir)" || mkdir "$(distdir)" - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" distdir="$(distdir)" \ - dist-hook - -test -n "$(am__skip_mode_fix)" \ - || find "$(distdir)" -type d ! -perm -755 \ - -exec chmod u+rwx,go+rx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r "$(distdir)" -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist-lzip: distdir - tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz - $(am__remove_distdir) - -dist-lzma: distdir - tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma - $(am__remove_distdir) - -dist-xz: distdir - tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz - $(am__remove_distdir) - -dist-tarZ: distdir - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) - -dist-shar: distdir - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) - -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lzma*) \ - lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ - *.tar.lz*) \ - lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ - *.tar.xz*) \ - xz -dc $(distdir).tar.xz | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir); chmod u+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst - chmod a-w $(distdir) - test -d $(distdir)/_build || exit 0; \ - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && am__cwd=`pwd` \ - && $(am__cd) $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(AM_DISTCHECK_CONFIGURE_FLAGS) \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ - && cd "$$am__cwd" \ - || exit 1 - $(am__remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' -distuninstallcheck: - @test -n '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: trying to run $@ with an empty' \ - '$$(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - $(am__cd) '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-recursive -all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(MANS) $(DATA) \ - config.h -install-binPROGRAMS: install-libLTLIBRARIES - -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(confexecdir)" "$(DESTDIR)$(m4datadir)" "$(DESTDIR)$(pkgconfigdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -clean: clean-recursive - -clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ - clean-libtool clean-noinstLTLIBRARIES clean-noinstPROGRAMS \ - mostlyclean-am - -distclean: distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-hdr distclean-libtool distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -html-am: - -info: info-recursive - -info-am: - -install-data-am: install-data-local install-m4dataDATA install-man \ - install-pkgconfigDATA - -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: install-binPROGRAMS install-binSCRIPTS \ - install-confexecDATA install-libLTLIBRARIES - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: install-man1 install-man3 - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \ - uninstall-confexecDATA uninstall-libLTLIBRARIES \ - uninstall-local uninstall-m4dataDATA uninstall-man \ - uninstall-pkgconfigDATA - -uninstall-man: uninstall-man1 uninstall-man3 - -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \ - ctags-recursive install install-am install-strip \ - tags-recursive - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am am--refresh check check-am clean clean-binPROGRAMS \ - clean-generic clean-libLTLIBRARIES clean-libtool \ - clean-noinstLTLIBRARIES clean-noinstPROGRAMS ctags \ - ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \ - dist-lzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ - distcheck distclean distclean-compile distclean-generic \ - distclean-hdr distclean-libtool distclean-tags distcleancheck \ - distdir distuninstallcheck dvi dvi-am html html-am info \ - info-am install install-am install-binPROGRAMS \ - install-binSCRIPTS install-confexecDATA install-data \ - install-data-am install-data-local install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-libLTLIBRARIES \ - install-m4dataDATA install-man install-man1 install-man3 \ - install-pdf install-pdf-am install-pkgconfigDATA install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am \ - uninstall-binPROGRAMS uninstall-binSCRIPTS \ - uninstall-confexecDATA uninstall-libLTLIBRARIES \ - uninstall-local uninstall-m4dataDATA uninstall-man \ - uninstall-man1 uninstall-man3 uninstall-pkgconfigDATA - - -# that one forces the rebuild when "make rebuild" is run on doc/ -rebuild_testapi: - -@(if [ "$(PYTHON)" != "" ] ; then \ - $(PYTHON) $(srcdir)/gentest.py $(srcdir) ; fi ) - -# that one is just to make sure it is rebuilt if missing -# but adding the dependances generate mess -testapi.c: $(srcdir)/gentest.py - -@(if [ "$(PYTHON)" != "" ] ; then \ - $(PYTHON) $(srcdir)/gentest.py $(srcdir) ; fi ) - -#testOOM_SOURCES=testOOM.c testOOMlib.h testOOMlib.c -#testOOM_LDFLAGS = -#testOOM_DEPENDENCIES = $(DEPS) -#testOOM_LDADD= $(LDADDS) - -runtests: - [ -d test ] || $(LN_S) $(srcdir)/test . - [ -d result ] || $(LN_S) $(srcdir)/result . - $(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testrecurse$(EXEEXT) &&$(CHECKER) ./testapi$(EXEEXT) && $(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT) - @(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \ - $(MAKE) tests ; fi) - -check: all runtests - -check-valgrind valgrind: all - @echo '## Running the regression tests under Valgrind' - @echo '## Go get a cup of coffee it is gonna take a while ...' - $(MAKE) CHECKER='valgrind -q' runtests - -testall : tests SVGtests SAXtests - -tests: XMLtests XMLenttests NStests IDtests Errtests APItests $(READER_TEST) $(TEST_SAX) $(TEST_PUSH) $(TEST_HTML) $(TEST_PHTML) $(TEST_VALID) URItests $(TEST_PATTERN) $(TEST_XPATH) $(TEST_XPTR) $(TEST_XINCLUDE) $(TEST_C14N) $(TEST_DEBUG) $(TEST_CATALOG) $(TEST_REGEXPS) $(TEST_SCHEMAS) $(TEST_SCHEMATRON) $(TEST_THREADS) Timingtests $(TEST_VTIME) $(PYTHON_TESTS) $(TEST_MODULES) - @(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \ - $(MAKE) tests ; fi) - @(cd doc/examples ; $(MAKE) tests) - -APItests: testapi$(EXEEXT) - @echo "## Running the API regression tests this may take a little while" - -@($(CHECKER) $(top_builddir)/testapi -q) - -HTMLtests : testHTML$(EXEEXT) - @(echo > .memdump) - @echo "## HTML regression tests" - -@(for i in $(srcdir)/test/HTML/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testHTML $$i > $(srcdir)/result/HTML/$$name 2>$(srcdir)/result/HTML/$$name.err ; \ - else \ - log=`$(CHECKER) $(top_builddir)/testHTML $$i > result.$$name 2> error.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/HTML/$$name result.$$name ; \ - diff -b $(srcdir)/result/HTML/$$name.err error.$$name ; \ - $(CHECKER) $(top_builddir)/testHTML result.$$name > result2.$$name 2>error.$$name ; \ - diff result.$$name result2.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name result2.$$name error.$$name ; \ - fi ; fi ; done) - -HTMLPushtests : testHTML$(EXEEXT) - @echo "## Push HTML regression tests" - -@(for i in $(srcdir)/test/HTML/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testHTML --push $$i > $(srcdir)/result/HTML/$$name 2>$(srcdir)/result/HTML/$$name.err ; \ - else \ - log=`$(CHECKER) $(top_builddir)/testHTML --push $$i > result.$$name 2> error.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/HTML/$$name result.$$name ; \ - cut -b 1-15 $(srcdir)/result/HTML/$$name.err > errorcut.$$name; \ - cut -b 1-15 error.$$name > errorcut2.$$name; \ - diff -b errorcut.$$name errorcut2.$$name ; \ - $(CHECKER) $(top_builddir)/testHTML --push result.$$name > result2.$$name 2>error.$$name ; \ - diff result.$$name result2.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name result2.$$name error.$$name errorcut.$$name errorcut2.$$name ; \ - fi ; fi ; done) - @echo "## HTML SAX regression tests" - -@(for i in $(srcdir)/test/HTML/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/HTML/$$name.sax ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testHTML --sax $$i > $(srcdir)/result/HTML/$$name.sax ; \ - else \ - log=`$(CHECKER) $(top_builddir)/testHTML --sax $$i > result.$$name.sax ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/HTML/$$name.sax result.$$name.sax` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name.sax ; \ - fi ; fi ; done) - @echo "## Push HTML SAX regression tests" - -@(for i in $(srcdir)/test/HTML/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testHTML --push --sax $$i > $(srcdir)/result/HTML/$$name.sax ; \ - else \ - log=`$(CHECKER) $(top_builddir)/testHTML --push --sax $$i 2>&1 > result.$$name.sax ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/HTML/$$name.sax result.$$name.sax` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name.sax ; \ - fi ; fi ; done) - -XMLtests : xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## XML regression tests" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint $$i > $(srcdir)/result/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff $(srcdir)/result/$$name result.$$name ; \ - $(CHECKER) $(top_builddir)/xmllint result.$$name 2>&1 > result2.$$name | grep -v 'failed to load external entity' ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff result.$$name result2.$$name` ;\ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name result2.$$name ; \ - fi ; fi ; done) - @echo "## XML regression tests on memory" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --memory $$i > $(srcdir)/result/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --memory $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/$$name result.$$name ; \ - $(CHECKER) $(top_builddir)/xmllint --memory result.$$name 2>&1 > result2.$$name | grep -v 'failed to load external entity' ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"`; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - diff result.$$name result2.$$name ; \ - rm result.$$name result2.$$name ; \ - fi ; fi ; done) - -XMLPushtests: xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## XML push regression tests" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --push $$i > $(srcdir)/result/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --push $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff $(srcdir)/result/$$name result.$$name ; \ - $(CHECKER) $(top_builddir)/xmllint --push result.$$name 2>&1 > result2.$$name | grep -v 'failed to load external entity' ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff result.$$name result2.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name result2.$$name ; \ - fi ; fi ; done) - -NStests : xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## XML Namespaces regression tests" - -@(for i in $(srcdir)/test/namespaces/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/namespaces/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint $$i \ - 2> $(srcdir)/result/namespaces/$$name.err \ - > $(srcdir)/result/namespaces/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint $$i 2> error.$$name > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff $(srcdir)/result/namespaces/$$name result.$$name ; \ - diff $(srcdir)/result/namespaces/$$name.err error.$$name`; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name error.$$name ; \ - fi ; fi ; done) - -IDtests : xmllint$(EXEEXT) testXPath$(EXEEXT) - @(echo > .memdump) - @echo "## xml:id regression tests" - -@(for i in $(srcdir)/test/xmlid/id_*.xml ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/xmlid/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testXPath -i $$i "id('bar')" \ - 2> $(srcdir)/result/xmlid/$$name.err \ - > $(srcdir)/result/xmlid/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/testXPath -i $$i "id('bar')" 2> error.$$name > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff $(srcdir)/result/xmlid/$$name result.$$name ; \ - diff $(srcdir)/result/xmlid/$$name.err error.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name error.$$name ; \ - fi ; fi ; done) - -Errtests : xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## Error cases regression tests" - -@(for i in $(srcdir)/test/errors/*.xml ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/errors/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint $$i \ - 2> $(srcdir)/result/errors/$$name.err \ - > $(srcdir)/result/errors/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint $$i 2> error.$$name > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff $(srcdir)/result/errors/$$name result.$$name ; \ - diff $(srcdir)/result/errors/$$name.err error.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name error.$$name ; \ - fi ; fi ; done) - @echo "## Error cases stream regression tests" - -@(for i in $(srcdir)/test/errors/*.xml ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/errors/$$name.str ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --stream $$i \ - 2> $(srcdir)/result/errors/$$name.str \ - > /dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --stream $$i 2> error.$$name > /dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff $(srcdir)/result/errors/$$name.str error.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm error.$$name ; \ - fi ; fi ; done) - -Docbtests : xmllint$(EXEEXT) - -XMLenttests : xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## XML entity subst regression tests" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/noent/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --noent $$i > $(srcdir)/result/noent/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --noent $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff $(srcdir)/result/noent/$$name result.$$name ; \ - $(CHECKER) $(top_builddir)/xmllint --noent result.$$name 2>&1 > result2.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff result.$$name result2.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name result2.$$name ; \ - fi ; fi ; done) - -URItests : testURI$(EXEEXT) - @(echo > .memdump) - @echo "## URI module regression tests" - -@(for i in $(srcdir)/test/URI/*.data ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/URI/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testURI -base 'http://foo.com/path/to/index.html?orig#help' < $$i > $(srcdir)/result/URI/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/testURI -base 'http://foo.com/path/to/index.html?orig#help' < $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/URI/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - -@(for i in $(srcdir)/test/URI/*.uri ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/URI/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testURI < $$i > $(srcdir)/result/URI/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/testURI < $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/URI/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - -XPathtests : testXPath$(EXEEXT) - @(echo > .memdump) - @echo "## XPath regression tests" - -@(if [ "`$(top_builddir)/testXPath | grep 'support not compiled in'`" != "" ] ; \ - then echo Skipping debug not compiled in ; exit 0 ; fi ; \ - for i in $(srcdir)/test/XPath/expr/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/XPath/expr/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testXPath -f --expr $$i > $(srcdir)/result/XPath/expr/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/testXPath -f --expr $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/XPath/expr/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done ; \ - for i in $(srcdir)/test/XPath/docs/* ; do \ - if [ ! -d $$i ] ; then \ - doc=`basename $$i`; \ - for j in $(srcdir)/test/XPath/tests/$$doc* ; do \ - if [ ! -f $$j ] ; then continue ; fi ; \ - name=`basename $$j`; \ - if [ ! -d $$j ] ; then \ - if [ ! -f $(srcdir)/result/XPath/tests/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testXPath -f -i $$i $$j > $(srcdir)/result/XPath/tests/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/testXPath -f -i $$i $$j 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/XPath/tests/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done ; fi ; done) - -XPtrtests : testXPath$(EXEEXT) - @(echo > .memdump) - @echo "## XPointer regression tests" - -@(if [ "`$(top_builddir)/testXPath | grep 'support not compiled in'`" != "" ] ; \ - then echo Skipping debug not compiled in ; exit 0 ; fi ; \ - for i in $(srcdir)/test/XPath/docs/* ; do \ - if [ ! -d $$i ] ; then \ - doc=`basename $$i`; \ - for j in $(srcdir)/test/XPath/xptr/$$doc* ; do \ - if [ ! -f $$j ] ; then continue ; fi ; \ - name=`basename $$j`; \ - if [ ! -d $$j ] ; then \ - if [ ! -f $(srcdir)/result/XPath/xptr/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testXPath -xptr -f -i $$i $$j > $(srcdir)/result/XPath/xptr/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - else \ - log=`$(CHECKER) $(top_builddir)/testXPath -xptr -f -i $$i $$j 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/XPath/xptr/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done ; fi ; done) - -XIncludetests : xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## XInclude regression tests" - -@(for i in $(srcdir)/test/XInclude/docs/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/XInclude/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude $$i > $(srcdir)/result/XInclude/$$name 2> $(srcdir)/result/XInclude/$$name.err ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude $$i > result.$$name 2>error.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/XInclude/$$name result.$$name ; \ - diff $(srcdir)/result/XInclude/$$name.err error.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name error.$$name ; \ - fi ; fi ; done) - -@(for i in $(srcdir)/test/XInclude/docs/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/XInclude/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --nowarning --noxincludenode $$i > $(srcdir)/result/XInclude/$$name 2> $(srcdir)/result/XInclude/$$name.err ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --noxincludenode $$i > result.$$name 2>error.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/XInclude/$$name result.$$name ; \ - diff $(srcdir)/result/XInclude/$$name.err error.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name error.$$name ; \ - fi ; fi ; done) - @(echo > .memdump) - @echo "## XInclude xmlReader regression tests" - -@(for i in $(srcdir)/test/XInclude/docs/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/XInclude/$$name.rdr ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude --stream --debug $$i > $(srcdir)/result/XInclude/$$name.rdr ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude --stream --debug $$i > result.$$name 2>error.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/XInclude/$$name.err error.$$name ; \ - diff $(srcdir)/result/XInclude/$$name.rdr result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name error.$$name ; \ - fi ; fi ; done) - -@(for i in $(srcdir)/test/XInclude/docs/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/XInclude/$$name.rdr ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --nowarning --noxincludenode --stream --debug $$i > $(srcdir)/result/XInclude/$$name.rdr ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude --stream --debug $$i > result.$$name 2>error.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/XInclude/$$name.err error.$$name ; \ - diff $(srcdir)/result/XInclude/$$name.rdr result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name error.$$name ; \ - fi ; fi ; done) - -Scripttests : xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## Scripts regression tests" - @echo "## Some of the base computations may be different if srcdir != ." - -@(for i in $(srcdir)/test/scripts/*.script ; do \ - name=`basename $$i .script`; \ - xml=$(srcdir)/test/scripts/`basename $$i .script`.xml; \ - if [ -f $$xml ] ; then \ - if [ ! -f $(srcdir)/result/scripts/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --shell $$xml < $$i > $(srcdir)/result/scripts/$$name 2> $(srcdir)/result/scripts/$$name.err ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --shell $$xml < $$i > result.$$name 2> result.$$name.err ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/scripts/$$name result.$$name ; \ - diff $(srcdir)/result/scripts/$$name.err result.$$name.err` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name result.$$name.err ; \ - fi ; fi ; done) - -Catatests : xmlcatalog$(EXEEXT) - @(echo > .memdump) - @echo "## Catalog regression tests" - -@(for i in $(srcdir)/test/catalogs/*.script ; do \ - name=`basename $$i .script`; \ - xml=$(srcdir)/test/catalogs/`basename $$i .script`.xml; \ - if [ -f $$xml ] ; then \ - if [ ! -f $(srcdir)/result/catalogs/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmlcatalog --shell $$xml < $$i 2>&1 > $(srcdir)/result/catalogs/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmlcatalog --shell $$xml < $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/catalogs/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - -@(for i in $(srcdir)/test/catalogs/*.script ; do \ - name=`basename $$i .script`; \ - sgml=$(srcdir)/test/catalogs/`basename $$i .script`.sgml; \ - if [ -f $$sgml ] ; then \ - if [ ! -f $(srcdir)/result/catalogs/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmlcatalog --shell $$sgml < $$i > $(srcdir)/result/catalogs/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmlcatalog --shell $$sgml < $$i > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/catalogs/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - @echo "## Add and del operations on XML Catalogs" - -@($(CHECKER) $(top_builddir)/xmlcatalog --create --noout $(srcdir)/result/catalogs/mycatalog; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - $(CHECKER) $(top_builddir)/xmlcatalog --noout --add public Pubid sysid $(srcdir)/result/catalogs/mycatalog; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - $(CHECKER) $(top_builddir)/xmlcatalog --noout --add public Pubid2 sysid2 $(srcdir)/result/catalogs/mycatalog; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - $(CHECKER) $(top_builddir)/xmlcatalog --noout --add public Pubid3 sysid3 $(srcdir)/result/catalogs/mycatalog; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff result/catalogs/mycatalog.full $(srcdir)/result/catalogs/mycatalog; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - $(CHECKER) $(top_builddir)/xmlcatalog --noout --del sysid $(srcdir)/result/catalogs/mycatalog; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - $(CHECKER) $(top_builddir)/xmlcatalog --noout --del sysid3 $(srcdir)/result/catalogs/mycatalog; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - $(CHECKER) $(top_builddir)/xmlcatalog --noout --del sysid2 $(srcdir)/result/catalogs/mycatalog; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - diff result/catalogs/mycatalog.empty $(srcdir)/result/catalogs/mycatalog; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - rm -f $(srcdir)/result/catalogs/mycatalog) - -SVGtests : xmllint$(EXEEXT) - @echo "## SVG parsing regression tests" - -@(for i in $(srcdir)/test/SVG/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/SVG/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint $$i > $(srcdir)/result/SVG/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - echo Testing $$name ; \ - $(CHECKER) $(top_builddir)/xmllint $$i > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/SVG/$$name result.$$name ; \ - $(CHECKER) $(top_builddir)/xmllint result.$$name > result2.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff result.$$name result2.$$name ; \ - rm result.$$name result2.$$name ; \ - fi ; fi ; done) - -Threadtests : testThreads$(EXEEXT) - @echo "## Threaded regression tests" - -@($(CHECKER) $(top_builddir)/testThreads ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ - exit 0) - -Readertests : xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## Reader regression tests" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/$$name.rdr ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --nonet --debug --stream $$i > $(srcdir)/result/$$name.rdr 2>/dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/$$name.rdr result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - @echo "## Reader on memory regression tests" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/$$name.rdr ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --memory --nonet --debug --stream $$i > $(srcdir)/result/$$name.rdr 2>/dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --memory --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/$$name.rdr result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - @(echo > .memdump) - @echo "## Walker regression tests" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/$$name.rdr ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --nonet --debug --walker $$i > $(srcdir)/result/$$name.rdr 2>/dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --nonet --debug --walker $$i > result.$$name 2>/dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/$$name.rdr result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - @echo "## Reader entities substitution regression tests" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/$$name.rde ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --noent --nonet --debug --stream $$i > $(srcdir)/result/$$name.rde 2>/dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --noent --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/$$name.rde result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - -SAXtests : testSAX$(EXEEXT) - @(echo > .memdump) - @echo "## SAX1 callbacks regression tests" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/$$name.sax ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testSAX $$i > $(srcdir)/result/$$name.sax 2> /dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/testSAX $$i > result.$$name 2> /dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/$$name.sax result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - @echo "## SAX2 callbacks regression tests" - -@(for i in $(srcdir)/test/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/$$name.sax2 ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testSAX --sax2 $$i > $(srcdir)/result/$$name.sax2 2> /dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/testSAX --sax2 $$i > result.$$name 2> /dev/null ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/$$name.sax2 result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - -Validtests : xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## Valid documents regression tests" - -@(for i in $(srcdir)/test/VCM/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - log=`$(CHECKER) $(top_builddir)/xmllint --valid --noout --nowarning $$i ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"`;\ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - fi ; done ; exit 0) - @echo "## Validity checking regression tests" - -@(for i in $(srcdir)/test/VC/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/VC/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --noout --valid $$i 2> $(srcdir)/result/VC/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --noout --valid $$i 2> result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/VC/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - @echo "## General documents valid regression tests" - -@(for i in $(srcdir)/test/valid/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/valid/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/xmllint --valid $$i > $(srcdir)/result/valid/$$name 2>$(srcdir)/result/valid/$$name.err ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint --valid $$i > result.$$name 2>error.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/valid/$$name result.$$name ; \ - diff $(srcdir)/result/valid/$$name.err error.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name error.$$name ; \ - fi ; fi ; done) - -Regexptests: testRegexp$(EXEEXT) - @(echo > .memdump) - @echo "## Regexp regression tests" - -@(for i in $(srcdir)/test/regexp/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/regexp/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testRegexp -i $$i > $(srcdir)/result/regexp/$$name; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/testRegexp -i $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/regexp/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - @echo "## Formal expresssions regression tests" - -@(for i in $(srcdir)/test/expr/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/expr/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testRegexp --expr -i $$i > $(srcdir)/result/expr/$$name; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/testRegexp --expr -i $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/expr/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - -Automatatests: testAutomata$(EXEEXT) - @(echo > .memdump) - @echo "## Automata regression tests" - -@(for i in $(srcdir)/test/automata/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/automata/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testAutomata $$i > $(srcdir)/result/automata/$$name; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/testAutomata $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/automata/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - -dba100000.xml: dbgenattr.pl - @echo "## generating dba100000.xml" - @($(PERL) $(top_srcdir)/dbgenattr.pl 100000 > dba100000.xml) - -Timingtests: xmllint$(EXEEXT) dba100000.xml - @echo "## Timing tests to try to detect performance" - @echo "## as well a memory usage breakage when streaming" - @echo "## 1/ using the file interface" - @echo "## 2/ using the memory interface" - @echo "## 3/ repeated DOM parsing" - @echo "## 4/ repeated DOM validation" - -@($(top_builddir)/xmllint --stream --timing dba100000.xml; \ - MEM=`cat .memdump | grep "MEMORY ALLOCATED" | awk '{ print $$7}'`;\ - if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - exit 0) - -@($(top_builddir)/xmllint --stream --timing --memory dba100000.xml; \ - MEM=`cat .memdump | grep "MEMORY ALLOCATED" | awk '{ print $$7}'`;\ - if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - exit 0) - -@($(top_builddir)/xmllint --noout --timing --repeat $(srcdir)/test/valid/REC-xml-19980210.xml; \ - MEM=`cat .memdump | grep "MEMORY ALLOCATED" | awk '{ print $$7}'`;\ - if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - exit 0) - -VTimingtests: xmllint$(EXEEXT) - -@($(top_builddir)/xmllint --noout --timing --valid --repeat $(srcdir)/test/valid/REC-xml-19980210.xml; \ - MEM=`cat .memdump | grep "MEMORY ALLOCATED" | awk '{ print $$7}'`;\ - if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - exit 0) - -C14Ntests : testC14N$(EXEEXT) - @echo "## C14N and XPath regression tests" - -@(for m in with-comments without-comments 1-1-without-comments exc-without-comments ; do \ - for i in $(srcdir)/test/c14n/$$m/*.xml ; do \ - if [ ! -d $$i ] ; then \ - name=`basename $$i .xml`; \ - cmdline="$(CHECKER) $(top_builddir)/testC14N --$$m $$i"; \ - if [ -f $(srcdir)/test/c14n/$$m/$$name.xpath ] ; then \ - cmdline="$$cmdline $(srcdir)/test/c14n/$$m/$$name.xpath"; \ - if [ -f $(srcdir)/test/c14n/$$m/$$name.ns ] ; then \ - cmdline="$$cmdline '`cat $(srcdir)/test/c14n/$$m/$$name.ns`'"; \ - fi; \ - fi; \ - $$cmdline > $(srcdir)/test/c14n/test.tmp; \ - if [ $$? -eq 0 ]; then \ - diff $(srcdir)/result/c14n/$$m/$$name $(srcdir)/test/c14n/test.tmp; \ - if [ $$? -ne 0 ]; then \ - echo "Test $$m/$$name failed"; \ - cat $(srcdir)/test/c14n/test.tmp; \ - fi; \ - else \ - echo "C14N failed"; \ - fi; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - fi; \ - rm -f $(srcdir)/test/c14n/test.tmp; \ - done; \ - done) - -Schemastests: testSchemas$(EXEEXT) - @(echo > .memdump) - @echo "## Schemas regression tests" - -@(for i in $(srcdir)/test/schemas/*_*.xsd ; do \ - name=`basename $$i | sed 's+_.*++'`; \ - sno=`basename $$i | sed 's+.*_\(.*\).xsd+\1+'`; \ - for j in $(srcdir)/test/schemas/"$$name"_*.xml ; do \ - if [ -f $$j ] ; then \ - xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \ - if [ ! -f $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" ]; \ - then \ - echo New test file "$$name"_"$$sno"_"$$xno" ; \ - $(CHECKER) $(top_builddir)/testSchemas $$i $$j \ - > $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" \ - 2> $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno".err; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/testSchemas $$i $$j \ - > res.$$name 2> err.$$name;\ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" \ - res.$$name;\ - diff $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno".err \ - err.$$name;\ - grep Unimplemented err.$$name`; \ - if [ -n "$$log" ] ; then echo "$$name"_"$$sno"_"$$xno" result ; echo $$log ; fi ; \ - rm res.$$name err.$$name ; \ - fi ; fi ;\ - done; done) - -Relaxtests: xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## Relax-NG regression tests" - -@(for i in $(srcdir)/test/relaxng/*.rng ; do \ - name=`basename $$i | sed 's+\.rng++'`; \ - if [ ! -f $(srcdir)/result/relaxng/"$$name"_valid ] ; then \ - echo New schemas $$name ; \ - $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $(srcdir)/test/relaxng/tutorA.rng $$i \ - > $(srcdir)/result/relaxng/"$$name"_valid \ - 2> $(srcdir)/result/relaxng/"$$name"_err; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $(srcdir)/test/relaxng/tutorA.rng $$i \ - > res.$$name 2> err.$$name;\ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/relaxng/"$$name"_valid \ - res.$$name;\ - diff $(srcdir)/result/relaxng/"$$name"_err \ - err.$$name | grep -v "error detected at";\ - grep Unimplemented err.$$name`; \ - if [ -n "$$log" ] ; then echo schemas $$name result ; echo $$log ; fi ; \ - rm res.$$name err.$$name ; \ - fi; \ - for j in $(srcdir)/test/relaxng/"$$name"_*.xml ; do \ - if [ -f $$j ] ; then \ - xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \ - if [ ! -f $(srcdir)/result/relaxng/"$$name"_"$$xno" ]; \ - then \ - echo New test file "$$name"_"$$xno" ; \ - $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $$i $$j \ - > $(srcdir)/result/relaxng/"$$name"_"$$xno" \ - 2> $(srcdir)/result/relaxng/"$$name"_"$$xno".err; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $$i $$j \ - > res.$$name 2> err.$$name;\ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/relaxng/"$$name"_"$$xno" \ - res.$$name;\ - diff $(srcdir)/result/relaxng/"$$name"_"$$xno".err \ - err.$$name | grep -v "error detected at";\ - grep Unimplemented err.$$name`; \ - if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo $$log ; fi ; \ - rm res.$$name err.$$name ; \ - fi ; fi ; \ - done; done) - @echo "## Relax-NG streaming regression tests" - -@(for i in $(srcdir)/test/relaxng/*.rng ; do \ - name=`basename $$i | sed 's+\.rng++'`; \ - for j in $(srcdir)/test/relaxng/"$$name"_*.xml ; do \ - if [ -f $$j ] ; then \ - xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \ - if [ ! -f $(srcdir)/result/relaxng/"$$name"_"$$xno" ]; \ - then \ - echo New test file "$$name"_"$$xno" ; \ - $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $$i $$j \ - > $(srcdir)/result/relaxng/"$$name"_"$$xno" \ - 2> $(srcdir)/result/relaxng/"$$name"_"$$xno".err; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --stream --relaxng $$i $$j \ - > res.$$name 2> err.$$name;\ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/relaxng/"$$name"_"$$xno" res.$$name;\ - if [ "$$name" != "tutor10_1" -a "$$name" != "tutor10_2" -a "$$name" != "tutor3_2" -a "$$name" != "307377" -a "$$name" != "tutor8_2" ] ; then \ - diff $(srcdir)/result/relaxng/"$$name"_"$$xno".err \ - err.$$name | grep -v "error detected at";\ - fi ; grep Unimplemented err.$$name`; \ - if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo $$log ; fi ; \ - rm res.$$name err.$$name ; \ - fi ; fi ; \ - done; done) - -Schematrontests: xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## Schematron regression tests" - -@(for i in $(srcdir)/test/schematron/*.sct ; do \ - name=`basename $$i | sed 's+\.sct++'`; \ - for j in $(srcdir)/test/schematron/"$$name"_*.xml ; do \ - if [ -f $$j ] ; then \ - xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \ - if [ ! -f $(srcdir)/result/schematron/"$$name"_"$$xno" ]; \ - then \ - echo New test file "$$name"_"$$xno" ; \ - $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --schematron $$i $$j \ - > $(srcdir)/result/schematron/"$$name"_"$$xno" \ - 2> $(srcdir)/result/schematron/"$$name"_"$$xno".err; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --schematron $$i $$j \ - > res.$$name 2> err.$$name;\ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/schematron/"$$name"_"$$xno" \ - res.$$name;\ - diff $(srcdir)/result/schematron/"$$name"_"$$xno".err \ - err.$$name | grep -v "error detected at";\ - grep Unimplemented err.$$name`; \ - if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo $$log ; fi ; \ - rm res.$$name err.$$name ; \ - fi ; fi ; \ - done; done) - -RelaxNGPythonTests: - @(if [ -x $(PYTHON) ] ; then \ - PYTHONPATH=$(top_builddir)/python:$(top_builddir)/python/.libs:$$PYTHONPATH ; \ - export PYTHONPATH; \ - LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \ - export LD_LIBRARY_PATH; \ - echo "## Relax-NG Python based test suite 1" ; \ - $(CHECKER) $(PYTHON) $(srcdir)/check-relaxng-test-suite.py ; \ - echo "## Relax-NG Python based test suite 2" ; \ - $(CHECKER) $(PYTHON) $(srcdir)/check-relaxng-test-suite2.py ; \ - fi) - -SchemasPythonTests: - @(if [ -x $(PYTHON) ] ; then \ - PYTHONPATH=$(top_builddir)/python:$(top_builddir)/python/.libs:$$PYTHONPATH; \ - export PYTHONPATH; \ - LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \ - export LD_LIBRARY_PATH; \ - echo "## XML Schemas datatypes Python based test suite" ; \ - echo "## It is normal to see 11 errors reported" ; \ - $(CHECKER) $(PYTHON) $(srcdir)/check-xsddata-test-suite.py ; \ - fi) - @(if [ -x $(PYTHON) -a -d xstc ] ; then cd xstc ; $(MAKE) CHECKER="$(CHECKER)" pytests ; fi) - -Patterntests: xmllint$(EXEEXT) - @(echo > .memdump) - @echo "## Pattern regression tests" - -@(for i in $(srcdir)/test/pattern/*.pat ; do \ - name=`basename $$i .pat`; \ - if [ -f $(srcdir)/test/pattern/$$name.xml ] ; then \ - if [ ! -f $(srcdir)/result/pattern/$$name ] ; then \ - rm -f result.$$name ; \ - echo New test file $$name ; \ - for pat in `cat $$i` ; do \ - $(CHECKER) $(top_builddir)/xmllint --walker --pattern $$pat $(srcdir)/test/pattern/$$name.xml >> $(srcdir)/result/pattern/$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - done ;\ - else \ - rm -f result.$$name ; \ - lst=`cat $$i` ; \ - log=`for pat in $$lst ; do $(CHECKER) $(top_builddir)/xmllint --walker --pattern $$pat $(srcdir)/test/pattern/$$name.xml 2>&1 >> result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - done ;\ - diff $(srcdir)/result/pattern/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done ;) - -ModuleTests: testModule$(EXEEXT) testdso.la - @echo "## Module tests" - @(./testModule$(EXEEXT)) - -cleanup: - -@(find . -name .\#\* -exec rm {} \;) - -@(find . -name \*.gcda -o -name \*.gcno -exec rm -f {} \;) - -@(find . -name \*.orig -o -name \*.rej -o -name \*.old -exec rm -f {} \;) - -dist-hook: cleanup libxml2.spec - -cp libxml2.spec $(distdir) - (cd $(srcdir) ; tar -cf - --exclude CVS --exclude .svn --exclude .git win32 macos vms VxWorks bakefile test result) | (cd $(distdir); tar xf -) - -dist-source: distdir - $(AMTAR) -chof - --exclude Tests --exclude test --exclude result $(distdir) | GZIP=$(GZIP_ENV) gzip -c >`echo "$(distdir)" | sed "s+libxml2+libxml2-sources+"`.tar.gz - -dist-test: distdir - (mkdir -p $(distdir)) - (cd $(srcdir) ; tar -cf - --exclude CVS --exclude .svn --exclude .git xstc/Tests) | (cd $(distdir); tar xf -) - tar -cf - $(distdir)/test $(distdir)/result $(distdir)/xstc/Tests $(distdir)/Makefile.tests $(distdir)/README $(distdir)/README.tests $(distdir)/AUTHORS $(distdir)/testapi.c $(distdir)/runtest.c $(distdir)/runsuite.c | GZIP=$(GZIP_ENV) gzip -c >`echo "$(distdir)" | sed "s+libxml2+libxml2-tests+"`.tar.gz - @(rm -rf $(distdir)/xstc/Test) - -cleantar: - @(rm -f libxml*.tar.gz COPYING.LIB) - -rpm: cleanup cleantar - @(unset CDPATH ; $(MAKE) dist-source dist && rpmbuild -ta $(distdir).tar.gz) - -xml2Conf.sh: xml2Conf.sh.in Makefile - sed -e 's?\@XML_LIBDIR\@?$(XML_LIBDIR)?g' \ - -e 's?\@XML_INCLUDEDIR\@?$(XML_INCLUDEDIR)?g' \ - -e 's?\@VERSION\@?$(VERSION)?g' \ - -e 's?\@XML_LIBS\@?$(XML_LIBS)?g' \ - < $(srcdir)/xml2Conf.sh.in > xml2Conf.tmp \ - && mv xml2Conf.tmp xml2Conf.sh - -install-data-local: - $(MKDIR_P) $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE) - -$(INSTALL) -m 0644 $(srcdir)/Copyright $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE) - $(MKDIR_P) $(DESTDIR)$(EXAMPLES_DIR) - -$(INSTALL) -m 0644 $(srcdir)/xmllint.c $(DESTDIR)$(EXAMPLES_DIR) - -$(INSTALL) -m 0644 $(srcdir)/testSAX.c $(DESTDIR)$(EXAMPLES_DIR) - -$(INSTALL) -m 0644 $(srcdir)/testHTML.c $(DESTDIR)$(EXAMPLES_DIR) - -$(INSTALL) -m 0644 $(srcdir)/testXPath.c $(DESTDIR)$(EXAMPLES_DIR) - -uninstall-local: - rm -f $(DESTDIR)$(EXAMPLES_DIR)/testXPath.c - rm -f $(DESTDIR)$(EXAMPLES_DIR)/testHTML.c - rm -f $(DESTDIR)$(EXAMPLES_DIR)/testSAX.c - rm -f $(DESTDIR)$(EXAMPLES_DIR)/xmllint.c - rm -rf $(DESTDIR)$(EXAMPLES_DIR) - rm -f $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)/Copyright - rm -rf $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE) - -tst: tst.c - $(CC) $(CFLAGS) -Iinclude -o tst tst.c .libs/libxml2.a -lpthread -lm -lz -llzma - -sparse: clean - $(MAKE) CC=cgcc - -cov: clean-cov - if [ "`echo $(LDFLAGS) | grep coverage`" = "" ] ; then \ - echo not configured with coverage; exit 1 ; fi - if [ ! -x $(LCOV) -o ! -x $(GENHTML) ] ; then \ - echo Need $(LCOV) and $(GENHTML) excecutables; exit 1 ; fi - -@($(MAKE) check) - -@(./runsuite$(EXEEXT)) - mkdir $(top_builddir)/coverage - $(LCOV) -c -o $(top_builddir)/coverage/libxml2.info.tmp -d $(top_srcdir) - $(LCOV) -r $(top_builddir)/coverage/libxml2.info.tmp -o $(top_builddir)/coverage/libxml2.info *usr* - rm $(top_builddir)/coverage/libxml2.info.tmp - $(GENHTML) -s -t "libxml2" -o $(top_builddir)/coverage --legend $(top_builddir)/coverage/libxml2.info - echo "Coverage report is in $(top_builddir)/coverage/index.html" - -clean-cov: - rm -rf $(top_builddir)/coverage - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/lib/3rdparty/libxml2/Makefile.tests b/lib/3rdparty/libxml2/Makefile.tests deleted file mode 100644 index 619cbfb8597..00000000000 --- a/lib/3rdparty/libxml2/Makefile.tests +++ /dev/null @@ -1,41 +0,0 @@ -# -# You may have to ajust to call the right compiler, or other oprions -# for compiling and linking -# - -CFLAGS=`xml2-config --cflags` -LIBS=`xml2-config --libs` -THREADLIB= -lpthread -EXEEXT= - -all: runtest$(EXEEXT) runsuite$(EXEEXT) testapi$(EXEEXT) testchar$(EXEEXT) - -clean: - $(RM) runtest$(EXEEXT) runsuite$(EXEEXT) testapi$(EXEEXT) - -check: do_runtest do_testchar do_testapi do_runsuite - -runtest$(EXEEXT): runtest.c - $(CC) -o runtest$(EXEEXT) $(CFLAGS) runtest.c $(LIBS) $(THREADLIB) - -do_runtest: runtest$(EXEEXT) - ./runtest - -runsuite$(EXEEXT): runsuite.c - $(CC) -o runsuite$(EXEEXT) $(CFLAGS) runsuite.c $(LIBS) - -do_runsuite: runsuite$(EXEEXT) - ./runsuite - -testapi$(EXEEXT): testapi.c - $(CC) -o testapi$(EXEEXT) $(CFLAGS) testapi.c $(LIBS) - -do_testapi: testapi$(EXEEXT) - ./testapi - -testchar$(EXEEXT): testchar.c - $(CC) -o testchar$(EXEEXT) $(CFLAGS) testchar.c $(LIBS) - -do_testchar: testchar$(EXEEXT) - ./testchar - diff --git a/lib/3rdparty/libxml2/README.tests b/lib/3rdparty/libxml2/README.tests deleted file mode 100644 index 8d86f2a19ce..00000000000 --- a/lib/3rdparty/libxml2/README.tests +++ /dev/null @@ -1,39 +0,0 @@ - README.tests - - Instructions for standalone test regressions of libxml2 - -libxml2-tests-$version.tar.gz contains 3 standalone C programs as well -as a large amount of tests and results coming from libxml2 itself and -from W3C, NIST, Sun Microsystems, Microsoft and James Clark. Each C -program has a different testing purpose: - - runtest.c : runs libxml2 basic internal regression tests - runsuite.c: runs libxml2 against external regression tests - testapi.c : exercises the library public entry points - testchar.c: exercise the check of character ranges and UTF-8 validation - -The command: - - make check -or - make -f Makefile.tests check - -should be sufficient on an Unix system to build and exercise the tests -for the version of the library installed on the system. Note however -that there isn't backward compatibility provided so if the installed -version is older than the testsuite one, failing to compile or run the tests -is likely. In any event this won't work with an installed libxml2 older -than 2.6.20. - -Building on other platforms should be a matter of compiling the C files -like any other program using libxml2, running the test should be done -simply by launching the resulting executables. - -Also note the availability of a "make valgrind" target which will run the -above tests under valgrind to check for memory errors (but this relies -on the availability of the valgrind command and take far more time to -complete). - -Daniel Veillard -Mon May 7 2012 - diff --git a/lib/3rdparty/libxml2/SAX2.c b/lib/3rdparty/libxml2/SAX2.c index a24abc88c3c..4adf2024465 100644 --- a/lib/3rdparty/libxml2/SAX2.c +++ b/lib/3rdparty/libxml2/SAX2.c @@ -411,6 +411,7 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name, xmlParserInputPtr input = NULL; xmlCharEncoding enc; int oldcharset; + const xmlChar *oldencoding; /* * Ask the Entity resolver to load the damn thing @@ -432,6 +433,8 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name, oldinputMax = ctxt->inputMax; oldinputTab = ctxt->inputTab; oldcharset = ctxt->charset; + oldencoding = ctxt->encoding; + ctxt->encoding = NULL; ctxt->inputTab = (xmlParserInputPtr *) xmlMalloc(5 * sizeof(xmlParserInputPtr)); @@ -442,6 +445,7 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name, ctxt->inputMax = oldinputMax; ctxt->inputTab = oldinputTab; ctxt->charset = oldcharset; + ctxt->encoding = oldencoding; return; } ctxt->inputNr = 0; @@ -487,6 +491,11 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name, ctxt->inputMax = oldinputMax; ctxt->inputTab = oldinputTab; ctxt->charset = oldcharset; + if ((ctxt->encoding != NULL) && + ((ctxt->dict == NULL) || + (!xmlDictOwns(ctxt->dict, ctxt->encoding)))) + xmlFree((xmlChar *) ctxt->encoding); + ctxt->encoding = oldencoding; /* ctxt->wellFormed = oldwellFormed; */ } } @@ -591,6 +600,7 @@ xmlSAX2GetEntity(void *ctx, const xmlChar *name) * parse the external entity */ xmlNodePtr children; + unsigned long oldnbent = ctxt->nbentities; val = xmlParseCtxtExternalEntity(ctxt, ret->URI, ret->ExternalID, &children); @@ -603,8 +613,11 @@ xmlSAX2GetEntity(void *ctx, const xmlChar *name) return(NULL); } ret->owner = 1; - if (ret->checked == 0) - ret->checked = 1; + if (ret->checked == 0) { + ret->checked = (ctxt->nbentities - oldnbent + 1) * 2; + if ((ret->content != NULL) && (xmlStrchr(ret->content, '<'))) + ret->checked |= 1; + } } return(ret); } @@ -2202,7 +2215,7 @@ xmlSAX2StartElementNs(void *ctx, (ctxt->myDoc->intSubset->elements == NULL) && (ctxt->myDoc->intSubset->attributes == NULL) && (ctxt->myDoc->intSubset->entities == NULL)))) { - xmlErrValid(ctxt, XML_ERR_NO_DTD, + xmlErrValid(ctxt, XML_DTD_NO_DTD, "Validation failed: no DTD found !", NULL, NULL); ctxt->validate = 0; } diff --git a/lib/3rdparty/libxml2/acinclude.m4 b/lib/3rdparty/libxml2/acinclude.m4 deleted file mode 100644 index 7ad8630a4f0..00000000000 --- a/lib/3rdparty/libxml2/acinclude.m4 +++ /dev/null @@ -1,28 +0,0 @@ -dnl Like AC_TRY_EVAL but also errors out if the compiler generates -dnl _any_ output. Some compilers might issue warnings which we want -dnl to catch. -AC_DEFUN([AC_TRY_EVAL2], -[{ (eval echo configure:__oline__: \"[$]$1\") 1>&AS_MESSAGE_LOG_FD; dnl -(eval [$]$1) 2>&AS_MESSAGE_LOG_FD; _out=`eval [$]$1 2>&1` && test "x$_out" = x; }]) - -dnl Like AC_TRY_COMPILE but calls AC_TRY_EVAL2 instead of AC_TRY_EVAL -AC_DEFUN([AC_TRY_COMPILE2], -[cat > conftest.$ac_ext <&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD -ifelse([$4], , , [ rm -rf conftest* - $4 -])dnl -fi -rm -f conftest*]) diff --git a/lib/3rdparty/libxml2/aclocal.m4 b/lib/3rdparty/libxml2/aclocal.m4 deleted file mode 100644 index 78c9ca9c65a..00000000000 --- a/lib/3rdparty/libxml2/aclocal.m4 +++ /dev/null @@ -1,1034 +0,0 @@ -# generated automatically by aclocal 1.11.3 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, -# Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, -[m4_warning([this file was generated for autoconf 2.68. -You have another version of autoconf. It may work, but is not guaranteed to. -If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically `autoreconf'.])]) - -# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software -# Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 1 - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -# (This private macro should not be called outside this file.) -AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.11' -dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to -dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11.3], [], - [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl -]) - -# _AM_AUTOCONF_VERSION(VERSION) -# ----------------------------- -# aclocal traces this macro to find the Autoconf version. -# This is a private macro too. Using m4_define simplifies -# the logic in aclocal, which can simply ignore this definition. -m4_define([_AM_AUTOCONF_VERSION], []) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. -# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11.3])dnl -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) - -# AM_AUX_DIR_EXPAND -*- Autoconf -*- - -# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 1 - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 9 - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ(2.52)dnl - ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE])dnl -AC_SUBST([$1_FALSE])dnl -_AM_SUBST_NOTMAKE([$1_TRUE])dnl -_AM_SUBST_NOTMAKE([$1_FALSE])dnl -m4_define([_AM_COND_VALUE_$1], [$2])dnl -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi -AC_CONFIG_COMMANDS_PRE( -[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([[conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]]) -fi])]) - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, -# 2010, 2011 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 12 - -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - -# _AM_DEPENDENCIES(NAME) -# ---------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "GCJ", or "OBJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], UPC, [depcc="$UPC" am_compiler_list=], - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - am__universal=false - m4_case([$1], [CC], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac], - [CXX], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac]) - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -AM_CONDITIONAL([am__fastdep$1], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES -AC_DEFUN([AM_SET_DEPDIR], -[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH])dnl -_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl -AC_SUBST([am__nodep])dnl -_AM_SUBST_NOTMAKE([am__nodep])dnl -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -#serial 5 - -# _AM_OUTPUT_DEPENDENCY_COMMANDS -# ------------------------------ -AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[{ - # Autoconf 2.62 quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} -])# _AM_OUTPUT_DEPENDENCY_COMMANDS - - -# AM_OUTPUT_DEPENDENCY_COMMANDS -# ----------------------------- -# This macro should only be invoked once -- use via AC_REQUIRE. -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], -[AC_CONFIG_COMMANDS([depfiles], - [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) - -# Do all the work for Automake. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 16 - -# This macro actually does too much. Some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.62])dnl -dnl Autoconf wants to disallow AM_ names. We explicitly allow -dnl the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL])dnl -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi -AC_SUBST([CYGPATH_W]) - -# Define the identity of the package. -dnl Distinguish between old-style and new-style calls. -m4_ifval([$2], -[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl -dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, - [m4_fatal([AC_INIT should be called with package and version arguments])])dnl - AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl - AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - -_AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) -AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AM_PROG_MKDIR_P])dnl -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl -_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES(OBJC)], - [define([AC_PROG_OBJC], - defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl -]) -_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl -dnl The `parallel-tests' driver may need to know about EXEEXT, so add the -dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro -dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. -AC_CONFIG_COMMANDS_PRE(dnl -[m4_provide_if([_AM_COMPILER_EXEEXT], - [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl -]) - -dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not -dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further -dnl mangled by Autoconf and run in a shell conditional statement. -m4_define([_AC_COMPILER_EXEEXT], -m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) - - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_arg=$1 -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) - -# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, -# Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 1 - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -if test x"${install_sh}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi -AC_SUBST(install_sh)]) - -# Copyright (C) 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 4 - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 6 - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([missing])dnl -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) -fi -]) - -# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, -# Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 1 - -# AM_PROG_MKDIR_P -# --------------- -# Check for `mkdir -p'. -AC_DEFUN([AM_PROG_MKDIR_P], -[AC_PREREQ([2.60])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, -dnl while keeping a definition of mkdir_p for backward compatibility. -dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. -dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of -dnl Makefile.ins that do not define MKDIR_P, so we do our own -dnl adjustment using top_builddir (which is defined more often than -dnl MKDIR_P). -AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl -case $mkdir_p in - [[\\/$]]* | ?:[[\\/]]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software -# Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 5 - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# -------------------- -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) - -# _AM_SET_OPTIONS(OPTIONS) -# ------------------------ -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 5 - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[[\\\"\#\$\&\'\`$am_lf]]*) - AC_MSG_ERROR([unsafe absolute working directory name]);; -esac -case $srcdir in - *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; -esac - -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT(yes)]) - -# Copyright (C) 2009, 2011 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# AM_SILENT_RULES([DEFAULT]) -# -------------------------- -# Enable less verbose build rules; with the default set to DEFAULT -# (`yes' being less verbose, `no' or empty being verbose). -AC_DEFUN([AM_SILENT_RULES], -[AC_ARG_ENABLE([silent-rules], -[ --enable-silent-rules less verbose build output (undo: `make V=1') - --disable-silent-rules verbose build output (undo: `make V=0')]) -case $enable_silent_rules in -yes) AM_DEFAULT_VERBOSITY=0;; -no) AM_DEFAULT_VERBOSITY=1;; -*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; -esac -dnl -dnl A few `make' implementations (e.g., NonStop OS and NextStep) -dnl do not support nested variable expansions. -dnl See automake bug#9928 and bug#10237. -am_make=${MAKE-make} -AC_CACHE_CHECK([whether $am_make supports nested variables], - [am_cv_make_support_nested_variables], - [if AS_ECHO([['TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi]) -if test $am_cv_make_support_nested_variables = yes; then - dnl Using `$V' instead of `$(V)' breaks IRIX make. - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AC_SUBST([AM_V])dnl -AM_SUBST_NOTMAKE([AM_V])dnl -AC_SUBST([AM_DEFAULT_V])dnl -AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl -AC_SUBST([AM_DEFAULT_VERBOSITY])dnl -AM_BACKSLASH='\' -AC_SUBST([AM_BACKSLASH])dnl -_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl -]) - -# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 1 - -# AM_PROG_INSTALL_STRIP -# --------------------- -# One issue with vendor `install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 3 - -# _AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. -# This macro is traced by Automake. -AC_DEFUN([_AM_SUBST_NOTMAKE]) - -# AM_SUBST_NOTMAKE(VARIABLE) -# -------------------------- -# Public sister of _AM_SUBST_NOTMAKE. -AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AC_SUBST([AMTAR], ['$${TAR-tar}']) -m4_if([$1], [v7], - [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -for _am_tool in $_am_tools -do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; - do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi -done -rm -rf conftest.dir - -AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -AC_MSG_RESULT([$am_cv_prog_tar_$1])]) -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - -m4_include([m4/libtool.m4]) -m4_include([m4/ltoptions.m4]) -m4_include([m4/ltsugar.m4]) -m4_include([m4/ltversion.m4]) -m4_include([m4/lt~obsolete.m4]) -m4_include([acinclude.m4]) diff --git a/lib/3rdparty/libxml2/buf.c b/lib/3rdparty/libxml2/buf.c index fa0c3f6e5f2..d1756c4ad62 100644 --- a/lib/3rdparty/libxml2/buf.c +++ b/lib/3rdparty/libxml2/buf.c @@ -1299,3 +1299,6 @@ xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input, input->end = &buf->content[buf->use]; return(0); } + +#define bottom_buf +#include "elfgcchack.h" diff --git a/lib/3rdparty/libxml2/catalog.c b/lib/3rdparty/libxml2/catalog.c index 61cce03d7cc..8e34cd2df5d 100644 --- a/lib/3rdparty/libxml2/catalog.c +++ b/lib/3rdparty/libxml2/catalog.c @@ -84,10 +84,12 @@ static char XML_XML_DEFAULT_CATALOG[256] = "file:///etc/xml/catalog"; #define GetModuleHandleA GetModuleHandle #define GetModuleFileNameA GetModuleFileName #else +#if !defined(_WINDOWS_) void* __stdcall GetModuleHandleA(const char*); unsigned long __stdcall GetModuleFileNameA(void*, char*, unsigned long); #endif #endif +#endif static xmlChar *xmlCatalogNormalizePublic(const xmlChar *pubID); static int xmlExpandCatalog(xmlCatalogPtr catal, const char *filename); @@ -989,7 +991,7 @@ xmlLoadFileContent(const char *filename) return (NULL); } #endif - content = xmlMallocAtomic(size + 10); + content = (xmlChar*)xmlMallocAtomic(size + 10); if (content == NULL) { xmlCatalogErrMemory("allocating catalog data"); return (NULL); @@ -1547,7 +1549,7 @@ xmlAddXMLCatalog(xmlCatalogEntryPtr catal, const xmlChar *type, NULL, catal->prefer, NULL); if (doregister) { catal->type = XML_CATA_CATALOG; - cur = xmlHashLookup(xmlCatalogXMLFiles, catal->URL); + cur = (xmlCatalogEntryPtr)xmlHashLookup(xmlCatalogXMLFiles, catal->URL); if (cur != NULL) cur->children = catal->children; } @@ -3129,7 +3131,7 @@ xmlInitializeCatalog(void) { if (p != buf) { xmlChar* uri; strncpy(p, "\\..\\etc\\catalog", 255 - (p - buf)); - uri = xmlCanonicPath(buf); + uri = xmlCanonicPath((const xmlChar*)buf); if (uri != NULL) { strncpy(XML_XML_DEFAULT_CATALOG, uri, 255); xmlFree(uri); @@ -3244,7 +3246,7 @@ xmlLoadCatalogs(const char *pathss) { cur++; path = xmlStrndup((const xmlChar *)paths, cur - paths); #ifdef _WIN32 - iLen = strlen(path); + iLen = strlen((const char*)path); for(i = 0; i < iLen; i++) { if(path[i] == '\\') { path[i] = '/'; diff --git a/lib/3rdparty/libxml2/check-relaxng-test-suite.py b/lib/3rdparty/libxml2/check-relaxng-test-suite.py deleted file mode 100644 index f4a5a69a46e..00000000000 --- a/lib/3rdparty/libxml2/check-relaxng-test-suite.py +++ /dev/null @@ -1,394 +0,0 @@ -#!/usr/bin/python -import sys -import time -import os -import string -import StringIO -sys.path.insert(0, "python") -import libxml2 - -# Memory debug specific -libxml2.debugMemory(1) -debug = 0 -verbose = 0 -quiet = 1 - -# -# the testsuite description -# -CONF=os.path.join(os.path.dirname(__file__), "test/relaxng/OASIS/spectest.xml") -LOG="check-relaxng-test-suite.log" -RES="relaxng-test-results.xml" - -log = open(LOG, "w") -nb_schemas_tests = 0 -nb_schemas_success = 0 -nb_schemas_failed = 0 -nb_instances_tests = 0 -nb_instances_success = 0 -nb_instances_failed = 0 - -libxml2.lineNumbersDefault(1) -# -# Error and warnng callbacks -# -def callback(ctx, str): - global log - log.write("%s%s" % (ctx, str)) - -libxml2.registerErrorHandler(callback, "") - -# -# Resolver callback -# -resources = {} -def resolver(URL, ID, ctxt): - global resources - - if string.find(URL, '#') != -1: - URL = URL[0:string.find(URL, '#')] - if resources.has_key(URL): - return(StringIO.StringIO(resources[URL])) - log.write("Resolver failure: asked %s\n" % (URL)) - log.write("resources: %s\n" % (resources)) - return None - -# -# Load the previous results -# -#results = {} -#previous = {} -# -#try: -# res = libxml2.parseFile(RES) -#except: -# log.write("Could not parse %s" % (RES)) - -# -# handle a valid instance -# -def handle_valid(node, schema): - global log - global nb_instances_success - global nb_instances_failed - - instance = "" - child = node.children - while child != None: - if child.type != 'text': - instance = instance + child.serialize() - child = child.next - - try: - doc = libxml2.parseDoc(instance) - except: - doc = None - - if doc == None: - log.write("\nFailed to parse correct instance:\n-----\n") - log.write(instance) - log.write("\n-----\n") - nb_instances_failed = nb_instances_failed + 1 - return - - try: - ctxt = schema.relaxNGNewValidCtxt() - ret = doc.relaxNGValidateDoc(ctxt) - except: - ret = -1 - if ret != 0: - log.write("\nFailed to validate correct instance:\n-----\n") - log.write(instance) - log.write("\n-----\n") - nb_instances_failed = nb_instances_failed + 1 - else: - nb_instances_success = nb_instances_success + 1 - doc.freeDoc() - -# -# handle an invalid instance -# -def handle_invalid(node, schema): - global log - global nb_instances_success - global nb_instances_failed - - instance = "" - child = node.children - while child != None: - if child.type != 'text': - instance = instance + child.serialize() - child = child.next - - try: - doc = libxml2.parseDoc(instance) - except: - doc = None - - if doc == None: - log.write("\nStrange: failed to parse incorrect instance:\n-----\n") - log.write(instance) - log.write("\n-----\n") - return - - try: - ctxt = schema.relaxNGNewValidCtxt() - ret = doc.relaxNGValidateDoc(ctxt) - except: - ret = -1 - if ret == 0: - log.write("\nFailed to detect validation problem in instance:\n-----\n") - log.write(instance) - log.write("\n-----\n") - nb_instances_failed = nb_instances_failed + 1 - else: - nb_instances_success = nb_instances_success + 1 - doc.freeDoc() - -# -# handle an incorrect test -# -def handle_correct(node): - global log - global nb_schemas_success - global nb_schemas_failed - - schema = "" - child = node.children - while child != None: - if child.type != 'text': - schema = schema + child.serialize() - child = child.next - - try: - rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema)) - rngs = rngp.relaxNGParse() - except: - rngs = None - if rngs == None: - log.write("\nFailed to compile correct schema:\n-----\n") - log.write(schema) - log.write("\n-----\n") - nb_schemas_failed = nb_schemas_failed + 1 - else: - nb_schemas_success = nb_schemas_success + 1 - return rngs - -def handle_incorrect(node): - global log - global nb_schemas_success - global nb_schemas_failed - - schema = "" - child = node.children - while child != None: - if child.type != 'text': - schema = schema + child.serialize() - child = child.next - - try: - rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema)) - rngs = rngp.relaxNGParse() - except: - rngs = None - if rngs != None: - log.write("\nFailed to detect schema error in:\n-----\n") - log.write(schema) - log.write("\n-----\n") - nb_schemas_failed = nb_schemas_failed + 1 - else: -# log.write("\nSuccess detecting schema error in:\n-----\n") -# log.write(schema) -# log.write("\n-----\n") - nb_schemas_success = nb_schemas_success + 1 - return None - -# -# resource handling: keep a dictionary of URL->string mappings -# -def handle_resource(node, dir): - global resources - - try: - name = node.prop('name') - except: - name = None - - if name == None or name == '': - log.write("resource has no name") - return; - - if dir != None: -# name = libxml2.buildURI(name, dir) - name = dir + '/' + name - - res = "" - child = node.children - while child != None: - if child.type != 'text': - res = res + child.serialize() - child = child.next - resources[name] = res - -# -# dir handling: pseudo directory resources -# -def handle_dir(node, dir): - try: - name = node.prop('name') - except: - name = None - - if name == None or name == '': - log.write("resource has no name") - return; - - if dir != None: -# name = libxml2.buildURI(name, dir) - name = dir + '/' + name - - dirs = node.xpathEval('dir') - for dir in dirs: - handle_dir(dir, name) - res = node.xpathEval('resource') - for r in res: - handle_resource(r, name) - -# -# handle a testCase element -# -def handle_testCase(node): - global nb_schemas_tests - global nb_instances_tests - global resources - - sections = node.xpathEval('string(section)') - log.write("\n ======== test %d line %d section %s ==========\n" % ( - - nb_schemas_tests, node.lineNo(), sections)) - resources = {} - if debug: - print "test %d line %d" % (nb_schemas_tests, node.lineNo()) - - dirs = node.xpathEval('dir') - for dir in dirs: - handle_dir(dir, None) - res = node.xpathEval('resource') - for r in res: - handle_resource(r, None) - - tsts = node.xpathEval('incorrect') - if tsts != []: - if len(tsts) != 1: - print "warning test line %d has more than one example" %(node.lineNo()) - schema = handle_incorrect(tsts[0]) - else: - tsts = node.xpathEval('correct') - if tsts != []: - if len(tsts) != 1: - print "warning test line %d has more than one example"% (node.lineNo()) - schema = handle_correct(tsts[0]) - else: - print "warning line %d has no nor child" % (node.lineNo()) - - nb_schemas_tests = nb_schemas_tests + 1; - - valids = node.xpathEval('valid') - invalids = node.xpathEval('invalid') - nb_instances_tests = nb_instances_tests + len(valids) + len(invalids) - if schema != None: - for valid in valids: - handle_valid(valid, schema) - for invalid in invalids: - handle_invalid(invalid, schema) - - -# -# handle a testSuite element -# -def handle_testSuite(node, level = 0): - global nb_schemas_tests, nb_schemas_success, nb_schemas_failed - global nb_instances_tests, nb_instances_success, nb_instances_failed - global quiet - if level >= 1: - old_schemas_tests = nb_schemas_tests - old_schemas_success = nb_schemas_success - old_schemas_failed = nb_schemas_failed - old_instances_tests = nb_instances_tests - old_instances_success = nb_instances_success - old_instances_failed = nb_instances_failed - - docs = node.xpathEval('documentation') - authors = node.xpathEval('author') - if docs != []: - msg = "" - for doc in docs: - msg = msg + doc.content + " " - if authors != []: - msg = msg + "written by " - for author in authors: - msg = msg + author.content + " " - if quiet == 0: - print msg - sections = node.xpathEval('section') - if sections != [] and level <= 0: - msg = "" - for section in sections: - msg = msg + section.content + " " - if quiet == 0: - print "Tests for section %s" % (msg) - for test in node.xpathEval('testCase'): - handle_testCase(test) - for test in node.xpathEval('testSuite'): - handle_testSuite(test, level + 1) - - - if verbose and level >= 1 and sections != []: - msg = "" - for section in sections: - msg = msg + section.content + " " - print "Result of tests for section %s" % (msg) - if nb_schemas_tests != old_schemas_tests: - print "found %d test schemas: %d success %d failures" % ( - nb_schemas_tests - old_schemas_tests, - nb_schemas_success - old_schemas_success, - nb_schemas_failed - old_schemas_failed) - if nb_instances_tests != old_instances_tests: - print "found %d test instances: %d success %d failures" % ( - nb_instances_tests - old_instances_tests, - nb_instances_success - old_instances_success, - nb_instances_failed - old_instances_failed) -# -# Parse the conf file -# -libxml2.substituteEntitiesDefault(1); -testsuite = libxml2.parseFile(CONF) -libxml2.setEntityLoader(resolver) -root = testsuite.getRootElement() -if root.name != 'testSuite': - print "%s doesn't start with a testSuite element, aborting" % (CONF) - sys.exit(1) -if quiet == 0: - print "Running Relax NG testsuite" -handle_testSuite(root) - -if quiet == 0: - print "\nTOTAL:\n" -if quiet == 0 or nb_schemas_failed != 0: - print "found %d test schemas: %d success %d failures" % ( - nb_schemas_tests, nb_schemas_success, nb_schemas_failed) -if quiet == 0 or nb_instances_failed != 0: - print "found %d test instances: %d success %d failures" % ( - nb_instances_tests, nb_instances_success, nb_instances_failed) - -testsuite.freeDoc() - -# Memory debug specific -libxml2.relaxNGCleanupTypes() -libxml2.cleanupParser() -if libxml2.debugMemory(1) == 0: - if quiet == 0: - print "OK" -else: - print "Memory leak %d bytes" % (libxml2.debugMemory(1)) - libxml2.dumpMemory() diff --git a/lib/3rdparty/libxml2/check-relaxng-test-suite2.py b/lib/3rdparty/libxml2/check-relaxng-test-suite2.py deleted file mode 100644 index 8618db7695d..00000000000 --- a/lib/3rdparty/libxml2/check-relaxng-test-suite2.py +++ /dev/null @@ -1,418 +0,0 @@ -#!/usr/bin/python -import sys -import time -import os -import string -import StringIO -sys.path.insert(0, "python") -import libxml2 - -# Memory debug specific -libxml2.debugMemory(1) -debug = 0 -quiet = 1 - -# -# the testsuite description -# -CONF=os.path.join(os.path.dirname(__file__), "test/relaxng/testsuite.xml") -LOG="check-relaxng-test-suite2.log" - -log = open(LOG, "w") -nb_schemas_tests = 0 -nb_schemas_success = 0 -nb_schemas_failed = 0 -nb_instances_tests = 0 -nb_instances_success = 0 -nb_instances_failed = 0 - -libxml2.lineNumbersDefault(1) -# -# Resolver callback -# -resources = {} -def resolver(URL, ID, ctxt): - global resources - - if resources.has_key(URL): - return(StringIO.StringIO(resources[URL])) - log.write("Resolver failure: asked %s\n" % (URL)) - log.write("resources: %s\n" % (resources)) - return None - -# -# Load the previous results -# -#results = {} -#previous = {} -# -#try: -# res = libxml2.parseFile(RES) -#except: -# log.write("Could not parse %s" % (RES)) - -# -# handle a valid instance -# -def handle_valid(node, schema): - global log - global nb_instances_success - global nb_instances_failed - - instance = node.prop("dtd") - if instance == None: - instance = "" - child = node.children - while child != None: - if child.type != 'text': - instance = instance + child.serialize() - child = child.next - -# mem = libxml2.debugMemory(1); - try: - doc = libxml2.parseDoc(instance) - except: - doc = None - - if doc == None: - log.write("\nFailed to parse correct instance:\n-----\n") - log.write(instance) - log.write("\n-----\n") - nb_instances_failed = nb_instances_failed + 1 - return - - if debug: - print "instance line %d" % (node.lineNo()) - - try: - ctxt = schema.relaxNGNewValidCtxt() - ret = doc.relaxNGValidateDoc(ctxt) - del ctxt - except: - ret = -1 - - doc.freeDoc() -# if mem != libxml2.debugMemory(1): -# print "validating instance %d line %d leaks" % ( -# nb_instances_tests, node.lineNo()) - - if ret != 0: - log.write("\nFailed to validate correct instance:\n-----\n") - log.write(instance) - log.write("\n-----\n") - nb_instances_failed = nb_instances_failed + 1 - else: - nb_instances_success = nb_instances_success + 1 - -# -# handle an invalid instance -# -def handle_invalid(node, schema): - global log - global nb_instances_success - global nb_instances_failed - - instance = node.prop("dtd") - if instance == None: - instance = "" - child = node.children - while child != None: - if child.type != 'text': - instance = instance + child.serialize() - child = child.next - -# mem = libxml2.debugMemory(1); - - try: - doc = libxml2.parseDoc(instance) - except: - doc = None - - if doc == None: - log.write("\nStrange: failed to parse incorrect instance:\n-----\n") - log.write(instance) - log.write("\n-----\n") - return - - if debug: - print "instance line %d" % (node.lineNo()) - - try: - ctxt = schema.relaxNGNewValidCtxt() - ret = doc.relaxNGValidateDoc(ctxt) - del ctxt - - except: - ret = -1 - - doc.freeDoc() -# mem2 = libxml2.debugMemory(1) -# if mem != mem2: -# print "validating instance %d line %d leaks %d bytes" % ( -# nb_instances_tests, node.lineNo(), mem2 - mem) - - if ret == 0: - log.write("\nFailed to detect validation problem in instance:\n-----\n") - log.write(instance) - log.write("\n-----\n") - nb_instances_failed = nb_instances_failed + 1 - else: - nb_instances_success = nb_instances_success + 1 - -# -# handle an incorrect test -# -def handle_correct(node): - global log - global nb_schemas_success - global nb_schemas_failed - - schema = "" - child = node.children - while child != None: - if child.type != 'text': - schema = schema + child.serialize() - child = child.next - - try: - rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema)) - rngs = rngp.relaxNGParse() - except: - rngs = None - if rngs == None: - log.write("\nFailed to compile correct schema:\n-----\n") - log.write(schema) - log.write("\n-----\n") - nb_schemas_failed = nb_schemas_failed + 1 - else: - nb_schemas_success = nb_schemas_success + 1 - return rngs - -def handle_incorrect(node): - global log - global nb_schemas_success - global nb_schemas_failed - - schema = "" - child = node.children - while child != None: - if child.type != 'text': - schema = schema + child.serialize() - child = child.next - - try: - rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema)) - rngs = rngp.relaxNGParse() - except: - rngs = None - if rngs != None: - log.write("\nFailed to detect schema error in:\n-----\n") - log.write(schema) - log.write("\n-----\n") - nb_schemas_failed = nb_schemas_failed + 1 - else: -# log.write("\nSuccess detecting schema error in:\n-----\n") -# log.write(schema) -# log.write("\n-----\n") - nb_schemas_success = nb_schemas_success + 1 - return None - -# -# resource handling: keep a dictionary of URL->string mappings -# -def handle_resource(node, dir): - global resources - - try: - name = node.prop('name') - except: - name = None - - if name == None or name == '': - log.write("resource has no name") - return; - - if dir != None: -# name = libxml2.buildURI(name, dir) - name = dir + '/' + name - - res = "" - child = node.children - while child != None: - if child.type != 'text': - res = res + child.serialize() - child = child.next - resources[name] = res - -# -# dir handling: pseudo directory resources -# -def handle_dir(node, dir): - try: - name = node.prop('name') - except: - name = None - - if name == None or name == '': - log.write("resource has no name") - return; - - if dir != None: -# name = libxml2.buildURI(name, dir) - name = dir + '/' + name - - dirs = node.xpathEval('dir') - for dir in dirs: - handle_dir(dir, name) - res = node.xpathEval('resource') - for r in res: - handle_resource(r, name) - -# -# handle a testCase element -# -def handle_testCase(node): - global nb_schemas_tests - global nb_instances_tests - global resources - - sections = node.xpathEval('string(section)') - log.write("\n ======== test %d line %d section %s ==========\n" % ( - - nb_schemas_tests, node.lineNo(), sections)) - resources = {} - if debug: - print "test %d line %d" % (nb_schemas_tests, node.lineNo()) - - dirs = node.xpathEval('dir') - for dir in dirs: - handle_dir(dir, None) - res = node.xpathEval('resource') - for r in res: - handle_resource(r, None) - - tsts = node.xpathEval('incorrect') - if tsts != []: - if len(tsts) != 1: - print "warning test line %d has more than one example" %(node.lineNo()) - schema = handle_incorrect(tsts[0]) - else: - tsts = node.xpathEval('correct') - if tsts != []: - if len(tsts) != 1: - print "warning test line %d has more than one example"% (node.lineNo()) - schema = handle_correct(tsts[0]) - else: - print "warning line %d has no nor child" % (node.lineNo()) - - nb_schemas_tests = nb_schemas_tests + 1; - - valids = node.xpathEval('valid') - invalids = node.xpathEval('invalid') - nb_instances_tests = nb_instances_tests + len(valids) + len(invalids) - if schema != None: - for valid in valids: - handle_valid(valid, schema) - for invalid in invalids: - handle_invalid(invalid, schema) - - -# -# handle a testSuite element -# -def handle_testSuite(node, level = 0): - global nb_schemas_tests, nb_schemas_success, nb_schemas_failed - global nb_instances_tests, nb_instances_success, nb_instances_failed - if level >= 1: - old_schemas_tests = nb_schemas_tests - old_schemas_success = nb_schemas_success - old_schemas_failed = nb_schemas_failed - old_instances_tests = nb_instances_tests - old_instances_success = nb_instances_success - old_instances_failed = nb_instances_failed - - docs = node.xpathEval('documentation') - authors = node.xpathEval('author') - if docs != []: - msg = "" - for doc in docs: - msg = msg + doc.content + " " - if authors != []: - msg = msg + "written by " - for author in authors: - msg = msg + author.content + " " - if quiet == 0: - print msg - sections = node.xpathEval('section') - if sections != [] and level <= 0: - msg = "" - for section in sections: - msg = msg + section.content + " " - if quiet == 0: - print "Tests for section %s" % (msg) - for test in node.xpathEval('testCase'): - handle_testCase(test) - for test in node.xpathEval('testSuite'): - handle_testSuite(test, level + 1) - - - if level >= 1 and sections != []: - msg = "" - for section in sections: - msg = msg + section.content + " " - print "Result of tests for section %s" % (msg) - if nb_schemas_tests != old_schemas_tests: - print "found %d test schemas: %d success %d failures" % ( - nb_schemas_tests - old_schemas_tests, - nb_schemas_success - old_schemas_success, - nb_schemas_failed - old_schemas_failed) - if nb_instances_tests != old_instances_tests: - print "found %d test instances: %d success %d failures" % ( - nb_instances_tests - old_instances_tests, - nb_instances_success - old_instances_success, - nb_instances_failed - old_instances_failed) -# -# Parse the conf file -# -libxml2.substituteEntitiesDefault(1); -testsuite = libxml2.parseFile(CONF) - -# -# Error and warnng callbacks -# -def callback(ctx, str): - global log - log.write("%s%s" % (ctx, str)) - -libxml2.registerErrorHandler(callback, "") - -libxml2.setEntityLoader(resolver) -root = testsuite.getRootElement() -if root.name != 'testSuite': - print "%s doesn't start with a testSuite element, aborting" % (CONF) - sys.exit(1) -if quiet == 0: - print "Running Relax NG testsuite" -handle_testSuite(root) - -if quiet == 0: - print "\nTOTAL:\n" -if quiet == 0 or nb_schemas_failed != 0: - print "found %d test schemas: %d success %d failures" % ( - nb_schemas_tests, nb_schemas_success, nb_schemas_failed) -if quiet == 0 or nb_instances_failed != 0: - print "found %d test instances: %d success %d failures" % ( - nb_instances_tests, nb_instances_success, nb_instances_failed) - - -testsuite.freeDoc() - -# Memory debug specific -libxml2.relaxNGCleanupTypes() -libxml2.cleanupParser() -if libxml2.debugMemory(1) == 0: - if quiet == 0: - print "OK" -else: - print "Memory leak %d bytes" % (libxml2.debugMemory(1)) - libxml2.dumpMemory() diff --git a/lib/3rdparty/libxml2/check-xinclude-test-suite.py b/lib/3rdparty/libxml2/check-xinclude-test-suite.py deleted file mode 100644 index f470011ebe3..00000000000 --- a/lib/3rdparty/libxml2/check-xinclude-test-suite.py +++ /dev/null @@ -1,221 +0,0 @@ -#!/usr/bin/python -import sys -import time -import os -import string -sys.path.insert(0, "python") -import libxml2 - -# -# the testsuite description -# -DIR="xinclude-test-suite" -CONF="testdescr.xml" -LOG="check-xinclude-test-suite.log" - -log = open(LOG, "w") - -os.chdir(DIR) - -test_nr = 0 -test_succeed = 0 -test_failed = 0 -test_error = 0 -# -# Error and warning handlers -# -error_nr = 0 -error_msg = '' - -def errorHandler(ctx, str): - global error_nr - global error_msg - - if string.find(str, "error:") >= 0: - error_nr = error_nr + 1 - if len(error_msg) < 300: - if len(error_msg) == 0 or error_msg[-1] == '\n': - error_msg = error_msg + " >>" + str - else: - error_msg = error_msg + str - -libxml2.registerErrorHandler(errorHandler, None) - -def testXInclude(filename, id): - global error_nr - global error_msg - global log - - error_nr = 0 - error_msg = '' - - print "testXInclude(%s, %s)" % (filename, id) - return 1 - -def runTest(test, basedir): - global test_nr - global test_failed - global test_error - global test_succeed - global error_msg - global log - - fatal_error = 0 - uri = test.prop('href') - id = test.prop('id') - type = test.prop('type') - if uri == None: - print "Test without ID:", uri - return -1 - if id == None: - print "Test without URI:", id - return -1 - if type == None: - print "Test without URI:", id - return -1 - if basedir != None: - URI = basedir + "/" + uri - else: - URI = uri - if os.access(URI, os.R_OK) == 0: - print "Test %s missing: base %s uri %s" % (URI, basedir, uri) - return -1 - - expected = None - outputfile = None - diff = None - if type != 'error': - output = test.xpathEval('string(output)') - if output == 'No output file.': - output = None - if output == '': - output = None - if output != None: - if basedir != None: - output = basedir + "/" + output - if os.access(output, os.R_OK) == 0: - print "Result for %s missing: %s" % (id, output) - output = None - else: - try: - f = open(output) - expected = f.read() - outputfile = output - except: - print "Result for %s unreadable: %s" % (id, output) - - try: - # print "testing %s" % (URI) - doc = libxml2.parseFile(URI) - except: - doc = None - if doc != None: - res = doc.xincludeProcess() - if res >= 0 and expected != None: - result = doc.serialize() - if result != expected: - print "Result for %s differs" % (id) - open("xinclude.res", "w").write(result) - diff = os.popen("diff %s xinclude.res" % outputfile).read() - - doc.freeDoc() - else: - print "Failed to parse %s" % (URI) - res = -1 - - - - test_nr = test_nr + 1 - if type == 'success': - if res > 0: - test_succeed = test_succeed + 1 - elif res == 0: - test_failed = test_failed + 1 - print "Test %s: no substitution done ???" % (id) - elif res < 0: - test_error = test_error + 1 - print "Test %s: failed valid XInclude processing" % (id) - elif type == 'error': - if res > 0: - test_error = test_error + 1 - print "Test %s: failed to detect invalid XInclude processing" % (id) - elif res == 0: - test_failed = test_failed + 1 - print "Test %s: Invalid but no substitution done" % (id) - elif res < 0: - test_succeed = test_succeed + 1 - elif type == 'optional': - if res > 0: - test_succeed = test_succeed + 1 - else: - print "Test %s: failed optional test" % (id) - - # Log the ontext - if res != 1: - log.write("Test ID %s\n" % (id)) - log.write(" File: %s\n" % (URI)) - content = string.strip(test.content) - while content[-1] == '\n': - content = content[0:-1] - log.write(" %s:%s\n\n" % (type, content)) - if error_msg != '': - log.write(" ----\n%s ----\n" % (error_msg)) - error_msg = '' - log.write("\n") - if diff != None: - log.write("diff from test %s:\n" %(id)) - log.write(" -----------\n%s\n -----------\n" % (diff)); - - return 0 - - -def runTestCases(case): - creator = case.prop('creator') - if creator != None: - print "=>", creator - base = case.getBase(None) - basedir = case.prop('basedir') - if basedir != None: - base = libxml2.buildURI(basedir, base) - test = case.children - while test != None: - if test.name == 'testcase': - runTest(test, base) - if test.name == 'testcases': - runTestCases(test) - test = test.next - -conf = libxml2.parseFile(CONF) -if conf == None: - print "Unable to load %s" % CONF - sys.exit(1) - -testsuite = conf.getRootElement() -if testsuite.name != 'testsuite': - print "Expecting TESTSUITE root element: aborting" - sys.exit(1) - -profile = testsuite.prop('PROFILE') -if profile != None: - print profile - -start = time.time() - -case = testsuite.children -while case != None: - if case.name == 'testcases': - old_test_nr = test_nr - old_test_succeed = test_succeed - old_test_failed = test_failed - old_test_error = test_error - runTestCases(case) - print " Ran %d tests: %d suceeded, %d failed and %d generated an error" % ( - test_nr - old_test_nr, test_succeed - old_test_succeed, - test_failed - old_test_failed, test_error - old_test_error) - case = case.next - -conf.freeDoc() -log.close() - -print "Ran %d tests: %d suceeded, %d failed and %d generated an error in %.2f s." % ( - test_nr, test_succeed, test_failed, test_error, time.time() - start) diff --git a/lib/3rdparty/libxml2/check-xml-test-suite.py b/lib/3rdparty/libxml2/check-xml-test-suite.py deleted file mode 100644 index 2de07b1095c..00000000000 --- a/lib/3rdparty/libxml2/check-xml-test-suite.py +++ /dev/null @@ -1,409 +0,0 @@ -#!/usr/bin/python -import sys -import time -import os -import string -sys.path.insert(0, "python") -import libxml2 - -test_nr = 0 -test_succeed = 0 -test_failed = 0 -test_error = 0 - -# -# the testsuite description -# -CONF="xml-test-suite/xmlconf/xmlconf.xml" -LOG="check-xml-test-suite.log" - -log = open(LOG, "w") - -# -# Error and warning handlers -# -error_nr = 0 -error_msg = '' -def errorHandler(ctx, str): - global error_nr - global error_msg - - error_nr = error_nr + 1 - if len(error_msg) < 300: - if len(error_msg) == 0 or error_msg[-1] == '\n': - error_msg = error_msg + " >>" + str - else: - error_msg = error_msg + str - -libxml2.registerErrorHandler(errorHandler, None) - -#warning_nr = 0 -#warning = '' -#def warningHandler(ctx, str): -# global warning_nr -# global warning -# -# warning_nr = warning_nr + 1 -# warning = warning + str -# -#libxml2.registerWarningHandler(warningHandler, None) - -# -# Used to load the XML testsuite description -# -def loadNoentDoc(filename): - ctxt = libxml2.createFileParserCtxt(filename) - if ctxt == None: - return None - ctxt.replaceEntities(1) - ctxt.parseDocument() - try: - doc = ctxt.doc() - except: - doc = None - if ctxt.wellFormed() != 1: - doc.freeDoc() - return None - return doc - -# -# The conformance testing routines -# - -def testNotWf(filename, id): - global error_nr - global error_msg - global log - - error_nr = 0 - error_msg = '' - - ctxt = libxml2.createFileParserCtxt(filename) - if ctxt == None: - return -1 - ret = ctxt.parseDocument() - - try: - doc = ctxt.doc() - except: - doc = None - if doc != None: - doc.freeDoc() - if ret == 0 or ctxt.wellFormed() != 0: - print "%s: error: Well Formedness error not detected" % (id) - log.write("%s: error: Well Formedness error not detected\n" % (id)) - return 0 - return 1 - -def testNotWfEnt(filename, id): - global error_nr - global error_msg - global log - - error_nr = 0 - error_msg = '' - - ctxt = libxml2.createFileParserCtxt(filename) - if ctxt == None: - return -1 - ctxt.replaceEntities(1) - ret = ctxt.parseDocument() - - try: - doc = ctxt.doc() - except: - doc = None - if doc != None: - doc.freeDoc() - if ret == 0 or ctxt.wellFormed() != 0: - print "%s: error: Well Formedness error not detected" % (id) - log.write("%s: error: Well Formedness error not detected\n" % (id)) - return 0 - return 1 - -def testNotWfEntDtd(filename, id): - global error_nr - global error_msg - global log - - error_nr = 0 - error_msg = '' - - ctxt = libxml2.createFileParserCtxt(filename) - if ctxt == None: - return -1 - ctxt.replaceEntities(1) - ctxt.loadSubset(1) - ret = ctxt.parseDocument() - - try: - doc = ctxt.doc() - except: - doc = None - if doc != None: - doc.freeDoc() - if ret == 0 or ctxt.wellFormed() != 0: - print "%s: error: Well Formedness error not detected" % (id) - log.write("%s: error: Well Formedness error not detected\n" % (id)) - return 0 - return 1 - -def testWfEntDtd(filename, id): - global error_nr - global error_msg - global log - - error_nr = 0 - error_msg = '' - - ctxt = libxml2.createFileParserCtxt(filename) - if ctxt == None: - return -1 - ctxt.replaceEntities(1) - ctxt.loadSubset(1) - ret = ctxt.parseDocument() - - try: - doc = ctxt.doc() - except: - doc = None - if doc == None or ret != 0 or ctxt.wellFormed() == 0: - print "%s: error: wrongly failed to parse the document" % (id) - log.write("%s: error: wrongly failed to parse the document\n" % (id)) - if doc != None: - doc.freeDoc() - return 0 - if error_nr != 0: - print "%s: warning: WF document generated an error msg" % (id) - log.write("%s: error: WF document generated an error msg\n" % (id)) - doc.freeDoc() - return 2 - doc.freeDoc() - return 1 - -def testError(filename, id): - global error_nr - global error_msg - global log - - error_nr = 0 - error_msg = '' - - ctxt = libxml2.createFileParserCtxt(filename) - if ctxt == None: - return -1 - ctxt.replaceEntities(1) - ctxt.loadSubset(1) - ret = ctxt.parseDocument() - - try: - doc = ctxt.doc() - except: - doc = None - if doc != None: - doc.freeDoc() - if ctxt.wellFormed() == 0: - print "%s: warning: failed to parse the document but accepted" % (id) - log.write("%s: warning: failed to parse the document but accepte\n" % (id)) - return 2 - if error_nr != 0: - print "%s: warning: WF document generated an error msg" % (id) - log.write("%s: error: WF document generated an error msg\n" % (id)) - return 2 - return 1 - -def testInvalid(filename, id): - global error_nr - global error_msg - global log - - error_nr = 0 - error_msg = '' - - ctxt = libxml2.createFileParserCtxt(filename) - if ctxt == None: - return -1 - ctxt.validate(1) - ret = ctxt.parseDocument() - - try: - doc = ctxt.doc() - except: - doc = None - valid = ctxt.isValid() - if doc == None: - print "%s: error: wrongly failed to parse the document" % (id) - log.write("%s: error: wrongly failed to parse the document\n" % (id)) - return 0 - if valid == 1: - print "%s: error: Validity error not detected" % (id) - log.write("%s: error: Validity error not detected\n" % (id)) - doc.freeDoc() - return 0 - if error_nr == 0: - print "%s: warning: Validity error not reported" % (id) - log.write("%s: warning: Validity error not reported\n" % (id)) - doc.freeDoc() - return 2 - - doc.freeDoc() - return 1 - -def testValid(filename, id): - global error_nr - global error_msg - - error_nr = 0 - error_msg = '' - - ctxt = libxml2.createFileParserCtxt(filename) - if ctxt == None: - return -1 - ctxt.validate(1) - ctxt.parseDocument() - - try: - doc = ctxt.doc() - except: - doc = None - valid = ctxt.isValid() - if doc == None: - print "%s: error: wrongly failed to parse the document" % (id) - log.write("%s: error: wrongly failed to parse the document\n" % (id)) - return 0 - if valid != 1: - print "%s: error: Validity check failed" % (id) - log.write("%s: error: Validity check failed\n" % (id)) - doc.freeDoc() - return 0 - if error_nr != 0 or valid != 1: - print "%s: warning: valid document reported an error" % (id) - log.write("%s: warning: valid document reported an error\n" % (id)) - doc.freeDoc() - return 2 - doc.freeDoc() - return 1 - -def runTest(test): - global test_nr - global test_succeed - global test_failed - global error_msg - global log - - uri = test.prop('URI') - id = test.prop('ID') - if uri == None: - print "Test without ID:", uri - return -1 - if id == None: - print "Test without URI:", id - return -1 - base = test.getBase(None) - URI = libxml2.buildURI(uri, base) - if os.access(URI, os.R_OK) == 0: - print "Test %s missing: base %s uri %s" % (URI, base, uri) - return -1 - type = test.prop('TYPE') - if type == None: - print "Test %s missing TYPE" % (id) - return -1 - - extra = None - if type == "invalid": - res = testInvalid(URI, id) - elif type == "valid": - res = testValid(URI, id) - elif type == "not-wf": - extra = test.prop('ENTITIES') - # print URI - #if extra == None: - # res = testNotWfEntDtd(URI, id) - #elif extra == 'none': - # res = testNotWf(URI, id) - #elif extra == 'general': - # res = testNotWfEnt(URI, id) - #elif extra == 'both' or extra == 'parameter': - res = testNotWfEntDtd(URI, id) - #else: - # print "Unknow value %s for an ENTITIES test value" % (extra) - # return -1 - elif type == "error": - res = testError(URI, id) - else: - # TODO skipped for now - return -1 - - test_nr = test_nr + 1 - if res > 0: - test_succeed = test_succeed + 1 - elif res == 0: - test_failed = test_failed + 1 - elif res < 0: - test_error = test_error + 1 - - # Log the ontext - if res != 1: - log.write(" File: %s\n" % (URI)) - content = string.strip(test.content) - while content[-1] == '\n': - content = content[0:-1] - if extra != None: - log.write(" %s:%s:%s\n" % (type, extra, content)) - else: - log.write(" %s:%s\n\n" % (type, content)) - if error_msg != '': - log.write(" ----\n%s ----\n" % (error_msg)) - error_msg = '' - log.write("\n") - - return 0 - - -def runTestCases(case): - profile = case.prop('PROFILE') - if profile != None and \ - string.find(profile, "IBM XML Conformance Test Suite - Production") < 0: - print "=>", profile - test = case.children - while test != None: - if test.name == 'TEST': - runTest(test) - if test.name == 'TESTCASES': - runTestCases(test) - test = test.next - -conf = loadNoentDoc(CONF) -if conf == None: - print "Unable to load %s" % CONF - sys.exit(1) - -testsuite = conf.getRootElement() -if testsuite.name != 'TESTSUITE': - print "Expecting TESTSUITE root element: aborting" - sys.exit(1) - -profile = testsuite.prop('PROFILE') -if profile != None: - print profile - -start = time.time() - -case = testsuite.children -while case != None: - if case.name == 'TESTCASES': - old_test_nr = test_nr - old_test_succeed = test_succeed - old_test_failed = test_failed - old_test_error = test_error - runTestCases(case) - print " Ran %d tests: %d suceeded, %d failed and %d generated an error" % ( - test_nr - old_test_nr, test_succeed - old_test_succeed, - test_failed - old_test_failed, test_error - old_test_error) - case = case.next - -conf.freeDoc() -log.close() - -print "Ran %d tests: %d suceeded, %d failed and %d generated an error in %.2f s." % ( - test_nr, test_succeed, test_failed, test_error, time.time() - start) diff --git a/lib/3rdparty/libxml2/check-xsddata-test-suite.py b/lib/3rdparty/libxml2/check-xsddata-test-suite.py deleted file mode 100644 index c946129bf37..00000000000 --- a/lib/3rdparty/libxml2/check-xsddata-test-suite.py +++ /dev/null @@ -1,420 +0,0 @@ -#!/usr/bin/python -import sys -import time -import os -import string -import StringIO -sys.path.insert(0, "python") -import libxml2 - -# Memory debug specific -libxml2.debugMemory(1) -debug = 0 -verbose = 0 -quiet = 1 - -# -# the testsuite description -# -CONF=os.path.join(os.path.dirname(__file__), "test/xsdtest/xsdtestsuite.xml") -LOG="check-xsddata-test-suite.log" - -log = open(LOG, "w") -nb_schemas_tests = 0 -nb_schemas_success = 0 -nb_schemas_failed = 0 -nb_instances_tests = 0 -nb_instances_success = 0 -nb_instances_failed = 0 - -libxml2.lineNumbersDefault(1) -# -# Error and warnng callbacks -# -def callback(ctx, str): - global log - log.write("%s%s" % (ctx, str)) - -libxml2.registerErrorHandler(callback, "") - -# -# Resolver callback -# -resources = {} -def resolver(URL, ID, ctxt): - global resources - - if resources.has_key(URL): - return(StringIO.StringIO(resources[URL])) - log.write("Resolver failure: asked %s\n" % (URL)) - log.write("resources: %s\n" % (resources)) - return None - -# -# handle a valid instance -# -def handle_valid(node, schema): - global log - global nb_instances_success - global nb_instances_failed - - instance = node.prop("dtd") - if instance == None: - instance = "" - child = node.children - while child != None: - if child.type != 'text': - instance = instance + child.serialize() - child = child.next - - mem = libxml2.debugMemory(1); - try: - doc = libxml2.parseDoc(instance) - except: - doc = None - - if doc == None: - log.write("\nFailed to parse correct instance:\n-----\n") - log.write(instance) - log.write("\n-----\n") - nb_instances_failed = nb_instances_failed + 1 - return - - if debug: - print "instance line %d" % (node.lineNo()) - - try: - ctxt = schema.relaxNGNewValidCtxt() - ret = doc.relaxNGValidateDoc(ctxt) - del ctxt - except: - ret = -1 - - doc.freeDoc() - if mem != libxml2.debugMemory(1): - print "validating instance %d line %d leaks" % ( - nb_instances_tests, node.lineNo()) - - if ret != 0: - log.write("\nFailed to validate correct instance:\n-----\n") - log.write(instance) - log.write("\n-----\n") - nb_instances_failed = nb_instances_failed + 1 - else: - nb_instances_success = nb_instances_success + 1 - -# -# handle an invalid instance -# -def handle_invalid(node, schema): - global log - global nb_instances_success - global nb_instances_failed - - instance = node.prop("dtd") - if instance == None: - instance = "" - child = node.children - while child != None: - if child.type != 'text': - instance = instance + child.serialize() - child = child.next - -# mem = libxml2.debugMemory(1); - - try: - doc = libxml2.parseDoc(instance) - except: - doc = None - - if doc == None: - log.write("\nStrange: failed to parse incorrect instance:\n-----\n") - log.write(instance) - log.write("\n-----\n") - return - - if debug: - print "instance line %d" % (node.lineNo()) - - try: - ctxt = schema.relaxNGNewValidCtxt() - ret = doc.relaxNGValidateDoc(ctxt) - del ctxt - - except: - ret = -1 - - doc.freeDoc() -# if mem != libxml2.debugMemory(1): -# print "validating instance %d line %d leaks" % ( -# nb_instances_tests, node.lineNo()) - - if ret == 0: - log.write("\nFailed to detect validation problem in instance:\n-----\n") - log.write(instance) - log.write("\n-----\n") - nb_instances_failed = nb_instances_failed + 1 - else: - nb_instances_success = nb_instances_success + 1 - -# -# handle an incorrect test -# -def handle_correct(node): - global log - global nb_schemas_success - global nb_schemas_failed - - schema = "" - child = node.children - while child != None: - if child.type != 'text': - schema = schema + child.serialize() - child = child.next - - try: - rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema)) - rngs = rngp.relaxNGParse() - except: - rngs = None - if rngs == None: - log.write("\nFailed to compile correct schema:\n-----\n") - log.write(schema) - log.write("\n-----\n") - nb_schemas_failed = nb_schemas_failed + 1 - else: - nb_schemas_success = nb_schemas_success + 1 - return rngs - -def handle_incorrect(node): - global log - global nb_schemas_success - global nb_schemas_failed - - schema = "" - child = node.children - while child != None: - if child.type != 'text': - schema = schema + child.serialize() - child = child.next - - try: - rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema)) - rngs = rngp.relaxNGParse() - except: - rngs = None - if rngs != None: - log.write("\nFailed to detect schema error in:\n-----\n") - log.write(schema) - log.write("\n-----\n") - nb_schemas_failed = nb_schemas_failed + 1 - else: -# log.write("\nSuccess detecting schema error in:\n-----\n") -# log.write(schema) -# log.write("\n-----\n") - nb_schemas_success = nb_schemas_success + 1 - return None - -# -# resource handling: keep a dictionary of URL->string mappings -# -def handle_resource(node, dir): - global resources - - try: - name = node.prop('name') - except: - name = None - - if name == None or name == '': - log.write("resource has no name") - return; - - if dir != None: -# name = libxml2.buildURI(name, dir) - name = dir + '/' + name - - res = "" - child = node.children - while child != None: - if child.type != 'text': - res = res + child.serialize() - child = child.next - resources[name] = res - -# -# dir handling: pseudo directory resources -# -def handle_dir(node, dir): - try: - name = node.prop('name') - except: - name = None - - if name == None or name == '': - log.write("resource has no name") - return; - - if dir != None: -# name = libxml2.buildURI(name, dir) - name = dir + '/' + name - - dirs = node.xpathEval('dir') - for dir in dirs: - handle_dir(dir, name) - res = node.xpathEval('resource') - for r in res: - handle_resource(r, name) - -# -# handle a testCase element -# -def handle_testCase(node): - global nb_schemas_tests - global nb_instances_tests - global resources - - sections = node.xpathEval('string(section)') - log.write("\n ======== test %d line %d section %s ==========\n" % ( - - nb_schemas_tests, node.lineNo(), sections)) - resources = {} - if debug: - print "test %d line %d" % (nb_schemas_tests, node.lineNo()) - - dirs = node.xpathEval('dir') - for dir in dirs: - handle_dir(dir, None) - res = node.xpathEval('resource') - for r in res: - handle_resource(r, None) - - tsts = node.xpathEval('incorrect') - if tsts != []: - if len(tsts) != 1: - print "warning test line %d has more than one example" %(node.lineNo()) - schema = handle_incorrect(tsts[0]) - else: - tsts = node.xpathEval('correct') - if tsts != []: - if len(tsts) != 1: - print "warning test line %d has more than one example"% (node.lineNo()) - schema = handle_correct(tsts[0]) - else: - print "warning line %d has no nor child" % (node.lineNo()) - - nb_schemas_tests = nb_schemas_tests + 1; - - valids = node.xpathEval('valid') - invalids = node.xpathEval('invalid') - nb_instances_tests = nb_instances_tests + len(valids) + len(invalids) - if schema != None: - for valid in valids: - handle_valid(valid, schema) - for invalid in invalids: - handle_invalid(invalid, schema) - - -# -# handle a testSuite element -# -def handle_testSuite(node, level = 0): - global nb_schemas_tests, nb_schemas_success, nb_schemas_failed - global nb_instances_tests, nb_instances_success, nb_instances_failed - if verbose and level >= 0: - old_schemas_tests = nb_schemas_tests - old_schemas_success = nb_schemas_success - old_schemas_failed = nb_schemas_failed - old_instances_tests = nb_instances_tests - old_instances_success = nb_instances_success - old_instances_failed = nb_instances_failed - - docs = node.xpathEval('documentation') - authors = node.xpathEval('author') - if docs != []: - msg = "" - for doc in docs: - msg = msg + doc.content + " " - if authors != []: - msg = msg + "written by " - for author in authors: - msg = msg + author.content + " " - if quiet == 0: - print msg - sections = node.xpathEval('section') - if verbose and sections != [] and level <= 0: - msg = "" - for section in sections: - msg = msg + section.content + " " - if quiet == 0: - print "Tests for section %s" % (msg) - for test in node.xpathEval('testCase'): - handle_testCase(test) - for test in node.xpathEval('testSuite'): - handle_testSuite(test, level + 1) - - - if verbose and level >= 0 : - if sections != []: - msg = "" - for section in sections: - msg = msg + section.content + " " - print "Result of tests for section %s" % (msg) - elif docs != []: - msg = "" - for doc in docs: - msg = msg + doc.content + " " - print "Result of tests for %s" % (msg) - - if nb_schemas_tests != old_schemas_tests: - print "found %d test schemas: %d success %d failures" % ( - nb_schemas_tests - old_schemas_tests, - nb_schemas_success - old_schemas_success, - nb_schemas_failed - old_schemas_failed) - if nb_instances_tests != old_instances_tests: - print "found %d test instances: %d success %d failures" % ( - nb_instances_tests - old_instances_tests, - nb_instances_success - old_instances_success, - nb_instances_failed - old_instances_failed) -# -# Parse the conf file -# -libxml2.substituteEntitiesDefault(1); -testsuite = libxml2.parseFile(CONF) - -# -# Error and warnng callbacks -# -def callback(ctx, str): - global log - log.write("%s%s" % (ctx, str)) - -libxml2.registerErrorHandler(callback, "") - -libxml2.setEntityLoader(resolver) -root = testsuite.getRootElement() -if root.name != 'testSuite': - print "%s doesn't start with a testSuite element, aborting" % (CONF) - sys.exit(1) -if quiet == 0: - print "Running Relax NG testsuite" -handle_testSuite(root) - -if quiet == 0 or nb_schemas_failed != 0: - print "\nTOTAL:\nfound %d test schemas: %d success %d failures" % ( - nb_schemas_tests, nb_schemas_success, nb_schemas_failed) -if quiet == 0 or nb_instances_failed != 0: - print "found %d test instances: %d success %d failures" % ( - nb_instances_tests, nb_instances_success, nb_instances_failed) - -testsuite.freeDoc() - -# Memory debug specific -libxml2.relaxNGCleanupTypes() -libxml2.cleanupParser() -if libxml2.debugMemory(1) == 0: - if quiet == 0: - print "OK" -else: - print "Memory leak %d bytes" % (libxml2.debugMemory(1)) - libxml2.dumpMemory() diff --git a/lib/3rdparty/libxml2/config.guess b/lib/3rdparty/libxml2/config.guess deleted file mode 100644 index 49ba16f15c6..00000000000 --- a/lib/3rdparty/libxml2/config.guess +++ /dev/null @@ -1,1522 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. - -timestamp='2012-01-01' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH="x86_64" - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep -q __LP64__ - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` - case ${UNAME_PROCESSOR} in - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:MSYS*:*) - echo ${UNAME_MACHINE}-pc-msys - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - *:Interix*:*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - arm*:Linux:*:*) - eval $set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - echo ${UNAME_MACHINE}-unknown-linux-gnu - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo ${UNAME_MACHINE}-unknown-linux-gnueabi - else - echo ${UNAME_MACHINE}-unknown-linux-gnueabihf - fi - fi - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-gnu - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; - x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/lib/3rdparty/libxml2/config.h b/lib/3rdparty/libxml2/config.h index 10b9b16a3cc..b96114a2c34 100644 --- a/lib/3rdparty/libxml2/config.h +++ b/lib/3rdparty/libxml2/config.h @@ -261,7 +261,7 @@ #define HAVE_VSPRINTF 1 /* Define to 1 if you have the header file. */ -/* #undef HAVE_ZLIB_H */ +#define HAVE_ZLIB_H /* Define to 1 if you have the `_stat' function. */ #define HAVE__STAT 1 diff --git a/lib/3rdparty/libxml2/config.h.in b/lib/3rdparty/libxml2/config.h.in deleted file mode 100644 index a564b6c7bba..00000000000 --- a/lib/3rdparty/libxml2/config.h.in +++ /dev/null @@ -1,324 +0,0 @@ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* Define to 1 if you have the header file. */ -#undef HAVE_ANSIDECL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_ARPA_INET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_ARPA_NAMESER_H - -/* Whether struct sockaddr::__ss_family exists */ -#undef HAVE_BROKEN_SS_FAMILY - -/* Define to 1 if you have the `class' function. */ -#undef HAVE_CLASS - -/* Define to 1 if you have the header file. */ -#undef HAVE_CTYPE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_DIRENT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Have dlopen based dso */ -#undef HAVE_DLOPEN - -/* Define to 1 if you have the header file. */ -#undef HAVE_DL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_ERRNO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the `finite' function. */ -#undef HAVE_FINITE - -/* Define to 1 if you have the header file. */ -#undef HAVE_FLOAT_H - -/* Define to 1 if you have the `fpclass' function. */ -#undef HAVE_FPCLASS - -/* Define to 1 if you have the `fprintf' function. */ -#undef HAVE_FPRINTF - -/* Define to 1 if you have the `fp_class' function. */ -#undef HAVE_FP_CLASS - -/* Define to 1 if you have the header file. */ -#undef HAVE_FP_CLASS_H - -/* Define to 1 if you have the `ftime' function. */ -#undef HAVE_FTIME - -/* Define if getaddrinfo is there */ -#undef HAVE_GETADDRINFO - -/* Define to 1 if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define to 1 if you have the header file. */ -#undef HAVE_IEEEFP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `isascii' function. */ -#undef HAVE_ISASCII - -/* Define if isinf is there */ -#undef HAVE_ISINF - -/* Define if isnan is there */ -#undef HAVE_ISNAN - -/* Define to 1 if you have the `isnand' function. */ -#undef HAVE_ISNAND - -/* Define if history library is there (-lhistory) */ -#undef HAVE_LIBHISTORY - -/* Have compression library */ -#undef HAVE_LIBLZMA - -/* Define if pthread library is there (-lpthread) */ -#undef HAVE_LIBPTHREAD - -/* Define if readline library is there (-lreadline) */ -#undef HAVE_LIBREADLINE - -/* Have compression library */ -#undef HAVE_LIBZ - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if you have the `localtime' function. */ -#undef HAVE_LOCALTIME - -/* Define to 1 if you have the header file. */ -#undef HAVE_LZMA_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MALLOC_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MATH_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `mmap' function. */ -#undef HAVE_MMAP - -/* Define to 1 if you have the `munmap' function. */ -#undef HAVE_MUNMAP - -/* mmap() is no good without munmap() */ -#if defined(HAVE_MMAP) && !defined(HAVE_MUNMAP) -# undef /**/ HAVE_MMAP -#endif - -/* Define to 1 if you have the header file. */ -#undef HAVE_NAN_H - -/* Define to 1 if you have the header file, and it defines `DIR'. */ -#undef HAVE_NDIR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETDB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_POLL_H - -/* Define to 1 if you have the `printf' function. */ -#undef HAVE_PRINTF - -/* Define if is there */ -#undef HAVE_PTHREAD_H - -/* Define to 1 if you have the `putenv' function. */ -#undef HAVE_PUTENV - -/* Define to 1 if you have the `rand' function. */ -#undef HAVE_RAND - -/* Define to 1 if you have the `rand_r' function. */ -#undef HAVE_RAND_R - -/* Define to 1 if you have the header file. */ -#undef HAVE_RESOLV_H - -/* Have shl_load based dso */ -#undef HAVE_SHLLOAD - -/* Define to 1 if you have the `signal' function. */ -#undef HAVE_SIGNAL - -/* Define to 1 if you have the header file. */ -#undef HAVE_SIGNAL_H - -/* Define to 1 if you have the `snprintf' function. */ -#undef HAVE_SNPRINTF - -/* Define to 1 if you have the `sprintf' function. */ -#undef HAVE_SPRINTF - -/* Define to 1 if you have the `srand' function. */ -#undef HAVE_SRAND - -/* Define to 1 if you have the `sscanf' function. */ -#undef HAVE_SSCANF - -/* Define to 1 if you have the `stat' function. */ -#undef HAVE_STAT - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDARG_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strdup' function. */ -#undef HAVE_STRDUP - -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - -/* Define to 1 if you have the `strftime' function. */ -#undef HAVE_STRFTIME - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strndup' function. */ -#undef HAVE_STRNDUP - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#undef HAVE_SYS_DIR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MMAN_H - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#undef HAVE_SYS_NDIR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SELECT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIMEB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the `time' function. */ -#undef HAVE_TIME - -/* Define to 1 if you have the header file. */ -#undef HAVE_TIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Whether va_copy() is available */ -#undef HAVE_VA_COPY - -/* Define to 1 if you have the `vfprintf' function. */ -#undef HAVE_VFPRINTF - -/* Define to 1 if you have the `vsnprintf' function. */ -#undef HAVE_VSNPRINTF - -/* Define to 1 if you have the `vsprintf' function. */ -#undef HAVE_VSPRINTF - -/* Define to 1 if you have the header file. */ -#undef HAVE_ZLIB_H - -/* Define to 1 if you have the `_stat' function. */ -#undef HAVE__STAT - -/* Whether __va_copy() is available */ -#undef HAVE___VA_COPY - -/* Define as const if the declaration of iconv() needs const. */ -#undef ICONV_CONST - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Support for IPv6 */ -#undef SUPPORT_IP6 - -/* Version number of package */ -#undef VERSION - -/* Determine what socket length (socklen_t) data type is */ -#undef XML_SOCKLEN_T - -/* Define for Solaris 2.5.1 so the uint32_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -#undef _UINT32_T - -/* Using the Win32 Socket implementation */ -#undef _WINSOCKAPI_ - -/* ss_family is not defined here, use __ss_family instead */ -#undef ss_family - -/* Define to the type of an unsigned integer type of width exactly 32 bits if - such a type exists and the standard includes do not define it. */ -#undef uint32_t diff --git a/lib/3rdparty/libxml2/config.sub b/lib/3rdparty/libxml2/config.sub deleted file mode 100644 index d6b6b3c768f..00000000000 --- a/lib/3rdparty/libxml2/config.sub +++ /dev/null @@ -1,1766 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. - -timestamp='2012-01-01' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | be32 | be64 \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 \ - | ns16k | ns32k \ - | open8 \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ - | rl78 | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12 | picochip) - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - - xscaleeb) - basic_machine=armeb-unknown - ;; - - xscaleel) - basic_machine=armel-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ - | rl78-* | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze) - basic_machine=microblaze-xilinx - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - msys) - basic_machine=i386-pc - os=-msys - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tile*) - basic_machine=$basic_machine-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux - ;; - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -nacl*) - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/lib/3rdparty/libxml2/configure b/lib/3rdparty/libxml2/configure deleted file mode 100644 index dab3f3abba4..00000000000 --- a/lib/3rdparty/libxml2/configure +++ /dev/null @@ -1,17695 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68. -# -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 - - test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ - || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - -SHELL=${CONFIG_SHELL-/bin/sh} - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= -PACKAGE_URL= - -ac_unique_file="entities.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='am__EXEEXT_FALSE -am__EXEEXT_TRUE -LTLIBOBJS -LIBOBJS -PYTHON_TESTS -RELDATE -RDL_LIBS -M_LIBS -PYTHON_SITE_PACKAGES -PYTHON_INCLUDES -PYTHON_VERSION -HAVE_ISINF -HAVE_ISNAN -XML_INCLUDEDIR -ICONV_LIBS -XML_LIBTOOLLIBS -XML_LIBS -XML_LIBDIR -XML_CFLAGS -CYGWIN_EXTRA_PYTHON_LIBADD -CYGWIN_EXTRA_LDFLAGS -WIN32_EXTRA_PYTHON_LIBADD -WIN32_EXTRA_LDFLAGS -WIN32_EXTRA_LIBADD -WITH_RUN_DEBUG -WITH_MEM_DEBUG -TEST_DEBUG -DEBUG_OBJ -WITH_DEBUG -TEST_REGEXPS -WITH_REGEXPS -TEST_SCHEMAS -WITH_SCHEMAS -TEST_SCHEMATRON -WITH_SCHEMATRON -WITH_ISO8859X -ICU_LIBS -WITH_ICU -WITH_ICONV -WITH_OUTPUT -TEST_XPATH -XPATH_OBJ -WITH_XPATH -TEST_XINCLUDE -XINCLUDE_OBJ -WITH_XINCLUDE -TEST_C14N -C14N_OBJ -WITH_C14N -TEST_XPTR -XPTR_OBJ -WITH_XPTR -DOCB_OBJ -WITH_DOCB -TEST_CATALOG -CATALOG_OBJ -WITH_CATALOG -TEST_VTIME -TEST_VALID -WITH_VALID -TEST_PHTML -TEST_HTML -HTML_OBJ -WITH_HTML -TEST_PUSH -WITH_PUSH -TEST_SAX -WITH_SAX1_SOURCES_FALSE -WITH_SAX1_SOURCES_TRUE -WITH_SAX1 -TEST_PATTERN -WITH_PATTERN -WITH_WRITER -READER_TEST -WITH_READER -WITH_LEGACY -HTTP_OBJ -WITH_HTTP -FTP_OBJ -WITH_FTP -WITH_TREE -THREADS_W32_FALSE -THREADS_W32_TRUE -TEST_THREADS -THREAD_CFLAGS -WITH_THREADS -BASE_THREAD_LIBS -THREAD_LIBS -WITH_TRIO -WITH_TRIO_SOURCES_FALSE -WITH_TRIO_SOURCES_TRUE -STATIC_BINARIES -TEST_MODULES -MODULE_EXTENSION -MODULE_PLATFORM_LIBS -WITH_MODULES -PYTHON_LIBS -PYTHON_SUBDIR -pythondir -WITH_PYTHON_FALSE -WITH_PYTHON_TRUE -PYTHON -WITH_LZMA -LZMA_LIBS -LZMA_CFLAGS -WITH_ZLIB -Z_LIBS -Z_CFLAGS -REBUILD_DOCS_FALSE -REBUILD_DOCS_TRUE -HTML_DIR -USE_VERSION_SCRIPT_FALSE -USE_VERSION_SCRIPT_TRUE -VERSION_SCRIPT_FLAGS -OTOOL64 -OTOOL -LIPO -NMEDIT -DSYMUTIL -MANIFEST_TOOL -RANLIB -ac_ct_AR -AR -DLLTOOL -OBJDUMP -NM -ac_ct_DUMPBIN -DUMPBIN -LD -FGREP -EGREP -GREP -SED -LIBTOOL -XSLTPROC -XMLLINT -WGET -PERL -TAR -MV -RM -CPP -LN_S -am__fastdepCC_FALSE -am__fastdepCC_TRUE -CCDEPMODE -am__nodep -AMDEPBACKSLASH -AMDEP_FALSE -AMDEP_TRUE -am__quote -am__include -DEPDIR -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -AM_BACKSLASH -AM_DEFAULT_VERBOSITY -AM_DEFAULT_V -AM_V -am__untar -am__tar -AMTAR -am__leading_dot -SET_MAKE -AWK -mkdir_p -MKDIR_P -INSTALL_STRIP_PROGRAM -STRIP -install_sh -MAKEINFO -AUTOHEADER -AUTOMAKE -AUTOCONF -ACLOCAL -VERSION -PACKAGE -CYGPATH_W -am__isrc -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -LIBXML_VERSION_EXTRA -LIBXML_VERSION_NUMBER -LIBXML_VERSION_INFO -LIBXML_VERSION -LIBXML_MICRO_VERSION -LIBXML_MINOR_VERSION -LIBXML_MAJOR_VERSION -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_silent_rules -enable_dependency_tracking -enable_shared -enable_static -with_pic -enable_fast_install -with_gnu_ld -with_sysroot -enable_libtool_lock -with_c14n -with_catalog -with_debug -with_docbook -with_fexceptions -with_ftp -with_history -with_html -with_html_dir -with_html_subdir -with_http -with_iconv -with_icu -with_iso8859x -with_legacy -with_mem_debug -with_minimum -with_output -with_pattern -with_push -with_python -with_reader -with_readline -with_regexps -with_run_debug -with_sax1 -with_schemas -with_schematron -with_threads -with_thread_alloc -with_tree -with_valid -with_writer -with_xinclude -with_xpath -with_xptr -with_modules -with_zlib -with_lzma -with_coverage -enable_rebuild_docs -enable_ipv6 -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-silent-rules less verbose build output (undo: `make V=1') - --disable-silent-rules verbose build output (undo: `make V=0') - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - --enable-shared[=PKGS] build shared libraries [default=yes] - --enable-static[=PKGS] build static libraries [default=yes] - --enable-fast-install[=PKGS] - optimize for fast installation [default=yes] - --disable-libtool-lock avoid locking (might break parallel builds) - --enable-rebuild-docs[=yes/no] rebuild some generated docs [default=no] - --enable-ipv6[=yes/no] enables compilation of IPv6 code [default=yes] - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use - both] - --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --with-sysroot=DIR Search for dependent libraries within DIR - (or the compiler's sysroot if not specified). - --with-c14n add the Canonicalization support (on) - --with-catalog add the Catalog support (on) - --with-debug add the debugging module (on) - --with-docbook add Docbook SGML support (on) - --with-fexceptions add GCC flag -fexceptions for C++ exceptions (off) - --with-ftp add the FTP support (on) - --with-history add history support to xmllint shell(off) - --with-html add the HTML support (on) - --with-html-dir=path path to base html directory, default - $datadir/doc/html - --with-html-subdir=path directory used under html-dir, default - $PACKAGE-$VERSION/html - --with-http add the HTTP support (on) - --with-iconv[=DIR] add ICONV support (on) - --with-icu add ICU support (off) - --with-iso8859x add ISO8859X support if no iconv (on) - --with-legacy add deprecated APIs for compatibility (on) - --with-mem-debug add the memory debugging module (off) - --with-minimum build a minimally sized library (off) - --with-output add the serialization support (on) - --with-pattern add the xmlPattern selection interface (on) - --with-push add the PUSH parser interfaces (on) - --with-python[=DIR] build Python bindings if found - --with-reader add the xmlReader parsing interface (on) - --with-readline=DIR use readline in DIR - --with-regexps add Regular Expressions support (on) - --with-run-debug add the runtime debugging module (off) - --with-sax1 add the older SAX1 interface (on) - --with-schemas add Relax-NG and Schemas support (on) - --with-schematron add Schematron support (on) - --with-threads add multithread support(on) - --with-thread-alloc add per-thread memory(off) - --with-tree add the DOM like tree manipulation APIs (on) - --with-valid add the DTD validation support (on) - --with-writer add the xmlWriter saving interface (on) - --with-xinclude add the XInclude support (on) - --with-xpath add the XPATH support (on) - --with-xptr add the XPointer support (on) - --with-modules add the dynamic modules support (on) - --with-zlib[=DIR] use libz in DIR - --with-lzma[=DIR] use liblzma in DIR - --with-coverage build for code coverage with GCC (off) - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to the package provider. -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -configure -generated by GNU Autoconf 2.68 - -Copyright (C) 2010 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_find_uintX_t LINENO BITS VAR -# ------------------------------------ -# Finds an unsigned integer type with width BITS, setting cache variable VAR -# accordingly. -ac_fn_c_find_uintX_t () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 -$as_echo_n "checking for uint$2_t... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - # Order is important - never check a type that is potentially smaller - # than half of the expected target width. - for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ - 'unsigned long long int' 'unsigned short int' 'unsigned char'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - case $ac_type in #( - uint$2_t) : - eval "$3=yes" ;; #( - *) : - eval "$3=\$ac_type" ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if eval test \"x\$"$3"\" = x"no"; then : - -else - break -fi - done -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_find_uintX_t -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by $as_me, which was -generated by GNU Autoconf 2.68. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -ac_config_headers="$ac_config_headers config.h" - - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - - -LIBXML_MAJOR_VERSION=2 -LIBXML_MINOR_VERSION=9 -LIBXML_MICRO_VERSION=0 -LIBXML_MICRO_VERSION_SUFFIX= -LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX -LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION - -LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION` - -if test -f CVS/Entries ; then - extra=`grep ChangeLog CVS/Entries | grep -v LIBXML | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%` - echo extra=$extra - if test "$extra" != "" - then - LIBXML_VERSION_EXTRA="-CVS$extra" - fi -else if test -d .svn ; then - extra=`svn info | grep Revision | sed 's+Revision: ++'` - echo extra=$extra - if test "$extra" != "" - then - LIBXML_VERSION_EXTRA="-SVN$extra" - fi -else if test -d .git ; then - extra=`git describe 2>/dev/null | sed 's+LIBXML[0-9.]*-++'` - echo extra=$extra - if test "$extra" != "" - then - LIBXML_VERSION_EXTRA="-GIT$extra" - fi -fi -fi -fi - - - - - - - - -VERSION=${LIBXML_VERSION} - -am__api_version='1.11' - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - - done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } -# Just in case -sleep 1 -echo timestamp > conftest.file -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; -esac -case $srcdir in - *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; -esac - -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken -alias in your environment" "$LINENO" 5 - fi - - test "$2" = conftest.file - ) -then - # Ok. - : -else - as_fn_error $? "newly created file is older than distributed files! -Check your system clock" "$LINENO" 5 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -if test x"${install_sh}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi - -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } -if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done - done -IFS=$as_save_IFS - -fi - - test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - MKDIR_P="$ac_install_sh -d" - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } - -mkdir_p="$MKDIR_P" -case $mkdir_p in - [\\/$]* | ?:[\\/]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - am__isrc=' -I$(srcdir)' - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE=libxml2 - VERSION=$VERSION - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AMTAR='$${TAR-tar}' - -am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' - - - - - - -# Support silent build rules, requires at least automake-1.11. Disable -# by either passing --disable-silent-rules to configure or passing V=1 -# to make -# Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : - enableval=$enable_silent_rules; -fi - -case $enable_silent_rules in -yes) AM_DEFAULT_VERBOSITY=0;; -no) AM_DEFAULT_VERBOSITY=1;; -*) AM_DEFAULT_VERBOSITY=0;; -esac -am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } -if test $am_cv_make_support_nested_variables = yes; then - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AM_BACKSLASH='\' - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -# Extract the first word of "rm", so it can be a program name with args. -set dummy rm; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_RM+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $RM in - [\\/]* | ?:[\\/]*) - ac_cv_path_RM="$RM" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_RM" && ac_cv_path_RM="/bin/rm" - ;; -esac -fi -RM=$ac_cv_path_RM -if test -n "$RM"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RM" >&5 -$as_echo "$RM" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -# Extract the first word of "mv", so it can be a program name with args. -set dummy mv; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_MV+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MV in - [\\/]* | ?:[\\/]*) - ac_cv_path_MV="$MV" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_MV="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_MV" && ac_cv_path_MV="/bin/mv" - ;; -esac -fi -MV=$ac_cv_path_MV -if test -n "$MV"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MV" >&5 -$as_echo "$MV" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -# Extract the first word of "tar", so it can be a program name with args. -set dummy tar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_TAR+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $TAR in - [\\/]* | ?:[\\/]*) - ac_cv_path_TAR="$TAR" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_TAR="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_TAR" && ac_cv_path_TAR="/bin/tar" - ;; -esac -fi -TAR=$ac_cv_path_TAR -if test -n "$TAR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TAR" >&5 -$as_echo "$TAR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -# Extract the first word of "perl", so it can be a program name with args. -set dummy perl; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PERL+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PERL in - [\\/]* | ?:[\\/]*) - ac_cv_path_PERL="$PERL" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="/usr/bin/perl" - ;; -esac -fi -PERL=$ac_cv_path_PERL -if test -n "$PERL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 -$as_echo "$PERL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -# Extract the first word of "wget", so it can be a program name with args. -set dummy wget; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_WGET+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $WGET in - [\\/]* | ?:[\\/]*) - ac_cv_path_WGET="$WGET" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_WGET="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_WGET" && ac_cv_path_WGET="/usr/bin/wget" - ;; -esac -fi -WGET=$ac_cv_path_WGET -if test -n "$WGET"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WGET" >&5 -$as_echo "$WGET" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -# Extract the first word of "xmllint", so it can be a program name with args. -set dummy xmllint; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_XMLLINT+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $XMLLINT in - [\\/]* | ?:[\\/]*) - ac_cv_path_XMLLINT="$XMLLINT" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_XMLLINT="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_XMLLINT" && ac_cv_path_XMLLINT="/usr/bin/xmllint" - ;; -esac -fi -XMLLINT=$ac_cv_path_XMLLINT -if test -n "$XMLLINT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XMLLINT" >&5 -$as_echo "$XMLLINT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -# Extract the first word of "xsltproc", so it can be a program name with args. -set dummy xsltproc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_XSLTPROC+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $XSLTPROC in - [\\/]* | ?:[\\/]*) - ac_cv_path_XSLTPROC="$XSLTPROC" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_XSLTPROC="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_XSLTPROC" && ac_cv_path_XSLTPROC="/usr/bin/xsltproc" - ;; -esac -fi -XSLTPROC=$ac_cv_path_XSLTPROC -if test -n "$XSLTPROC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XSLTPROC" >&5 -$as_echo "$XSLTPROC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - -case `pwd` in - *\ * | *\ *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; -esac - - - -macro_version='2.4.2' -macro_revision='1.3337' - - - - - - - - - - - - - -ltmain="$ac_aux_dir/ltmain.sh" - -# Backslashify metacharacters that are still active within -# double-quoted strings. -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 -$as_echo_n "checking how to print strings... " >&6; } -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "" -} - -case "$ECHO" in - printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 -$as_echo "printf" >&6; } ;; - print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 -$as_echo "print -r" >&6; } ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 -$as_echo "cat" >&6; } ;; -esac - - - - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${ac_cv_path_SED+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for ac_i in 1 2 3 4 5 6 7; do - ac_script="$ac_script$as_nl$ac_script" - done - echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed - { ac_script=; unset ac_script;} - if test -z "$SED"; then - ac_path_SED_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue -# Check for GNU ac_path_SED and select it if it is found. - # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in -*GNU*) - ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo '' >> "conftest.nl" - "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_SED="$ac_path_SED" - ac_path_SED_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_SED_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_SED"; then - as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 - fi -else - ac_cv_path_SED=$SED -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } - SED="$ac_cv_path_SED" - rm -f conftest.sed - -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -$as_echo_n "checking for fgrep... " >&6; } -if ${ac_cv_path_FGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 - then ac_cv_path_FGREP="$GREP -F" - else - if test -z "$FGREP"; then - ac_path_FGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in fgrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue -# Check for GNU ac_path_FGREP and select it if it is found. - # Check for GNU $ac_path_FGREP -case `"$ac_path_FGREP" --version 2>&1` in -*GNU*) - ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'FGREP' >> "conftest.nl" - "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_FGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_FGREP="$ac_path_FGREP" - ac_path_FGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_FGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_FGREP"; then - as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_FGREP=$FGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -$as_echo "$ac_cv_path_FGREP" >&6; } - FGREP="$ac_cv_path_FGREP" - - -test -z "$GREP" && GREP=grep - - - - - - - - - - - - - - - - - - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if ${lt_cv_path_NM+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - if test -n "$ac_tool_prefix"; then - for ac_prog in dumpbin "link -dump" - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DUMPBIN"; then - ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DUMPBIN=$ac_cv_prog_DUMPBIN -if test -n "$DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 -$as_echo "$DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$DUMPBIN" && break - done -fi -if test -z "$DUMPBIN"; then - ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in dumpbin "link -dump" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DUMPBIN"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN -if test -n "$ac_ct_DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 -$as_echo "$ac_ct_DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_DUMPBIN" && break -done - - if test "x$ac_ct_DUMPBIN" = x; then - DUMPBIN=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DUMPBIN=$ac_ct_DUMPBIN - fi -fi - - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols" - ;; - *) - DUMPBIN=: - ;; - esac - fi - - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 -$as_echo_n "checking the name lister ($NM) interface... " >&6; } -if ${lt_cv_nm_interface+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: output\"" >&5) - cat conftest.out >&5 - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 -$as_echo "$lt_cv_nm_interface" >&6; } - -# find the maximum length of command line arguments -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -$as_echo_n "checking the maximum length of command line arguments... " >&6; } -if ${lt_cv_sys_max_cmd_len+:} false; then : - $as_echo_n "(cached) " >&6 -else - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - os2*) - # The test takes a long time on OS/2. - lt_cv_sys_max_cmd_len=8192 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac - -fi - -if test -n $lt_cv_sys_max_cmd_len ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -$as_echo "$lt_cv_sys_max_cmd_len" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } -fi -max_cmd_len=$lt_cv_sys_max_cmd_len - - - - - - -: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 -$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,b/c, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 -$as_echo "$xsi_shell" >&6; } - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 -$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } -lt_shell_append=no -( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 -$as_echo "$lt_shell_append" >&6; } - - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi - - - - - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 -$as_echo_n "checking how to convert $build file names to $host format... " >&6; } -if ${lt_cv_to_host_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; -esac - -fi - -to_host_file_cmd=$lt_cv_to_host_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 -$as_echo "$lt_cv_to_host_file_cmd" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 -$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } -if ${lt_cv_to_tool_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - #assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac - ;; -esac - -fi - -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 -$as_echo "$lt_cv_to_tool_file_cmd" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 -$as_echo_n "checking for $LD option to reload object files... " >&6; } -if ${lt_cv_ld_reload_flag+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_reload_flag='-r' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 -$as_echo "$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - if test "$GCC" != yes; then - reload_cmds=false - fi - ;; - darwin*) - if test "$GCC" = yes; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJDUMP=$ac_ct_OBJDUMP - fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" -fi - -test -z "$OBJDUMP" && OBJDUMP=objdump - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 -$as_echo_n "checking how to recognize dependent libraries... " >&6; } -if ${lt_cv_deplibs_check_method+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix[4-9]*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi[45]*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump', - # unless we find 'file', for example because we are cross-compiling. - # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. - if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[3-9]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 -$as_echo "$lt_cv_deplibs_check_method" >&6; } - -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` - fi - ;; - esac -fi - -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - - - - - - - - - - - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DLLTOOL=$ac_ct_DLLTOOL - fi -else - DLLTOOL="$ac_cv_prog_DLLTOOL" -fi - -test -z "$DLLTOOL" && DLLTOOL=dlltool - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 -$as_echo_n "checking how to associate runtime and link libraries... " >&6; } -if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_sharedlib_from_linklib_cmd='unknown' - -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh - # decide which to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd="$ECHO" - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 -$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - - - - - - - - -if test -n "$ac_tool_prefix"; then - for ac_prog in ar - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AR="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AR" && break - done -fi -if test -z "$AR"; then - ac_ct_AR=$AR - for ac_prog in ar -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_AR="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_AR" && break -done - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -fi - -: ${AR=ar} -: ${AR_FLAGS=cru} - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 -$as_echo_n "checking for archiver @FILE support... " >&6; } -if ${lt_cv_ar_at_file+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ar_at_file=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -eq 0; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -ne 0; then - lt_cv_ar_at_file=@ - fi - fi - rm -f conftest.* libconftest.a - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 -$as_echo "$lt_cv_ar_at_file" >&6; } - -if test "x$lt_cv_ar_at_file" = xno; then - archiver_list_spec= -else - archiver_list_spec=$lt_cv_ar_at_file -fi - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -test -z "$STRIP" && STRIP=: - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -test -z "$RANLIB" && RANLIB=: - - - - - - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 -$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if ${lt_cv_sys_global_symbol_pipe+:} false; then : - $as_echo_n "(cached) " >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[ABCDGISTW]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris*) - symcode='[BDRT]' - ;; -sco3.2v5*) - symcode='[DT]' - ;; -sysv4.2uw2*) - symcode='[DT]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[ABDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK '"\ -" {last_section=section; section=\$ 3};"\ -" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -LT_DLSYM_CONST struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS=$lt_globsym_save_LIBS - CFLAGS=$lt_globsym_save_CFLAGS - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } -fi - -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then - nm_file_list_spec='@' -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 -$as_echo_n "checking for sysroot... " >&6; } - -# Check whether --with-sysroot was given. -if test "${with_sysroot+set}" = set; then : - withval=$with_sysroot; -else - with_sysroot=no -fi - - -lt_sysroot= -case ${with_sysroot} in #( - yes) - if test "$GCC" = yes; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 -$as_echo "${with_sysroot}" >&6; } - as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 - ;; -esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 -$as_echo "${lt_sysroot:-no}" >&6; } - - - - - -# Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : - enableval=$enable_libtool_lock; -fi - -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line '$LINENO' "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 -$as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if ${lt_cv_cc_needs_belf+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_cc_needs_belf=yes -else - lt_cv_cc_needs_belf=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 -$as_echo "$lt_cv_cc_needs_belf" >&6; } - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) - case $host in - i?86-*-solaris*) - LD="${LD-ld} -m elf_x86_64" - ;; - sparc*-*-solaris*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - # GNU ld 2.21 introduced _sol2 emulations. Use them if available. - if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then - LD="${LD-ld}_sol2" - fi - ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. -set dummy ${ac_tool_prefix}mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$MANIFEST_TOOL"; then - ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL -if test -n "$MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 -$as_echo "$MANIFEST_TOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_MANIFEST_TOOL"; then - ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL - # Extract the first word of "mt", so it can be a program name with args. -set dummy mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_MANIFEST_TOOL"; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL -if test -n "$ac_ct_MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 -$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_MANIFEST_TOOL" = x; then - MANIFEST_TOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL - fi -else - MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" -fi - -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 -$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } -if ${lt_cv_path_mainfest_tool+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&5 - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes - fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 -$as_echo "$lt_cv_path_mainfest_tool" >&6; } -if test "x$lt_cv_path_mainfest_tool" != xyes; then - MANIFEST_TOOL=: -fi - - - - - - - case $host_os in - rhapsody* | darwin*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. -set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DSYMUTIL"; then - ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DSYMUTIL=$ac_cv_prog_DSYMUTIL -if test -n "$DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 -$as_echo "$DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DSYMUTIL"; then - ac_ct_DSYMUTIL=$DSYMUTIL - # Extract the first word of "dsymutil", so it can be a program name with args. -set dummy dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DSYMUTIL"; then - ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL -if test -n "$ac_ct_DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 -$as_echo "$ac_ct_DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DSYMUTIL" = x; then - DSYMUTIL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DSYMUTIL=$ac_ct_DSYMUTIL - fi -else - DSYMUTIL="$ac_cv_prog_DSYMUTIL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. -set dummy ${ac_tool_prefix}nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NMEDIT"; then - ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -NMEDIT=$ac_cv_prog_NMEDIT -if test -n "$NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 -$as_echo "$NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_NMEDIT"; then - ac_ct_NMEDIT=$NMEDIT - # Extract the first word of "nmedit", so it can be a program name with args. -set dummy nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_NMEDIT"; then - ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_NMEDIT="nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT -if test -n "$ac_ct_NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 -$as_echo "$ac_ct_NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_NMEDIT" = x; then - NMEDIT=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - NMEDIT=$ac_ct_NMEDIT - fi -else - NMEDIT="$ac_cv_prog_NMEDIT" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. -set dummy ${ac_tool_prefix}lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$LIPO"; then - ac_cv_prog_LIPO="$LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_LIPO="${ac_tool_prefix}lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -LIPO=$ac_cv_prog_LIPO -if test -n "$LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 -$as_echo "$LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_LIPO"; then - ac_ct_LIPO=$LIPO - # Extract the first word of "lipo", so it can be a program name with args. -set dummy lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_LIPO"; then - ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_LIPO="lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO -if test -n "$ac_ct_LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 -$as_echo "$ac_ct_LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_LIPO" = x; then - LIPO=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - LIPO=$ac_ct_LIPO - fi -else - LIPO="$ac_cv_prog_LIPO" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL"; then - ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OTOOL="${ac_tool_prefix}otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL=$ac_cv_prog_OTOOL -if test -n "$OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 -$as_echo "$OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL"; then - ac_ct_OTOOL=$OTOOL - # Extract the first word of "otool", so it can be a program name with args. -set dummy otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL"; then - ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OTOOL="otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL -if test -n "$ac_ct_OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 -$as_echo "$ac_ct_OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL" = x; then - OTOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL=$ac_ct_OTOOL - fi -else - OTOOL="$ac_cv_prog_OTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL64"; then - ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL64=$ac_cv_prog_OTOOL64 -if test -n "$OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 -$as_echo "$OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL64"; then - ac_ct_OTOOL64=$OTOOL64 - # Extract the first word of "otool64", so it can be a program name with args. -set dummy otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL64"; then - ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OTOOL64="otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 -if test -n "$ac_ct_OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 -$as_echo "$ac_ct_OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL64" = x; then - OTOOL64=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL64=$ac_ct_OTOOL64 - fi -else - OTOOL64="$ac_cv_prog_OTOOL64" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 -$as_echo_n "checking for -single_module linker flag... " >&6; } -if ${lt_cv_apple_cc_single_mod+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - # If there is a non-empty error log, and "single_module" - # appears in it, assume the flag caused a linker warning - if test -s conftest.err && $GREP single_module conftest.err; then - cat conftest.err >&5 - # Otherwise, if the output was created with a 0 exit code from - # the compiler, it worked. - elif test -f libconftest.dylib && test $_lt_result -eq 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&5 - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 -$as_echo "$lt_cv_apple_cc_single_mod" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 -$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if ${lt_cv_ld_exported_symbols_list+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_ld_exported_symbols_list=yes -else - lt_cv_ld_exported_symbols_list=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 -$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 -$as_echo_n "checking for -force_load linker flag... " >&6; } -if ${lt_cv_ld_force_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR cru libconftest.a conftest.o" >&5 - $AR cru libconftest.a conftest.o 2>&5 - echo "$RANLIB libconftest.a" >&5 - $RANLIB libconftest.a 2>&5 - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -s conftest.err && $GREP force_load conftest.err; then - cat conftest.err >&5 - elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&5 - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 -$as_echo "$lt_cv_ld_force_load" >&6; } - case $host_os in - rhapsody* | darwin1.[012]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[91]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[012]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default -" -if test "x$ac_cv_header_dlfcn_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 -_ACEOF - -fi - -done - - - - - -# Set options - - - - enable_dlopen=no - - - enable_win32_dll=no - - - # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_shared=yes -fi - - - - - - - - - - # Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=yes -fi - - - - - - - - - - -# Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : - withval=$with_pic; lt_p=${PACKAGE-default} - case $withval in - yes|no) pic_mode=$withval ;; - *) - pic_mode=default - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for lt_pkg in $withval; do - IFS="$lt_save_ifs" - if test "X$lt_pkg" = "X$lt_p"; then - pic_mode=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - pic_mode=default -fi - - -test -z "$pic_mode" && pic_mode=default - - - - - - - - # Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then : - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_fast_install=yes -fi - - - - - - - - - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -test -z "$LN_S" && LN_S="ln -s" - - - - - - - - - - - - - - -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -$as_echo_n "checking for objdir... " >&6; } -if ${lt_cv_objdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -$as_echo "$lt_cv_objdir" >&6; } -objdir=$lt_cv_objdir - - - - - -cat >>confdefs.h <<_ACEOF -#define LT_OBJDIR "$lt_cv_objdir/" -_ACEOF - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` - - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 -$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 -$as_echo_n "checking for file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -# Use C for the default configuration in the libtool script - -lt_save_CC="$CC" -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* - -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* - - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -if test -n "$compiler"; then - -lt_prog_compiler_no_builtin_flag= - -if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; - *) - lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; - esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - - - - - - - lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - - - if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static= - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic - fi - ;; - - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - lt_prog_compiler_wl='-Xlinker ' - if test -n "$lt_prog_compiler_pic"; then - lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" - fi - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='--shared' - lt_prog_compiler_static='--static' - ;; - nagfor*) - # NAG Fortran compiler - lt_prog_compiler_wl='-Wl,-Wl,,' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-qpic' - lt_prog_compiler_static='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' - ;; - *Sun\ F* | *Sun*Fortran*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Qoption ld ' - ;; - *Sun\ C*) - # Sun C 5.9 - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Wl,' - ;; - *Intel*\ [CF]*Compiler*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - *Portland\ Group*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - esac - ;; - esac - ;; - - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - - rdos*) - lt_prog_compiler_static='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_can_build_shared=no - ;; - - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared=no - ;; - esac - fi - -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic=$lt_prog_compiler_pic -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 -$as_echo "$lt_cv_prog_compiler_pic" >&6; } -lt_prog_compiler_pic=$lt_cv_prog_compiler_pic - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if ${lt_cv_prog_compiler_pic_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } - -if test x"$lt_cv_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac -else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi - -fi - - - - - - - - - - - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works=yes - fi - else - lt_cv_prog_compiler_static_works=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 -$as_echo "$lt_cv_prog_compiler_static_works" >&6; } - -if test x"$lt_cv_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - runpath_var= - allow_undefined_flag= - always_export_symbols=no - archive_cmds= - archive_expsym_cmds= - compiler_needs_object=no - enable_shared_with_static_runtimes=no - export_dynamic_flag_spec= - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - hardcode_automatic=no - hardcode_direct=no - hardcode_direct_absolute=no - hardcode_libdir_flag_spec= - hardcode_libdir_separator= - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - inherit_rpath=no - link_all_deplibs=unknown - module_cmds= - module_expsym_cmds= - old_archive_from_new_cmds= - old_archive_from_expsyms_cmds= - thread_safe_flag_spec= - whole_archive_flag_spec= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test "$with_gnu_ld" = yes; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; - *\ \(GNU\ Binutils\)\ [3-9]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test "$lt_use_gnu_ld_interface" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[3-9]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.19, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - export_dynamic_flag_spec='${wl}--export-all-symbols' - allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs=no - fi - ;; - - haiku*) - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - link_all_deplibs=yes - ;; - - interix[3-9]*) - hardcode_direct=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag=' $pic_flag' - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - whole_archive_flag_spec= - tmp_sharedflag='--shared' ;; - xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix[4-9]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_direct_absolute=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - file_list_spec='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - export_dynamic_flag_spec='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' - fi - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - case $cc_basename in - cl*) - # Native MSVC - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - always_export_symbols=yes - file_list_spec='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, )='true' - enable_shared_with_static_runtimes=yes - exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - old_postinstall_cmds='chmod 644 $oldlib' - postlink_cmds='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # Assume MSVC wrapper - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - enable_shared_with_static_runtimes=yes - ;; - esac - ;; - - darwin* | rhapsody*) - - - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - - else - whole_archive_flag_spec='' - fi - link_all_deplibs=yes - allow_undefined_flag="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - - else - ld_shlibs=no - fi - - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2.*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 -$as_echo_n "checking if $CC understands -b... " >&6; } -if ${lt_cv_prog_compiler__b+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler__b=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -b" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler__b=yes - fi - else - lt_cv_prog_compiler__b=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 -$as_echo "$lt_cv_prog_compiler__b" >&6; } - -if test x"$lt_cv_prog_compiler__b" = xyes; then - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' -else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' -fi - - ;; - esac - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - *) - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 -$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } -if ${lt_cv_irix_exported_symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int foo (void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_irix_exported_symbol=yes -else - lt_cv_irix_exported_symbol=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 -$as_echo "$lt_cv_irix_exported_symbol" >&6; } - if test "$lt_cv_irix_exported_symbol" = yes; then - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - fi - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - inherit_rpath=yes - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct=yes - hardcode_shlibpath_var=no - hardcode_direct_absolute=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - else - ld_shlibs=no - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - archive_cmds_need_lc='no' - hardcode_libdir_separator=: - ;; - - solaris*) - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' - fi - ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag='${wl}-z,text' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag='${wl}-z,text' - allow_undefined_flag='${wl}-z,nodefs' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-R,$libdir' - hardcode_libdir_separator=':' - link_all_deplibs=yes - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - export_dynamic_flag_spec='${wl}-Blargedynsym' - ;; - esac - fi - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 -$as_echo "$ld_shlibs" >&6; } -test "$ld_shlibs" = no && can_build_shared=no - -with_gnu_ld=$with_gnu_ld - - - - - - - - - - - - - - - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc+:} false; then : - $as_echo_n "(cached) " >&6 -else - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } - archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc - ;; - esac - fi - ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } - -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[lt_foo]++; } - if (lt_freq[lt_foo] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([A-Za-z]:\),\1,g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[4-9]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec="$LIB" - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC wrapper - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[23].*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2.*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -haiku*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[3-9]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux # correct to gnu/linux during the next big refactor - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - lt_cv_shlibpath_overrides_runpath=yes -fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - -fi - - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Add ABI-specific directories to the system library path. - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" - - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || - test -n "$runpath_var" || - test "X$hardcode_automatic" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 -$as_echo "$hardcode_action" >&6; } - -if test "$hardcode_action" = relink || - test "$inherit_rpath" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - - - - - - if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); -int -main () -{ -return shl_load (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_shl_load=yes -else - ac_cv_lib_dld_shl_load=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" -else - ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 -$as_echo_n "checking for dlopen in -lsvld... " >&6; } -if ${ac_cv_lib_svld_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_svld_dlopen=yes -else - ac_cv_lib_svld_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 -$as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 -$as_echo_n "checking for dld_link in -ldld... " >&6; } -if ${ac_cv_lib_dld_dld_link+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dld_link (); -int -main () -{ -return dld_link (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_dld_link=yes -else - ac_cv_lib_dld_dld_link=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 -$as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = xyes; then : - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 -$as_echo_n "checking whether a program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 -$as_echo "$lt_cv_dlopen_self" >&6; } - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 -$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self_static+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 -$as_echo "$lt_cv_dlopen_self_static" >&6; } - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - - - - - - - - - - - - - - - - -striplib= -old_striplib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -$as_echo_n "checking whether stripping libraries is possible... " >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac -fi - - - - - - - - - - - - - # Report which library types will actually be built - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&6; } - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[4-9]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } - - - - -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - - - - - - - - - - - - - - - ac_config_commands="$ac_config_commands libtool" - - - - -# Only expand once: - - - -VERSION_SCRIPT_FLAGS= -# lt_cv_prog_gnu_ld is from libtool 2.+ -if test "$lt_cv_prog_gnu_ld" = yes; then - VERSION_SCRIPT_FLAGS=-Wl,--version-script= -else - case $host in - *-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";; - esac -fi - - if test -n "$VERSION_SCRIPT_FLAGS"; then - USE_VERSION_SCRIPT_TRUE= - USE_VERSION_SCRIPT_FALSE='#' -else - USE_VERSION_SCRIPT_TRUE='#' - USE_VERSION_SCRIPT_FALSE= -fi - - - -_cppflags="${CPPFLAGS}" -_libs="${LIBS}" - - -# Check whether --with-c14n was given. -if test "${with_c14n+set}" = set; then : - withval=$with_c14n; -fi - - -# Check whether --with-catalog was given. -if test "${with_catalog+set}" = set; then : - withval=$with_catalog; -fi - - -# Check whether --with-debug was given. -if test "${with_debug+set}" = set; then : - withval=$with_debug; -fi - - -# Check whether --with-docbook was given. -if test "${with_docbook+set}" = set; then : - withval=$with_docbook; -fi - - -# Check whether --with-fexceptions was given. -if test "${with_fexceptions+set}" = set; then : - withval=$with_fexceptions; -fi - - -# Check whether --with-ftp was given. -if test "${with_ftp+set}" = set; then : - withval=$with_ftp; -fi - - -# Check whether --with-history was given. -if test "${with_history+set}" = set; then : - withval=$with_history; -fi - - -# Check whether --with-html was given. -if test "${with_html+set}" = set; then : - withval=$with_html; -fi - - -# Check whether --with-html-dir was given. -if test "${with_html_dir+set}" = set; then : - withval=$with_html_dir; HTML_DIR=$withval -else - HTML_DIR='$(datadir)/doc' -fi - - - -# Check whether --with-html-subdir was given. -if test "${with_html_subdir+set}" = set; then : - withval=$with_html_subdir; test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval" -else - HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html" -fi - - - -# Check whether --with-http was given. -if test "${with_http+set}" = set; then : - withval=$with_http; -fi - - -# Check whether --with-iconv was given. -if test "${with_iconv+set}" = set; then : - withval=$with_iconv; -fi - - -# Check whether --with-icu was given. -if test "${with_icu+set}" = set; then : - withval=$with_icu; -fi - - -# Check whether --with-iso8859x was given. -if test "${with_iso8859x+set}" = set; then : - withval=$with_iso8859x; -fi - - -# Check whether --with-legacy was given. -if test "${with_legacy+set}" = set; then : - withval=$with_legacy; -fi - - -# Check whether --with-mem_debug was given. -if test "${with_mem_debug+set}" = set; then : - withval=$with_mem_debug; -fi - - -# Check whether --with-minimum was given. -if test "${with_minimum+set}" = set; then : - withval=$with_minimum; -fi - - -# Check whether --with-output was given. -if test "${with_output+set}" = set; then : - withval=$with_output; -fi - - -# Check whether --with-pattern was given. -if test "${with_pattern+set}" = set; then : - withval=$with_pattern; -fi - - -# Check whether --with-push was given. -if test "${with_push+set}" = set; then : - withval=$with_push; -fi - - -# Check whether --with-python was given. -if test "${with_python+set}" = set; then : - withval=$with_python; -fi - - -# Check whether --with-reader was given. -if test "${with_reader+set}" = set; then : - withval=$with_reader; -fi - - -# Check whether --with-readline was given. -if test "${with_readline+set}" = set; then : - withval=$with_readline; - if test "$withval" != "no" -a "$withval" != "yes"; then - RDL_DIR=$withval - CPPFLAGS="${CPPFLAGS} -I$withval/include" - LIBS="${LIBS} -L$withval/lib" - fi - -fi - - -# Check whether --with-regexps was given. -if test "${with_regexps+set}" = set; then : - withval=$with_regexps; -fi - - -# Check whether --with-run_debug was given. -if test "${with_run_debug+set}" = set; then : - withval=$with_run_debug; -fi - - -# Check whether --with-sax1 was given. -if test "${with_sax1+set}" = set; then : - withval=$with_sax1; -fi - - -# Check whether --with-schemas was given. -if test "${with_schemas+set}" = set; then : - withval=$with_schemas; -fi - - -# Check whether --with-schematron was given. -if test "${with_schematron+set}" = set; then : - withval=$with_schematron; -fi - - -# Check whether --with-threads was given. -if test "${with_threads+set}" = set; then : - withval=$with_threads; -fi - - -# Check whether --with-thread-alloc was given. -if test "${with_thread_alloc+set}" = set; then : - withval=$with_thread_alloc; -fi - - -# Check whether --with-tree was given. -if test "${with_tree+set}" = set; then : - withval=$with_tree; -fi - - -# Check whether --with-valid was given. -if test "${with_valid+set}" = set; then : - withval=$with_valid; -fi - - -# Check whether --with-writer was given. -if test "${with_writer+set}" = set; then : - withval=$with_writer; -fi - - -# Check whether --with-xinclude was given. -if test "${with_xinclude+set}" = set; then : - withval=$with_xinclude; -fi - - -# Check whether --with-xpath was given. -if test "${with_xpath+set}" = set; then : - withval=$with_xpath; -fi - - -# Check whether --with-xptr was given. -if test "${with_xptr+set}" = set; then : - withval=$with_xptr; -fi - - -# Check whether --with-modules was given. -if test "${with_modules+set}" = set; then : - withval=$with_modules; -fi - - -# Check whether --with-zlib was given. -if test "${with_zlib+set}" = set; then : - withval=$with_zlib; - if test "$withval" != "no" -a "$withval" != "yes"; then - Z_DIR=$withval - CPPFLAGS="${CPPFLAGS} -I$withval/include" - LIBS="${LIBS} -L$withval/lib" - fi - -fi - - -# Check whether --with-lzma was given. -if test "${with_lzma+set}" = set; then : - withval=$with_lzma; - if test "$withval" != "no" -a "$withval" != "yes"; then - LZMA_DIR=$withval - CPPFLAGS="${CPPFLAGS} -I$withval/include" - LIBS="${LIBS} -L$withval/lib" - fi - -fi - - -# Check whether --with-coverage was given. -if test "${with_coverage+set}" = set; then : - withval=$with_coverage; -fi - - -# Check whether --enable-rebuild-docs was given. -if test "${enable_rebuild_docs+set}" = set; then : - enableval=$enable_rebuild_docs; -fi - -if test "$enable_rebuild_docs" = "yes" -a "$srcdir" != "."; then - as_fn_error $? "cannot rebuild docs when builddir != srcdir" "$LINENO" 5 -fi - if test "$enable_rebuild_docs" = "yes" -o "$USER" = "veillard"; then - REBUILD_DOCS_TRUE= - REBUILD_DOCS_FALSE='#' -else - REBUILD_DOCS_TRUE='#' - REBUILD_DOCS_FALSE= -fi - - -if test "$with_schemas" = "yes" -then - with_pattern=yes - with_regexps=yes -fi -if test "$with_schematron" = "yes" -then - with_pattern=yes - with_xpath=yes -fi -if test "$with_reader" = "yes" -then - with_push=yes -fi -if test "$with_xptr" = "yes" -then - with_xpath=yes -fi -if test "$with_minimum" = "yes" -then - echo "Configuring for a minimal library" - if test "$with_c14n" = "" - then - with_c14n=no - fi - if test "$with_catalog" = "" - then - with_catalog=no - fi - echo So far so good! - if test "$with_debug" = "" - then - with_debug=no - fi - if test "$with_docbook" = "" - then - with_docbook=no - fi - if test "$with_fexceptions" = "" - then - with_fexceptions=no - fi - if test "$with_ftp" = "" - then - with_ftp=no - fi - if test "$with_history" = "" - then - with_history=no - fi - if test "$with_html" = "" - then - with_html=no - fi - if test "$with_http" = "" - then - with_http=no - fi - if test "$with_iconv" = "" - then - with_iconv=no - fi - if test "$with_iso8859x" = "" - then - with_iso8859x=no - fi - if test "$with_legacy" = "" - then - with_legacy=no - fi - if test "$with_mem_debug" = "" - then - with_mem_debug=no - fi - if test "$with_output" = "" - then - with_output=no - fi - if test "$with_pattern" = "" - then - with_pattern=no - fi - if test "$with_push" = "" - then - with_push=no - fi - if test "$with_python" = "" - then - with_python=no - fi - if test "$with_reader" = "" - then - with_reader=no - fi - if test "$with_readline" = "" - then - with_readline=no - fi - if test "$with_regexps" = "" - then - with_regexps=no - fi - if test "$with_run_debug" = "" - then - with_run_debug=no - fi - if test "$with_sax1" = "" - then - with_sax1=no - fi - if test "$with_schemas" = "" - then - with_schemas=no - fi - if test "$with_schematron" = "" - then - with_schematron=no - fi - if test "$with_threads" = "" - then - with_threads=no - fi - if test "$with_thread_alloc" = "" - then - with_thread_alloc=no - fi - if test "$with_tree" = "" - then - with_tree=no - fi - if test "$with_valid" = "" - then - with_valid=no - fi - if test "$with_writer" = "" - then - with_writer=no - fi - if test "$with_xinclude" = "" - then - with_xinclude=no - fi - if test "$with_xpath" = "" - then - with_xpath=no - fi - if test "$with_xptr" = "" - then - with_xptr=no - fi - if test "$with_zlib" = "" - then - with_zlib=no - fi - if test "$with_modules" = "" - then - with_modules=no - fi -fi - -echo Checking zlib - - -WITH_ZLIB=0 -if test "$with_zlib" = "no"; then - echo "Disabling compression support" -else - for ac_header in zlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" -if test "x$ac_cv_header_zlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_ZLIB_H 1 -_ACEOF - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzread in -lz" >&5 -$as_echo_n "checking for gzread in -lz... " >&6; } -if ${ac_cv_lib_z_gzread+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lz $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gzread (); -int -main () -{ -return gzread (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_z_gzread=yes -else - ac_cv_lib_z_gzread=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzread" >&5 -$as_echo "$ac_cv_lib_z_gzread" >&6; } -if test "x$ac_cv_lib_z_gzread" = xyes; then : - - -$as_echo "#define HAVE_LIBZ 1" >>confdefs.h - - WITH_ZLIB=1 - if test "x${Z_DIR}" != "x"; then - Z_CFLAGS="-I${Z_DIR}/include" - Z_LIBS="-L${Z_DIR}/lib -lz" - case ${host} in - *-*-solaris*) - Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz" - ;; - esac - else - Z_LIBS="-lz" - fi -fi - -fi - -done - -fi - - - - - -echo Checking lzma - - -WITH_LZMA=0 -if test "$with_lzma" = "no"; then - echo "Disabling compression support" -else - for ac_header in lzma.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "lzma.h" "ac_cv_header_lzma_h" "$ac_includes_default" -if test "x$ac_cv_header_lzma_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LZMA_H 1 -_ACEOF - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzma_code in -llzma" >&5 -$as_echo_n "checking for lzma_code in -llzma... " >&6; } -if ${ac_cv_lib_lzma_lzma_code+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-llzma $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char lzma_code (); -int -main () -{ -return lzma_code (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lzma_lzma_code=yes -else - ac_cv_lib_lzma_lzma_code=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lzma_lzma_code" >&5 -$as_echo "$ac_cv_lib_lzma_lzma_code" >&6; } -if test "x$ac_cv_lib_lzma_lzma_code" = xyes; then : - - -$as_echo "#define HAVE_LIBLZMA 1" >>confdefs.h - - WITH_LZMA=1 - if test "x${LZMA_DIR}" != "x"; then - LZMA_CFLAGS="-I${LZMA_DIR}/include" - LZMA_LIBS="-L${LZMA_DIR}/lib -llzma" - else - LZMA_LIBS="-llzma" - fi -fi - -fi - -done - -fi - - - - - -CPPFLAGS=${_cppflags} -LIBS=${_libs} - -echo Checking headers - -ac_header_dirent=no -for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do - as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 -$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } -if eval \${$as_ac_Header+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include <$ac_hdr> - -int -main () -{ -if ((DIR *) 0) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_ac_Header=yes" -else - eval "$as_ac_Header=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$as_ac_Header - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 -_ACEOF - -ac_header_dirent=$ac_hdr; break -fi - -done -# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. -if test $ac_header_dirent = dirent.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 -$as_echo_n "checking for library containing opendir... " >&6; } -if ${ac_cv_search_opendir+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char opendir (); -int -main () -{ -return opendir (); - ; - return 0; -} -_ACEOF -for ac_lib in '' dir; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_opendir=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_opendir+:} false; then : - break -fi -done -if ${ac_cv_search_opendir+:} false; then : - -else - ac_cv_search_opendir=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 -$as_echo "$ac_cv_search_opendir" >&6; } -ac_res=$ac_cv_search_opendir -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 -$as_echo_n "checking for library containing opendir... " >&6; } -if ${ac_cv_search_opendir+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char opendir (); -int -main () -{ -return opendir (); - ; - return 0; -} -_ACEOF -for ac_lib in '' x; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_opendir=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_opendir+:} false; then : - break -fi -done -if ${ac_cv_search_opendir+:} false; then : - -else - ac_cv_search_opendir=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 -$as_echo "$ac_cv_search_opendir" >&6; } -ac_res=$ac_cv_search_opendir -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -for ac_header in fcntl.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" -if test "x$ac_cv_header_fcntl_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_FCNTL_H 1 -_ACEOF - -fi - -done - -for ac_header in unistd.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" -if test "x$ac_cv_header_unistd_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_UNISTD_H 1 -_ACEOF - -fi - -done - -for ac_header in ctype.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "ctype.h" "ac_cv_header_ctype_h" "$ac_includes_default" -if test "x$ac_cv_header_ctype_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_CTYPE_H 1 -_ACEOF - -fi - -done - -for ac_header in dirent.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "dirent.h" "ac_cv_header_dirent_h" "$ac_includes_default" -if test "x$ac_cv_header_dirent_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DIRENT_H 1 -_ACEOF - -fi - -done - -for ac_header in errno.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "errno.h" "ac_cv_header_errno_h" "$ac_includes_default" -if test "x$ac_cv_header_errno_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_ERRNO_H 1 -_ACEOF - -fi - -done - -for ac_header in malloc.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "malloc.h" "ac_cv_header_malloc_h" "$ac_includes_default" -if test "x$ac_cv_header_malloc_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_MALLOC_H 1 -_ACEOF - -fi - -done - -for ac_header in stdarg.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdarg.h" "ac_cv_header_stdarg_h" "$ac_includes_default" -if test "x$ac_cv_header_stdarg_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDARG_H 1 -_ACEOF - -fi - -done - -for ac_header in sys/stat.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/stat.h" "ac_cv_header_sys_stat_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_stat_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_STAT_H 1 -_ACEOF - -fi - -done - -for ac_header in sys/types.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_types_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_TYPES_H 1 -_ACEOF - -fi - -done - -for ac_header in stdint.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" -if test "x$ac_cv_header_stdint_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDINT_H 1 -_ACEOF - -fi - -done - -for ac_header in inttypes.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default" -if test "x$ac_cv_header_inttypes_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_INTTYPES_H 1 -_ACEOF - -fi - -done - -for ac_header in time.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "time.h" "ac_cv_header_time_h" "$ac_includes_default" -if test "x$ac_cv_header_time_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_TIME_H 1 -_ACEOF - -fi - -done - -for ac_header in ansidecl.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "ansidecl.h" "ac_cv_header_ansidecl_h" "$ac_includes_default" -if test "x$ac_cv_header_ansidecl_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_ANSIDECL_H 1 -_ACEOF - -fi - -done - -for ac_header in ieeefp.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "ieeefp.h" "ac_cv_header_ieeefp_h" "$ac_includes_default" -if test "x$ac_cv_header_ieeefp_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_IEEEFP_H 1 -_ACEOF - -fi - -done - -for ac_header in nan.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "nan.h" "ac_cv_header_nan_h" "$ac_includes_default" -if test "x$ac_cv_header_nan_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_NAN_H 1 -_ACEOF - -fi - -done - -for ac_header in math.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "math.h" "ac_cv_header_math_h" "$ac_includes_default" -if test "x$ac_cv_header_math_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_MATH_H 1 -_ACEOF - -fi - -done - -for ac_header in limits.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" -if test "x$ac_cv_header_limits_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIMITS_H 1 -_ACEOF - -fi - -done - -for ac_header in fp_class.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "fp_class.h" "ac_cv_header_fp_class_h" "$ac_includes_default" -if test "x$ac_cv_header_fp_class_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_FP_CLASS_H 1 -_ACEOF - -fi - -done - -for ac_header in float.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default" -if test "x$ac_cv_header_float_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_FLOAT_H 1 -_ACEOF - -fi - -done - -for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 -_ACEOF - -fi - -done - -for ac_header in sys/socket.h -do : - ac_fn_c_check_header_compile "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "#if HAVE_SYS_TYPES_H -# include -# endif - -" -if test "x$ac_cv_header_sys_socket_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_SOCKET_H 1 -_ACEOF - -fi - -done - -for ac_header in netinet/in.h -do : - ac_fn_c_check_header_compile "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "#if HAVE_SYS_TYPES_H -# include -# endif - -" -if test "x$ac_cv_header_netinet_in_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_NETINET_IN_H 1 -_ACEOF - -fi - -done - -for ac_header in arpa/inet.h -do : - ac_fn_c_check_header_compile "$LINENO" "arpa/inet.h" "ac_cv_header_arpa_inet_h" "#if HAVE_SYS_TYPES_H -# include -# endif -#if HAVE_ARPA_INET_H -# include -# endif - -" -if test "x$ac_cv_header_arpa_inet_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_ARPA_INET_H 1 -_ACEOF - -fi - -done - -for ac_header in netdb.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "netdb.h" "ac_cv_header_netdb_h" "$ac_includes_default" -if test "x$ac_cv_header_netdb_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_NETDB_H 1 -_ACEOF - -fi - -done - -for ac_header in sys/time.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_time_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_TIME_H 1 -_ACEOF - -fi - -done - -for ac_header in sys/select.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/select.h" "ac_cv_header_sys_select_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_select_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_SELECT_H 1 -_ACEOF - -fi - -done - -for ac_header in poll.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "poll.h" "ac_cv_header_poll_h" "$ac_includes_default" -if test "x$ac_cv_header_poll_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_POLL_H 1 -_ACEOF - -fi - -done - -for ac_header in sys/mman.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mman_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_MMAN_H 1 -_ACEOF - -fi - -done - -for ac_header in sys/timeb.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/timeb.h" "ac_cv_header_sys_timeb_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_timeb_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_TIMEB_H 1 -_ACEOF - -fi - -done - -for ac_header in signal.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "signal.h" "ac_cv_header_signal_h" "$ac_includes_default" -if test "x$ac_cv_header_signal_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SIGNAL_H 1 -_ACEOF - -fi - -done - -for ac_header in arpa/nameser.h -do : - ac_fn_c_check_header_compile "$LINENO" "arpa/nameser.h" "ac_cv_header_arpa_nameser_h" "#if HAVE_SYS_TYPES_H -# include -# endif - -" -if test "x$ac_cv_header_arpa_nameser_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_ARPA_NAMESER_H 1 -_ACEOF - -fi - -done - -for ac_header in resolv.h -do : - ac_fn_c_check_header_compile "$LINENO" "resolv.h" "ac_cv_header_resolv_h" "#if HAVE_SYS_TYPES_H -# include -# endif -#if HAVE_NETINET_IN_H -# include -# endif -#if HAVE_ARPA_NAMESER_H -# include -# endif - -" -if test "x$ac_cv_header_resolv_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_RESOLV_H 1 -_ACEOF - -fi - -done - -for ac_header in dl.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "dl.h" "ac_cv_header_dl_h" "$ac_includes_default" -if test "x$ac_cv_header_dl_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DL_H 1 -_ACEOF - -fi - -done - -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" -if test "x$ac_cv_header_dlfcn_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 -_ACEOF - -fi - -done - - - -echo Checking types - -ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" -case $ac_cv_c_uint32_t in #( - no|yes) ;; #( - *) - -$as_echo "#define _UINT32_T 1" >>confdefs.h - - -cat >>confdefs.h <<_ACEOF -#define uint32_t $ac_cv_c_uint32_t -_ACEOF -;; - esac - - - -echo Checking libraries - -for ac_func in strftime -do : - ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime" -if test "x$ac_cv_func_strftime" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STRFTIME 1 -_ACEOF - -else - # strftime is in -lintl on SCO UNIX. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5 -$as_echo_n "checking for strftime in -lintl... " >&6; } -if ${ac_cv_lib_intl_strftime+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lintl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char strftime (); -int -main () -{ -return strftime (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_intl_strftime=yes -else - ac_cv_lib_intl_strftime=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5 -$as_echo "$ac_cv_lib_intl_strftime" >&6; } -if test "x$ac_cv_lib_intl_strftime" = xyes; then : - $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h - -LIBS="-lintl $LIBS" -fi - -fi -done - -for ac_func in strdup strndup strerror -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -for ac_func in finite isnand fp_class class fpclass -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -for ac_func in strftime localtime gettimeofday ftime -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -for ac_func in stat _stat signal -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -for ac_func in rand rand_r srand time -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -for ac_func in isascii mmap munmap putenv -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for va_copy" >&5 -$as_echo_n "checking for va_copy... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -va_list ap1,ap2; -int -main () -{ -va_copy(ap1,ap2); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - have_va_copy=yes -else - have_va_copy=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_va_copy" >&5 -$as_echo "$have_va_copy" >&6; } -if test x"$have_va_copy" = x"yes"; then - -$as_echo "#define HAVE_VA_COPY 1" >>confdefs.h - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __va_copy" >&5 -$as_echo_n "checking for __va_copy... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - va_list ap1,ap2; -int -main () -{ -__va_copy(ap1,ap2); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - have___va_copy=yes -else - have___va_copy=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have___va_copy" >&5 -$as_echo "$have___va_copy" >&6; } - if test x"$have___va_copy" = x"yes"; then - -$as_echo "#define HAVE___VA_COPY 1" >>confdefs.h - - fi -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostent" >&5 -$as_echo_n "checking for library containing gethostent... " >&6; } -if ${ac_cv_search_gethostent+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gethostent (); -int -main () -{ -return gethostent (); - ; - return 0; -} -_ACEOF -for ac_lib in '' nsl; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_gethostent=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_gethostent+:} false; then : - break -fi -done -if ${ac_cv_search_gethostent+:} false; then : - -else - ac_cv_search_gethostent=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostent" >&5 -$as_echo "$ac_cv_search_gethostent" >&6; } -ac_res=$ac_cv_search_gethostent -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing setsockopt" >&5 -$as_echo_n "checking for library containing setsockopt... " >&6; } -if ${ac_cv_search_setsockopt+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char setsockopt (); -int -main () -{ -return setsockopt (); - ; - return 0; -} -_ACEOF -for ac_lib in '' socket net network; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_setsockopt=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_setsockopt+:} false; then : - break -fi -done -if ${ac_cv_search_setsockopt+:} false; then : - -else - ac_cv_search_setsockopt=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_setsockopt" >&5 -$as_echo "$ac_cv_search_setsockopt" >&6; } -ac_res=$ac_cv_search_setsockopt -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing connect" >&5 -$as_echo_n "checking for library containing connect... " >&6; } -if ${ac_cv_search_connect+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char connect (); -int -main () -{ -return connect (); - ; - return 0; -} -_ACEOF -for ac_lib in '' inet; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_connect=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_connect+:} false; then : - break -fi -done -if ${ac_cv_search_connect+:} false; then : - -else - ac_cv_search_connect=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_connect" >&5 -$as_echo "$ac_cv_search_connect" >&6; } -ac_res=$ac_cv_search_connect -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for type of socket length (socklen_t)" >&5 -$as_echo_n "checking for type of socket length (socklen_t)... " >&6; } -cat > conftest.$ac_ext < -#include -#include -int main(void) { - -(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL) -; return 0; } -EOF -if { (eval echo configure:13619: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then - rm -rf conftest* - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: socklen_t *" >&5 -$as_echo "socklen_t *" >&6; } - XML_SOCKLEN_T=socklen_t -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - - cat > conftest.$ac_ext < -#include -#include -int main(void) { - -(void)getsockopt (1, 1, 1, NULL, (size_t *)NULL) -; return 0; } -EOF -if { (eval echo configure:13642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then - rm -rf conftest* - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: size_t *" >&5 -$as_echo "size_t *" >&6; } - XML_SOCKLEN_T=size_t -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - - cat > conftest.$ac_ext < -#include -#include -int main(void) { - -(void)getsockopt (1, 1, 1, NULL, (int *)NULL) -; return 0; } -EOF -if { (eval echo configure:13665: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then - rm -rf conftest* - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: int *" >&5 -$as_echo "int *" >&6; } - XML_SOCKLEN_T=int -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not determine" >&5 -$as_echo "$as_me: WARNING: could not determine" >&2;} - XML_SOCKLEN_T="int" -fi -rm -f conftest* -fi -rm -f conftest* -fi -rm -f conftest* - -cat >>confdefs.h <<_ACEOF -#define XML_SOCKLEN_T $XML_SOCKLEN_T -_ACEOF - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable IPv6" >&5 -$as_echo_n "checking whether to enable IPv6... " >&6; } -# Check whether --enable-ipv6 was given. -if test "${enable_ipv6+set}" = set; then : - enableval=$enable_ipv6; -else - enable_ipv6=yes -fi - -if test "$with_minimum" = "yes" -then - enable_ipv6=no -fi -if test $enable_ipv6 = yes; then - have_ipv6=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -# include -# include - -int -main () -{ - - struct sockaddr_storage ss; - socket(AF_INET6, SOCK_STREAM, 0) - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - have_ipv6=yes -else - have_ipv6=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_ipv6" >&5 -$as_echo "$have_ipv6" >&6; } - - if test $have_ipv6 = yes; then - -$as_echo "#define SUPPORT_IP6 /**/" >>confdefs.h - - have_broken_ss_family=no - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking struct sockaddr::ss_family" >&5 -$as_echo_n "checking struct sockaddr::ss_family... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -# include -# include - -int -main () -{ - - struct sockaddr_storage ss ; - ss.ss_family = 0 ; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - have_ss_family=yes -else - have_ss_family=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_ss_family" >&5 -$as_echo "$have_ss_family" >&6; } - if test x$have_ss_family = xno ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking broken struct sockaddr::ss_family" >&5 -$as_echo_n "checking broken struct sockaddr::ss_family... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -# include -# include - -int -main () -{ - - struct sockaddr_storage ss ; - ss.__ss_family = 0 ; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - have_broken_ss_family=yes -else - have_broken_ss_family=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_broken_ss_family" >&5 -$as_echo "$have_broken_ss_family" >&6; } - if test x$have_broken_ss_family = xyes ; then - -$as_echo "#define HAVE_BROKEN_SS_FAMILY /**/" >>confdefs.h - - -$as_echo "#define ss_family __ss_family" >>confdefs.h - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ss_family and __ss_family not found" >&5 -$as_echo "$as_me: WARNING: ss_family and __ss_family not found" >&2;} - fi - fi - - have_getaddrinfo=no - ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo" -if test "x$ac_cv_func_getaddrinfo" = xyes; then : - have_getaddrinfo=yes -fi - - if test $have_getaddrinfo != yes; then - for lib in bsd socket inet; do - as_ac_Lib=`$as_echo "ac_cv_lib_$lib''_getaddrinfo" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo in -l$lib" >&5 -$as_echo_n "checking for getaddrinfo in -l$lib... " >&6; } -if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l$lib $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char getaddrinfo (); -int -main () -{ -return getaddrinfo (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" -else - eval "$as_ac_Lib=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : - LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break -fi - - done - fi - - if test $have_getaddrinfo = yes; then - -$as_echo "#define HAVE_GETADDRINFO /**/" >>confdefs.h - - fi - fi -fi - - -ac_fn_c_check_func "$LINENO" "isnan" "ac_cv_func_isnan" -if test "x$ac_cv_func_isnan" = xyes; then : - -$as_echo "#define HAVE_ISNAN /**/" >>confdefs.h - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for isnan in -lm" >&5 -$as_echo_n "checking for isnan in -lm... " >&6; } -if ${ac_cv_lib_m_isnan+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lm $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char isnan (); -int -main () -{ -return isnan (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_m_isnan=yes -else - ac_cv_lib_m_isnan=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_isnan" >&5 -$as_echo "$ac_cv_lib_m_isnan" >&6; } -if test "x$ac_cv_lib_m_isnan" = xyes; then : - -$as_echo "#define HAVE_ISNAN /**/" >>confdefs.h - -fi - -fi - - -ac_fn_c_check_func "$LINENO" "isinf" "ac_cv_func_isinf" -if test "x$ac_cv_func_isinf" = xyes; then : - -$as_echo "#define HAVE_ISINF /**/" >>confdefs.h - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for isinf in -lm" >&5 -$as_echo_n "checking for isinf in -lm... " >&6; } -if ${ac_cv_lib_m_isinf+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lm $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char isinf (); -int -main () -{ -return isinf (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_m_isinf=yes -else - ac_cv_lib_m_isinf=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_isinf" >&5 -$as_echo "$ac_cv_lib_m_isinf" >&6; } -if test "x$ac_cv_lib_m_isinf" = xyes; then : - -$as_echo "#define HAVE_ISINF /**/" >>confdefs.h - -fi - -fi - - -XML_LIBDIR='-L${libdir}' -XML_INCLUDEDIR='-I${includedir}/libxml2' - -XML_CFLAGS="" -RDL_LIBS="" - -if test "${GCC}" != "yes" ; then - case "${host}" in - hppa*-*-hpux* ) - CFLAGS="${CFLAGS} -Wp,-H30000" - ;; - *-dec-osf* ) - CFLAGS="${CFLAGS} -ieee" - ;; - alpha*-*-linux* ) - CFLAGS="${CFLAGS} -ieee" - ;; - esac -else - if test "$with_fexceptions" = "yes" - then - # - # Not activated by default because this inflates the code size - # Used to allow propagation of C++ exceptions through the library - # - CFLAGS="${CFLAGS} -fexceptions" - fi - - # warnings we'd like to see - CFLAGS="${CFLAGS} -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls" - # warnings we'd like to supress - CFLAGS="${CFLAGS} -Wno-long-long" - case "${host}" in - alpha*-*-linux* ) - CFLAGS="${CFLAGS} -mieee" - ;; - alpha*-*-osf* ) - CFLAGS="${CFLAGS} -mieee" - ;; - esac -fi -case ${host} in - *-*-solaris*) - XML_LIBDIR="${XML_LIBDIR} -R${libdir}" - ;; - hppa*-hp-mpeix) - NEED_TRIO=1 - ;; - *-*-mingw* | *-*-cygwin* | *-*-msvc* ) - # If the host is Windows, and shared libraries are disabled, we - # need to add -DLIBXML_STATIC to CFLAGS in order for linking to - # work properly (without it, xmlexports.h would force the use of - # DLL imports, which obviously aren't present in a static - # library). - if test "x$enable_shared" = "xno"; then - XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC" - CFLAGS="$CFLAGS -DLIBXML_STATIC" - fi - ;; -esac - - - -PYTHON_VERSION= -PYTHON_INCLUDES= -PYTHON_SITE_PACKAGES= -PYTHON_TESTS= -pythondir= -if test "$with_python" != "no" ; then - if test -x "$with_python/bin/python" - then - echo Found python in $with_python/bin/python - PYTHON="$with_python/bin/python" - else - if test -x "$with_python/python.exe" - then - echo Found python in $with_python/python.exe - PYTHON="$with_python/python.exe" - else - if test -x "$with_python" - then - echo Found python in $with_python - PYTHON="$with_python" - else - if test -x "$PYTHON" - then - echo Found python in environment PYTHON=$PYTHON - with_python=`$PYTHON -c "import sys; print sys.exec_prefix"` - else - # Extract the first word of "python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5", so it can be a program name with args. -set dummy python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PYTHON+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PYTHON in - [\\/]* | ?:[\\/]*) - ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PYTHON=$ac_cv_path_PYTHON -if test -n "$PYTHON"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 -$as_echo "$PYTHON" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi - fi - fi - fi - if test "$PYTHON" != "" - then - PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[0:3]"` - echo Found Python version $PYTHON_VERSION - fi - if test "$PYTHON_VERSION" != "" - then - if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \ - -d $with_python/lib/python$PYTHON_VERSION/site-packages - then - PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION - PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages - else - if test -r $prefix/include/python$PYTHON_VERSION/Python.h - then - PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION - PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages - else - if test -r /usr/include/python$PYTHON_VERSION/Python.h - then - PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION - PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages - else - if test -r $with_python/include/Python.h -a \ - -d $with_python/lib/site-packages - then - PYTHON_INCLUDES=$with_python/include - PYTHON_SITE_PACKAGES=$with_python/lib/site-packages - else - echo could not find python$PYTHON_VERSION/Python.h or $with_python/include/Python.h - fi - fi - fi - if test ! -d "$PYTHON_SITE_PACKAGES" - then - PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"` - fi - fi - PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags` - fi - if test "$with_python" != "" - then - pythondir='$(PYTHON_SITE_PACKAGES)' - else - pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages' - fi -else - PYTHON= -fi - if test "$PYTHON_INCLUDES" != ""; then - WITH_PYTHON_TRUE= - WITH_PYTHON_FALSE='#' -else - WITH_PYTHON_TRUE='#' - WITH_PYTHON_FALSE= -fi - -if test "$PYTHON_INCLUDES" != "" -then - PYTHON_SUBDIR=python -else - PYTHON_SUBDIR= -fi - - - - -WITH_MODULES=0 -TEST_MODULES= - -if test "$with_modules" != "no" ; then - case "$host" in - *-*-cygwin*) - MODULE_EXTENSION=".dll" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lcygwin" >&5 -$as_echo_n "checking for dlopen in -lcygwin... " >&6; } -if ${ac_cv_lib_cygwin_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcygwin $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_cygwin_dlopen=yes -else - ac_cv_lib_cygwin_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cygwin_dlopen" >&5 -$as_echo "$ac_cv_lib_cygwin_dlopen" >&6; } -if test "x$ac_cv_lib_cygwin_dlopen" = xyes; then : - - WITH_MODULES=1 - MODULE_PLATFORM_LIBS= - -$as_echo "#define HAVE_DLOPEN /**/" >>confdefs.h - - -fi - - ;; - *-*-mingw*) - MODULE_EXTENSION=".dll" - WITH_MODULES=1 - ;; - *) - ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes; then : - libxml_have_shl_load=yes -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); -int -main () -{ -return shl_load (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_shl_load=yes -else - ac_cv_lib_dld_shl_load=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : - - MODULE_PLATFORM_LIBS="-ldld" - libxml_have_shl_load=yes -else - - ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : - libxml_have_dlopen=yes -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - - MODULE_PLATFORM_LIBS="-ldl" - libxml_have_dlopen=yes -fi - -fi - -fi - -fi - - - if test "${libxml_have_shl_load}" = "yes"; then - MODULE_EXTENSION=".sl" - WITH_MODULES=1 - -$as_echo "#define HAVE_SHLLOAD /**/" >>confdefs.h - - fi - - if test "${libxml_have_dlopen}" = "yes"; then - case "${host}" in - *-*-hpux* ) - MODULE_EXTENSION=".sl" - ;; - * ) - MODULE_EXTENSION=".so" - ;; - esac - - WITH_MODULES=1 - -$as_echo "#define HAVE_DLOPEN /**/" >>confdefs.h - - fi - ;; - esac -fi - -if test "${WITH_MODULES}" = "1"; then - TEST_MODULES="ModuleTests" -fi - - - - - - - -if [ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ] || \ - [ "${LOGNAME}" = "veillard" -a "`pwd`" = "/home/veillard/libxml2" ] || \ - [ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxml2" ] - then - if test "$with_minimum" != "yes" - then - if test "${with_mem_debug}" = "" ; then - echo Activating memory debugging - with_mem_debug="yes" - with_run_debug="yes" - fi - if test "${with_docbook}" = "" ; then - with_docbook="yes" - fi - fi - if test "${GCC}" = "yes" ; then - CFLAGS="-g -O -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wall" - fi - STATIC_BINARIES="-static" -else - STATIC_BINARIES= -fi - - - -if test "${NEED_TRIO}" = "1" ; then - echo Adding trio library for string functions - WITH_TRIO=1 -else - WITH_TRIO=0 -fi - if test "${NEED_TRIO}" = "1"; then - WITH_TRIO_SOURCES_TRUE= - WITH_TRIO_SOURCES_FALSE='#' -else - WITH_TRIO_SOURCES_TRUE='#' - WITH_TRIO_SOURCES_FALSE= -fi - - - -echo Checking configuration requirements - -THREAD_LIBS="" -BASE_THREAD_LIBS="" -WITH_THREADS=0 -THREAD_CFLAGS="" -TEST_THREADS="" -THREADS_W32="" - -if test "$with_threads" = "no" ; then - echo Disabling multithreaded support -else - echo Enabling multithreaded support - - case $host_os in - *mingw32*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then - WITH_THREADS="1" - THREADS_W32="1" - THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS" - fi - ;; - esac - - if test -z "$THREADS_W32"; then - if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then - ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" -if test "x$ac_cv_header_pthread_h" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in -lpthread" >&5 -$as_echo_n "checking for pthread_join in -lpthread... " >&6; } -if ${ac_cv_lib_pthread_pthread_join+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_join (); -int -main () -{ -return pthread_join (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_join=yes -else - ac_cv_lib_pthread_pthread_join=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_join" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_join" >&6; } -if test "x$ac_cv_lib_pthread_pthread_join" = xyes; then : - - THREAD_LIBS="-lpthread" - -$as_echo "#define HAVE_LIBPTHREAD /**/" >>confdefs.h - - -$as_echo "#define HAVE_PTHREAD_H /**/" >>confdefs.h - - WITH_THREADS="1" -fi - -fi - - - fi - fi - - case $host_os in - *cygwin*) THREAD_LIBS="" - ;; - *beos*) WITH_THREADS="1" - THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS" - ;; - *linux*) - if test "${GCC}" = "yes" ; then - GCC_VERSION=`${CC} --version | head -1 | awk '{print $3}'` - GCC_MAJOR=`echo ${GCC_VERSION} | sed 's+\..*++'` - GCC_MEDIUM=`echo ${GCC_VERSION} | sed 's+[0-9]*\.++' | sed 's+\..*++'` - if test "${THREAD_LIBS}" = "-lpthread" ; then - if expr ${GCC_MEDIUM} \> 2 \& ${GCC_MAJOR} = 3 > /dev/null - then - THREAD_LIBS="" - BASE_THREAD_LIBS="-lpthread" - else - if expr ${GCC_MAJOR} \> 3 > /dev/null - then - THREAD_LIBS="" - BASE_THREAD_LIBS="-lpthread" - else - echo old GCC disabling weak symbols for pthread - fi - fi - fi - fi - ;; - esac - if test "$WITH_THREADS" = "1" ; then - THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT" - TEST_THREADS="Threadtests" - fi -fi -if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then - THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED" -fi - - - - - - - if test -n "$THREADS_W32"; then - THREADS_W32_TRUE= - THREADS_W32_FALSE='#' -else - THREADS_W32_TRUE='#' - THREADS_W32_FALSE= -fi - - -if test "$with_history" = "yes" ; then - echo Enabling xmllint shell history - unset tcap - for termlib in ncurses curses termcap terminfo termlib; do - as_ac_Lib=`$as_echo "ac_cv_lib_${termlib}''_tputs" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tputs in -l${termlib}" >&5 -$as_echo_n "checking for tputs in -l${termlib}... " >&6; } -if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l${termlib} $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char tputs (); -int -main () -{ -return tputs (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" -else - eval "$as_ac_Lib=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : - tcap="-l$termlib" -fi - - test -n "$tcap" && break - done - - ac_fn_c_check_header_mongrel "$LINENO" "readline/history.h" "ac_cv_header_readline_history_h" "$ac_includes_default" -if test "x$ac_cv_header_readline_history_h" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for append_history in -lhistory" >&5 -$as_echo_n "checking for append_history in -lhistory... " >&6; } -if ${ac_cv_lib_history_append_history+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lhistory $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char append_history (); -int -main () -{ -return append_history (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_history_append_history=yes -else - ac_cv_lib_history_append_history=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_history_append_history" >&5 -$as_echo "$ac_cv_lib_history_append_history" >&6; } -if test "x$ac_cv_lib_history_append_history" = xyes; then : - - RDL_LIBS="-lhistory" - -$as_echo "#define HAVE_LIBHISTORY /**/" >>confdefs.h - -fi - -fi - - - ac_fn_c_check_header_mongrel "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default" -if test "x$ac_cv_header_readline_readline_h" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline in -lreadline" >&5 -$as_echo_n "checking for readline in -lreadline... " >&6; } -if ${ac_cv_lib_readline_readline+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lreadline $tcap $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char readline (); -int -main () -{ -return readline (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_readline_readline=yes -else - ac_cv_lib_readline_readline=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_readline" >&5 -$as_echo "$ac_cv_lib_readline_readline" >&6; } -if test "x$ac_cv_lib_readline_readline" = xyes; then : - - RDL_LIBS="-lreadline $RDL_LIBS $tcap" - -$as_echo "#define HAVE_LIBREADLINE /**/" >>confdefs.h - -fi - -fi - - - if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then - CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include" - RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS" - fi -fi - -if test "$with_tree" = "no" ; then - echo Disabling DOM like tree manipulation APIs - WITH_TREE=0 -else - WITH_TREE=1 -fi - - -if test "$with_ftp" = "no" ; then - echo Disabling FTP support - WITH_FTP=0 - FTP_OBJ= -else - WITH_FTP=1 - FTP_OBJ=nanoftp.o -fi - - - -if test "$with_http" = "no" ; then - echo Disabling HTTP support - WITH_HTTP=0 - HTTP_OBJ= -else - WITH_HTTP=1 - HTTP_OBJ=nanohttp.o -fi - - - -if test "$with_legacy" = "no" ; then - echo Disabling deprecated APIs - WITH_LEGACY=0 -else - WITH_LEGACY=1 -fi - - -if test "$with_reader" = "no" ; then - echo Disabling the xmlReader parsing interface - WITH_READER=0 - READER_TEST= -else - WITH_READER=1 - READER_TEST=Readertests - if test "$with_push" = "no" ; then - echo xmlReader requires Push interface - enabling it - with_push=yes - fi -fi - - - -if test "$with_writer" = "no" ; then - echo Disabling the xmlWriter saving interface - WITH_WRITER=0 -# WRITER_TEST= -else - WITH_WRITER=1 -# WRITER_TEST=Writertests - if test "$with_push" = "no" ; then - echo xmlWriter requires Push interface - enabling it - with_push=yes - fi - if test "$with_output" = "no" ; then - echo xmlWriter requires Output interface - enabling it - with_output=yes - fi -fi - -#AC_SUBST(WRITER_TEST) - -if test "$with_pattern" = "no" ; then - echo Disabling the xmlPattern parsing interface - WITH_PATTERN=0 - TEST_PATTERN= -else - WITH_PATTERN=1 - TEST_PATTERN=Patterntests -fi - - - -if test "$with_sax1" = "no" ; then - echo Disabling the older SAX1 interface - WITH_SAX1=0 - TEST_SAX= -else - WITH_SAX1=1 - TEST_SAX=SAXtests -fi - - if test "${WITH_TRIO}" = "1"; then - WITH_SAX1_SOURCES_TRUE= - WITH_SAX1_SOURCES_FALSE='#' -else - WITH_SAX1_SOURCES_TRUE='#' - WITH_SAX1_SOURCES_FALSE= -fi - - - -if test "$with_push" = "no" ; then - echo Disabling the PUSH parser interfaces - WITH_PUSH=0 - TEST_PUSH= -else - WITH_PUSH=1 - TEST_PUSH="XMLPushtests" -fi - - - -if test "$with_html" = "no" ; then - echo Disabling HTML support - WITH_HTML=0 - HTML_OBJ= - TEST_HTML= -else - WITH_HTML=1 - HTML_OBJ="HTMLparser.o HTMLtree.o" - TEST_HTML=HTMLtests - if test "$with_push" != "no" ; then - TEST_PHTML=HTMLPushtests - else - TEST_PHTML= - fi -fi - - - - - -if test "$with_valid" = "no" ; then - echo Disabling DTD validation support - WITH_VALID=0 - TEST_VALID= - TEST_VTIME= -else - WITH_VALID=1 - TEST_VALID=Validtests - TEST_VTIME=VTimingtests -fi - - - - -if test "$with_catalog" = "no" ; then - echo Disabling Catalog support - WITH_CATALOG=0 - CATALOG_OBJ= - TEST_CATALOG= -else - WITH_CATALOG=1 - CATALOG_OBJ="catalog.o" - TEST_CATALOG=Catatests -fi - - - - -if test "$with_docbook" = "no" ; then - echo Disabling Docbook support - WITH_DOCB=0 - DOCB_OBJ= -else - WITH_DOCB=1 - DOCB_OBJ="DOCBparser.o" -fi - - - - -if test "$with_xptr" = "no" ; then - echo Disabling XPointer support - WITH_XPTR=0 - XPTR_OBJ= - TEST_XPTR= -else - WITH_XPTR=1 - XPTR_OBJ=xpointer.o - TEST_XPTR=XPtrtests - if test "$with_xpath" = "no" ; then - echo XPointer requires XPath support - enabling it - with_xpath=yes - fi -fi - - - - -if test "$with_c14n" = "no" ; then - echo Disabling C14N support - WITH_C14N=0 - C14N_OBJ= - TEST_C14N= -else - WITH_C14N=1 - C14N_OBJ="c14n.c" - TEST_C14N=C14Ntests - if test "$with_xpath" = "no" ; then - echo C14N requires XPath support - enabling it - with_xpath=yes - fi -fi - - - - -if test "$with_xinclude" = "no" ; then - echo Disabling XInclude support - WITH_XINCLUDE=0 - XINCLUDE_OBJ= - with_xinclude="no" - TEST_XINCLUDE= -else - WITH_XINCLUDE=1 - XINCLUDE_OBJ=xinclude.o - TEST_XINCLUDE=XIncludetests - if test "$with_xpath" = "no" ; then - echo XInclude requires XPath support - enabling it - with_xpath=yes - fi -fi - - - - -if test "$with_xpath" = "no" ; then - echo Disabling XPATH support - WITH_XPATH=0 - XPATH_OBJ= - TEST_XPATH= -else - WITH_XPATH=1 - XPATH_OBJ=xpath.o - TEST_XPATH=XPathtests -fi - - - - -if test "$with_output" = "no" ; then - echo Disabling serialization/saving support - WITH_OUTPUT=0 -else - WITH_OUTPUT=1 -fi - - -WITH_ICONV=0 -if test "$with_iconv" = "no" ; then - echo Disabling ICONV support -else - if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then - CPPFLAGS="${CPPFLAGS} -I$with_iconv/include" - # Export this since our headers include iconv.h - XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include" - ICONV_LIBS="-L$with_iconv/lib" - fi - - ac_fn_c_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default" -if test "x$ac_cv_header_iconv_h" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 -$as_echo_n "checking for iconv... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -int -main () -{ - -iconv_t cd = iconv_open ("",""); -iconv (cd, NULL, NULL, NULL, NULL); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - WITH_ICONV=1 -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv in -liconv" >&5 -$as_echo_n "checking for iconv in -liconv... " >&6; } - - _ldflags="${LDFLAGS}" - _libs="${LIBS}" - LDFLAGS="${LDFLAGS} ${ICONV_LIBS}" - LIBS="${LIBS} -liconv" - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -int -main () -{ - -iconv_t cd = iconv_open ("",""); -iconv (cd, NULL, NULL, NULL, NULL); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - WITH_ICONV=1 - ICONV_LIBS="${ICONV_LIBS} -liconv" - LIBS="${_libs}" - LDFLAGS="${_ldflags}" -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - LIBS="${_libs}" - LDFLAGS="${_ldflags}" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi - - - - if test "$WITH_ICONV" = "1" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv declaration" >&5 -$as_echo_n "checking for iconv declaration... " >&6; } - if ${xml_cv_iconv_arg2+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -extern -#ifdef __cplusplus -"C" -#endif -#if defined(__STDC__) || defined(__cplusplus) -size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); -#else -size_t iconv(); -#endif - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - xml_cv_iconv_arg2="" -else - xml_cv_iconv_arg2="const" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - - - xml_cv_iconv_decl="extern size_t iconv (iconv_t cd, $xml_cv_iconv_arg2 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${xml_xxx:- - }$xml_cv_iconv_decl" >&5 -$as_echo "${xml_xxx:- - }$xml_cv_iconv_decl" >&6; } - -cat >>confdefs.h <<_ACEOF -#define ICONV_CONST $xml_cv_iconv_arg2 -_ACEOF - - fi -fi -case "$host" in - *mingw*) M_LIBS="" - ;; - *beos*) M_LIBS="" - ;; - *haiku*) M_LIBS="" - ;; - *) M_LIBS="-lm" - ;; -esac -XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS" -XML_LIBTOOLLIBS="libxml2.la" - - -WITH_ICU=0 -ICU_LIBS="" -if test "$with_icu" != "yes" ; then - echo Disabling ICU support -else - ICU_CONFIG=icu-config - if ${ICU_CONFIG} --cflags >/dev/null 2>&1 - then - ICU_LIBS=`${ICU_CONFIG} --ldflags` - WITH_ICU=1 - echo Enabling ICU support - else - as_fn_error $? "libicu config program icu-config not found" "$LINENO" 5 - fi -fi - - - -WITH_ISO8859X=1 -if test "$WITH_ICONV" != "1" ; then -if test "$with_iso8859x" = "no" ; then - echo Disabling ISO8859X support - WITH_ISO8859X=0 -fi -fi - - -if test "$with_schematron" = "no" ; then - echo "Disabling Schematron support" - WITH_SCHEMATRON=0 - TEST_SCHEMATRON= -else - echo "Enabled Schematron support" - WITH_SCHEMATRON=1 - TEST_SCHEMATRON="Schematrontests" - with_xpath=yes - with_pattern=yes -fi - - - -if test "$with_schemas" = "no" ; then - echo "Disabling Schemas/Relax-NG support" - WITH_SCHEMAS=0 - TEST_SCHEMAS= -else - echo "Enabled Schemas/Relax-NG support" - WITH_SCHEMAS=1 - TEST_SCHEMAS="Schemastests Relaxtests" - if test "$PYTHON_INCLUDES" != "" ; then - PYTHON_TESTS="$PYTHON_TESTS RelaxNGPythonTests SchemasPythonTests" - fi - with_regexps=yes -fi - - - -if test "$with_regexps" = "no" ; then - echo Disabling Regexps support - WITH_REGEXPS=0 - TEST_REGEXPS= -else - WITH_REGEXPS=1 - TEST_REGEXPS="Regexptests Automatatests" -fi - - - -if test "$with_debug" = "no" ; then - echo Disabling DEBUG support - WITH_DEBUG=0 - DEBUG_OBJ= - TEST_DEBUG= -else - WITH_DEBUG=1 - DEBUG_OBJ=debugXML.o - TEST_DEBUG=Scripttests -fi - - - - -if test "$with_mem_debug" = "yes" ; then - if test "$with_thread_alloc" = "yes" ; then - echo Disabling memory debug - cannot use mem-debug with thread-alloc! - WITH_MEM_DEBUG=0 - else - echo Enabling memory debug support - WITH_MEM_DEBUG=1 - fi -else - WITH_MEM_DEBUG=0 -fi - - -if test "$with_run_debug" = "yes" ; then - echo Enabling runtime debug support - WITH_RUN_DEBUG=1 -else - WITH_RUN_DEBUG=0 -fi - - -WIN32_EXTRA_LIBADD= -WIN32_EXTRA_LDFLAGS= -CYGWIN_EXTRA_LDFLAGS= -CYGWIN_EXTRA_PYTHON_LIBADD= -WIN32_EXTRA_PYTHON_LIBADD= -case "$host" in - *-*-mingw*) - CPPFLAGS="$CPPFLAGS -DWIN32" - WIN32_EXTRA_LIBADD="-lws2_32" - WIN32_EXTRA_LDFLAGS="-no-undefined" - -$as_echo "#define _WINSOCKAPI_ 1" >>confdefs.h - - if test "${PYTHON}" != "" - then - WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython$(echo ${PYTHON_VERSION} | tr -d .)" - fi - ;; - *-*-cygwin*) - CYGWIN_EXTRA_LDFLAGS="-no-undefined" - if test "${PYTHON}" != "" - then - CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}" - fi - ;; -esac - - - - - - -for ac_func in printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -else - NEED_TRIO=1 -fi -done - - -if test "$with_coverage" = "yes" -a "${GCC}" = "yes" -then - echo Enabling code coverage for GCC - CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" - LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage" -else - echo Disabling code coverage for GCC -fi - - - - - - - - - - - - - - - - - - - - - - -RELDATE=`date +'%a %b %e %Y'` - - - -rm -f COPYING.LIB COPYING -ln -s $srcdir/Copyright COPYING - -# keep on one line for cygwin c.f. #130896 -ac_config_files="$ac_config_files libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h xml2-config libxml-2.0.pc libxml-2.0-uninstalled.pc python/setup.py" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - if test -n "$EXEEXT"; then - am__EXEEXT_TRUE= - am__EXEEXT_FALSE='#' -else - am__EXEEXT_TRUE='#' - am__EXEEXT_FALSE= -fi - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error $? "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${USE_VERSION_SCRIPT_TRUE}" && test -z "${USE_VERSION_SCRIPT_FALSE}"; then - as_fn_error $? "conditional \"USE_VERSION_SCRIPT\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${REBUILD_DOCS_TRUE}" && test -z "${REBUILD_DOCS_FALSE}"; then - as_fn_error $? "conditional \"REBUILD_DOCS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${WITH_PYTHON_TRUE}" && test -z "${WITH_PYTHON_FALSE}"; then - as_fn_error $? "conditional \"WITH_PYTHON\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${WITH_TRIO_SOURCES_TRUE}" && test -z "${WITH_TRIO_SOURCES_FALSE}"; then - as_fn_error $? "conditional \"WITH_TRIO_SOURCES\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${THREADS_W32_TRUE}" && test -z "${THREADS_W32_FALSE}"; then - as_fn_error $? "conditional \"THREADS_W32\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${WITH_SAX1_SOURCES_TRUE}" && test -z "${WITH_SAX1_SOURCES_FALSE}"; then - as_fn_error $? "conditional \"WITH_SAX1_SOURCES\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by $as_me, which was -generated by GNU Autoconf 2.68. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to the package provider." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.68, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2010 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -MKDIR_P='$MKDIR_P' -AWK='$AWK' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# -# INIT-COMMANDS -# -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' -macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' -enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' -enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' -pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' -enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' -SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' -ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' -PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' -host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' -host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' -host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' -build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' -build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' -build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' -SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' -Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' -GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' -EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' -FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' -LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' -NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' -LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' -max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' -ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' -exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' -lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' -lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' -lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' -lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' -lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' -reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' -reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' -OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' -deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' -file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' -file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' -want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' -DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' -sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' -AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' -AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' -archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' -STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' -RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' -old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' -old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' -lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' -CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' -CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' -compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' -GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' -nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' -lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' -objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' -MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' -need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' -MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' -DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' -NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' -LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' -OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' -OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' -libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' -shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' -extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' -export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' -whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' -compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' -old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' -archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' -module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' -module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' -with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' -allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' -no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' -hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' -hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' -hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' -hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' -hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' -inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' -link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' -always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' -export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' -exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' -include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' -prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' -postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' -file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' -variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' -need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' -need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' -version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' -runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' -libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' -library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' -soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' -install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' -postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' -postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' -finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' -hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' -sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' -sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' -hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' -enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' -old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' -striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' - -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - -# Quote evaled strings. -for var in SHELL \ -ECHO \ -PATH_SEPARATOR \ -SED \ -GREP \ -EGREP \ -FGREP \ -LD \ -NM \ -LN_S \ -lt_SP2NL \ -lt_NL2SP \ -reload_flag \ -OBJDUMP \ -deplibs_check_method \ -file_magic_cmd \ -file_magic_glob \ -want_nocaseglob \ -DLLTOOL \ -sharedlib_from_linklib_cmd \ -AR \ -AR_FLAGS \ -archiver_list_spec \ -STRIP \ -RANLIB \ -CC \ -CFLAGS \ -compiler \ -lt_cv_sys_global_symbol_pipe \ -lt_cv_sys_global_symbol_to_cdecl \ -lt_cv_sys_global_symbol_to_c_name_address \ -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ -nm_file_list_spec \ -lt_prog_compiler_no_builtin_flag \ -lt_prog_compiler_pic \ -lt_prog_compiler_wl \ -lt_prog_compiler_static \ -lt_cv_prog_compiler_c_o \ -need_locks \ -MANIFEST_TOOL \ -DSYMUTIL \ -NMEDIT \ -LIPO \ -OTOOL \ -OTOOL64 \ -shrext_cmds \ -export_dynamic_flag_spec \ -whole_archive_flag_spec \ -compiler_needs_object \ -with_gnu_ld \ -allow_undefined_flag \ -no_undefined_flag \ -hardcode_libdir_flag_spec \ -hardcode_libdir_separator \ -exclude_expsyms \ -include_expsyms \ -file_list_spec \ -variables_saved_for_relink \ -libname_spec \ -library_names_spec \ -soname_spec \ -install_override_mode \ -finish_eval \ -old_striplib \ -striplib; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in reload_cmds \ -old_postinstall_cmds \ -old_postuninstall_cmds \ -old_archive_cmds \ -extract_expsyms_cmds \ -old_archive_from_new_cmds \ -old_archive_from_expsyms_cmds \ -archive_cmds \ -archive_expsym_cmds \ -module_cmds \ -module_expsym_cmds \ -export_symbols_cmds \ -prelink_cmds \ -postlink_cmds \ -postinstall_cmds \ -postuninstall_cmds \ -finish_cmds \ -sys_lib_search_path_spec \ -sys_lib_dlsearch_path_spec; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -ac_aux_dir='$ac_aux_dir' -xsi_shell='$xsi_shell' -lt_shell_append='$lt_shell_append' - -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - - - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile' - - - - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; - "libxml2.spec") CONFIG_FILES="$CONFIG_FILES libxml2.spec:libxml.spec.in" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; - "include/libxml/Makefile") CONFIG_FILES="$CONFIG_FILES include/libxml/Makefile" ;; - "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; - "doc/examples/Makefile") CONFIG_FILES="$CONFIG_FILES doc/examples/Makefile" ;; - "doc/devhelp/Makefile") CONFIG_FILES="$CONFIG_FILES doc/devhelp/Makefile" ;; - "example/Makefile") CONFIG_FILES="$CONFIG_FILES example/Makefile" ;; - "python/Makefile") CONFIG_FILES="$CONFIG_FILES python/Makefile" ;; - "python/tests/Makefile") CONFIG_FILES="$CONFIG_FILES python/tests/Makefile" ;; - "xstc/Makefile") CONFIG_FILES="$CONFIG_FILES xstc/Makefile" ;; - "include/libxml/xmlversion.h") CONFIG_FILES="$CONFIG_FILES include/libxml/xmlversion.h" ;; - "xml2-config") CONFIG_FILES="$CONFIG_FILES xml2-config" ;; - "libxml-2.0.pc") CONFIG_FILES="$CONFIG_FILES libxml-2.0.pc" ;; - "libxml-2.0-uninstalled.pc") CONFIG_FILES="$CONFIG_FILES libxml-2.0-uninstalled.pc" ;; - "python/setup.py") CONFIG_FILES="$CONFIG_FILES python/setup.py" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac - ac_MKDIR_P=$MKDIR_P - case $MKDIR_P in - [\\/$]* | ?:[\\/]* ) ;; - */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -s&@MKDIR_P@&$ac_MKDIR_P&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 - fi -# Compute "$ac_file"'s index in $config_headers. -_am_arg="$ac_file" -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || -$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$_am_arg" : 'X\(//\)[^/]' \| \ - X"$_am_arg" : 'X\(//\)$' \| \ - X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'`/stamp-h$_am_stamp_count - ;; - - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Autoconf 2.62 quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} - ;; - "libtool":C) - - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - -# The names of the tagged configurations supported by this script. -available_tags="" - -# ### BEGIN LIBTOOL CONFIG - -# Which release of libtool.m4 was used? -macro_version=$macro_version -macro_revision=$macro_revision - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# What type of objects to build. -pic_mode=$pic_mode - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# An echo program that protects backslashes. -ECHO=$lt_ECHO - -# The PATH separator for the build system. -PATH_SEPARATOR=$lt_PATH_SEPARATOR - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="\$SED -e 1s/^X//" - -# A grep program that handles long lines. -GREP=$lt_GREP - -# An ERE matcher. -EGREP=$lt_EGREP - -# A literal string matcher. -FGREP=$lt_FGREP - -# A BSD- or MS-compatible name lister. -NM=$lt_NM - -# Whether we need soft or hard links. -LN_S=$lt_LN_S - -# What is the maximum length of a command? -max_cmd_len=$max_cmd_len - -# Object file suffix (normally "o"). -objext=$ac_objext - -# Executable file suffix (normally ""). -exeext=$exeext - -# whether the shell understands "unset". -lt_unset=$lt_unset - -# turn spaces into newlines. -SP2NL=$lt_lt_SP2NL - -# turn newlines into spaces. -NL2SP=$lt_lt_NL2SP - -# convert \$build file names to \$host format. -to_host_file_cmd=$lt_cv_to_host_file_cmd - -# convert \$build files to toolchain format. -to_tool_file_cmd=$lt_cv_to_tool_file_cmd - -# An object symbol dumper. -OBJDUMP=$lt_OBJDUMP - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method = "file_magic". -file_magic_cmd=$lt_file_magic_cmd - -# How to find potential files when deplibs_check_method = "file_magic". -file_magic_glob=$lt_file_magic_glob - -# Find potential files using nocaseglob when deplibs_check_method = "file_magic". -want_nocaseglob=$lt_want_nocaseglob - -# DLL creation program. -DLLTOOL=$lt_DLLTOOL - -# Command to associate shared and link libraries. -sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd - -# The archiver. -AR=$lt_AR - -# Flags to create an archive. -AR_FLAGS=$lt_AR_FLAGS - -# How to feed a file listing to the archiver. -archiver_list_spec=$lt_archiver_list_spec - -# A symbol stripping program. -STRIP=$lt_STRIP - -# Commands used to install an old-style archive. -RANLIB=$lt_RANLIB -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Whether to use a lock for old archive extraction. -lock_old_archive_extraction=$lock_old_archive_extraction - -# A C compiler. -LTCC=$lt_CC - -# LTCC compiler flags. -LTCFLAGS=$lt_CFLAGS - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration. -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair. -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# Transform the output of nm in a C name address pair when lib prefix is needed. -global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix - -# Specify filename containing input files for \$NM. -nm_file_list_spec=$lt_nm_file_list_spec - -# The root where to search for dependent libraries,and in which our libraries should be installed. -lt_sysroot=$lt_sysroot - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# Used to examine libraries when file_magic_cmd begins with "file". -MAGIC_CMD=$MAGIC_CMD - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Manifest tool. -MANIFEST_TOOL=$lt_MANIFEST_TOOL - -# Tool to manipulate archived DWARF debug symbol files on Mac OS X. -DSYMUTIL=$lt_DSYMUTIL - -# Tool to change global to local symbols on Mac OS X. -NMEDIT=$lt_NMEDIT - -# Tool to manipulate fat objects and archives on Mac OS X. -LIPO=$lt_LIPO - -# ldd/readelf like tool for Mach-O binaries on Mac OS X. -OTOOL=$lt_OTOOL - -# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. -OTOOL64=$lt_OTOOL64 - -# Old archive suffix (normally "a"). -libext=$libext - -# Shared library suffix (normally ".so"). -shrext_cmds=$lt_shrext_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at link time. -variables_saved_for_relink=$lt_variables_saved_for_relink - -# Do we need the "lib" prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Library versioning type. -version_type=$version_type - -# Shared library runtime path variable. -runpath_var=$runpath_var - -# Shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Permission mode override for installation of shared libraries. -install_override_mode=$lt_install_override_mode - -# Command to use after installation of a shared archive. -postinstall_cmds=$lt_postinstall_cmds - -# Command to use after uninstallation of a shared archive. -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# As "finish_cmds", except a single script fragment to be evaled but -# not shown. -finish_eval=$lt_finish_eval - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Compile-time system search path for libraries. -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries. -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - - -# The linker used to build libraries. -LD=$lt_LD - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# Commands used to build an old-style archive. -old_archive_cmds=$lt_old_archive_cmds - -# A language specific compiler. -CC=$lt_compiler - -# Is the compiler the GNU compiler? -with_gcc=$GCC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object=$lt_compiler_needs_object - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds - -# Commands used to build a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - -# Whether we are building with GNU ld or not. -with_gnu_ld=$lt_with_gnu_ld - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag - -# Flag that enforces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=$hardcode_direct - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute=$hardcode_direct_absolute - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=$hardcode_automatic - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=$inherit_rpath - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Set to "yes" if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds=$lt_prelink_cmds - -# Commands necessary for finishing linking programs. -postlink_cmds=$lt_postlink_cmds - -# Specify filename containing input files. -file_list_spec=$lt_file_list_spec - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - -ltmain="$ac_aux_dir/ltmain.sh" - - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - if test x"$xsi_shell" = xyes; then - sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ -func_dirname ()\ -{\ -\ case ${1} in\ -\ */*) func_dirname_result="${1%/*}${2}" ;;\ -\ * ) func_dirname_result="${3}" ;;\ -\ esac\ -} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_basename ()$/,/^} # func_basename /c\ -func_basename ()\ -{\ -\ func_basename_result="${1##*/}"\ -} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ -func_dirname_and_basename ()\ -{\ -\ case ${1} in\ -\ */*) func_dirname_result="${1%/*}${2}" ;;\ -\ * ) func_dirname_result="${3}" ;;\ -\ esac\ -\ func_basename_result="${1##*/}"\ -} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ -func_stripname ()\ -{\ -\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ -\ # positional parameters, so assign one to ordinary parameter first.\ -\ func_stripname_result=${3}\ -\ func_stripname_result=${func_stripname_result#"${1}"}\ -\ func_stripname_result=${func_stripname_result%"${2}"}\ -} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ -func_split_long_opt ()\ -{\ -\ func_split_long_opt_name=${1%%=*}\ -\ func_split_long_opt_arg=${1#*=}\ -} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ -func_split_short_opt ()\ -{\ -\ func_split_short_opt_arg=${1#??}\ -\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ -} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ -func_lo2o ()\ -{\ -\ case ${1} in\ -\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ -\ *) func_lo2o_result=${1} ;;\ -\ esac\ -} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_xform ()$/,/^} # func_xform /c\ -func_xform ()\ -{\ - func_xform_result=${1%.*}.lo\ -} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_arith ()$/,/^} # func_arith /c\ -func_arith ()\ -{\ - func_arith_result=$(( $* ))\ -} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_len ()$/,/^} # func_len /c\ -func_len ()\ -{\ - func_len_result=${#1}\ -} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - -fi - -if test x"$lt_shell_append" = xyes; then - sed -e '/^func_append ()$/,/^} # func_append /c\ -func_append ()\ -{\ - eval "${1}+=\\${2}"\ -} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ -func_append_quoted ()\ -{\ -\ func_quote_for_eval "${2}"\ -\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ -} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - # Save a `func_append' function call where possible by direct use of '+=' - sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -else - # Save a `func_append' function call even when '+=' is not available - sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -fi - -if test x"$_lt_function_replace_fail" = x":"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 -$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} -fi - - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" - - ;; - - esac -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - - -chmod +x xml2-config python/setup.py -echo Done configuring diff --git a/lib/3rdparty/libxml2/configure.in b/lib/3rdparty/libxml2/configure.in deleted file mode 100644 index 3d5f48be247..00000000000 --- a/lib/3rdparty/libxml2/configure.in +++ /dev/null @@ -1,1577 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -AC_PREREQ([2.68]) -AC_INIT -AC_CONFIG_SRCDIR([entities.c]) -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_MACRO_DIR([m4]) -AC_CANONICAL_HOST - -LIBXML_MAJOR_VERSION=2 -LIBXML_MINOR_VERSION=9 -LIBXML_MICRO_VERSION=0 -LIBXML_MICRO_VERSION_SUFFIX= -LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX -LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION - -LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION` - -if test -f CVS/Entries ; then - extra=`grep ChangeLog CVS/Entries | grep -v LIBXML | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%` - echo extra=$extra - if test "$extra" != "" - then - LIBXML_VERSION_EXTRA="-CVS$extra" - fi -else if test -d .svn ; then - extra=`svn info | grep Revision | sed 's+Revision: ++'` - echo extra=$extra - if test "$extra" != "" - then - LIBXML_VERSION_EXTRA="-SVN$extra" - fi -else if test -d .git ; then - extra=`git describe 2>/dev/null | sed 's+LIBXML[[0-9.]]*-++'` - echo extra=$extra - if test "$extra" != "" - then - LIBXML_VERSION_EXTRA="-GIT$extra" - fi -fi -fi -fi -AC_SUBST(LIBXML_MAJOR_VERSION) -AC_SUBST(LIBXML_MINOR_VERSION) -AC_SUBST(LIBXML_MICRO_VERSION) -AC_SUBST(LIBXML_VERSION) -AC_SUBST(LIBXML_VERSION_INFO) -AC_SUBST(LIBXML_VERSION_NUMBER) -AC_SUBST(LIBXML_VERSION_EXTRA) - -VERSION=${LIBXML_VERSION} - -AM_INIT_AUTOMAKE(libxml2, $VERSION) - -# Support silent build rules, requires at least automake-1.11. Disable -# by either passing --disable-silent-rules to configure or passing V=1 -# to make -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -dnl Checks for programs. -AC_PROG_CC -AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_MKDIR_P -AC_PROG_CPP -AC_PATH_PROG(RM, rm, /bin/rm) -AC_PATH_PROG(MV, mv, /bin/mv) -AC_PATH_PROG(TAR, tar, /bin/tar) -AC_PATH_PROG(PERL, perl, /usr/bin/perl) -AC_PATH_PROG(WGET, wget, /usr/bin/wget) -AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint) -AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc) - -LT_INIT - -dnl -dnl if the system support linker version scripts for symbol versioning -dnl then add it -dnl -VERSION_SCRIPT_FLAGS= -# lt_cv_prog_gnu_ld is from libtool 2.+ -if test "$lt_cv_prog_gnu_ld" = yes; then - VERSION_SCRIPT_FLAGS=-Wl,--version-script= -else - case $host in - *-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";; - esac -fi -AC_SUBST(VERSION_SCRIPT_FLAGS) -AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"]) - -dnl -dnl We process the AC_ARG_WITH first so that later we can modify -dnl some of them to try to prevent impossible combinations. This -dnl also allows up so alphabetize the choices -dnl - -dnl -dnl zlib option might change flags, so we save them initially -dnl -_cppflags="${CPPFLAGS}" -_libs="${LIBS}" - -AC_ARG_WITH(c14n, -[ --with-c14n add the Canonicalization support (on)]) -AC_ARG_WITH(catalog, -[ --with-catalog add the Catalog support (on)]) -AC_ARG_WITH(debug, -[ --with-debug add the debugging module (on)]) -AC_ARG_WITH(docbook, -[ --with-docbook add Docbook SGML support (on)]) -AC_ARG_WITH(fexceptions, -[ --with-fexceptions add GCC flag -fexceptions for C++ exceptions (off)]) -AC_ARG_WITH(ftp, -[ --with-ftp add the FTP support (on)]) -AC_ARG_WITH(history, -[ --with-history add history support to xmllint shell(off)]) -AC_ARG_WITH(html, -[ --with-html add the HTML support (on)]) -dnl Specific dir for HTML output ? -AC_ARG_WITH(html-dir, AS_HELP_STRING([--with-html-dir=path], - [path to base html directory, default $datadir/doc/html]), - [HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc']) - -AC_ARG_WITH(html-subdir, AS_HELP_STRING([--with-html-subdir=path], - [directory used under html-dir, default $PACKAGE-$VERSION/html]), - [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"], - [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"]) -AC_SUBST(HTML_DIR) -AC_ARG_WITH(http, -[ --with-http add the HTTP support (on)]) -AC_ARG_WITH(iconv, -[ --with-iconv[[=DIR]] add ICONV support (on)]) -AC_ARG_WITH(icu, -[ --with-icu add ICU support (off)]) -AC_ARG_WITH(iso8859x, -[ --with-iso8859x add ISO8859X support if no iconv (on)]) -AC_ARG_WITH(legacy, -[ --with-legacy add deprecated APIs for compatibility (on)]) -AC_ARG_WITH(mem_debug, -[ --with-mem-debug add the memory debugging module (off)]) -AC_ARG_WITH(minimum, -[ --with-minimum build a minimally sized library (off)]) -AC_ARG_WITH(output, -[ --with-output add the serialization support (on)]) -AC_ARG_WITH(pattern, -[ --with-pattern add the xmlPattern selection interface (on)]) -AC_ARG_WITH(push, -[ --with-push add the PUSH parser interfaces (on)]) -AC_ARG_WITH(python, -[ --with-python[[=DIR]] build Python bindings if found]) -AC_ARG_WITH(reader, -[ --with-reader add the xmlReader parsing interface (on)]) -AC_ARG_WITH(readline, -[ --with-readline=DIR use readline in DIR],[ - if test "$withval" != "no" -a "$withval" != "yes"; then - RDL_DIR=$withval - CPPFLAGS="${CPPFLAGS} -I$withval/include" - LIBS="${LIBS} -L$withval/lib" - fi -]) -AC_ARG_WITH(regexps, -[ --with-regexps add Regular Expressions support (on)]) -AC_ARG_WITH(run_debug, -[ --with-run-debug add the runtime debugging module (off)]) -AC_ARG_WITH(sax1, -[ --with-sax1 add the older SAX1 interface (on)]) -AC_ARG_WITH(schemas, -[ --with-schemas add Relax-NG and Schemas support (on)]) -AC_ARG_WITH(schematron, -[ --with-schematron add Schematron support (on)]) -AC_ARG_WITH(threads, -[ --with-threads add multithread support(on)]) -AC_ARG_WITH(thread-alloc, -[ --with-thread-alloc add per-thread memory(off)]) -AC_ARG_WITH(tree, -[ --with-tree add the DOM like tree manipulation APIs (on)]) -AC_ARG_WITH(valid, -[ --with-valid add the DTD validation support (on)]) -AC_ARG_WITH(writer, -[ --with-writer add the xmlWriter saving interface (on)]) -AC_ARG_WITH(xinclude, -[ --with-xinclude add the XInclude support (on)]) -AC_ARG_WITH(xpath, -[ --with-xpath add the XPATH support (on)]) -AC_ARG_WITH(xptr, -[ --with-xptr add the XPointer support (on)]) -AC_ARG_WITH(modules, -[ --with-modules add the dynamic modules support (on)]) -AC_ARG_WITH(zlib, -[ --with-zlib[[=DIR]] use libz in DIR],[ - if test "$withval" != "no" -a "$withval" != "yes"; then - Z_DIR=$withval - CPPFLAGS="${CPPFLAGS} -I$withval/include" - LIBS="${LIBS} -L$withval/lib" - fi -]) -AC_ARG_WITH(lzma, -[ --with-lzma[[=DIR]] use liblzma in DIR],[ - if test "$withval" != "no" -a "$withval" != "yes"; then - LZMA_DIR=$withval - CPPFLAGS="${CPPFLAGS} -I$withval/include" - LIBS="${LIBS} -L$withval/lib" - fi -]) -AC_ARG_WITH(coverage, -[ --with-coverage build for code coverage with GCC (off)]) - -AC_ARG_ENABLE(rebuild-docs, -[ --enable-rebuild-docs[[=yes/no]] rebuild some generated docs [[default=no]]]) -if test "$enable_rebuild_docs" = "yes" -a "$srcdir" != "."; then - AC_MSG_ERROR([cannot rebuild docs when builddir != srcdir]) -fi -AM_CONDITIONAL([REBUILD_DOCS], [test "$enable_rebuild_docs" = "yes" -o "$USER" = "veillard"]) - -dnl -dnl hard dependancies on options -dnl -if test "$with_schemas" = "yes" -then - with_pattern=yes - with_regexps=yes -fi -if test "$with_schematron" = "yes" -then - with_pattern=yes - with_xpath=yes -fi -if test "$with_reader" = "yes" -then - with_push=yes -fi -if test "$with_xptr" = "yes" -then - with_xpath=yes -fi -dnl -dnl option to build a minimal libxml2 library -dnl -if test "$with_minimum" = "yes" -then - echo "Configuring for a minimal library" - if test "$with_c14n" = "" - then - with_c14n=no - fi - if test "$with_catalog" = "" - then - with_catalog=no - fi - echo So far so good! - if test "$with_debug" = "" - then - with_debug=no - fi - if test "$with_docbook" = "" - then - with_docbook=no - fi - if test "$with_fexceptions" = "" - then - with_fexceptions=no - fi - if test "$with_ftp" = "" - then - with_ftp=no - fi - if test "$with_history" = "" - then - with_history=no - fi - if test "$with_html" = "" - then - with_html=no - fi - if test "$with_http" = "" - then - with_http=no - fi - if test "$with_iconv" = "" - then - with_iconv=no - fi - if test "$with_iso8859x" = "" - then - with_iso8859x=no - fi - if test "$with_legacy" = "" - then - with_legacy=no - fi - if test "$with_mem_debug" = "" - then - with_mem_debug=no - fi - if test "$with_output" = "" - then - with_output=no - fi - if test "$with_pattern" = "" - then - with_pattern=no - fi - if test "$with_push" = "" - then - with_push=no - fi - if test "$with_python" = "" - then - with_python=no - fi - if test "$with_reader" = "" - then - with_reader=no - fi - if test "$with_readline" = "" - then - with_readline=no - fi - if test "$with_regexps" = "" - then - with_regexps=no - fi - if test "$with_run_debug" = "" - then - with_run_debug=no - fi - if test "$with_sax1" = "" - then - with_sax1=no - fi - if test "$with_schemas" = "" - then - with_schemas=no - fi - if test "$with_schematron" = "" - then - with_schematron=no - fi - if test "$with_threads" = "" - then - with_threads=no - fi - if test "$with_thread_alloc" = "" - then - with_thread_alloc=no - fi - if test "$with_tree" = "" - then - with_tree=no - fi - if test "$with_valid" = "" - then - with_valid=no - fi - if test "$with_writer" = "" - then - with_writer=no - fi - if test "$with_xinclude" = "" - then - with_xinclude=no - fi - if test "$with_xpath" = "" - then - with_xpath=no - fi - if test "$with_xptr" = "" - then - with_xptr=no - fi - if test "$with_zlib" = "" - then - with_zlib=no - fi - if test "$with_modules" = "" - then - with_modules=no - fi -fi - -echo Checking zlib - -dnl Checks for zlib library. - -WITH_ZLIB=0 -if test "$with_zlib" = "no"; then - echo "Disabling compression support" -else - AC_CHECK_HEADERS(zlib.h, - AC_CHECK_LIB(z, gzread,[ - AC_DEFINE([HAVE_LIBZ], [1], [Have compression library]) - WITH_ZLIB=1 - if test "x${Z_DIR}" != "x"; then - Z_CFLAGS="-I${Z_DIR}/include" - Z_LIBS="-L${Z_DIR}/lib -lz" - [case ${host} in - *-*-solaris*) - Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz" - ;; - esac] - else - Z_LIBS="-lz" - fi])) -fi - -AC_SUBST(Z_CFLAGS) -AC_SUBST(Z_LIBS) -AC_SUBST(WITH_ZLIB) - -echo Checking lzma - -dnl Checks for lzma library. - -WITH_LZMA=0 -if test "$with_lzma" = "no"; then - echo "Disabling compression support" -else - AC_CHECK_HEADERS(lzma.h, - AC_CHECK_LIB(lzma, lzma_code,[ - AC_DEFINE([HAVE_LIBLZMA], [1], [Have compression library]) - WITH_LZMA=1 - if test "x${LZMA_DIR}" != "x"; then - LZMA_CFLAGS="-I${LZMA_DIR}/include" - LZMA_LIBS="-L${LZMA_DIR}/lib -llzma" - else - LZMA_LIBS="-llzma" - fi])) -fi - -AC_SUBST(LZMA_CFLAGS) -AC_SUBST(LZMA_LIBS) -AC_SUBST(WITH_LZMA) - -CPPFLAGS=${_cppflags} -LIBS=${_libs} - -echo Checking headers - -dnl Checks for header files. -AC_HEADER_DIRENT -AC_HEADER_STDC -AC_CHECK_HEADERS([fcntl.h]) -AC_CHECK_HEADERS([unistd.h]) -AC_CHECK_HEADERS([ctype.h]) -AC_CHECK_HEADERS([dirent.h]) -AC_CHECK_HEADERS([errno.h]) -AC_CHECK_HEADERS([malloc.h]) -AC_CHECK_HEADERS([stdarg.h]) -AC_CHECK_HEADERS([sys/stat.h]) -AC_CHECK_HEADERS([sys/types.h]) -AC_CHECK_HEADERS([stdint.h]) -AC_CHECK_HEADERS([inttypes.h]) -AC_CHECK_HEADERS([time.h]) -AC_CHECK_HEADERS([ansidecl.h]) -AC_CHECK_HEADERS([ieeefp.h]) -AC_CHECK_HEADERS([nan.h]) -AC_CHECK_HEADERS([math.h]) -AC_CHECK_HEADERS([limits.h]) -AC_CHECK_HEADERS([fp_class.h]) -AC_CHECK_HEADERS([float.h]) -AC_CHECK_HEADERS([stdlib.h]) -AC_CHECK_HEADERS([sys/socket.h], [], [], -[#if HAVE_SYS_TYPES_H -# include -# endif -]) -AC_CHECK_HEADERS([netinet/in.h], [], [], -[#if HAVE_SYS_TYPES_H -# include -# endif -]) -AC_CHECK_HEADERS([arpa/inet.h], [], [], -[#if HAVE_SYS_TYPES_H -# include -# endif -#if HAVE_ARPA_INET_H -# include -# endif -]) -AC_CHECK_HEADERS([netdb.h]) -AC_CHECK_HEADERS([sys/time.h]) -AC_CHECK_HEADERS([sys/select.h]) -AC_CHECK_HEADERS([poll.h]) -AC_CHECK_HEADERS([sys/mman.h]) -AC_CHECK_HEADERS([sys/timeb.h]) -AC_CHECK_HEADERS([signal.h]) -AC_CHECK_HEADERS([arpa/nameser.h], [], [], -[#if HAVE_SYS_TYPES_H -# include -# endif -]) -AC_CHECK_HEADERS([resolv.h], [], [], -[#if HAVE_SYS_TYPES_H -# include -# endif -#if HAVE_NETINET_IN_H -# include -# endif -#if HAVE_ARPA_NAMESER_H -# include -# endif -]) -AC_CHECK_HEADERS([dl.h]) -AC_CHECK_HEADERS([dlfcn.h]) - - -echo Checking types - -AC_TYPE_UINT32_T - - -echo Checking libraries - -dnl Checks for library functions. -AC_FUNC_STRFTIME -AC_CHECK_FUNCS(strdup strndup strerror) -AC_CHECK_FUNCS(finite isnand fp_class class fpclass) -AC_CHECK_FUNCS(strftime localtime gettimeofday ftime) -AC_CHECK_FUNCS(stat _stat signal) -AC_CHECK_FUNCS(rand rand_r srand time) -AC_CHECK_FUNCS(isascii mmap munmap putenv) - -AH_VERBATIM([HAVE_MUNMAP_AFTER],[/* mmap() is no good without munmap() */ -#if defined(HAVE_MMAP) && !defined(HAVE_MUNMAP) -# undef /**/ HAVE_MMAP -#endif]) - -dnl Checking for va_copy availability -AC_MSG_CHECKING([for va_copy]) -AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include -va_list ap1,ap2;]], [[va_copy(ap1,ap2);]])], -have_va_copy=yes, -have_va_copy=no) -AC_MSG_RESULT($have_va_copy) -if test x"$have_va_copy" = x"yes"; then - AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available]) -else - AC_MSG_CHECKING([for __va_copy]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include - va_list ap1,ap2;]], [[__va_copy(ap1,ap2);]])], - have___va_copy=yes, - have___va_copy=no) - AC_MSG_RESULT($have___va_copy) - if test x"$have___va_copy" = x"yes"; then - AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available]) - fi -fi - -dnl Checks for inet libraries: -AC_SEARCH_LIBS(gethostent, [nsl]) -AC_SEARCH_LIBS(setsockopt, [socket net network]) -AC_SEARCH_LIBS(connect, [inet]) - -dnl Determine what socket length (socklen_t) data type is -AC_MSG_CHECKING([for type of socket length (socklen_t)]) -AC_TRY_COMPILE2([ -#include -#include -#include ],[ -(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[ - AC_MSG_RESULT(socklen_t *) - XML_SOCKLEN_T=socklen_t],[ - AC_TRY_COMPILE2([ -#include -#include -#include ],[ -(void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[ - AC_MSG_RESULT(size_t *) - XML_SOCKLEN_T=size_t],[ - AC_TRY_COMPILE2([ -#include -#include -#include ],[ -(void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[ - AC_MSG_RESULT(int *) - XML_SOCKLEN_T=int],[ - AC_MSG_WARN(could not determine) - XML_SOCKLEN_T="int"])])]) -AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is]) - -dnl ***********************Checking for availability of IPv6******************* - -AC_MSG_CHECKING([whether to enable IPv6]) -AC_ARG_ENABLE(ipv6, [ --enable-ipv6[[=yes/no]] enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes) -if test "$with_minimum" = "yes" -then - enable_ipv6=no -fi -if test $enable_ipv6 = yes; then - have_ipv6=no - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -# include -# include - ]], [[ - struct sockaddr_storage ss; - socket(AF_INET6, SOCK_STREAM, 0) - ]])], - have_ipv6=yes, - have_ipv6=no - ) - AC_MSG_RESULT($have_ipv6) - - if test $have_ipv6 = yes; then - AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6]) - have_broken_ss_family=no - - dnl ********************************************************************* - dnl on some platforms (like AIX 5L), the structure sockaddr doesn't have - dnl a ss_family member, but rather __ss_family. Let's detect that - dnl and define the HAVE_BROKEN_SS_FAMILY when we are on one of these - dnl platforms. However, we should only do this if ss_family is not - dnl present. - dnl ******************************************************************** - AC_MSG_CHECKING([struct sockaddr::ss_family]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -# include -# include - ]], [[ - struct sockaddr_storage ss ; - ss.ss_family = 0 ; - ]])], - have_ss_family=yes, - have_ss_family=no - ) - AC_MSG_RESULT($have_ss_family) - if test x$have_ss_family = xno ; then - AC_MSG_CHECKING([broken struct sockaddr::ss_family]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -# include -# include - ]], [[ - struct sockaddr_storage ss ; - ss.__ss_family = 0 ; - ]])], - have_broken_ss_family=yes, - have_broken_ss_family=no - ) - AC_MSG_RESULT($have_broken_ss_family) - if test x$have_broken_ss_family = xyes ; then - AC_DEFINE(HAVE_BROKEN_SS_FAMILY, [], - [Whether struct sockaddr::__ss_family exists]) - AC_DEFINE(ss_family, __ss_family, - [ss_family is not defined here, use __ss_family instead]) - else - AC_MSG_WARN(ss_family and __ss_family not found) - fi - fi - - have_getaddrinfo=no - AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes) - if test $have_getaddrinfo != yes; then - for lib in bsd socket inet; do - AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break]) - done - fi - - if test $have_getaddrinfo = yes; then - AC_DEFINE([HAVE_GETADDRINFO], [], [Define if getaddrinfo is there]) - fi - fi -fi - -dnl ******************************End IPv6 checks****************************** - -dnl Checks for isnan in libm if not in libc -AC_CHECK_FUNC(isnan, AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there]) , AC_CHECK_LIB(m, isnan, - [AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there])])) - -AC_CHECK_FUNC(isinf, AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there]) , AC_CHECK_LIB(m, isinf, - [AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there])])) - -XML_LIBDIR='-L${libdir}' -XML_INCLUDEDIR='-I${includedir}/libxml2' - -dnl -dnl Extra flags -dnl -XML_CFLAGS="" -RDL_LIBS="" - -dnl -dnl Workaround for native compilers -dnl HP : http://bugs.gnome.org/db/31/3163.html -dnl DEC : Enable NaN/Inf -dnl -if test "${GCC}" != "yes" ; then - case "${host}" in - hppa*-*-hpux* ) - CFLAGS="${CFLAGS} -Wp,-H30000" - ;; - *-dec-osf* ) - CFLAGS="${CFLAGS} -ieee" - ;; - alpha*-*-linux* ) - CFLAGS="${CFLAGS} -ieee" - ;; - esac -else - if test "$with_fexceptions" = "yes" - then - # - # Not activated by default because this inflates the code size - # Used to allow propagation of C++ exceptions through the library - # - CFLAGS="${CFLAGS} -fexceptions" - fi - - # warnings we'd like to see - CFLAGS="${CFLAGS} -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls" - # warnings we'd like to supress - CFLAGS="${CFLAGS} -Wno-long-long" - case "${host}" in - alpha*-*-linux* ) - CFLAGS="${CFLAGS} -mieee" - ;; - alpha*-*-osf* ) - CFLAGS="${CFLAGS} -mieee" - ;; - esac -fi -case ${host} in - *-*-solaris*) - XML_LIBDIR="${XML_LIBDIR} -R${libdir}" - ;; - hppa*-hp-mpeix) - NEED_TRIO=1 - ;; - *-*-mingw* | *-*-cygwin* | *-*-msvc* ) - # If the host is Windows, and shared libraries are disabled, we - # need to add -DLIBXML_STATIC to CFLAGS in order for linking to - # work properly (without it, xmlexports.h would force the use of - # DLL imports, which obviously aren't present in a static - # library). - if test "x$enable_shared" = "xno"; then - XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC" - CFLAGS="$CFLAGS -DLIBXML_STATIC" - fi - ;; -esac - - -dnl -dnl check for python -dnl - -PYTHON_VERSION= -PYTHON_INCLUDES= -PYTHON_SITE_PACKAGES= -PYTHON_TESTS= -pythondir= -if test "$with_python" != "no" ; then - if test -x "$with_python/bin/python" - then - echo Found python in $with_python/bin/python - PYTHON="$with_python/bin/python" - else - if test -x "$with_python/python.exe" - then - echo Found python in $with_python/python.exe - PYTHON="$with_python/python.exe" - else - if test -x "$with_python" - then - echo Found python in $with_python - PYTHON="$with_python" - else - if test -x "$PYTHON" - then - echo Found python in environment PYTHON=$PYTHON - with_python=`$PYTHON -c "import sys; print sys.exec_prefix"` - else - AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5) - fi - fi - fi - fi - if test "$PYTHON" != "" - then - PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"` - echo Found Python version $PYTHON_VERSION - fi - if test "$PYTHON_VERSION" != "" - then - if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \ - -d $with_python/lib/python$PYTHON_VERSION/site-packages - then - PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION - PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages - else - if test -r $prefix/include/python$PYTHON_VERSION/Python.h - then - PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION - PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages - else - if test -r /usr/include/python$PYTHON_VERSION/Python.h - then - PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION - PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages - else - if test -r $with_python/include/Python.h -a \ - -d $with_python/lib/site-packages - then - PYTHON_INCLUDES=$with_python/include - PYTHON_SITE_PACKAGES=$with_python/lib/site-packages - else - echo could not find python$PYTHON_VERSION/Python.h or $with_python/include/Python.h - fi - fi - fi - if test ! -d "$PYTHON_SITE_PACKAGES" - then - PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"` - fi - fi - PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags` - fi - if test "$with_python" != "" - then - pythondir='$(PYTHON_SITE_PACKAGES)' - else - pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages' - fi -else - PYTHON= -fi -AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "") -if test "$PYTHON_INCLUDES" != "" -then - PYTHON_SUBDIR=python -else - PYTHON_SUBDIR= -fi -AC_SUBST(pythondir) -AC_SUBST(PYTHON_SUBDIR) -AC_SUBST(PYTHON_LIBS) - -dnl check for dso support -WITH_MODULES=0 -TEST_MODULES= - -if test "$with_modules" != "no" ; then - case "$host" in - *-*-cygwin*) - MODULE_EXTENSION=".dll" - AC_CHECK_LIB(cygwin, dlopen, [ - WITH_MODULES=1 - MODULE_PLATFORM_LIBS= - AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso]) - ]) - ;; - *-*-mingw*) - MODULE_EXTENSION=".dll" - WITH_MODULES=1 - ;; - *) - AC_CHECK_FUNC(shl_load, libxml_have_shl_load=yes, [ - AC_CHECK_LIB(dld, shl_load, [ - MODULE_PLATFORM_LIBS="-ldld" - libxml_have_shl_load=yes], [ - AC_CHECK_FUNC(dlopen, libxml_have_dlopen=yes, [ - AC_CHECK_LIB(dl, dlopen, [ - MODULE_PLATFORM_LIBS="-ldl" - libxml_have_dlopen=yes])])])]) - - if test "${libxml_have_shl_load}" = "yes"; then - MODULE_EXTENSION=".sl" - WITH_MODULES=1 - AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso]) - fi - - if test "${libxml_have_dlopen}" = "yes"; then - case "${host}" in - *-*-hpux* ) - MODULE_EXTENSION=".sl" - ;; - * ) - MODULE_EXTENSION=".so" - ;; - esac - - WITH_MODULES=1 - AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso]) - fi - ;; - esac -fi - -if test "${WITH_MODULES}" = "1"; then - TEST_MODULES="ModuleTests" -fi - -AC_SUBST(WITH_MODULES) -AC_SUBST(MODULE_PLATFORM_LIBS) -AC_SUBST(MODULE_EXTENSION) -AC_SUBST(TEST_MODULES) - -dnl -dnl Tester makes use of readline if present -dnl - -dnl -dnl specific tests to setup DV and Bill's devel environments with debug etc ... -dnl (-Wunreachable-code) -dnl -if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \ - [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/home/veillard/libxml2" ]] || \ - [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxml2" ]] - then - if test "$with_minimum" != "yes" - then - if test "${with_mem_debug}" = "" ; then - echo Activating memory debugging - with_mem_debug="yes" - with_run_debug="yes" - fi - if test "${with_docbook}" = "" ; then - with_docbook="yes" - fi - fi - if test "${GCC}" = "yes" ; then - CFLAGS="-g -O -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wall" - fi - STATIC_BINARIES="-static" -dnl -Wcast-qual -ansi -else - STATIC_BINARIES= -fi -AC_SUBST(STATIC_BINARIES) - -dnl -dnl Check for trio string functions -dnl - -if test "${NEED_TRIO}" = "1" ; then - echo Adding trio library for string functions - WITH_TRIO=1 -else - WITH_TRIO=0 -fi -AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1") -AC_SUBST(WITH_TRIO) - -dnl -dnl Allow to enable/disable various pieces -dnl -echo Checking configuration requirements - -dnl -dnl Thread-related stuff -dnl -THREAD_LIBS="" -BASE_THREAD_LIBS="" -WITH_THREADS=0 -THREAD_CFLAGS="" -TEST_THREADS="" -THREADS_W32="" - -if test "$with_threads" = "no" ; then - echo Disabling multithreaded support -else - echo Enabling multithreaded support - - dnl Default to native threads on Win32 - case $host_os in - *mingw32*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then - WITH_THREADS="1" - THREADS_W32="1" - THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS" - fi - ;; - esac - - dnl Use pthread by default in other cases - if test -z "$THREADS_W32"; then - if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then - AC_CHECK_HEADER(pthread.h, - AC_CHECK_LIB(pthread, pthread_join,[ - THREAD_LIBS="-lpthread" - AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)]) - AC_DEFINE([HAVE_PTHREAD_H], [], [Define if is there]) - WITH_THREADS="1"])) - fi - fi - - case $host_os in - *cygwin*) THREAD_LIBS="" - ;; - *beos*) WITH_THREADS="1" - THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS" - ;; - *linux*) - if test "${GCC}" = "yes" ; then - GCC_VERSION=`${CC} --version | head -1 | awk '{print $3}'` - GCC_MAJOR=`echo ${GCC_VERSION} | sed 's+\..*++'` - GCC_MEDIUM=`echo ${GCC_VERSION} | sed 's+[[0-9]]*\.++' | sed 's+\..*++'` - if test "${THREAD_LIBS}" = "-lpthread" ; then - if expr ${GCC_MEDIUM} \> 2 \& ${GCC_MAJOR} = 3 > /dev/null - then - THREAD_LIBS="" - BASE_THREAD_LIBS="-lpthread" - else - if expr ${GCC_MAJOR} \> 3 > /dev/null - then - THREAD_LIBS="" - BASE_THREAD_LIBS="-lpthread" - else - echo old GCC disabling weak symbols for pthread - fi - fi - fi - fi - ;; - esac - if test "$WITH_THREADS" = "1" ; then - THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT" - TEST_THREADS="Threadtests" - fi -fi -if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then - THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED" -fi - -AC_SUBST(THREAD_LIBS) -AC_SUBST(BASE_THREAD_LIBS) -AC_SUBST(WITH_THREADS) -AC_SUBST(THREAD_CFLAGS) -AC_SUBST(TEST_THREADS) -AM_CONDITIONAL([THREADS_W32],[test -n "$THREADS_W32"]) - -dnl -dnl xmllint shell history -dnl -if test "$with_history" = "yes" ; then - echo Enabling xmllint shell history - dnl check for terminal library. this is a very cool solution - dnl from octave's configure.in - unset tcap - for termlib in ncurses curses termcap terminfo termlib; do - AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"]) - test -n "$tcap" && break - done - - AC_CHECK_HEADER(readline/history.h, - AC_CHECK_LIB(history, append_history,[ - RDL_LIBS="-lhistory" - AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])])) - AC_CHECK_HEADER(readline/readline.h, - AC_CHECK_LIB(readline, readline,[ - RDL_LIBS="-lreadline $RDL_LIBS $tcap" - AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap)) - if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then - CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include" - RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS" - fi -fi - -dnl -dnl Tree functions -dnl -if test "$with_tree" = "no" ; then - echo Disabling DOM like tree manipulation APIs - WITH_TREE=0 -else - WITH_TREE=1 -fi -AC_SUBST(WITH_TREE) - -if test "$with_ftp" = "no" ; then - echo Disabling FTP support - WITH_FTP=0 - FTP_OBJ= -else - WITH_FTP=1 - FTP_OBJ=nanoftp.o -fi -AC_SUBST(WITH_FTP) -AC_SUBST(FTP_OBJ) - -if test "$with_http" = "no" ; then - echo Disabling HTTP support - WITH_HTTP=0 - HTTP_OBJ= -else - WITH_HTTP=1 - HTTP_OBJ=nanohttp.o -fi -AC_SUBST(WITH_HTTP) -AC_SUBST(HTTP_OBJ) - -if test "$with_legacy" = "no" ; then - echo Disabling deprecated APIs - WITH_LEGACY=0 -else - WITH_LEGACY=1 -fi -AC_SUBST(WITH_LEGACY) - -if test "$with_reader" = "no" ; then - echo Disabling the xmlReader parsing interface - WITH_READER=0 - READER_TEST= -else - WITH_READER=1 - READER_TEST=Readertests - if test "$with_push" = "no" ; then - echo xmlReader requires Push interface - enabling it - with_push=yes - fi -fi -AC_SUBST(WITH_READER) -AC_SUBST(READER_TEST) - -if test "$with_writer" = "no" ; then - echo Disabling the xmlWriter saving interface - WITH_WRITER=0 -# WRITER_TEST= -else - WITH_WRITER=1 -# WRITER_TEST=Writertests - if test "$with_push" = "no" ; then - echo xmlWriter requires Push interface - enabling it - with_push=yes - fi - if test "$with_output" = "no" ; then - echo xmlWriter requires Output interface - enabling it - with_output=yes - fi -fi -AC_SUBST(WITH_WRITER) -#AC_SUBST(WRITER_TEST) - -if test "$with_pattern" = "no" ; then - echo Disabling the xmlPattern parsing interface - WITH_PATTERN=0 - TEST_PATTERN= -else - WITH_PATTERN=1 - TEST_PATTERN=Patterntests -fi -AC_SUBST(WITH_PATTERN) -AC_SUBST(TEST_PATTERN) - -if test "$with_sax1" = "no" ; then - echo Disabling the older SAX1 interface - WITH_SAX1=0 - TEST_SAX= -else - WITH_SAX1=1 - TEST_SAX=SAXtests -fi -AC_SUBST(WITH_SAX1) -AM_CONDITIONAL(WITH_SAX1_SOURCES, test "${WITH_TRIO}" = "1") -AC_SUBST(TEST_SAX) - -if test "$with_push" = "no" ; then - echo Disabling the PUSH parser interfaces - WITH_PUSH=0 - TEST_PUSH= -else - WITH_PUSH=1 - TEST_PUSH="XMLPushtests" -fi -AC_SUBST(WITH_PUSH) -AC_SUBST(TEST_PUSH) - -if test "$with_html" = "no" ; then - echo Disabling HTML support - WITH_HTML=0 - HTML_OBJ= - TEST_HTML= -else - WITH_HTML=1 - HTML_OBJ="HTMLparser.o HTMLtree.o" - TEST_HTML=HTMLtests - if test "$with_push" != "no" ; then - TEST_PHTML=HTMLPushtests - else - TEST_PHTML= - fi -fi -AC_SUBST(WITH_HTML) -AC_SUBST(HTML_OBJ) -AC_SUBST(TEST_HTML) -AC_SUBST(TEST_PHTML) - -if test "$with_valid" = "no" ; then - echo Disabling DTD validation support - WITH_VALID=0 - TEST_VALID= - TEST_VTIME= -else - WITH_VALID=1 - TEST_VALID=Validtests - TEST_VTIME=VTimingtests -fi -AC_SUBST(WITH_VALID) -AC_SUBST(TEST_VALID) -AC_SUBST(TEST_VTIME) - -if test "$with_catalog" = "no" ; then - echo Disabling Catalog support - WITH_CATALOG=0 - CATALOG_OBJ= - TEST_CATALOG= -else - WITH_CATALOG=1 - CATALOG_OBJ="catalog.o" - TEST_CATALOG=Catatests -fi -AC_SUBST(WITH_CATALOG) -AC_SUBST(CATALOG_OBJ) -AC_SUBST(TEST_CATALOG) - -if test "$with_docbook" = "no" ; then - echo Disabling Docbook support - WITH_DOCB=0 - DOCB_OBJ= -else - WITH_DOCB=1 - DOCB_OBJ="DOCBparser.o" -fi -AC_SUBST(WITH_DOCB) -AC_SUBST(DOCB_OBJ) - - -if test "$with_xptr" = "no" ; then - echo Disabling XPointer support - WITH_XPTR=0 - XPTR_OBJ= - TEST_XPTR= -else - WITH_XPTR=1 - XPTR_OBJ=xpointer.o - TEST_XPTR=XPtrtests - if test "$with_xpath" = "no" ; then - echo XPointer requires XPath support - enabling it - with_xpath=yes - fi -fi -AC_SUBST(WITH_XPTR) -AC_SUBST(XPTR_OBJ) -AC_SUBST(TEST_XPTR) - -if test "$with_c14n" = "no" ; then - echo Disabling C14N support - WITH_C14N=0 - C14N_OBJ= - TEST_C14N= -else - WITH_C14N=1 - C14N_OBJ="c14n.c" - TEST_C14N=C14Ntests - if test "$with_xpath" = "no" ; then - echo C14N requires XPath support - enabling it - with_xpath=yes - fi -fi -AC_SUBST(WITH_C14N) -AC_SUBST(C14N_OBJ) -AC_SUBST(TEST_C14N) - -if test "$with_xinclude" = "no" ; then - echo Disabling XInclude support - WITH_XINCLUDE=0 - XINCLUDE_OBJ= - with_xinclude="no" - TEST_XINCLUDE= -else - WITH_XINCLUDE=1 - XINCLUDE_OBJ=xinclude.o - TEST_XINCLUDE=XIncludetests - if test "$with_xpath" = "no" ; then - echo XInclude requires XPath support - enabling it - with_xpath=yes - fi -fi -AC_SUBST(WITH_XINCLUDE) -AC_SUBST(XINCLUDE_OBJ) -AC_SUBST(TEST_XINCLUDE) - -if test "$with_xpath" = "no" ; then - echo Disabling XPATH support - WITH_XPATH=0 - XPATH_OBJ= - TEST_XPATH= -else - WITH_XPATH=1 - XPATH_OBJ=xpath.o - TEST_XPATH=XPathtests -fi -AC_SUBST(WITH_XPATH) -AC_SUBST(XPATH_OBJ) -AC_SUBST(TEST_XPATH) - -dnl -dnl output functions -dnl -if test "$with_output" = "no" ; then - echo Disabling serialization/saving support - WITH_OUTPUT=0 -else - WITH_OUTPUT=1 -fi -AC_SUBST(WITH_OUTPUT) - -WITH_ICONV=0 -if test "$with_iconv" = "no" ; then - echo Disabling ICONV support -else - if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then - CPPFLAGS="${CPPFLAGS} -I$with_iconv/include" - # Export this since our headers include iconv.h - XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include" - ICONV_LIBS="-L$with_iconv/lib" - fi - - AC_CHECK_HEADER(iconv.h, - AC_MSG_CHECKING(for iconv) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include -#include ]],[[ -iconv_t cd = iconv_open ("",""); -iconv (cd, NULL, NULL, NULL, NULL);]])],[ - AC_MSG_RESULT(yes) - WITH_ICONV=1],[ - AC_MSG_RESULT(no) - AC_MSG_CHECKING(for iconv in -liconv) - - _ldflags="${LDFLAGS}" - _libs="${LIBS}" - LDFLAGS="${LDFLAGS} ${ICONV_LIBS}" - LIBS="${LIBS} -liconv" - - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include -#include ]],[[ -iconv_t cd = iconv_open ("",""); -iconv (cd, NULL, NULL, NULL, NULL);]])],[ - AC_MSG_RESULT(yes) - WITH_ICONV=1 - ICONV_LIBS="${ICONV_LIBS} -liconv" - LIBS="${_libs}" - LDFLAGS="${_ldflags}"],[ - AC_MSG_RESULT(no) - LIBS="${_libs}" - LDFLAGS="${_ldflags}"])])) - - if test "$WITH_ICONV" = "1" ; then - AC_MSG_CHECKING([for iconv declaration]) - AC_CACHE_VAL(xml_cv_iconv_arg2, [ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include -#include -extern -#ifdef __cplusplus -"C" -#endif -#if defined(__STDC__) || defined(__cplusplus) -size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); -#else -size_t iconv(); -#endif -]], [])], xml_cv_iconv_arg2="", xml_cv_iconv_arg2="const")]) - - xml_cv_iconv_decl="extern size_t iconv (iconv_t cd, $xml_cv_iconv_arg2 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" - AC_MSG_RESULT([${xml_xxx:- - }$xml_cv_iconv_decl]) - AC_DEFINE_UNQUOTED(ICONV_CONST, $xml_cv_iconv_arg2, - [Define as const if the declaration of iconv() needs const.]) - fi -fi -case "$host" in - *mingw*) M_LIBS="" - ;; - *beos*) M_LIBS="" - ;; - *haiku*) M_LIBS="" - ;; - *) M_LIBS="-lm" - ;; -esac -XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS" -XML_LIBTOOLLIBS="libxml2.la" -AC_SUBST(WITH_ICONV) - -WITH_ICU=0 -ICU_LIBS="" -if test "$with_icu" != "yes" ; then - echo Disabling ICU support -else - ICU_CONFIG=icu-config - if ${ICU_CONFIG} --cflags >/dev/null 2>&1 - then - ICU_LIBS=`${ICU_CONFIG} --ldflags` - WITH_ICU=1 - echo Enabling ICU support - else - AC_MSG_ERROR([libicu config program icu-config not found]) - fi -fi -AC_SUBST(WITH_ICU) -AC_SUBST(ICU_LIBS) - -WITH_ISO8859X=1 -if test "$WITH_ICONV" != "1" ; then -if test "$with_iso8859x" = "no" ; then - echo Disabling ISO8859X support - WITH_ISO8859X=0 -fi -fi -AC_SUBST(WITH_ISO8859X) - -if test "$with_schematron" = "no" ; then - echo "Disabling Schematron support" - WITH_SCHEMATRON=0 - TEST_SCHEMATRON= -else - echo "Enabled Schematron support" - WITH_SCHEMATRON=1 - TEST_SCHEMATRON="Schematrontests" - with_xpath=yes - with_pattern=yes -fi -AC_SUBST(WITH_SCHEMATRON) -AC_SUBST(TEST_SCHEMATRON) - -if test "$with_schemas" = "no" ; then - echo "Disabling Schemas/Relax-NG support" - WITH_SCHEMAS=0 - TEST_SCHEMAS= -else - echo "Enabled Schemas/Relax-NG support" - WITH_SCHEMAS=1 - TEST_SCHEMAS="Schemastests Relaxtests" - if test "$PYTHON_INCLUDES" != "" ; then - PYTHON_TESTS="$PYTHON_TESTS RelaxNGPythonTests SchemasPythonTests" - fi - with_regexps=yes -fi -AC_SUBST(WITH_SCHEMAS) -AC_SUBST(TEST_SCHEMAS) - -if test "$with_regexps" = "no" ; then - echo Disabling Regexps support - WITH_REGEXPS=0 - TEST_REGEXPS= -else - WITH_REGEXPS=1 - TEST_REGEXPS="Regexptests Automatatests" -fi -AC_SUBST(WITH_REGEXPS) -AC_SUBST(TEST_REGEXPS) - -if test "$with_debug" = "no" ; then - echo Disabling DEBUG support - WITH_DEBUG=0 - DEBUG_OBJ= - TEST_DEBUG= -else - WITH_DEBUG=1 - DEBUG_OBJ=debugXML.o - TEST_DEBUG=Scripttests -fi -AC_SUBST(WITH_DEBUG) -AC_SUBST(DEBUG_OBJ) -AC_SUBST(TEST_DEBUG) - -if test "$with_mem_debug" = "yes" ; then - if test "$with_thread_alloc" = "yes" ; then - echo Disabling memory debug - cannot use mem-debug with thread-alloc! - WITH_MEM_DEBUG=0 - else - echo Enabling memory debug support - WITH_MEM_DEBUG=1 - fi -else - WITH_MEM_DEBUG=0 -fi -AC_SUBST(WITH_MEM_DEBUG) - -if test "$with_run_debug" = "yes" ; then - echo Enabling runtime debug support - WITH_RUN_DEBUG=1 -else - WITH_RUN_DEBUG=0 -fi -AC_SUBST(WITH_RUN_DEBUG) - -WIN32_EXTRA_LIBADD= -WIN32_EXTRA_LDFLAGS= -CYGWIN_EXTRA_LDFLAGS= -CYGWIN_EXTRA_PYTHON_LIBADD= -WIN32_EXTRA_PYTHON_LIBADD= -case "$host" in - *-*-mingw*) - CPPFLAGS="$CPPFLAGS -DWIN32" - WIN32_EXTRA_LIBADD="-lws2_32" - WIN32_EXTRA_LDFLAGS="-no-undefined" - AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation]) - if test "${PYTHON}" != "" - then - WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython$(echo ${PYTHON_VERSION} | tr -d .)" - fi - ;; - *-*-cygwin*) - CYGWIN_EXTRA_LDFLAGS="-no-undefined" - if test "${PYTHON}" != "" - then - CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}" - fi - ;; -esac -AC_SUBST(WIN32_EXTRA_LIBADD) -AC_SUBST(WIN32_EXTRA_LDFLAGS) -AC_SUBST(WIN32_EXTRA_PYTHON_LIBADD) -AC_SUBST(CYGWIN_EXTRA_LDFLAGS) -AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD) - -dnl Checking the standard string functions availability -dnl -dnl Note mingw* has C99 implementation that produce expected xml numbers -dnl if code use {v}snprintf functions. -dnl If you like to activate at run-time C99 compatible number output -dnl see release note for mingw runtime 3.15: -dnl http://sourceforge.net/project/shownotes.php?release_id=24832 -dnl -dnl Also *win32*config.h files redefine them for various MSC compilers. -dnl -dnl So do not redefine {v}snprintf to _{v}snprintf like follwing: -dnl AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around]) -dnl AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around]) -dnl and do not redefine those functions is C-source files. -dnl -AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,, - NEED_TRIO=1) - -if test "$with_coverage" = "yes" -a "${GCC}" = "yes" -then - echo Enabling code coverage for GCC - CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" - LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage" -else - echo Disabling code coverage for GCC -fi - -AC_SUBST(CPPFLAGS) -AC_SUBST(CFLAGS) -AC_SUBST(LDFLAGS) -AC_SUBST(XML_CFLAGS) - -AC_SUBST(XML_LIBDIR) -AC_SUBST(XML_LIBS) -AC_SUBST(XML_LIBTOOLLIBS) -AC_SUBST(ICONV_LIBS) -AC_SUBST(XML_INCLUDEDIR) -AC_SUBST(HTML_DIR) -AC_SUBST(HAVE_ISNAN) -AC_SUBST(HAVE_ISINF) -AC_SUBST(PYTHON) -AC_SUBST(PYTHON_VERSION) -AC_SUBST(PYTHON_INCLUDES) -AC_SUBST(PYTHON_SITE_PACKAGES) - -AC_SUBST(M_LIBS) -AC_SUBST(RDL_LIBS) - -dnl for the spec file -RELDATE=`date +'%a %b %e %Y'` -AC_SUBST(RELDATE) -AC_SUBST(PYTHON_TESTS) - -rm -f COPYING.LIB COPYING -ln -s $srcdir/Copyright COPYING - -# keep on one line for cygwin c.f. #130896 -AC_CONFIG_FILES([libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h xml2-config libxml-2.0.pc libxml-2.0-uninstalled.pc python/setup.py]) -AC_OUTPUT - -chmod +x xml2-config python/setup.py -echo Done configuring diff --git a/lib/3rdparty/libxml2/dbgen.pl b/lib/3rdparty/libxml2/dbgen.pl deleted file mode 100644 index 1383d6e9797..00000000000 --- a/lib/3rdparty/libxml2/dbgen.pl +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/perl - -$size = shift; - -if ($size eq "") -{ - die "usage: dbgen.pl [size]\n"; -} - -@firstnames = ("Al", "Bob", "Charles", "David", "Egon", "Farbood", - "George", "Hank", "Inki", "James"); -@lastnames = ("Aranow", "Barker", "Corsetti", "Dershowitz", "Engleman", - "Franklin", "Grice", "Haverford", "Ilvedson", "Jones"); -@states = ("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", - "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", - "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", - "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", - "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"); - -print "\n"; -print "\n"; -print "\n"; - -for ($i=0; $i<$size; $i++) -{ - $first = $firstnames [$i % 10]; - $last = $lastnames [($i / 10) % 10]; - $state = $states [($i / 100) % 50]; - $zip = 22000 + $i / 5000; - - printf " \n"; - printf " %04d\n", $i; - printf " $first\n", $i; - printf " $last\n", $i; - printf " %d Any St.\n", ($i % 100) + 1; - printf " Anytown\n"; - printf " $state\n"; - printf " %d\n", $zip; - printf " \n"; -} - -print "
\n"; - diff --git a/lib/3rdparty/libxml2/dbgenattr.pl b/lib/3rdparty/libxml2/dbgenattr.pl deleted file mode 100644 index dce11cd8b17..00000000000 --- a/lib/3rdparty/libxml2/dbgenattr.pl +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/perl - -$size = shift; - -if ($size eq "") -{ - die "usage: dbgen.pl [size]\n"; -} - -@firstnames = ("Al", "Bob", "Charles", "David", "Egon", "Farbood", - "George", "Hank", "Inki", "James"); -@lastnames = ("Aranow", "Barker", "Corsetti", "Dershowitz", "Engleman", - "Franklin", "Grice", "Haverford", "Ilvedson", "Jones"); -@states = ("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", - "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", - "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", - "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", - "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"); - -print "\n"; -print "\n"; -print "\n"; - -for ($i=0; $i<$size; $i++) -{ - $first = $firstnames [$i % 10]; - $last = $lastnames [($i / 10) % 10]; - $state = $states [($i / 100) % 50]; - $zip = 22000 + $i / 5000; - - printf " \n", $zip; -} - -print "
\n"; - diff --git a/lib/3rdparty/libxml2/debugXML.c b/lib/3rdparty/libxml2/debugXML.c index 3874b19fbf6..c8efe6abd60 100644 --- a/lib/3rdparty/libxml2/debugXML.c +++ b/lib/3rdparty/libxml2/debugXML.c @@ -354,7 +354,6 @@ xmlCtxtGenericNodeCheck(xmlDebugCtxtPtr ctxt, xmlNodePtr node) { (node->type != XML_ELEMENT_DECL) && (node->type != XML_ATTRIBUTE_DECL) && (node->type != XML_DTD_NODE) && - (node->type != XML_ELEMENT_DECL) && (node->type != XML_HTML_DOCUMENT_NODE) && (node->type != XML_DOCUMENT_NODE)) { if (node->content != NULL) diff --git a/lib/3rdparty/libxml2/depcomp b/lib/3rdparty/libxml2/depcomp deleted file mode 100644 index bd0ac089584..00000000000 --- a/lib/3rdparty/libxml2/depcomp +++ /dev/null @@ -1,688 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2011-12-04.11; # UTC - -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, -# 2011 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by `PROGRAMS ARGS'. - object Object file output by `PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputting dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit $? - ;; -esac - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi - -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -cygpath_u="cygpath -u -f -" -if test "$depmode" = msvcmsys; then - # This is just like msvisualcpp but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvisualcpp -fi - -if test "$depmode" = msvc7msys; then - # This is just like msvc7 but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvc7 -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. -## Unfortunately, FreeBSD c89 acceptance of flags depends upon -## the command line argument order; so add the flags where they -## appear in depend2.am. Note that the slowdown incurred here -## affects only configure: in makefiles, %FASTDEP% shortcuts this. - for arg - do - case $arg in - -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; - *) set fnord "$@" "$arg" ;; - esac - shift # fnord - shift # $arg - done - "$@" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. hp depmode also adds that space, but also prefixes the VPATH -## to the object. Take care to not repeat it in the output. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> "$depfile" - echo >> "$depfile" - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts `$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.u - tmpdepfile2=$base.u - tmpdepfile3=$dir.libs/$base.u - "$@" -Wc,-M - else - tmpdepfile1=$dir$base.u - tmpdepfile2=$dir$base.u - tmpdepfile3=$dir$base.u - "$@" -M - fi - stat=$? - - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -icc) - # Intel's C compiler understands `-MD -MF file'. However on - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # ICC 7.0 will fill foo.d with something like - # foo.o: sub/foo.c - # foo.o: sub/foo.h - # which is wrong. We want: - # sub/foo.o: sub/foo.c - # sub/foo.o: sub/foo.h - # sub/foo.c: - # sub/foo.h: - # ICC 7.1 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using \ : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | - sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp2) - # The "hp" stanza above does not work with aCC (C++) and HP's ia64 - # compilers, which have integrated preprocessors. The correct option - # to use with these is +Maked; it writes dependencies to a file named - # 'foo.d', which lands next to the object file, wherever that - # happens to be. - # Much of this is similar to the tru64 case; see comments there. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir.libs/$base.d - "$@" -Wc,+Maked - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - "$@" +Maked - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" - # Add `dependent.h:' lines. - sed -ne '2,${ - s/^ *// - s/ \\*$// - s/$/:/ - p - }' "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" "$tmpdepfile2" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - - if test "$libtool" = yes; then - # With Tru64 cc, shared objects can also be used to make a - # static library. This mechanism is used in libtool 1.4 series to - # handle both shared and static libraries in a single compilation. - # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. - # - # With libtool 1.5 this exception was removed, and libtool now - # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 - tmpdepfile2=$dir$base.o.d # libtool 1.5 - tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 - tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.o.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - tmpdepfile4=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -msvc7) - if test "$libtool" = yes; then - showIncludes=-Wc,-showIncludes - else - showIncludes=-showIncludes - fi - "$@" $showIncludes > "$tmpdepfile" - stat=$? - grep -v '^Note: including file: ' "$tmpdepfile" - if test "$stat" = 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - # The first sed program below extracts the file names and escapes - # backslashes for cygpath. The second sed program outputs the file - # name when reading, but also accumulates all include files in the - # hold buffer in order to output them again at the end. This only - # works with sed implementations that can handle large buffers. - sed < "$tmpdepfile" -n ' -/^Note: including file: *\(.*\)/ { - s//\1/ - s/\\/\\\\/g - p -}' | $cygpath_u | sort -u | sed -n ' -s/ /\\ /g -s/\(.*\)/ \1 \\/p -s/.\(.*\) \\/\1:/ -H -$ { - s/.*/ / - G - p -}' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvc7msys) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for `:' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. - "$@" $dashmflag | - sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no eat=no - for arg - do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - if test $eat = yes; then - eat=no - continue - fi - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -arch) - eat=yes ;; - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix=`echo "$object" | sed 's/^.*\././'` - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - # makedepend may prepend the VPATH from the source file name to the object. - # No need to regex-escape $object, excess matching of '.' is harmless. - sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E | - sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - IFS=" " - for arg - do - case "$arg" in - -o) - shift - ;; - $object) - shift - ;; - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E 2>/dev/null | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvcmsys) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/lib/3rdparty/libxml2/dict.c b/lib/3rdparty/libxml2/dict.c index 9935a2554d9..5f71d55d736 100644 --- a/lib/3rdparty/libxml2/dict.c +++ b/lib/3rdparty/libxml2/dict.c @@ -143,7 +143,7 @@ static int xmlDictInitialized = 0; /* * Internal data for random function, protected by xmlDictMutex */ -unsigned int rand_seed = 0; +static unsigned int rand_seed = 0; #endif #endif @@ -151,13 +151,28 @@ unsigned int rand_seed = 0; * xmlInitializeDict: * * Do the dictionary mutex initialization. - * this function is not thread safe, initialization should - * preferably be done once at startup + * this function is deprecated * * Returns 0 if initialization was already done, and 1 if that * call led to the initialization */ int xmlInitializeDict(void) { + return(0); +} + +/** + * __xmlInitializeDict: + * + * This function is not public + * Do the dictionary mutex initialization. + * this function is not thread safe, initialization should + * normally be done once at setup when called from xmlOnceInit() + * we may also land in this code if thread support is not compiled in + * + * Returns 0 if initialization was already done, and 1 if that + * call led to the initialization + */ +int __xmlInitializeDict(void) { if (xmlDictInitialized) return(1); @@ -183,7 +198,7 @@ int __xmlRandom(void) { int ret; if (xmlDictInitialized == 0) - xmlInitializeDict(); + __xmlInitializeDict(); xmlRMutexLock(xmlDictMutex); #ifdef HAVE_RAND_R @@ -522,7 +537,7 @@ xmlDictCreate(void) { xmlDictPtr dict; if (!xmlDictInitialized) - if (!xmlInitializeDict()) + if (!__xmlInitializeDict()) return(NULL); #ifdef DICT_DEBUG_PATTERNS @@ -590,7 +605,7 @@ xmlDictCreateSub(xmlDictPtr sub) { int xmlDictReference(xmlDictPtr dict) { if (!xmlDictInitialized) - if (!xmlInitializeDict()) + if (!__xmlInitializeDict()) return(-1); if (dict == NULL) return -1; @@ -754,7 +769,7 @@ xmlDictFree(xmlDictPtr dict) { return; if (!xmlDictInitialized) - if (!xmlInitializeDict()) + if (!__xmlInitializeDict()) return; /* decrement the counter, it may be shared by a parser and docs */ diff --git a/lib/3rdparty/libxml2/elfgcchack.h b/lib/3rdparty/libxml2/elfgcchack.h index 84e81516a55..85c49d60b88 100644 --- a/lib/3rdparty/libxml2/elfgcchack.h +++ b/lib/3rdparty/libxml2/elfgcchack.h @@ -1343,6 +1343,68 @@ extern __typeof (xmlBoolToText) xmlBoolToText__internal_alias __attribute((visib #endif #endif +#ifdef bottom_buf +#undef xmlBufContent +extern __typeof (xmlBufContent) xmlBufContent __attribute((alias("xmlBufContent__internal_alias"))); +#else +#ifndef xmlBufContent +extern __typeof (xmlBufContent) xmlBufContent__internal_alias __attribute((visibility("hidden"))); +#define xmlBufContent xmlBufContent__internal_alias +#endif +#endif + +#ifdef bottom_buf +#undef xmlBufEnd +extern __typeof (xmlBufEnd) xmlBufEnd __attribute((alias("xmlBufEnd__internal_alias"))); +#else +#ifndef xmlBufEnd +extern __typeof (xmlBufEnd) xmlBufEnd__internal_alias __attribute((visibility("hidden"))); +#define xmlBufEnd xmlBufEnd__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufGetNodeContent +extern __typeof (xmlBufGetNodeContent) xmlBufGetNodeContent __attribute((alias("xmlBufGetNodeContent__internal_alias"))); +#else +#ifndef xmlBufGetNodeContent +extern __typeof (xmlBufGetNodeContent) xmlBufGetNodeContent__internal_alias __attribute((visibility("hidden"))); +#define xmlBufGetNodeContent xmlBufGetNodeContent__internal_alias +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlBufNodeDump +extern __typeof (xmlBufNodeDump) xmlBufNodeDump __attribute((alias("xmlBufNodeDump__internal_alias"))); +#else +#ifndef xmlBufNodeDump +extern __typeof (xmlBufNodeDump) xmlBufNodeDump__internal_alias __attribute((visibility("hidden"))); +#define xmlBufNodeDump xmlBufNodeDump__internal_alias +#endif +#endif +#endif + +#ifdef bottom_buf +#undef xmlBufShrink +extern __typeof (xmlBufShrink) xmlBufShrink __attribute((alias("xmlBufShrink__internal_alias"))); +#else +#ifndef xmlBufShrink +extern __typeof (xmlBufShrink) xmlBufShrink__internal_alias __attribute((visibility("hidden"))); +#define xmlBufShrink xmlBufShrink__internal_alias +#endif +#endif + +#ifdef bottom_buf +#undef xmlBufUse +extern __typeof (xmlBufUse) xmlBufUse __attribute((alias("xmlBufUse__internal_alias"))); +#else +#ifndef xmlBufUse +extern __typeof (xmlBufUse) xmlBufUse__internal_alias __attribute((visibility("hidden"))); +#define xmlBufUse xmlBufUse__internal_alias +#endif +#endif + #ifdef bottom_tree #undef xmlBufferAdd extern __typeof (xmlBufferAdd) xmlBufferAdd __attribute((alias("xmlBufferAdd__internal_alias"))); @@ -1423,6 +1485,16 @@ extern __typeof (xmlBufferCreateStatic) xmlBufferCreateStatic__internal_alias __ #endif #endif +#ifdef bottom_tree +#undef xmlBufferDetach +extern __typeof (xmlBufferDetach) xmlBufferDetach __attribute((alias("xmlBufferDetach__internal_alias"))); +#else +#ifndef xmlBufferDetach +extern __typeof (xmlBufferDetach) xmlBufferDetach__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferDetach xmlBufferDetach__internal_alias +#endif +#endif + #ifdef bottom_tree #undef xmlBufferDump extern __typeof (xmlBufferDump) xmlBufferDump __attribute((alias("xmlBufferDump__internal_alias"))); @@ -2839,6 +2911,16 @@ extern __typeof (xmlDictFree) xmlDictFree__internal_alias __attribute((visibilit #endif #endif +#ifdef bottom_dict +#undef xmlDictGetUsage +extern __typeof (xmlDictGetUsage) xmlDictGetUsage __attribute((alias("xmlDictGetUsage__internal_alias"))); +#else +#ifndef xmlDictGetUsage +extern __typeof (xmlDictGetUsage) xmlDictGetUsage__internal_alias __attribute((visibility("hidden"))); +#define xmlDictGetUsage xmlDictGetUsage__internal_alias +#endif +#endif + #ifdef bottom_dict #undef xmlDictLookup extern __typeof (xmlDictLookup) xmlDictLookup __attribute((alias("xmlDictLookup__internal_alias"))); @@ -2879,6 +2961,16 @@ extern __typeof (xmlDictReference) xmlDictReference__internal_alias __attribute( #endif #endif +#ifdef bottom_dict +#undef xmlDictSetLimit +extern __typeof (xmlDictSetLimit) xmlDictSetLimit __attribute((alias("xmlDictSetLimit__internal_alias"))); +#else +#ifndef xmlDictSetLimit +extern __typeof (xmlDictSetLimit) xmlDictSetLimit__internal_alias __attribute((visibility("hidden"))); +#define xmlDictSetLimit xmlDictSetLimit__internal_alias +#endif +#endif + #ifdef bottom_dict #undef xmlDictSize extern __typeof (xmlDictSize) xmlDictSize __attribute((alias("xmlDictSize__internal_alias"))); @@ -4601,6 +4693,16 @@ extern __typeof (xmlInitializeCatalog) xmlInitializeCatalog__internal_alias __at #endif #endif +#ifdef bottom_dict +#undef xmlInitializeDict +extern __typeof (xmlInitializeDict) xmlInitializeDict __attribute((alias("xmlInitializeDict__internal_alias"))); +#else +#ifndef xmlInitializeDict +extern __typeof (xmlInitializeDict) xmlInitializeDict__internal_alias __attribute((visibility("hidden"))); +#define xmlInitializeDict xmlInitializeDict__internal_alias +#endif +#endif + #ifdef bottom_globals #undef xmlInitializeGlobalState extern __typeof (xmlInitializeGlobalState) xmlInitializeGlobalState __attribute((alias("xmlInitializeGlobalState__internal_alias"))); @@ -6755,6 +6857,30 @@ extern __typeof (xmlOutputBufferFlush) xmlOutputBufferFlush__internal_alias __at #endif #endif +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlOutputBufferGetContent +extern __typeof (xmlOutputBufferGetContent) xmlOutputBufferGetContent __attribute((alias("xmlOutputBufferGetContent__internal_alias"))); +#else +#ifndef xmlOutputBufferGetContent +extern __typeof (xmlOutputBufferGetContent) xmlOutputBufferGetContent__internal_alias __attribute((visibility("hidden"))); +#define xmlOutputBufferGetContent xmlOutputBufferGetContent__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlOutputBufferGetSize +extern __typeof (xmlOutputBufferGetSize) xmlOutputBufferGetSize __attribute((alias("xmlOutputBufferGetSize__internal_alias"))); +#else +#ifndef xmlOutputBufferGetSize +extern __typeof (xmlOutputBufferGetSize) xmlOutputBufferGetSize__internal_alias __attribute((visibility("hidden"))); +#define xmlOutputBufferGetSize xmlOutputBufferGetSize__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_OUTPUT_ENABLED) #ifdef bottom_xmlIO #undef xmlOutputBufferWrite @@ -10041,6 +10167,30 @@ extern __typeof (xmlSchemaValidatePredefinedType) xmlSchemaValidatePredefinedTyp #endif #endif +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaValidateSetFilename +extern __typeof (xmlSchemaValidateSetFilename) xmlSchemaValidateSetFilename __attribute((alias("xmlSchemaValidateSetFilename__internal_alias"))); +#else +#ifndef xmlSchemaValidateSetFilename +extern __typeof (xmlSchemaValidateSetFilename) xmlSchemaValidateSetFilename__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValidateSetFilename xmlSchemaValidateSetFilename__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaValidateSetLocator +extern __typeof (xmlSchemaValidateSetLocator) xmlSchemaValidateSetLocator __attribute((alias("xmlSchemaValidateSetLocator__internal_alias"))); +#else +#ifndef xmlSchemaValidateSetLocator +extern __typeof (xmlSchemaValidateSetLocator) xmlSchemaValidateSetLocator__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValidateSetLocator xmlSchemaValidateSetLocator__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_SCHEMAS_ENABLED) #ifdef bottom_xmlschemas #undef xmlSchemaValidateStream @@ -11713,6 +11863,18 @@ extern __typeof (xmlTextReaderRelaxNGValidate) xmlTextReaderRelaxNGValidate__int #endif #endif +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderRelaxNGValidateCtxt +extern __typeof (xmlTextReaderRelaxNGValidateCtxt) xmlTextReaderRelaxNGValidateCtxt __attribute((alias("xmlTextReaderRelaxNGValidateCtxt__internal_alias"))); +#else +#ifndef xmlTextReaderRelaxNGValidateCtxt +extern __typeof (xmlTextReaderRelaxNGValidateCtxt) xmlTextReaderRelaxNGValidateCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderRelaxNGValidateCtxt xmlTextReaderRelaxNGValidateCtxt__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) #ifdef bottom_xmlreader #undef xmlTextReaderSchemaValidate @@ -12001,6 +12163,18 @@ extern __typeof (xmlTextWriterSetIndentString) xmlTextWriterSetIndentString__int #endif #endif +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterSetQuoteChar +extern __typeof (xmlTextWriterSetQuoteChar) xmlTextWriterSetQuoteChar __attribute((alias("xmlTextWriterSetQuoteChar__internal_alias"))); +#else +#ifndef xmlTextWriterSetQuoteChar +extern __typeof (xmlTextWriterSetQuoteChar) xmlTextWriterSetQuoteChar__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterSetQuoteChar xmlTextWriterSetQuoteChar__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_WRITER_ENABLED) #ifdef bottom_xmlwriter #undef xmlTextWriterStartAttribute diff --git a/lib/3rdparty/libxml2/enc.h b/lib/3rdparty/libxml2/enc.h index 91977604414..057d206df8a 100644 --- a/lib/3rdparty/libxml2/enc.h +++ b/lib/3rdparty/libxml2/enc.h @@ -21,7 +21,7 @@ extern "C" { int xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out, xmlBufferPtr in, int len); int xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len); -int xmlCharEncInput(xmlParserInputBufferPtr input); +int xmlCharEncInput(xmlParserInputBufferPtr input, int flush); int xmlCharEncOutput(xmlOutputBufferPtr output, int init); #ifdef __cplusplus diff --git a/lib/3rdparty/libxml2/encoding.c b/lib/3rdparty/libxml2/encoding.c index 87b1d9b84fe..7330e9082a5 100644 --- a/lib/3rdparty/libxml2/encoding.c +++ b/lib/3rdparty/libxml2/encoding.c @@ -1517,6 +1517,8 @@ xmlGetCharEncodingHandler(xmlCharEncoding enc) { if (handler != NULL) return(handler); handler = xmlFindCharEncodingHandler("EBCDIC-US"); if (handler != NULL) return(handler); + handler = xmlFindCharEncodingHandler("IBM-037"); + if (handler != NULL) return(handler); break; case XML_CHAR_ENCODING_UCS4BE: handler = xmlFindCharEncodingHandler("ISO-10646-UCS-4"); @@ -2161,6 +2163,7 @@ xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len) /** * xmlCharEncInput: * @input: a parser input buffer + * @flush: try to flush all the raw buffer * * Generic front-end for the encoding handler on parser input * @@ -2170,7 +2173,7 @@ xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len) * the result of transformation can't fit into the encoding we want), or */ int -xmlCharEncInput(xmlParserInputBufferPtr input) +xmlCharEncInput(xmlParserInputBufferPtr input, int flush) { int ret = -2; size_t written; @@ -2189,7 +2192,7 @@ xmlCharEncInput(xmlParserInputBufferPtr input) toconv = xmlBufUse(in); if (toconv == 0) return (0); - if (toconv > 64 * 1024) + if ((toconv > 64 * 1024) && (flush == 0)) toconv = 64 * 1024; written = xmlBufAvail(out); if (written > 0) @@ -2200,7 +2203,7 @@ xmlCharEncInput(xmlParserInputBufferPtr input) if (written > 0) written--; /* count '\0' */ } - if (written > 128 * 1024) + if ((written > 128 * 1024) && (flush == 0)) written = 128 * 1024; c_in = toconv; diff --git a/lib/3rdparty/libxml2/genUnicode.py b/lib/3rdparty/libxml2/genUnicode.py deleted file mode 100644 index 56e4e9ba2ab..00000000000 --- a/lib/3rdparty/libxml2/genUnicode.py +++ /dev/null @@ -1,478 +0,0 @@ -#!/usr/bin/python -u -# -# Original script modified in November 2003 to take advantage of -# the character-validation range routines, and updated to the -# current Unicode information (Version 4.0.1) -# -# NOTE: there is an 'alias' facility for blocks which are not present in -# the current release, but are needed for ABI compatibility. This -# must be accomplished MANUALLY! Please see the comments below under -# 'blockAliases' -# -import sys -import string -import time - -webpage = "http://www.unicode.org/Public/4.0-Update1/UCD-4.0.1.html" -sources = "Blocks-4.0.1.txt UnicodeData-4.0.1.txt" - -# -# blockAliases is a small hack - it is used for mapping block names which -# were were used in the 3.1 release, but are missing or changed in the current -# release. The format is "OldBlockName:NewBlockName1[,NewBlockName2[,...]]" -blockAliases = [] -blockAliases.append("CombiningMarksforSymbols:CombiningDiacriticalMarksforSymbols") -blockAliases.append("Greek:GreekandCoptic") -blockAliases.append("PrivateUse:PrivateUseArea,SupplementaryPrivateUseArea-A," + - "SupplementaryPrivateUseArea-B") - -# minTableSize gives the minimum number of ranges which must be present -# before a range table is produced. If there are less than this -# number, inline comparisons are generated -minTableSize = 8 - -(blockfile, catfile) = string.split(sources) - - -# -# Now process the "blocks" file, reducing it to a dictionary -# indexed by blockname, containing a tuple with the applicable -# block range -# -BlockNames = {} -try: - blocks = open(blockfile, "r") -except: - print "Missing %s, aborting ..." % blockfile - sys.exit(1) - -for line in blocks.readlines(): - if line[0] == '#': - continue - line = string.strip(line) - if line == '': - continue - try: - fields = string.split(line, ';') - range = string.strip(fields[0]) - (start, end) = string.split(range, "..") - name = string.strip(fields[1]) - name = string.replace(name, ' ', '') - except: - print "Failed to process line: %s" % (line) - continue - start = "0x" + start - end = "0x" + end - try: - BlockNames[name].append((start, end)) - except: - BlockNames[name] = [(start, end)] -blocks.close() -print "Parsed %d blocks descriptions" % (len(BlockNames.keys())) - -for block in blockAliases: - alias = string.split(block,':') - alist = string.split(alias[1],',') - for comp in alist: - if BlockNames.has_key(comp): - if alias[0] not in BlockNames: - BlockNames[alias[0]] = [] - for r in BlockNames[comp]: - BlockNames[alias[0]].append(r) - else: - print "Alias %s: %s not in Blocks" % (alias[0], comp) - continue - -# -# Next process the Categories file. This is more complex, since -# the file is in code sequence, and we need to invert it. We use -# a dictionary with index category-name, with each entry containing -# all the ranges (codepoints) of that category. Note that category -# names comprise two parts - the general category, and the "subclass" -# within that category. Therefore, both "general category" (which is -# the first character of the 2-character category-name) and the full -# (2-character) name are entered into this dictionary. -# -try: - data = open(catfile, "r") -except: - print "Missing %s, aborting ..." % catfile - sys.exit(1) - -nbchar = 0; -Categories = {} -for line in data.readlines(): - if line[0] == '#': - continue - line = string.strip(line) - if line == '': - continue - try: - fields = string.split(line, ';') - point = string.strip(fields[0]) - value = 0 - while point != '': - value = value * 16 - if point[0] >= '0' and point[0] <= '9': - value = value + ord(point[0]) - ord('0') - elif point[0] >= 'A' and point[0] <= 'F': - value = value + 10 + ord(point[0]) - ord('A') - elif point[0] >= 'a' and point[0] <= 'f': - value = value + 10 + ord(point[0]) - ord('a') - point = point[1:] - name = fields[2] - except: - print "Failed to process line: %s" % (line) - continue - - nbchar = nbchar + 1 - # update entry for "full name" - try: - Categories[name].append(value) - except: - try: - Categories[name] = [value] - except: - print "Failed to process line: %s" % (line) - # update "general category" name - try: - Categories[name[0]].append(value) - except: - try: - Categories[name[0]] = [value] - except: - print "Failed to process line: %s" % (line) - -blocks.close() -print "Parsed %d char generating %d categories" % (nbchar, len(Categories.keys())) - -# -# The data is now all read. Time to process it into a more useful form. -# -# reduce the number list into ranges -for cat in Categories.keys(): - list = Categories[cat] - start = -1 - prev = -1 - end = -1 - ranges = [] - for val in list: - if start == -1: - start = val - prev = val - continue - elif val == prev + 1: - prev = val - continue - elif prev == start: - ranges.append((prev, prev)) - start = val - prev = val - continue - else: - ranges.append((start, prev)) - start = val - prev = val - continue - if prev == start: - ranges.append((prev, prev)) - else: - ranges.append((start, prev)) - Categories[cat] = ranges - -# -# Assure all data is in alphabetic order, since we will be doing binary -# searches on the tables. -# -bkeys = BlockNames.keys() -bkeys.sort() - -ckeys = Categories.keys() -ckeys.sort() - -# -# Generate the resulting files -# -try: - header = open("include/libxml/xmlunicode.h", "w") -except: - print "Failed to open include/libxml/xmlunicode.h" - sys.exit(1) - -try: - output = open("xmlunicode.c", "w") -except: - print "Failed to open xmlunicode.c" - sys.exit(1) - -date = time.asctime(time.localtime(time.time())) - -header.write( -"""/* - * Summary: Unicode character APIs - * Description: API for the Unicode character APIs - * - * This file is automatically generated from the - * UCS description files of the Unicode Character Database - * %s - * using the genUnicode.py Python script. - * - * Generation date: %s - * Sources: %s - * Author: Daniel Veillard - */ - -#ifndef __XML_UNICODE_H__ -#define __XML_UNICODE_H__ - -#include - -#ifdef LIBXML_UNICODE_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -""" % (webpage, date, sources)); - -output.write( -"""/* - * xmlunicode.c: this module implements the Unicode character APIs - * - * This file is automatically generated from the - * UCS description files of the Unicode Character Database - * %s - * using the genUnicode.py Python script. - * - * Generation date: %s - * Sources: %s - * Daniel Veillard - */ - -#define IN_LIBXML -#include "libxml.h" - -#ifdef LIBXML_UNICODE_ENABLED - -#include -#include -#include -#include - -typedef int (xmlIntFunc)(int); /* just to keep one's mind untwisted */ - -typedef struct { - const char *rangename; - xmlIntFunc *func; -} xmlUnicodeRange; - -typedef struct { - xmlUnicodeRange *table; - int numentries; -} xmlUnicodeNameTable; - - -static xmlIntFunc *xmlUnicodeLookup(xmlUnicodeNameTable *tptr, const char *tname); - -static xmlUnicodeRange xmlUnicodeBlocks[] = { -""" % (webpage, date, sources)); - -flag = 0 -for block in bkeys: - name = string.replace(block, '-', '') - if flag: - output.write(',\n') - else: - flag = 1 - output.write(' {"%s", xmlUCSIs%s}' % (block, name)) -output.write('};\n\n') - -output.write('static xmlUnicodeRange xmlUnicodeCats[] = {\n') -flag = 0; -for name in ckeys: - if flag: - output.write(',\n') - else: - flag = 1 - output.write(' {"%s", xmlUCSIsCat%s}' % (name, name)) -output.write('};\n\n') - -# -# For any categories with more than minTableSize ranges we generate -# a range table suitable for xmlCharInRange -# -for name in ckeys: - if len(Categories[name]) > minTableSize: - numshort = 0 - numlong = 0 - ranges = Categories[name] - sptr = "NULL" - lptr = "NULL" - for range in ranges: - (low, high) = range - if high < 0x10000: - if numshort == 0: - pline = "static const xmlChSRange xml%sS[] = {" % name - sptr = "xml%sS" % name - else: - pline += ", " - numshort += 1 - else: - if numlong == 0: - if numshort > 0: - output.write(pline + " };\n") - pline = "static const xmlChLRange xml%sL[] = {" % name - lptr = "xml%sL" % name - else: - pline += ", " - numlong += 1 - if len(pline) > 60: - output.write(pline + "\n") - pline = " " - pline += "{%s, %s}" % (hex(low), hex(high)) - output.write(pline + " };\nstatic xmlChRangeGroup xml%sG = {%s,%s,%s,%s};\n\n" - % (name, numshort, numlong, sptr, lptr)) - - -output.write( -"""static xmlUnicodeNameTable xmlUnicodeBlockTbl = {xmlUnicodeBlocks, %s}; -static xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, %s}; - -/** - * xmlUnicodeLookup: - * @tptr: pointer to the name table - * @name: name to be found - * - * binary table lookup for user-supplied name - * - * Returns pointer to range function if found, otherwise NULL - */ -static xmlIntFunc -*xmlUnicodeLookup(xmlUnicodeNameTable *tptr, const char *tname) { - int low, high, mid, cmp; - xmlUnicodeRange *sptr; - - if ((tptr == NULL) || (tname == NULL)) return(NULL); - - low = 0; - high = tptr->numentries - 1; - sptr = tptr->table; - while (low <= high) { - mid = (low + high) / 2; - if ((cmp=strcmp(tname, sptr[mid].rangename)) == 0) - return (sptr[mid].func); - if (cmp < 0) - high = mid - 1; - else - low = mid + 1; - } - return (NULL); -} - -""" % (len(BlockNames), len(Categories)) ) - -for block in bkeys: - name = string.replace(block, '-', '') - header.write("XMLPUBFUN int XMLCALL xmlUCSIs%s\t(int code);\n" % name) - output.write("/**\n * xmlUCSIs%s:\n * @code: UCS code point\n" % (name)) - output.write(" *\n * Check whether the character is part of %s UCS Block\n"% - (block)) - output.write(" *\n * Returns 1 if true 0 otherwise\n */\n"); - output.write("int\nxmlUCSIs%s(int code) {\n return(" % name) - flag = 0 - for (start, end) in BlockNames[block]: - if flag: - output.write(" ||\n ") - else: - flag = 1 - output.write("((code >= %s) && (code <= %s))" % (start, end)) - output.write(");\n}\n\n") - -header.write("\nXMLPUBFUN int XMLCALL xmlUCSIsBlock\t(int code, const char *block);\n\n") -output.write( -"""/** - * xmlUCSIsBlock: - * @code: UCS code point - * @block: UCS block name - * - * Check whether the character is part of the UCS Block - * - * Returns 1 if true, 0 if false and -1 on unknown block - */ -int -xmlUCSIsBlock(int code, const char *block) { - xmlIntFunc *func; - - func = xmlUnicodeLookup(&xmlUnicodeBlockTbl, block); - if (func == NULL) - return (-1); - return (func(code)); -} - -""") - -for name in ckeys: - ranges = Categories[name] - header.write("XMLPUBFUN int XMLCALL xmlUCSIsCat%s\t(int code);\n" % name) - output.write("/**\n * xmlUCSIsCat%s:\n * @code: UCS code point\n" % (name)) - output.write(" *\n * Check whether the character is part of %s UCS Category\n"% - (name)) - output.write(" *\n * Returns 1 if true 0 otherwise\n */\n"); - output.write("int\nxmlUCSIsCat%s(int code) {\n" % name) - if len(Categories[name]) > minTableSize: - output.write(" return(xmlCharInRange((unsigned int)code, &xml%sG)" - % name) - else: - start = 1 - for range in ranges: - (begin, end) = range; - if start: - output.write(" return("); - start = 0 - else: - output.write(" ||\n "); - if (begin == end): - output.write("(code == %s)" % (hex(begin))) - else: - output.write("((code >= %s) && (code <= %s))" % ( - hex(begin), hex(end))) - output.write(");\n}\n\n") - -header.write("\nXMLPUBFUN int XMLCALL xmlUCSIsCat\t(int code, const char *cat);\n") -output.write( -"""/** - * xmlUCSIsCat: - * @code: UCS code point - * @cat: UCS Category name - * - * Check whether the character is part of the UCS Category - * - * Returns 1 if true, 0 if false and -1 on unknown category - */ -int -xmlUCSIsCat(int code, const char *cat) { - xmlIntFunc *func; - - func = xmlUnicodeLookup(&xmlUnicodeCatTbl, cat); - if (func == NULL) - return (-1); - return (func(code)); -} - -#define bottom_xmlunicode -#include "elfgcchack.h" -#endif /* LIBXML_UNICODE_ENABLED */ -""") - -header.write(""" -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_UNICODE_ENABLED */ - -#endif /* __XML_UNICODE_H__ */ -"""); - -header.close() -output.close() diff --git a/lib/3rdparty/libxml2/gentest.py b/lib/3rdparty/libxml2/gentest.py deleted file mode 100644 index f1786205020..00000000000 --- a/lib/3rdparty/libxml2/gentest.py +++ /dev/null @@ -1,963 +0,0 @@ -#!/usr/bin/python -u -# -# generate a tester program for the API -# -import sys -import os -import string -try: - import libxml2 -except: - print "libxml2 python bindings not available, skipping testapi.c generation" - sys.exit(0) - -if len(sys.argv) > 1: - srcPref = sys.argv[1] + '/' -else: - srcPref = '' - -# -# Modules we want to skip in API test -# -skipped_modules = [ "SAX", "xlink", "threads", "globals", - "xmlmemory", "xmlversion", "xmlexports", - #deprecated - "DOCBparser", -] - -# -# defines for each module -# -modules_defines = { - "HTMLparser": "LIBXML_HTML_ENABLED", - "catalog": "LIBXML_CATALOG_ENABLED", - "xmlreader": "LIBXML_READER_ENABLED", - "relaxng": "LIBXML_SCHEMAS_ENABLED", - "schemasInternals": "LIBXML_SCHEMAS_ENABLED", - "xmlschemas": "LIBXML_SCHEMAS_ENABLED", - "xmlschemastypes": "LIBXML_SCHEMAS_ENABLED", - "xpath": "LIBXML_XPATH_ENABLED", - "xpathInternals": "LIBXML_XPATH_ENABLED", - "xinclude": "LIBXML_XINCLUDE_ENABLED", - "xpointer": "LIBXML_XPTR_ENABLED", - "xmlregexp" : "LIBXML_REGEXP_ENABLED", - "xmlautomata" : "LIBXML_AUTOMATA_ENABLED", - "xmlsave" : "LIBXML_OUTPUT_ENABLED", - "DOCBparser" : "LIBXML_DOCB_ENABLED", - "xmlmodule" : "LIBXML_MODULES_ENABLED", - "pattern" : "LIBXML_PATTERN_ENABLED", - "schematron" : "LIBXML_SCHEMATRON_ENABLED", -} - -# -# defines for specific functions -# -function_defines = { - "htmlDefaultSAXHandlerInit": "LIBXML_HTML_ENABLED", - "xmlSAX2EndElement" : "LIBXML_SAX1_ENABLED", - "xmlSAX2StartElement" : "LIBXML_SAX1_ENABLED", - "xmlSAXDefaultVersion" : "LIBXML_SAX1_ENABLED", - "UTF8Toisolat1" : "LIBXML_OUTPUT_ENABLED", - "xmlCleanupPredefinedEntities": "LIBXML_LEGACY_ENABLED", - "xmlInitializePredefinedEntities": "LIBXML_LEGACY_ENABLED", - "xmlSetFeature": "LIBXML_LEGACY_ENABLED", - "xmlGetFeature": "LIBXML_LEGACY_ENABLED", - "xmlGetFeaturesList": "LIBXML_LEGACY_ENABLED", - "xmlIOParseDTD": "LIBXML_VALID_ENABLED", - "xmlParseDTD": "LIBXML_VALID_ENABLED", - "xmlParseDoc": "LIBXML_SAX1_ENABLED", - "xmlParseMemory": "LIBXML_SAX1_ENABLED", - "xmlRecoverDoc": "LIBXML_SAX1_ENABLED", - "xmlParseFile": "LIBXML_SAX1_ENABLED", - "xmlRecoverFile": "LIBXML_SAX1_ENABLED", - "xmlRecoverMemory": "LIBXML_SAX1_ENABLED", - "xmlSAXParseFileWithData": "LIBXML_SAX1_ENABLED", - "xmlSAXParseMemory": "LIBXML_SAX1_ENABLED", - "xmlSAXUserParseMemory": "LIBXML_SAX1_ENABLED", - "xmlSAXParseDoc": "LIBXML_SAX1_ENABLED", - "xmlSAXParseDTD": "LIBXML_SAX1_ENABLED", - "xmlSAXUserParseFile": "LIBXML_SAX1_ENABLED", - "xmlParseEntity": "LIBXML_SAX1_ENABLED", - "xmlParseExternalEntity": "LIBXML_SAX1_ENABLED", - "xmlSAXParseMemoryWithData": "LIBXML_SAX1_ENABLED", - "xmlParseBalancedChunkMemory": "LIBXML_SAX1_ENABLED", - "xmlParseBalancedChunkMemoryRecover": "LIBXML_SAX1_ENABLED", - "xmlSetupParserForBuffer": "LIBXML_SAX1_ENABLED", - "xmlStopParser": "LIBXML_PUSH_ENABLED", - "xmlAttrSerializeTxtContent": "LIBXML_OUTPUT_ENABLED", - "xmlSAXParseFile": "LIBXML_SAX1_ENABLED", - "xmlSAXParseEntity": "LIBXML_SAX1_ENABLED", - "xmlNewTextChild": "LIBXML_TREE_ENABLED", - "xmlNewDocRawNode": "LIBXML_TREE_ENABLED", - "xmlNewProp": "LIBXML_TREE_ENABLED", - "xmlReconciliateNs": "LIBXML_TREE_ENABLED", - "xmlValidateNCName": "LIBXML_TREE_ENABLED", - "xmlValidateNMToken": "LIBXML_TREE_ENABLED", - "xmlValidateName": "LIBXML_TREE_ENABLED", - "xmlNewChild": "LIBXML_TREE_ENABLED", - "xmlValidateQName": "LIBXML_TREE_ENABLED", - "xmlSprintfElementContent": "LIBXML_OUTPUT_ENABLED", - "xmlValidGetPotentialChildren" : "LIBXML_VALID_ENABLED", - "xmlValidGetValidElements" : "LIBXML_VALID_ENABLED", - "docbDefaultSAXHandlerInit" : "LIBXML_DOCB_ENABLED", - "xmlTextReaderPreservePattern" : "LIBXML_PATTERN_ENABLED", -} - -# -# Some functions really need to be skipped for the tests. -# -skipped_functions = [ -# block on I/O -"xmlFdRead", "xmlReadFd", "xmlCtxtReadFd", -"htmlFdRead", "htmlReadFd", "htmlCtxtReadFd", -"xmlReaderNewFd", "xmlReaderForFd", -"xmlIORead", "xmlReadIO", "xmlCtxtReadIO", -"htmlIORead", "htmlReadIO", "htmlCtxtReadIO", -"xmlReaderNewIO", "xmlBufferDump", "xmlNanoFTPConnect", -"xmlNanoFTPConnectTo", "xmlNanoHTTPMethod", "xmlNanoHTTPMethodRedir", -# Complex I/O APIs -"xmlCreateIOParserCtxt", "xmlParserInputBufferCreateIO", -"xmlRegisterInputCallbacks", "xmlReaderForIO", -"xmlOutputBufferCreateIO", "xmlRegisterOutputCallbacks", -"xmlSaveToIO", "xmlIOHTTPOpenW", -# library state cleanup, generate false leak informations and other -# troubles, heavillyb tested otherwise. -"xmlCleanupParser", "xmlRelaxNGCleanupTypes", "xmlSetListDoc", -"xmlSetTreeDoc", "xmlUnlinkNode", -# hard to avoid leaks in the tests -"xmlStrcat", "xmlStrncat", "xmlCatalogAddLocal", "xmlNewTextWriterDoc", -"xmlXPathNewValueTree", "xmlXPathWrapString", -# unimplemented -"xmlTextReaderReadInnerXml", "xmlTextReaderReadOuterXml", -"xmlTextReaderReadString", -# destructor -"xmlListDelete", "xmlOutputBufferClose", "xmlNanoFTPClose", "xmlNanoHTTPClose", -# deprecated -"xmlCatalogGetPublic", "xmlCatalogGetSystem", "xmlEncodeEntities", -"xmlNewGlobalNs", "xmlHandleEntity", "xmlNamespaceParseNCName", -"xmlNamespaceParseNSDef", "xmlNamespaceParseQName", -"xmlParseNamespace", "xmlParseQuotedString", "xmlParserHandleReference", -"xmlScanName", -"xmlDecodeEntities", -# allocators -"xmlMemFree", -# verbosity -"xmlCatalogSetDebug", "xmlShellPrintXPathError", "xmlShellPrintNode", -# Internal functions, no user space should really call them -"xmlParseAttribute", "xmlParseAttributeListDecl", "xmlParseName", -"xmlParseNmtoken", "xmlParseEntityValue", "xmlParseAttValue", -"xmlParseSystemLiteral", "xmlParsePubidLiteral", "xmlParseCharData", -"xmlParseExternalID", "xmlParseComment", "xmlParsePITarget", "xmlParsePI", -"xmlParseNotationDecl", "xmlParseEntityDecl", "xmlParseDefaultDecl", -"xmlParseNotationType", "xmlParseEnumerationType", "xmlParseEnumeratedType", -"xmlParseAttributeType", "xmlParseAttributeListDecl", -"xmlParseElementMixedContentDecl", "xmlParseElementChildrenContentDecl", -"xmlParseElementContentDecl", "xmlParseElementDecl", "xmlParseMarkupDecl", -"xmlParseCharRef", "xmlParseEntityRef", "xmlParseReference", -"xmlParsePEReference", "xmlParseDocTypeDecl", "xmlParseAttribute", -"xmlParseStartTag", "xmlParseEndTag", "xmlParseCDSect", "xmlParseContent", -"xmlParseElement", "xmlParseVersionNum", "xmlParseVersionInfo", -"xmlParseEncName", "xmlParseEncodingDecl", "xmlParseSDDecl", -"xmlParseXMLDecl", "xmlParseTextDecl", "xmlParseMisc", -"xmlParseExternalSubset", "xmlParserHandlePEReference", -"xmlSkipBlankChars", -] - -# -# These functions have side effects on the global state -# and hence generate errors on memory allocation tests -# -skipped_memcheck = [ "xmlLoadCatalog", "xmlAddEncodingAlias", - "xmlSchemaInitTypes", "xmlNanoFTPProxy", "xmlNanoFTPScanProxy", - "xmlNanoHTTPScanProxy", "xmlResetLastError", "xmlCatalogConvert", - "xmlCatalogRemove", "xmlLoadCatalogs", "xmlCleanupCharEncodingHandlers", - "xmlInitCharEncodingHandlers", "xmlCatalogCleanup", - "xmlSchemaGetBuiltInType", - "htmlParseFile", "htmlCtxtReadFile", # loads the catalogs - "xmlTextReaderSchemaValidate", "xmlSchemaCleanupTypes", # initialize the schemas type system - "xmlCatalogResolve", "xmlIOParseDTD" # loads the catalogs -] - -# -# Extra code needed for some test cases -# -extra_pre_call = { - "xmlSAXUserParseFile": """ -#ifdef LIBXML_SAX1_ENABLED - if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; -#endif -""", - "xmlSAXUserParseMemory": """ -#ifdef LIBXML_SAX1_ENABLED - if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; -#endif -""", - "xmlParseBalancedChunkMemory": """ -#ifdef LIBXML_SAX1_ENABLED - if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; -#endif -""", - "xmlParseBalancedChunkMemoryRecover": """ -#ifdef LIBXML_SAX1_ENABLED - if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; -#endif -""", - "xmlParserInputBufferCreateFd": - "if (fd >= 0) fd = -1;", -} -extra_post_call = { - "xmlAddChild": - "if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }", - "xmlAddEntity": - "if (ret_val != NULL) { xmlFreeNode(ret_val) ; ret_val = NULL; }", - "xmlAddChildList": - "if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }", - "xmlAddSibling": - "if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }", - "xmlAddNextSibling": - "if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }", - "xmlAddPrevSibling": - "if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }", - "xmlDocSetRootElement": - "if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }", - "xmlReplaceNode": - """if (cur != NULL) { - xmlUnlinkNode(cur); - xmlFreeNode(cur) ; cur = NULL ; } - if (old != NULL) { - xmlUnlinkNode(old); - xmlFreeNode(old) ; old = NULL ; } - ret_val = NULL;""", - "xmlTextMerge": - """if ((first != NULL) && (first->type != XML_TEXT_NODE)) { - xmlUnlinkNode(second); - xmlFreeNode(second) ; second = NULL ; }""", - "xmlBuildQName": - """if ((ret_val != NULL) && (ret_val != ncname) && - (ret_val != prefix) && (ret_val != memory)) - xmlFree(ret_val); - ret_val = NULL;""", - "xmlNewDocElementContent": - """xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;""", - "xmlDictReference": "xmlDictFree(dict);", - # Functions which deallocates one of their parameters - "xmlXPathConvertBoolean": """val = NULL;""", - "xmlXPathConvertNumber": """val = NULL;""", - "xmlXPathConvertString": """val = NULL;""", - "xmlSaveFileTo": """buf = NULL;""", - "xmlSaveFormatFileTo": """buf = NULL;""", - "xmlIOParseDTD": "input = NULL;", - "xmlRemoveProp": "cur = NULL;", - "xmlNewNs": "if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);", - "xmlCopyNamespace": "if (ret_val != NULL) xmlFreeNs(ret_val);", - "xmlCopyNamespaceList": "if (ret_val != NULL) xmlFreeNsList(ret_val);", - "xmlNewTextWriter": "if (ret_val != NULL) out = NULL;", - "xmlNewTextWriterPushParser": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;", - "xmlNewIOInputStream": "if (ret_val != NULL) input = NULL;", - "htmlParseChunk": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}", - "htmlParseDocument": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}", - "xmlParseDocument": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}", - "xmlParseChunk": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}", - "xmlParseExtParsedEnt": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}", - "xmlDOMWrapAdoptNode": "if ((node != NULL) && (node->parent == NULL)) {xmlUnlinkNode(node);xmlFreeNode(node);node = NULL;}", - "xmlBufferSetAllocationScheme": "if ((buf != NULL) && (scheme == XML_BUFFER_ALLOC_IMMUTABLE) && (buf->content != NULL) && (buf->content != static_buf_content)) { xmlFree(buf->content); buf->content = NULL;}" -} - -modules = [] - -def is_skipped_module(name): - for mod in skipped_modules: - if mod == name: - return 1 - return 0 - -def is_skipped_function(name): - for fun in skipped_functions: - if fun == name: - return 1 - # Do not test destructors - if string.find(name, 'Free') != -1: - return 1 - return 0 - -def is_skipped_memcheck(name): - for fun in skipped_memcheck: - if fun == name: - return 1 - return 0 - -missing_types = {} -def add_missing_type(name, func): - try: - list = missing_types[name] - list.append(func) - except: - missing_types[name] = [func] - -generated_param_types = [] -def add_generated_param_type(name): - generated_param_types.append(name) - -generated_return_types = [] -def add_generated_return_type(name): - generated_return_types.append(name) - -missing_functions = {} -missing_functions_nr = 0 -def add_missing_functions(name, module): - global missing_functions_nr - - missing_functions_nr = missing_functions_nr + 1 - try: - list = missing_functions[module] - list.append(name) - except: - missing_functions[module] = [name] - -# -# Provide the type generators and destructors for the parameters -# - -def type_convert(str, name, info, module, function, pos): -# res = string.replace(str, " ", " ") -# res = string.replace(str, " ", " ") -# res = string.replace(str, " ", " ") - res = string.replace(str, " *", "_ptr") -# res = string.replace(str, "*", "_ptr") - res = string.replace(res, " ", "_") - if res == 'const_char_ptr': - if string.find(name, "file") != -1 or \ - string.find(name, "uri") != -1 or \ - string.find(name, "URI") != -1 or \ - string.find(info, "filename") != -1 or \ - string.find(info, "URI") != -1 or \ - string.find(info, "URL") != -1: - if string.find(function, "Save") != -1 or \ - string.find(function, "Create") != -1 or \ - string.find(function, "Write") != -1 or \ - string.find(function, "Fetch") != -1: - return('fileoutput') - return('filepath') - if res == 'void_ptr': - if module == 'nanoftp' and name == 'ctx': - return('xmlNanoFTPCtxtPtr') - if function == 'xmlNanoFTPNewCtxt' or \ - function == 'xmlNanoFTPConnectTo' or \ - function == 'xmlNanoFTPOpen': - return('xmlNanoFTPCtxtPtr') - if module == 'nanohttp' and name == 'ctx': - return('xmlNanoHTTPCtxtPtr') - if function == 'xmlNanoHTTPMethod' or \ - function == 'xmlNanoHTTPMethodRedir' or \ - function == 'xmlNanoHTTPOpen' or \ - function == 'xmlNanoHTTPOpenRedir': - return('xmlNanoHTTPCtxtPtr'); - if function == 'xmlIOHTTPOpen': - return('xmlNanoHTTPCtxtPtr') - if string.find(name, "data") != -1: - return('userdata') - if string.find(name, "user") != -1: - return('userdata') - if res == 'xmlDoc_ptr': - res = 'xmlDocPtr' - if res == 'xmlNode_ptr': - res = 'xmlNodePtr' - if res == 'xmlDict_ptr': - res = 'xmlDictPtr' - if res == 'xmlNodePtr' and pos != 0: - if (function == 'xmlAddChild' and pos == 2) or \ - (function == 'xmlAddChildList' and pos == 2) or \ - (function == 'xmlAddNextSibling' and pos == 2) or \ - (function == 'xmlAddSibling' and pos == 2) or \ - (function == 'xmlDocSetRootElement' and pos == 2) or \ - (function == 'xmlReplaceNode' and pos == 2) or \ - (function == 'xmlTextMerge') or \ - (function == 'xmlAddPrevSibling' and pos == 2): - return('xmlNodePtr_in'); - if res == 'const xmlBufferPtr': - res = 'xmlBufferPtr' - if res == 'xmlChar_ptr' and name == 'name' and \ - string.find(function, "EatName") != -1: - return('eaten_name') - if res == 'void_ptr*': - res = 'void_ptr_ptr' - if res == 'char_ptr*': - res = 'char_ptr_ptr' - if res == 'xmlChar_ptr*': - res = 'xmlChar_ptr_ptr' - if res == 'const_xmlChar_ptr*': - res = 'const_xmlChar_ptr_ptr' - if res == 'const_char_ptr*': - res = 'const_char_ptr_ptr' - if res == 'FILE_ptr' and module == 'debugXML': - res = 'debug_FILE_ptr'; - if res == 'int' and name == 'options': - if module == 'parser' or module == 'xmlreader': - res = 'parseroptions' - - return res - -known_param_types = [] - -def is_known_param_type(name, rtype): - global test - for type in known_param_types: - if type == name: - return 1 - for type in generated_param_types: - if type == name: - return 1 - - if name[-3:] == 'Ptr' or name[-4:] == '_ptr': - if rtype[0:6] == 'const ': - crtype = rtype[6:] - else: - crtype = rtype - - define = 0 - if modules_defines.has_key(module): - test.write("#ifdef %s\n" % (modules_defines[module])) - define = 1 - test.write(""" -#define gen_nb_%s 1 -static %s gen_%s(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -""" % (name, crtype, name, name, rtype)) - if define == 1: - test.write("#endif\n\n") - add_generated_param_type(name) - return 1 - - return 0 - -# -# Provide the type destructors for the return values -# - -known_return_types = [] - -def is_known_return_type(name): - for type in known_return_types: - if type == name: - return 1 - return 0 - -# -# Copy the beginning of the C test program result -# - -try: - input = open("testapi.c", "r") -except: - input = open(srcPref + "testapi.c", "r") -test = open('testapi.c.new', 'w') - -def compare_and_save(): - global test - - test.close() - try: - input = open("testapi.c", "r").read() - except: - input = '' - test = open('testapi.c.new', "r").read() - if input != test: - try: - os.system("rm testapi.c; mv testapi.c.new testapi.c") - except: - os.system("mv testapi.c.new testapi.c") - print("Updated testapi.c") - else: - print("Generated testapi.c is identical") - -line = input.readline() -while line != "": - if line == "/* CUT HERE: everything below that line is generated */\n": - break; - if line[0:15] == "#define gen_nb_": - type = string.split(line[15:])[0] - known_param_types.append(type) - if line[0:19] == "static void desret_": - type = string.split(line[19:], '(')[0] - known_return_types.append(type) - test.write(line) - line = input.readline() -input.close() - -if line == "": - print "Could not find the CUT marker in testapi.c skipping generation" - test.close() - sys.exit(0) - -print("Scanned testapi.c: found %d parameters types and %d return types\n" % ( - len(known_param_types), len(known_return_types))) -test.write("/* CUT HERE: everything below that line is generated */\n") - - -# -# Open the input API description -# -doc = libxml2.readFile(srcPref + 'doc/libxml2-api.xml', None, 0) -if doc == None: - print "Failed to load doc/libxml2-api.xml" - sys.exit(1) -ctxt = doc.xpathNewContext() - -# -# Generate a list of all function parameters and select only -# those used in the api tests -# -argtypes = {} -args = ctxt.xpathEval("/api/symbols/function/arg") -for arg in args: - mod = arg.xpathEval('string(../@file)') - func = arg.xpathEval('string(../@name)') - if (mod not in skipped_modules) and (func not in skipped_functions): - type = arg.xpathEval('string(@type)') - if not argtypes.has_key(type): - argtypes[type] = func - -# similarly for return types -rettypes = {} -rets = ctxt.xpathEval("/api/symbols/function/return") -for ret in rets: - mod = ret.xpathEval('string(../@file)') - func = ret.xpathEval('string(../@name)') - if (mod not in skipped_modules) and (func not in skipped_functions): - type = ret.xpathEval('string(@type)') - if not rettypes.has_key(type): - rettypes[type] = func - -# -# Generate constructors and return type handling for all enums -# which are used as function parameters -# -enums = ctxt.xpathEval("/api/symbols/typedef[@type='enum']") -for enum in enums: - module = enum.xpathEval('string(@file)') - name = enum.xpathEval('string(@name)') - # - # Skip any enums which are not in our filtered lists - # - if (name == None) or ((name not in argtypes) and (name not in rettypes)): - continue; - define = 0 - - if argtypes.has_key(name) and is_known_param_type(name, name) == 0: - values = ctxt.xpathEval("/api/symbols/enum[@type='%s']" % name) - i = 0 - vals = [] - for value in values: - vname = value.xpathEval('string(@name)') - if vname == None: - continue; - i = i + 1 - if i >= 5: - break; - vals.append(vname) - if vals == []: - print "Didn't find any value for enum %s" % (name) - continue - if modules_defines.has_key(module): - test.write("#ifdef %s\n" % (modules_defines[module])) - define = 1 - test.write("#define gen_nb_%s %d\n" % (name, len(vals))) - test.write("""static %s gen_%s(int no, int nr ATTRIBUTE_UNUSED) {\n""" % - (name, name)) - i = 1 - for value in vals: - test.write(" if (no == %d) return(%s);\n" % (i, value)) - i = i + 1 - test.write(""" return(0); -} - -static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -""" % (name, name)); - known_param_types.append(name) - - if (is_known_return_type(name) == 0) and (name in rettypes): - if define == 0 and modules_defines.has_key(module): - test.write("#ifdef %s\n" % (modules_defines[module])) - define = 1 - test.write("""static void desret_%s(%s val ATTRIBUTE_UNUSED) { -} - -""" % (name, name)) - known_return_types.append(name) - if define == 1: - test.write("#endif\n\n") - -# -# Load the interfaces -# -headers = ctxt.xpathEval("/api/files/file") -for file in headers: - name = file.xpathEval('string(@name)') - if (name == None) or (name == ''): - continue - - # - # Some module may be skipped because they don't really consists - # of user callable APIs - # - if is_skipped_module(name): - continue - - # - # do not test deprecated APIs - # - desc = file.xpathEval('string(description)') - if string.find(desc, 'DEPRECATED') != -1: - print "Skipping deprecated interface %s" % name - continue; - - test.write("#include \n" % name) - modules.append(name) - -# -# Generate the callers signatures -# -for module in modules: - test.write("static int test_%s(void);\n" % module); - -# -# Generate the top caller -# - -test.write(""" -/** - * testlibxml2: - * - * Main entry point of the tester for the full libxml2 module, - * it calls all the tester entry point for each module. - * - * Returns the number of error found - */ -static int -testlibxml2(void) -{ - int test_ret = 0; - -""") - -for module in modules: - test.write(" test_ret += test_%s();\n" % module) - -test.write(""" - printf("Total: %d functions, %d tests, %d errors\\n", - function_tests, call_tests, test_ret); - return(test_ret); -} - -""") - -# -# How to handle a function -# -nb_tests = 0 - -def generate_test(module, node): - global test - global nb_tests - nb_cond = 0 - no_gen = 0 - - name = node.xpathEval('string(@name)') - if is_skipped_function(name): - return - - # - # check we know how to handle the args and return values - # and store the informations for the generation - # - try: - args = node.xpathEval("arg") - except: - args = [] - t_args = [] - n = 0 - for arg in args: - n = n + 1 - rtype = arg.xpathEval("string(@type)") - if rtype == 'void': - break; - info = arg.xpathEval("string(@info)") - nam = arg.xpathEval("string(@name)") - type = type_convert(rtype, nam, info, module, name, n) - if is_known_param_type(type, rtype) == 0: - add_missing_type(type, name); - no_gen = 1 - if (type[-3:] == 'Ptr' or type[-4:] == '_ptr') and \ - rtype[0:6] == 'const ': - crtype = rtype[6:] - else: - crtype = rtype - t_args.append((nam, type, rtype, crtype, info)) - - try: - rets = node.xpathEval("return") - except: - rets = [] - t_ret = None - for ret in rets: - rtype = ret.xpathEval("string(@type)") - info = ret.xpathEval("string(@info)") - type = type_convert(rtype, 'return', info, module, name, 0) - if rtype == 'void': - break - if is_known_return_type(type) == 0: - add_missing_type(type, name); - no_gen = 1 - t_ret = (type, rtype, info) - break - - test.write(""" -static int -test_%s(void) { - int test_ret = 0; - -""" % (name)) - - if no_gen == 1: - add_missing_functions(name, module) - test.write(""" - /* missing type support */ - return(test_ret); -} - -""") - return - - try: - conds = node.xpathEval("cond") - for cond in conds: - test.write("#if %s\n" % (cond.get_content())) - nb_cond = nb_cond + 1 - except: - pass - - define = 0 - if function_defines.has_key(name): - test.write("#ifdef %s\n" % (function_defines[name])) - define = 1 - - # Declare the memory usage counter - no_mem = is_skipped_memcheck(name) - if no_mem == 0: - test.write(" int mem_base;\n"); - - # Declare the return value - if t_ret != None: - test.write(" %s ret_val;\n" % (t_ret[1])) - - # Declare the arguments - for arg in t_args: - (nam, type, rtype, crtype, info) = arg; - # add declaration - test.write(" %s %s; /* %s */\n" % (crtype, nam, info)) - test.write(" int n_%s;\n" % (nam)) - test.write("\n") - - # Cascade loop on of each argument list of values - for arg in t_args: - (nam, type, rtype, crtype, info) = arg; - # - test.write(" for (n_%s = 0;n_%s < gen_nb_%s;n_%s++) {\n" % ( - nam, nam, type, nam)) - - # log the memory usage - if no_mem == 0: - test.write(" mem_base = xmlMemBlocks();\n"); - - # prepare the call - i = 0; - for arg in t_args: - (nam, type, rtype, crtype, info) = arg; - # - test.write(" %s = gen_%s(n_%s, %d);\n" % (nam, type, nam, i)) - i = i + 1; - - # do the call, and clanup the result - if extra_pre_call.has_key(name): - test.write(" %s\n"% (extra_pre_call[name])) - if t_ret != None: - test.write("\n ret_val = %s(" % (name)) - need = 0 - for arg in t_args: - (nam, type, rtype, crtype, info) = arg - if need: - test.write(", ") - else: - need = 1 - if rtype != crtype: - test.write("(%s)" % rtype) - test.write("%s" % nam); - test.write(");\n") - if extra_post_call.has_key(name): - test.write(" %s\n"% (extra_post_call[name])) - test.write(" desret_%s(ret_val);\n" % t_ret[0]) - else: - test.write("\n %s(" % (name)); - need = 0; - for arg in t_args: - (nam, type, rtype, crtype, info) = arg; - if need: - test.write(", ") - else: - need = 1 - if rtype != crtype: - test.write("(%s)" % rtype) - test.write("%s" % nam) - test.write(");\n") - if extra_post_call.has_key(name): - test.write(" %s\n"% (extra_post_call[name])) - - test.write(" call_tests++;\n"); - - # Free the arguments - i = 0; - for arg in t_args: - (nam, type, rtype, crtype, info) = arg; - # This is a hack to prevent generating a destructor for the - # 'input' argument in xmlTextReaderSetup. There should be - # a better, more generic way to do this! - if string.find(info, 'destroy') == -1: - test.write(" des_%s(n_%s, " % (type, nam)) - if rtype != crtype: - test.write("(%s)" % rtype) - test.write("%s, %d);\n" % (nam, i)) - i = i + 1; - - test.write(" xmlResetLastError();\n"); - # Check the memory usage - if no_mem == 0: - test.write(""" if (mem_base != xmlMemBlocks()) { - printf("Leak of %%d blocks found in %s", - xmlMemBlocks() - mem_base); - test_ret++; -""" % (name)); - for arg in t_args: - (nam, type, rtype, crtype, info) = arg; - test.write(""" printf(" %%d", n_%s);\n""" % (nam)) - test.write(""" printf("\\n");\n""") - test.write(" }\n") - - for arg in t_args: - test.write(" }\n") - - test.write(" function_tests++;\n") - # - # end of conditional - # - while nb_cond > 0: - test.write("#endif\n") - nb_cond = nb_cond -1 - if define == 1: - test.write("#endif\n") - - nb_tests = nb_tests + 1; - - test.write(""" - return(test_ret); -} - -""") - -# -# Generate all module callers -# -for module in modules: - # gather all the functions exported by that module - try: - functions = ctxt.xpathEval("/api/symbols/function[@file='%s']" % (module)) - except: - print "Failed to gather functions from module %s" % (module) - continue; - - # iterate over all functions in the module generating the test - i = 0 - nb_tests_old = nb_tests - for function in functions: - i = i + 1 - generate_test(module, function); - - # header - test.write("""static int -test_%s(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing %s : %d of %d functions ...\\n"); -""" % (module, module, nb_tests - nb_tests_old, i)) - - # iterate over all functions in the module generating the call - for function in functions: - name = function.xpathEval('string(@name)') - if is_skipped_function(name): - continue - test.write(" test_ret += test_%s();\n" % (name)) - - # footer - test.write(""" - if (test_ret != 0) - printf("Module %s: %%d errors\\n", test_ret); - return(test_ret); -} -""" % (module)) - -# -# Generate direct module caller -# -test.write("""static int -test_module(const char *module) { -"""); -for module in modules: - test.write(""" if (!strcmp(module, "%s")) return(test_%s());\n""" % ( - module, module)) -test.write(""" return(0); -} -"""); - -print "Generated test for %d modules and %d functions" %(len(modules), nb_tests) - -compare_and_save() - -missing_list = [] -for missing in missing_types.keys(): - if missing == 'va_list' or missing == '...': - continue; - - n = len(missing_types[missing]) - missing_list.append((n, missing)) - -def compare_missing(a, b): - return b[0] - a[0] - -missing_list.sort(compare_missing) -print "Missing support for %d functions and %d types see missing.lst" % (missing_functions_nr, len(missing_list)) -lst = open("missing.lst", "w") -lst.write("Missing support for %d types" % (len(missing_list))) -lst.write("\n") -for miss in missing_list: - lst.write("%s: %d :" % (miss[1], miss[0])) - i = 0 - for n in missing_types[miss[1]]: - i = i + 1 - if i > 5: - lst.write(" ...") - break - lst.write(" %s" % (n)) - lst.write("\n") -lst.write("\n") -lst.write("\n") -lst.write("Missing support per module"); -for module in missing_functions.keys(): - lst.write("module %s:\n %s\n" % (module, missing_functions[module])) - -lst.close() - - diff --git a/lib/3rdparty/libxml2/hash.c b/lib/3rdparty/libxml2/hash.c index afabcb1a0bc..0145109cb12 100644 --- a/lib/3rdparty/libxml2/hash.c +++ b/lib/3rdparty/libxml2/hash.c @@ -93,11 +93,13 @@ xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name, value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); } } + value = value ^ ((value << 5) + (value >> 3)); if (name2 != NULL) { while ((ch = *name2++) != 0) { value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); } } + value = value ^ ((value << 5) + (value >> 3)); if (name3 != NULL) { while ((ch = *name3++) != 0) { value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); @@ -133,6 +135,7 @@ xmlHashComputeQKey(xmlHashTablePtr table, value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); } } + value = value ^ ((value << 5) + (value >> 3)); if (prefix2 != NULL) { while ((ch = *prefix2++) != 0) { value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); @@ -144,6 +147,7 @@ xmlHashComputeQKey(xmlHashTablePtr table, value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); } } + value = value ^ ((value << 5) + (value >> 3)); if (prefix3 != NULL) { while ((ch = *prefix3++) != 0) { value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); diff --git a/lib/3rdparty/libxml2/include/Makefile.am b/lib/3rdparty/libxml2/include/Makefile.am deleted file mode 100644 index 7dbfaa5bb58..00000000000 --- a/lib/3rdparty/libxml2/include/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -## Process this file with automake to produce Makefile.in -SUBDIRS=libxml - -EXTRA_DIST = win32config.h wsockcompat.h - diff --git a/lib/3rdparty/libxml2/include/Makefile.in b/lib/3rdparty/libxml2/include/Makefile.in deleted file mode 100644 index a4bf4922b6f..00000000000 --- a/lib/3rdparty/libxml2/include/Makefile.in +++ /dev/null @@ -1,680 +0,0 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = include -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ - $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ - distdir -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BASE_THREAD_LIBS = @BASE_THREAD_LIBS@ -C14N_OBJ = @C14N_OBJ@ -CATALOG_OBJ = @CATALOG_OBJ@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -CYGWIN_EXTRA_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ -CYGWIN_EXTRA_PYTHON_LIBADD = @CYGWIN_EXTRA_PYTHON_LIBADD@ -DEBUG_OBJ = @DEBUG_OBJ@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DOCB_OBJ = @DOCB_OBJ@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -FTP_OBJ = @FTP_OBJ@ -GREP = @GREP@ -HAVE_ISINF = @HAVE_ISINF@ -HAVE_ISNAN = @HAVE_ISNAN@ -HTML_DIR = @HTML_DIR@ -HTML_OBJ = @HTML_OBJ@ -HTTP_OBJ = @HTTP_OBJ@ -ICONV_LIBS = @ICONV_LIBS@ -ICU_LIBS = @ICU_LIBS@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_MAJOR_VERSION = @LIBXML_MAJOR_VERSION@ -LIBXML_MICRO_VERSION = @LIBXML_MICRO_VERSION@ -LIBXML_MINOR_VERSION = @LIBXML_MINOR_VERSION@ -LIBXML_VERSION = @LIBXML_VERSION@ -LIBXML_VERSION_EXTRA = @LIBXML_VERSION_EXTRA@ -LIBXML_VERSION_INFO = @LIBXML_VERSION_INFO@ -LIBXML_VERSION_NUMBER = @LIBXML_VERSION_NUMBER@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LZMA_CFLAGS = @LZMA_CFLAGS@ -LZMA_LIBS = @LZMA_LIBS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -MODULE_EXTENSION = @MODULE_EXTENSION@ -MODULE_PLATFORM_LIBS = @MODULE_PLATFORM_LIBS@ -MV = @MV@ -M_LIBS = @M_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PYTHON = @PYTHON@ -PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ -PYTHON_SITE_PACKAGES = @PYTHON_SITE_PACKAGES@ -PYTHON_SUBDIR = @PYTHON_SUBDIR@ -PYTHON_TESTS = @PYTHON_TESTS@ -PYTHON_VERSION = @PYTHON_VERSION@ -RANLIB = @RANLIB@ -RDL_LIBS = @RDL_LIBS@ -READER_TEST = @READER_TEST@ -RELDATE = @RELDATE@ -RM = @RM@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STATIC_BINARIES = @STATIC_BINARIES@ -STRIP = @STRIP@ -TAR = @TAR@ -TEST_C14N = @TEST_C14N@ -TEST_CATALOG = @TEST_CATALOG@ -TEST_DEBUG = @TEST_DEBUG@ -TEST_HTML = @TEST_HTML@ -TEST_MODULES = @TEST_MODULES@ -TEST_PATTERN = @TEST_PATTERN@ -TEST_PHTML = @TEST_PHTML@ -TEST_PUSH = @TEST_PUSH@ -TEST_REGEXPS = @TEST_REGEXPS@ -TEST_SAX = @TEST_SAX@ -TEST_SCHEMAS = @TEST_SCHEMAS@ -TEST_SCHEMATRON = @TEST_SCHEMATRON@ -TEST_THREADS = @TEST_THREADS@ -TEST_VALID = @TEST_VALID@ -TEST_VTIME = @TEST_VTIME@ -TEST_XINCLUDE = @TEST_XINCLUDE@ -TEST_XPATH = @TEST_XPATH@ -TEST_XPTR = @TEST_XPTR@ -THREAD_CFLAGS = @THREAD_CFLAGS@ -THREAD_LIBS = @THREAD_LIBS@ -VERSION = @VERSION@ -VERSION_SCRIPT_FLAGS = @VERSION_SCRIPT_FLAGS@ -WGET = @WGET@ -WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ -WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ -WIN32_EXTRA_PYTHON_LIBADD = @WIN32_EXTRA_PYTHON_LIBADD@ -WITH_C14N = @WITH_C14N@ -WITH_CATALOG = @WITH_CATALOG@ -WITH_DEBUG = @WITH_DEBUG@ -WITH_DOCB = @WITH_DOCB@ -WITH_FTP = @WITH_FTP@ -WITH_HTML = @WITH_HTML@ -WITH_HTTP = @WITH_HTTP@ -WITH_ICONV = @WITH_ICONV@ -WITH_ICU = @WITH_ICU@ -WITH_ISO8859X = @WITH_ISO8859X@ -WITH_LEGACY = @WITH_LEGACY@ -WITH_LZMA = @WITH_LZMA@ -WITH_MEM_DEBUG = @WITH_MEM_DEBUG@ -WITH_MODULES = @WITH_MODULES@ -WITH_OUTPUT = @WITH_OUTPUT@ -WITH_PATTERN = @WITH_PATTERN@ -WITH_PUSH = @WITH_PUSH@ -WITH_READER = @WITH_READER@ -WITH_REGEXPS = @WITH_REGEXPS@ -WITH_RUN_DEBUG = @WITH_RUN_DEBUG@ -WITH_SAX1 = @WITH_SAX1@ -WITH_SCHEMAS = @WITH_SCHEMAS@ -WITH_SCHEMATRON = @WITH_SCHEMATRON@ -WITH_THREADS = @WITH_THREADS@ -WITH_TREE = @WITH_TREE@ -WITH_TRIO = @WITH_TRIO@ -WITH_VALID = @WITH_VALID@ -WITH_WRITER = @WITH_WRITER@ -WITH_XINCLUDE = @WITH_XINCLUDE@ -WITH_XPATH = @WITH_XPATH@ -WITH_XPTR = @WITH_XPTR@ -WITH_ZLIB = @WITH_ZLIB@ -XINCLUDE_OBJ = @XINCLUDE_OBJ@ -XMLLINT = @XMLLINT@ -XML_CFLAGS = @XML_CFLAGS@ -XML_INCLUDEDIR = @XML_INCLUDEDIR@ -XML_LIBDIR = @XML_LIBDIR@ -XML_LIBS = @XML_LIBS@ -XML_LIBTOOLLIBS = @XML_LIBTOOLLIBS@ -XPATH_OBJ = @XPATH_OBJ@ -XPTR_OBJ = @XPTR_OBJ@ -XSLTPROC = @XSLTPROC@ -Z_CFLAGS = @Z_CFLAGS@ -Z_LIBS = @Z_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythondir = @pythondir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -SUBDIRS = libxml -EXTRA_DIST = win32config.h wsockcompat.h -all: all-recursive - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu include/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -html-am: - -info: info-recursive - -info-am: - -install-data-am: - -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: - -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ - install-am install-strip tags-recursive - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am check check-am clean clean-generic clean-libtool \ - ctags ctags-recursive distclean distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ - uninstall uninstall-am - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/lib/3rdparty/libxml2/install-sh b/lib/3rdparty/libxml2/install-sh deleted file mode 100644 index a9244eb0786..00000000000 --- a/lib/3rdparty/libxml2/install-sh +++ /dev/null @@ -1,527 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2011-01-19.21; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -nl=' -' -IFS=" "" $nl" - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -no_target_directory= - -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) dst_arg=$2 - # Protect names problematic for `test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - shift;; - - -T) no_target_directory=true;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - # Protect names problematic for `test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - do_exit='(exit $ret); exit $ret' - trap "ret=129; $do_exit" 1 - trap "ret=130; $do_exit" 2 - trap "ret=141; $do_exit" 13 - trap "ret=143; $do_exit" 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names problematic for `test' and other utilities. - case $src in - -* | [=\(\)!]) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - dst=$dst_arg - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writeable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - [-=\(\)!]*) prefix='./';; - *) prefix='';; - esac - - eval "$initialize_posix_glob" - - oIFS=$IFS - IFS=/ - $posix_glob set -f - set fnord $dstdir - shift - $posix_glob set +f - IFS=$oIFS - - prefixes= - - for d - do - test X"$d" = X && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/lib/3rdparty/libxml2/libxml-2.0-uninstalled.pc.in b/lib/3rdparty/libxml2/libxml-2.0-uninstalled.pc.in deleted file mode 100644 index cab68346534..00000000000 --- a/lib/3rdparty/libxml2/libxml-2.0-uninstalled.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix= -exec_prefix= -libdir=${pcfiledir} -includedir=${pcfiledir}/include - - -Name: libXML -Version: @VERSION@ -Description: libXML library version2. -Requires: -Libs: -L${libdir} -lxml2 @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @LIBS@ -Cflags: -I${includedir} @XML_INCLUDEDIR@ @XML_CFLAGS@ diff --git a/lib/3rdparty/libxml2/libxml-2.0.pc.in b/lib/3rdparty/libxml2/libxml-2.0.pc.in deleted file mode 100644 index f5f5f03fc0b..00000000000 --- a/lib/3rdparty/libxml2/libxml-2.0.pc.in +++ /dev/null @@ -1,13 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -modules=@WITH_MODULES@ - -Name: libXML -Version: @VERSION@ -Description: libXML library version2. -Requires: -Libs: -L${libdir} -lxml2 -Libs.private: @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @WIN32_EXTRA_LIBADD@ @LIBS@ -Cflags: @XML_INCLUDEDIR@ @XML_CFLAGS@ diff --git a/lib/3rdparty/libxml2/libxml.3 b/lib/3rdparty/libxml2/libxml.3 deleted file mode 100644 index b3e9fef0617..00000000000 --- a/lib/3rdparty/libxml2/libxml.3 +++ /dev/null @@ -1,71 +0,0 @@ -.TH libxml 3 "12 April 2000" -.SH NAME -libxml \- library used to parse XML files -.SH DESCRIPTION -The -.I libxml -library is used to parse XML files. -Its internal document representation is as close as possible to the -.I DOM -(Document Object Model) interface, -an API for accessing XML or HTML structured documents. -.LP -The -.I libxml -library also has a -.IR SAX -like -interface, -which is designed to be compatible with -.IR expat (1). -NOTE: -.IR SAX , -the Simple API for XML, -is a standard interface for event-based XML parsing, -developed collaboratively by the members of the XML-DEV mailing list, -currently hosted by OASIS. -The -.I expat -library is a XML 1.0 parser written in C, -which aims to be fully conforming. -It is currently not a validating XML processor. -.LP -The -.I libxml -library now includes a nearly complete -.I XPath -implementation. -The -.I XPath -(XML Path Language) is a language for addressing parts of an -XML document, -designed to be used by both -.I XSLT -and -.IR XPointer . -.LP -The -.I libxml -library exports Push and Pull type parser interfaces for both XML and -.IR html . -.SH FILES -.TP 2.2i -.B /depot/lib/libxml_2.0.0/libxml.a -static library -.TP -.B /depot/lib/libxml_2.0.0/libxml.so -shared library -.TP -.B /depot/package/libxml_2.0.0/bin/xmllint -binary application for parsing XML files -.SH AUTHORS -Daniel Veillard (daniel@veillard.com). -Red Hat Inc. -Manual page by Ziying Sherwin (sherwin@nlm.nih.gov), -Lister Hill National Center for Biomedical Communications, -U.S. National Library of Medicine. -.SH SEE ALSO -.IR xmllint (1), -.IR libxslt (3), -.IR libexslt (3), -.IR xsltproc (1) -.\" end of manual page diff --git a/lib/3rdparty/libxml2/libxml.h b/lib/3rdparty/libxml2/libxml.h index 6f9e56c051f..66218f0e79f 100644 --- a/lib/3rdparty/libxml2/libxml.h +++ b/lib/3rdparty/libxml2/libxml.h @@ -84,6 +84,8 @@ void __xmlGlobalInitMutexLock(void); void __xmlGlobalInitMutexUnlock(void); void __xmlGlobalInitMutexDestroy(void); +int __xmlInitializeDict(void); + #if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) /* * internal thread safe random function @@ -91,6 +93,8 @@ void __xmlGlobalInitMutexDestroy(void); int __xmlRandom(void); #endif +int xmlNop(void); + #ifdef IN_LIBXML #ifdef __GNUC__ #ifdef PIC diff --git a/lib/3rdparty/libxml2/libxml.m4 b/lib/3rdparty/libxml2/libxml.m4 deleted file mode 100644 index 68cd8242fbc..00000000000 --- a/lib/3rdparty/libxml2/libxml.m4 +++ /dev/null @@ -1,188 +0,0 @@ -# Configure paths for LIBXML2 -# Mike Hommey 2004-06-19 -# use CPPFLAGS instead of CFLAGS -# Toshio Kuratomi 2001-04-21 -# Adapted from: -# Configure paths for GLIB -# Owen Taylor 97-11-3 - -dnl AM_PATH_XML2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl Test for XML, and define XML_CPPFLAGS and XML_LIBS -dnl -AC_DEFUN([AM_PATH_XML2],[ -AC_ARG_WITH(xml-prefix, - [ --with-xml-prefix=PFX Prefix where libxml is installed (optional)], - xml_config_prefix="$withval", xml_config_prefix="") -AC_ARG_WITH(xml-exec-prefix, - [ --with-xml-exec-prefix=PFX Exec prefix where libxml is installed (optional)], - xml_config_exec_prefix="$withval", xml_config_exec_prefix="") -AC_ARG_ENABLE(xmltest, - [ --disable-xmltest Do not try to compile and run a test LIBXML program],, - enable_xmltest=yes) - - if test x$xml_config_exec_prefix != x ; then - xml_config_args="$xml_config_args" - if test x${XML2_CONFIG+set} != xset ; then - XML2_CONFIG=$xml_config_exec_prefix/bin/xml2-config - fi - fi - if test x$xml_config_prefix != x ; then - xml_config_args="$xml_config_args --prefix=$xml_config_prefix" - if test x${XML2_CONFIG+set} != xset ; then - XML2_CONFIG=$xml_config_prefix/bin/xml2-config - fi - fi - - AC_PATH_PROG(XML2_CONFIG, xml2-config, no) - min_xml_version=ifelse([$1], ,2.0.0,[$1]) - AC_MSG_CHECKING(for libxml - version >= $min_xml_version) - no_xml="" - if test "$XML2_CONFIG" = "no" ; then - no_xml=yes - else - XML_CPPFLAGS=`$XML2_CONFIG $xml_config_args --cflags` - XML_LIBS=`$XML2_CONFIG $xml_config_args --libs` - xml_config_major_version=`$XML2_CONFIG $xml_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - xml_config_minor_version=`$XML2_CONFIG $xml_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - xml_config_micro_version=`$XML2_CONFIG $xml_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - if test "x$enable_xmltest" = "xyes" ; then - ac_save_CPPFLAGS="$CPPFLAGS" - ac_save_LIBS="$LIBS" - CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS" - LIBS="$XML_LIBS $LIBS" -dnl -dnl Now check if the installed libxml is sufficiently new. -dnl (Also sanity checks the results of xml2-config to some extent) -dnl - rm -f conf.xmltest - AC_TRY_RUN([ -#include -#include -#include -#include - -int -main() -{ - int xml_major_version, xml_minor_version, xml_micro_version; - int major, minor, micro; - char *tmp_version; - - system("touch conf.xmltest"); - - /* Capture xml2-config output via autoconf/configure variables */ - /* HP/UX 9 (%@#!) writes to sscanf strings */ - tmp_version = (char *)strdup("$min_xml_version"); - if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string from xml2-config\n", "$min_xml_version"); - exit(1); - } - free(tmp_version); - - /* Capture the version information from the header files */ - tmp_version = (char *)strdup(LIBXML_DOTTED_VERSION); - if (sscanf(tmp_version, "%d.%d.%d", &xml_major_version, &xml_minor_version, &xml_micro_version) != 3) { - printf("%s, bad version string from libxml includes\n", "LIBXML_DOTTED_VERSION"); - exit(1); - } - free(tmp_version); - - /* Compare xml2-config output to the libxml headers */ - if ((xml_major_version != $xml_config_major_version) || - (xml_minor_version != $xml_config_minor_version) || - (xml_micro_version != $xml_config_micro_version)) - { - printf("*** libxml header files (version %d.%d.%d) do not match\n", - xml_major_version, xml_minor_version, xml_micro_version); - printf("*** xml2-config (version %d.%d.%d)\n", - $xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version); - return 1; - } -/* Compare the headers to the library to make sure we match */ - /* Less than ideal -- doesn't provide us with return value feedback, - * only exits if there's a serious mismatch between header and library. - */ - LIBXML_TEST_VERSION; - - /* Test that the library is greater than our minimum version */ - if ((xml_major_version > major) || - ((xml_major_version == major) && (xml_minor_version > minor)) || - ((xml_major_version == major) && (xml_minor_version == minor) && - (xml_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** An old version of libxml (%d.%d.%d) was found.\n", - xml_major_version, xml_minor_version, xml_micro_version); - printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n", - major, minor, micro); - printf("*** libxml is always available from ftp://ftp.xmlsoft.org.\n"); - printf("***\n"); - printf("*** If you have already installed a sufficiently new version, this error\n"); - printf("*** probably means that the wrong copy of the xml2-config shell script is\n"); - printf("*** being found. The easiest way to fix this is to remove the old version\n"); - printf("*** of LIBXML, but you can also set the XML2_CONFIG environment to point to the\n"); - printf("*** correct copy of xml2-config. (In this case, you will have to\n"); - printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); - printf("*** so that the correct libraries are found at run-time))\n"); - } - return 1; -} -],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CPPFLAGS="$ac_save_CPPFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - - if test "x$no_xml" = x ; then - AC_MSG_RESULT(yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version)) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - if test "$XML2_CONFIG" = "no" ; then - echo "*** The xml2-config script installed by LIBXML could not be found" - echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the XML2_CONFIG environment variable to the" - echo "*** full path to xml2-config." - else - if test -f conf.xmltest ; then - : - else - echo "*** Could not run libxml test program, checking why..." - CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS" - LIBS="$LIBS $XML_LIBS" - AC_TRY_LINK([ -#include -#include -], [ LIBXML_TEST_VERSION; return 0;], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding LIBXML or finding the wrong" - echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means LIBXML was incorrectly installed" - echo "*** or that you have moved LIBXML since it was installed. In the latter case, you" - echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ]) - CPPFLAGS="$ac_save_CPPFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - - XML_CPPFLAGS="" - XML_LIBS="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(XML_CPPFLAGS) - AC_SUBST(XML_LIBS) - rm -f conf.xmltest -]) diff --git a/lib/3rdparty/libxml2/libxml.spec.in b/lib/3rdparty/libxml2/libxml.spec.in deleted file mode 100644 index 03eb24ee0e4..00000000000 --- a/lib/3rdparty/libxml2/libxml.spec.in +++ /dev/null @@ -1,133 +0,0 @@ -Summary: Library providing XML and HTML support -Name: libxml2 -Version: @VERSION@ -Release: 1 -License: MIT -Group: Development/Libraries -Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root -BuildRequires: python python-devel zlib-devel pkgconfig xz-devel -URL: http://xmlsoft.org/ - -%description -This library allows to manipulate XML files. It includes support -to read, modify and write XML and HTML files. There is DTDs support -this includes parsing and validation even with complex DtDs, either -at parse time or later once the document has been modified. The output -can be a simple SAX stream or and in-memory DOM like representations. -In this case one can use the built-in XPath and XPointer implementation -to select subnodes or ranges. A flexible Input/Output mechanism is -available, with existing HTTP and FTP modules and combined to an -URI library. - -%package devel -Summary: Libraries, includes, etc. to develop XML and HTML applications -Group: Development/Libraries -Requires: libxml2 = %{version}-%{release} -Requires: zlib-devel -Requires: xz-devel -Requires: pkgconfig - -%description devel -Libraries, include files, etc you can use to develop XML applications. -This library allows to manipulate XML files. It includes support -to read, modify and write XML and HTML files. There is DTDs support -this includes parsing and validation even with complex DtDs, either -at parse time or later once the document has been modified. The output -can be a simple SAX stream or and in-memory DOM like representations. -In this case one can use the built-in XPath and XPointer implementation -to select subnodes or ranges. A flexible Input/Output mechanism is -available, with existing HTTP and FTP modules and combined to an -URI library. - -%package python -Summary: Python bindings for the libxml2 library -Group: Development/Libraries -Requires: libxml2 = %{version}-%{release} -Requires: python - -%description python -The libxml2-python package contains a module that permits applications -written in the Python programming language to use the interface -supplied by the libxml2 library to manipulate XML files. - -This library allows to manipulate XML files. It includes support -to read, modify and write XML and HTML files. There is DTDs support -this includes parsing and validation even with complex DTDs, either -at parse time or later once the document has been modified. - -%prep -%setup -q - -%build -%configure -make %{_smp_mflags} -gzip -9 ChangeLog - -%install -rm -fr %{buildroot} - -%makeinstall -(cd doc/examples ; make clean ; rm -rf .deps Makefile) -gzip -9 doc/libxml2-api.xml -rm -f $RPM_BUILD_ROOT%{_libdir}/*.la - -%clean -rm -fr %{buildroot} - -%post -/sbin/ldconfig - -%postun -/sbin/ldconfig - -%files -%defattr(-, root, root) - -%doc AUTHORS ChangeLog.gz NEWS README Copyright TODO -%doc %{_mandir}/man1/xmllint.1* -%doc %{_mandir}/man1/xmlcatalog.1* -%doc %{_mandir}/man3/libxml.3* - -%{_libdir}/lib*.so.* -%{_bindir}/xmllint -%{_bindir}/xmlcatalog - -%files devel -%defattr(-, root, root) - -%doc %{_mandir}/man1/xml2-config.1* -%doc AUTHORS ChangeLog.gz NEWS README Copyright -%doc doc/*.html doc/html doc/*.gif doc/*.png -%doc doc/tutorial doc/libxml2-api.xml.gz -%doc doc/examples -%doc %dir %{_datadir}/gtk-doc/html/libxml2 -%doc %{_datadir}/gtk-doc/html/libxml2/*.devhelp -%doc %{_datadir}/gtk-doc/html/libxml2/*.html -%doc %{_datadir}/gtk-doc/html/libxml2/*.png -%doc %{_datadir}/gtk-doc/html/libxml2/*.css - -%{_libdir}/lib*.so -%{_libdir}/*a -%{_libdir}/*.sh -%{_includedir}/* -%{_bindir}/xml2-config -%{_datadir}/aclocal/libxml.m4 -%{_libdir}/pkgconfig/libxml-2.0.pc -%files python -%defattr(-, root, root) - -%doc AUTHORS ChangeLog.gz NEWS README Copyright -%{_libdir}/python*/site-packages/libxml2.py* -%{_libdir}/python*/site-packages/drv_libxml2.py* -%{_libdir}/python*/site-packages/libxml2mod* -%doc python/TODO -%doc python/libxml2class.txt -%doc python/tests/*.py -%doc doc/*.py -%doc doc/python.html - -%changelog -* @RELDATE@ Daniel Veillard -- upstream release @VERSION@ see http://xmlsoft.org/news.html - diff --git a/lib/3rdparty/libxml2/libxml2.spec b/lib/3rdparty/libxml2/libxml2.spec deleted file mode 100644 index 214adcf416f..00000000000 --- a/lib/3rdparty/libxml2/libxml2.spec +++ /dev/null @@ -1,133 +0,0 @@ -Summary: Library providing XML and HTML support -Name: libxml2 -Version: 2.9.0 -Release: 1 -License: MIT -Group: Development/Libraries -Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root -BuildRequires: python python-devel zlib-devel pkgconfig xz-devel -URL: http://xmlsoft.org/ - -%description -This library allows to manipulate XML files. It includes support -to read, modify and write XML and HTML files. There is DTDs support -this includes parsing and validation even with complex DtDs, either -at parse time or later once the document has been modified. The output -can be a simple SAX stream or and in-memory DOM like representations. -In this case one can use the built-in XPath and XPointer implementation -to select subnodes or ranges. A flexible Input/Output mechanism is -available, with existing HTTP and FTP modules and combined to an -URI library. - -%package devel -Summary: Libraries, includes, etc. to develop XML and HTML applications -Group: Development/Libraries -Requires: libxml2 = %{version}-%{release} -Requires: zlib-devel -Requires: xz-devel -Requires: pkgconfig - -%description devel -Libraries, include files, etc you can use to develop XML applications. -This library allows to manipulate XML files. It includes support -to read, modify and write XML and HTML files. There is DTDs support -this includes parsing and validation even with complex DtDs, either -at parse time or later once the document has been modified. The output -can be a simple SAX stream or and in-memory DOM like representations. -In this case one can use the built-in XPath and XPointer implementation -to select subnodes or ranges. A flexible Input/Output mechanism is -available, with existing HTTP and FTP modules and combined to an -URI library. - -%package python -Summary: Python bindings for the libxml2 library -Group: Development/Libraries -Requires: libxml2 = %{version}-%{release} -Requires: python - -%description python -The libxml2-python package contains a module that permits applications -written in the Python programming language to use the interface -supplied by the libxml2 library to manipulate XML files. - -This library allows to manipulate XML files. It includes support -to read, modify and write XML and HTML files. There is DTDs support -this includes parsing and validation even with complex DTDs, either -at parse time or later once the document has been modified. - -%prep -%setup -q - -%build -%configure -make %{_smp_mflags} -gzip -9 ChangeLog - -%install -rm -fr %{buildroot} - -%makeinstall -(cd doc/examples ; make clean ; rm -rf .deps Makefile) -gzip -9 doc/libxml2-api.xml -rm -f $RPM_BUILD_ROOT%{_libdir}/*.la - -%clean -rm -fr %{buildroot} - -%post -/sbin/ldconfig - -%postun -/sbin/ldconfig - -%files -%defattr(-, root, root) - -%doc AUTHORS ChangeLog.gz NEWS README Copyright TODO -%doc %{_mandir}/man1/xmllint.1* -%doc %{_mandir}/man1/xmlcatalog.1* -%doc %{_mandir}/man3/libxml.3* - -%{_libdir}/lib*.so.* -%{_bindir}/xmllint -%{_bindir}/xmlcatalog - -%files devel -%defattr(-, root, root) - -%doc %{_mandir}/man1/xml2-config.1* -%doc AUTHORS ChangeLog.gz NEWS README Copyright -%doc doc/*.html doc/html doc/*.gif doc/*.png -%doc doc/tutorial doc/libxml2-api.xml.gz -%doc doc/examples -%doc %dir %{_datadir}/gtk-doc/html/libxml2 -%doc %{_datadir}/gtk-doc/html/libxml2/*.devhelp -%doc %{_datadir}/gtk-doc/html/libxml2/*.html -%doc %{_datadir}/gtk-doc/html/libxml2/*.png -%doc %{_datadir}/gtk-doc/html/libxml2/*.css - -%{_libdir}/lib*.so -%{_libdir}/*a -%{_libdir}/*.sh -%{_includedir}/* -%{_bindir}/xml2-config -%{_datadir}/aclocal/libxml.m4 -%{_libdir}/pkgconfig/libxml-2.0.pc -%files python -%defattr(-, root, root) - -%doc AUTHORS ChangeLog.gz NEWS README Copyright -%{_libdir}/python*/site-packages/libxml2.py* -%{_libdir}/python*/site-packages/drv_libxml2.py* -%{_libdir}/python*/site-packages/libxml2mod* -%doc python/TODO -%doc python/libxml2class.txt -%doc python/tests/*.py -%doc doc/*.py -%doc doc/python.html - -%changelog -* Tue Sep 11 2012 Daniel Veillard -- upstream release 2.9.0 see http://xmlsoft.org/news.html - diff --git a/lib/3rdparty/libxml2/ltmain.sh b/lib/3rdparty/libxml2/ltmain.sh deleted file mode 100644 index 63ae69dc6fe..00000000000 --- a/lib/3rdparty/libxml2/ltmain.sh +++ /dev/null @@ -1,9655 +0,0 @@ - -# libtool (GNU libtool) 2.4.2 -# Written by Gordon Matzigkeit , 1996 - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, -# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# GNU Libtool is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -# Usage: $progname [OPTION]... [MODE-ARG]... -# -# Provide generalized library-building support services. -# -# --config show all configuration variables -# --debug enable verbose shell tracing -# -n, --dry-run display commands without modifying any files -# --features display basic configuration information and exit -# --mode=MODE use operation mode MODE -# --preserve-dup-deps don't remove duplicate dependency libraries -# --quiet, --silent don't print informational messages -# --no-quiet, --no-silent -# print informational messages (default) -# --no-warn don't display warning messages -# --tag=TAG use configuration variables from tag TAG -# -v, --verbose print more informational messages than default -# --no-verbose don't print the extra informational messages -# --version print version information -# -h, --help, --help-all print short, long, or detailed help message -# -# MODE must be one of the following: -# -# clean remove files from the build directory -# compile compile a source file into a libtool object -# execute automatically set library path, then run a program -# finish complete the installation of libtool libraries -# install install libraries or executables -# link create a library or an executable -# uninstall remove libraries from an installed directory -# -# MODE-ARGS vary depending on the MODE. When passed as first option, -# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. -# Try `$progname --help --mode=MODE' for a more detailed description of MODE. -# -# When reporting a bug, please describe a test case to reproduce it and -# include the following information: -# -# host-triplet: $host -# shell: $SHELL -# compiler: $LTCC -# compiler flags: $LTCFLAGS -# linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4.2 -# automake: $automake_version -# autoconf: $autoconf_version -# -# Report bugs to . -# GNU libtool home page: . -# General help using GNU software: . - -PROGRAM=libtool -PACKAGE=libtool -VERSION=2.4.2 -TIMESTAMP="" -package_revision=1.3337 - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - -# NLS nuisances: We save the old values to restore during execute mode. -lt_user_locale= -lt_safe_locale= -for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES -do - eval "if test \"\${$lt_var+set}\" = set; then - save_$lt_var=\$$lt_var - $lt_var=C - export $lt_var - lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" - lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" - fi" -done -LC_ALL=C -LANGUAGE=C -export LANGUAGE LC_ALL - -$lt_unset CDPATH - - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - - - -: ${CP="cp -f"} -test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} -: ${MAKE="make"} -: ${MKDIR="mkdir"} -: ${MV="mv -f"} -: ${RM="rm -f"} -: ${SHELL="${CONFIG_SHELL-/bin/sh}"} -: ${Xsed="$SED -e 1s/^X//"} - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 -EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. -EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. - -exit_status=$EXIT_SUCCESS - -# Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" - -dirname="s,/[^/]*$,," -basename="s,^.*/,," - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} # func_dirname may be replaced by extended shell implementation - - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "${1}" | $SED "$basename"` -} # func_basename may be replaced by extended shell implementation - - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi - func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` -} # func_dirname_and_basename may be replaced by extended shell implementation - - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname may be replaced by extended shell implementation - - -# These SED scripts presuppose an absolute path with a trailing slash. -pathcar='s,^/\([^/]*\).*$,\1,' -pathcdr='s,^/[^/]*,,' -removedotparts=':dotsl - s@/\./@/@g - t dotsl - s,/\.$,/,' -collapseslashes='s@/\{1,\}@/@g' -finalslash='s,/*$,/,' - -# func_normal_abspath PATH -# Remove doubled-up and trailing slashes, "." path components, -# and cancel out any ".." path components in PATH after making -# it an absolute path. -# value returned in "$func_normal_abspath_result" -func_normal_abspath () -{ - # Start from root dir and reassemble the path. - func_normal_abspath_result= - func_normal_abspath_tpath=$1 - func_normal_abspath_altnamespace= - case $func_normal_abspath_tpath in - "") - # Empty path, that just means $cwd. - func_stripname '' '/' "`pwd`" - func_normal_abspath_result=$func_stripname_result - return - ;; - # The next three entries are used to spot a run of precisely - # two leading slashes without using negated character classes; - # we take advantage of case's first-match behaviour. - ///*) - # Unusual form of absolute path, do nothing. - ;; - //*) - # Not necessarily an ordinary path; POSIX reserves leading '//' - # and for example Cygwin uses it to access remote file shares - # over CIFS/SMB, so we conserve a leading double slash if found. - func_normal_abspath_altnamespace=/ - ;; - /*) - # Absolute path, do nothing. - ;; - *) - # Relative path, prepend $cwd. - func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath - ;; - esac - # Cancel out all the simple stuff to save iterations. We also want - # the path to end with a slash for ease of parsing, so make sure - # there is one (and only one) here. - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` - while :; do - # Processed it all yet? - if test "$func_normal_abspath_tpath" = / ; then - # If we ascended to the root using ".." the result may be empty now. - if test -z "$func_normal_abspath_result" ; then - func_normal_abspath_result=/ - fi - break - fi - func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcar"` - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcdr"` - # Figure out what to do with it - case $func_normal_abspath_tcomponent in - "") - # Trailing empty path component, ignore it. - ;; - ..) - # Parent dir; strip last assembled component from result. - func_dirname "$func_normal_abspath_result" - func_normal_abspath_result=$func_dirname_result - ;; - *) - # Actual path component, append it. - func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent - ;; - esac - done - # Restore leading double-slash if one was found on entry. - func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result -} - -# func_relative_path SRCDIR DSTDIR -# generates a relative path from SRCDIR to DSTDIR, with a trailing -# slash if non-empty, suitable for immediately appending a filename -# without needing to append a separator. -# value returned in "$func_relative_path_result" -func_relative_path () -{ - func_relative_path_result= - func_normal_abspath "$1" - func_relative_path_tlibdir=$func_normal_abspath_result - func_normal_abspath "$2" - func_relative_path_tbindir=$func_normal_abspath_result - - # Ascend the tree starting from libdir - while :; do - # check if we have found a prefix of bindir - case $func_relative_path_tbindir in - $func_relative_path_tlibdir) - # found an exact match - func_relative_path_tcancelled= - break - ;; - $func_relative_path_tlibdir*) - # found a matching prefix - func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" - func_relative_path_tcancelled=$func_stripname_result - if test -z "$func_relative_path_result"; then - func_relative_path_result=. - fi - break - ;; - *) - func_dirname $func_relative_path_tlibdir - func_relative_path_tlibdir=${func_dirname_result} - if test "x$func_relative_path_tlibdir" = x ; then - # Have to descend all the way to the root! - func_relative_path_result=../$func_relative_path_result - func_relative_path_tcancelled=$func_relative_path_tbindir - break - fi - func_relative_path_result=../$func_relative_path_result - ;; - esac - done - - # Now calculate path; take care to avoid doubling-up slashes. - func_stripname '' '/' "$func_relative_path_result" - func_relative_path_result=$func_stripname_result - func_stripname '/' '/' "$func_relative_path_tcancelled" - if test "x$func_stripname_result" != x ; then - func_relative_path_result=${func_relative_path_result}/${func_stripname_result} - fi - - # Normalisation. If bindir is libdir, return empty string, - # else relative path ending with a slash; either way, target - # file name can be directly appended. - if test ! -z "$func_relative_path_result"; then - func_stripname './' '' "$func_relative_path_result/" - func_relative_path_result=$func_stripname_result - fi -} - -# The name of this program: -func_dirname_and_basename "$progpath" -progname=$func_basename_result - -# Make sure we have an absolute path for reexecution: -case $progpath in - [\\/]*|[A-Za-z]:\\*) ;; - *[\\/]*) - progdir=$func_dirname_result - progdir=`cd "$progdir" && pwd` - progpath="$progdir/$progname" - ;; - *) - save_IFS="$IFS" - IFS=${PATH_SEPARATOR-:} - for progdir in $PATH; do - IFS="$save_IFS" - test -x "$progdir/$progname" && break - done - IFS="$save_IFS" - test -n "$progdir" || progdir=`pwd` - progpath="$progdir/$progname" - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution that turns a string into a regex matching for the -# string literally. -sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' - -# Sed substitution that converts a w32 file name or path -# which contains forward slashes, into one that contains -# (escaped) backslashes. A very naive implementation. -lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - -# Re-`\' parameter expansions in output of double_quote_subst that were -# `\'-ed in input to the same. If an odd number of `\' preceded a '$' -# in input to double_quote_subst, that '$' was protected from expansion. -# Since each input `\' is now two `\'s, look for any number of runs of -# four `\'s followed by two `\'s and then a '$'. `\' that '$'. -bs='\\' -bs2='\\\\' -bs4='\\\\\\\\' -dollar='\$' -sed_double_backslash="\ - s/$bs4/&\\ -/g - s/^$bs2$dollar/$bs&/ - s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g - s/\n//g" - -# Standard options: -opt_dry_run=false -opt_help=false -opt_quiet=false -opt_verbose=false -opt_warning=: - -# func_echo arg... -# Echo program name prefixed message, along with the current mode -# name if it has been set yet. -func_echo () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }$*" -} - -# func_verbose arg... -# Echo program name prefixed message in verbose mode only. -func_verbose () -{ - $opt_verbose && func_echo ${1+"$@"} - - # A bug in bash halts the script if the last line of a function - # fails when set -e is in force, so we need another command to - # work around that: - : -} - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -# func_error arg... -# Echo program name prefixed message to standard error. -func_error () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 -} - -# func_warning arg... -# Echo program name prefixed warning message to standard error. -func_warning () -{ - $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 - - # bash bug again: - : -} - -# func_fatal_error arg... -# Echo program name prefixed message to standard error, and exit. -func_fatal_error () -{ - func_error ${1+"$@"} - exit $EXIT_FAILURE -} - -# func_fatal_help arg... -# Echo program name prefixed message to standard error, followed by -# a help hint, and exit. -func_fatal_help () -{ - func_error ${1+"$@"} - func_fatal_error "$help" -} -help="Try \`$progname --help' for more information." ## default - - -# func_grep expression filename -# Check whether EXPRESSION matches any line of FILENAME, without output. -func_grep () -{ - $GREP "$1" "$2" >/dev/null 2>&1 -} - - -# func_mkdir_p directory-path -# Make sure the entire path to DIRECTORY-PATH is available. -func_mkdir_p () -{ - my_directory_path="$1" - my_dir_list= - - if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then - - # Protect directory names starting with `-' - case $my_directory_path in - -*) my_directory_path="./$my_directory_path" ;; - esac - - # While some portion of DIR does not yet exist... - while test ! -d "$my_directory_path"; do - # ...make a list in topmost first order. Use a colon delimited - # list incase some portion of path contains whitespace. - my_dir_list="$my_directory_path:$my_dir_list" - - # If the last portion added has no slash in it, the list is done - case $my_directory_path in */*) ;; *) break ;; esac - - # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` - done - my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` - - save_mkdir_p_IFS="$IFS"; IFS=':' - for my_dir in $my_dir_list; do - IFS="$save_mkdir_p_IFS" - # mkdir can fail with a `File exist' error if two processes - # try to create one of the directories concurrently. Don't - # stop in that case! - $MKDIR "$my_dir" 2>/dev/null || : - done - IFS="$save_mkdir_p_IFS" - - # Bail out if we (or some other process) failed to create a directory. - test -d "$my_directory_path" || \ - func_fatal_error "Failed to create \`$1'" - fi -} - - -# func_mktempdir [string] -# Make a temporary directory that won't clash with other running -# libtool processes, and avoids race conditions if possible. If -# given, STRING is the basename for that directory. -func_mktempdir () -{ - my_template="${TMPDIR-/tmp}/${1-$progname}" - - if test "$opt_dry_run" = ":"; then - # Return a directory name, but don't create it in dry-run mode - my_tmpdir="${my_template}-$$" - else - - # If mktemp works, use that first and foremost - my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` - - if test ! -d "$my_tmpdir"; then - # Failing that, at least try and use $RANDOM to avoid a race - my_tmpdir="${my_template}-${RANDOM-0}$$" - - save_mktempdir_umask=`umask` - umask 0077 - $MKDIR "$my_tmpdir" - umask $save_mktempdir_umask - fi - - # If we're not in dry-run mode, bomb out on failure - test -d "$my_tmpdir" || \ - func_fatal_error "cannot create temporary directory \`$my_tmpdir'" - fi - - $ECHO "$my_tmpdir" -} - - -# func_quote_for_eval arg -# Aesthetically quote ARG to be evaled later. -# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT -# is double-quoted, suitable for a subsequent eval, whereas -# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters -# which are still active within double quotes backslashified. -func_quote_for_eval () -{ - case $1 in - *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; - *) - func_quote_for_eval_unquoted_result="$1" ;; - esac - - case $func_quote_for_eval_unquoted_result in - # Double-quote args containing shell metacharacters to delay - # word splitting, command substitution and and variable - # expansion for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" - ;; - *) - func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" - esac -} - - -# func_quote_for_expand arg -# Aesthetically quote ARG to be evaled later; same as above, -# but do not quote variable references. -func_quote_for_expand () -{ - case $1 in - *[\\\`\"]*) - my_arg=`$ECHO "$1" | $SED \ - -e "$double_quote_subst" -e "$sed_double_backslash"` ;; - *) - my_arg="$1" ;; - esac - - case $my_arg in - # Double-quote args containing shell metacharacters to delay - # word splitting and command substitution for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - my_arg="\"$my_arg\"" - ;; - esac - - func_quote_for_expand_result="$my_arg" -} - - -# func_show_eval cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. -func_show_eval () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$my_cmd" - my_status=$? - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - - -# func_show_eval_locale cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. Use the saved locale for evaluation. -func_show_eval_locale () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$lt_user_locale - $my_cmd" - my_status=$? - eval "$lt_safe_locale" - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - -# func_tr_sh -# Turn $1 into a string suitable for a shell variable name. -# Result is stored in $func_tr_sh_result. All characters -# not in the set a-zA-Z0-9_ are replaced with '_'. Further, -# if $1 begins with a digit, a '_' is prepended as well. -func_tr_sh () -{ - case $1 in - [0-9]* | *[!a-zA-Z0-9_]*) - func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` - ;; - * ) - func_tr_sh_result=$1 - ;; - esac -} - - -# func_version -# Echo version message to standard output and exit. -func_version () -{ - $opt_debug - - $SED -n '/(C)/!b go - :more - /\./!{ - N - s/\n# / / - b more - } - :go - /^# '$PROGRAM' (GNU /,/# warranty; / { - s/^# // - s/^# *$// - s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ - p - }' < "$progpath" - exit $? -} - -# func_usage -# Echo short help message to standard output and exit. -func_usage () -{ - $opt_debug - - $SED -n '/^# Usage:/,/^# *.*--help/ { - s/^# // - s/^# *$// - s/\$progname/'$progname'/ - p - }' < "$progpath" - echo - $ECHO "run \`$progname --help | more' for full usage" - exit $? -} - -# func_help [NOEXIT] -# Echo long help message to standard output and exit, -# unless 'noexit' is passed as argument. -func_help () -{ - $opt_debug - - $SED -n '/^# Usage:/,/# Report bugs to/ { - :print - s/^# // - s/^# *$// - s*\$progname*'$progname'* - s*\$host*'"$host"'* - s*\$SHELL*'"$SHELL"'* - s*\$LTCC*'"$LTCC"'* - s*\$LTCFLAGS*'"$LTCFLAGS"'* - s*\$LD*'"$LD"'* - s/\$with_gnu_ld/'"$with_gnu_ld"'/ - s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ - s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ - p - d - } - /^# .* home page:/b print - /^# General help using/b print - ' < "$progpath" - ret=$? - if test -z "$1"; then - exit $ret - fi -} - -# func_missing_arg argname -# Echo program name prefixed message to standard error and set global -# exit_cmd. -func_missing_arg () -{ - $opt_debug - - func_error "missing argument for $1." - exit_cmd=exit -} - - -# func_split_short_opt shortopt -# Set func_split_short_opt_name and func_split_short_opt_arg shell -# variables after splitting SHORTOPT after the 2nd character. -func_split_short_opt () -{ - my_sed_short_opt='1s/^\(..\).*$/\1/;q' - my_sed_short_rest='1s/^..\(.*\)$/\1/;q' - - func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` - func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` -} # func_split_short_opt may be replaced by extended shell implementation - - -# func_split_long_opt longopt -# Set func_split_long_opt_name and func_split_long_opt_arg shell -# variables after splitting LONGOPT at the `=' sign. -func_split_long_opt () -{ - my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' - my_sed_long_arg='1s/^--[^=]*=//' - - func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` - func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` -} # func_split_long_opt may be replaced by extended shell implementation - -exit_cmd=: - - - - - -magic="%%%MAGIC variable%%%" -magic_exe="%%%MAGIC EXE variable%%%" - -# Global variables. -nonopt= -preserve_args= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" -extracted_archives= -extracted_serial=0 - -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "${1}=\$${1}\${2}" -} # func_append may be replaced by extended shell implementation - -# func_append_quoted var value -# Quote VALUE and append to the end of shell variable VAR, separated -# by a space. -func_append_quoted () -{ - func_quote_for_eval "${2}" - eval "${1}=\$${1}\\ \$func_quote_for_eval_result" -} # func_append_quoted may be replaced by extended shell implementation - - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "${@}"` -} # func_arith may be replaced by extended shell implementation - - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` -} # func_len may be replaced by extended shell implementation - - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` -} # func_lo2o may be replaced by extended shell implementation - - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` -} # func_xform may be replaced by extended shell implementation - - -# func_fatal_configuration arg... -# Echo program name prefixed message to standard error, followed by -# a configuration failure hint, and exit. -func_fatal_configuration () -{ - func_error ${1+"$@"} - func_error "See the $PACKAGE documentation for more information." - func_fatal_error "Fatal configuration error." -} - - -# func_config -# Display the configuration for all the tags in this script. -func_config () -{ - re_begincf='^# ### BEGIN LIBTOOL' - re_endcf='^# ### END LIBTOOL' - - # Default configuration. - $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" - - # Now print the configurations for the tags. - for tagname in $taglist; do - $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" - done - - exit $? -} - -# func_features -# Display the features supported by this script. -func_features () -{ - echo "host: $host" - if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" - else - echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - echo "enable static libraries" - else - echo "disable static libraries" - fi - - exit $? -} - -# func_enable_tag tagname -# Verify that TAGNAME is valid, and either flag an error and exit, or -# enable the TAGNAME tag. We also add TAGNAME to the global $taglist -# variable here. -func_enable_tag () -{ - # Global variable: - tagname="$1" - - re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" - re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" - sed_extractcf="/$re_begincf/,/$re_endcf/p" - - # Validate tagname. - case $tagname in - *[!-_A-Za-z0-9,/]*) - func_fatal_error "invalid tag name: $tagname" - ;; - esac - - # Don't test for the "default" C tag, as we know it's - # there but not specially marked. - case $tagname in - CC) ;; - *) - if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then - taglist="$taglist $tagname" - - # Evaluate the configuration. Be careful to quote the path - # and the sed script, to avoid splitting on whitespace, but - # also don't use non-portable quotes within backquotes within - # quotes we have to do it in 2 steps: - extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` - eval "$extractedcf" - else - func_error "ignoring unknown tag $tagname" - fi - ;; - esac -} - -# func_check_version_match -# Ensure that we are using m4 macros, and libtool script from the same -# release of libtool. -func_check_version_match () -{ - if test "$package_revision" != "$macro_revision"; then - if test "$VERSION" != "$macro_version"; then - if test -z "$macro_version"; then - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from an older release. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - fi - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, -$progname: but the definition of this LT_INIT comes from revision $macro_revision. -$progname: You should recreate aclocal.m4 with macros from revision $package_revision -$progname: of $PACKAGE $VERSION and run autoconf again. -_LT_EOF - fi - - exit $EXIT_MISMATCH - fi -} - - -# Shorthand for --mode=foo, only valid as the first argument -case $1 in -clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; -compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; -execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; -finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; -install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; -link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; -uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift - ;; -esac - - - -# Option defaults: -opt_debug=: -opt_dry_run=false -opt_config=false -opt_preserve_dup_deps=false -opt_features=false -opt_finish=false -opt_help=false -opt_help_all=false -opt_silent=: -opt_warning=: -opt_verbose=: -opt_silent=false -opt_verbose=false - - -# Parse options once, thoroughly. This comes as soon as possible in the -# script to make things like `--version' happen as quickly as we can. -{ - # this just eases exit handling - while test $# -gt 0; do - opt="$1" - shift - case $opt in - --debug|-x) opt_debug='set -x' - func_echo "enabling shell trace mode" - $opt_debug - ;; - --dry-run|--dryrun|-n) - opt_dry_run=: - ;; - --config) - opt_config=: -func_config - ;; - --dlopen|-dlopen) - optarg="$1" - opt_dlopen="${opt_dlopen+$opt_dlopen -}$optarg" - shift - ;; - --preserve-dup-deps) - opt_preserve_dup_deps=: - ;; - --features) - opt_features=: -func_features - ;; - --finish) - opt_finish=: -set dummy --mode finish ${1+"$@"}; shift - ;; - --help) - opt_help=: - ;; - --help-all) - opt_help_all=: -opt_help=': help-all' - ;; - --mode) - test $# = 0 && func_missing_arg $opt && break - optarg="$1" - opt_mode="$optarg" -case $optarg in - # Valid mode arguments: - clean|compile|execute|finish|install|link|relink|uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $opt" - exit_cmd=exit - break - ;; -esac - shift - ;; - --no-silent|--no-quiet) - opt_silent=false -func_append preserve_args " $opt" - ;; - --no-warning|--no-warn) - opt_warning=false -func_append preserve_args " $opt" - ;; - --no-verbose) - opt_verbose=false -func_append preserve_args " $opt" - ;; - --silent|--quiet) - opt_silent=: -func_append preserve_args " $opt" - opt_verbose=false - ;; - --verbose|-v) - opt_verbose=: -func_append preserve_args " $opt" -opt_silent=false - ;; - --tag) - test $# = 0 && func_missing_arg $opt && break - optarg="$1" - opt_tag="$optarg" -func_append preserve_args " $opt $optarg" -func_enable_tag "$optarg" - shift - ;; - - -\?|-h) func_usage ;; - --help) func_help ;; - --version) func_version ;; - - # Separate optargs to long options: - --*=*) - func_split_long_opt "$opt" - set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} - shift - ;; - - # Separate non-argument short options: - -\?*|-h*|-n*|-v*) - func_split_short_opt "$opt" - set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} - shift - ;; - - --) break ;; - -*) func_fatal_help "unrecognized option \`$opt'" ;; - *) set dummy "$opt" ${1+"$@"}; shift; break ;; - esac - done - - # Validate options: - - # save first non-option argument - if test "$#" -gt 0; then - nonopt="$opt" - shift - fi - - # preserve --debug - test "$opt_debug" = : || func_append preserve_args " --debug" - - case $host in - *cygwin* | *mingw* | *pw32* | *cegcc*) - # don't eliminate duplications in $postdeps and $predeps - opt_duplicate_compiler_generated_deps=: - ;; - *) - opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps - ;; - esac - - $opt_help || { - # Sanity checks first: - func_check_version_match - - if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - func_fatal_configuration "not configured to build any kind of library" - fi - - # Darwin sucks - eval std_shrext=\"$shrext_cmds\" - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$opt_dlopen" && test "$opt_mode" != execute; then - func_error "unrecognized option \`-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$progname --help --mode=$opt_mode' for more information." - } - - - # Bail if the options were screwed - $exit_cmd $EXIT_FAILURE -} - - - - -## ----------- ## -## Main. ## -## ----------- ## - -# func_lalib_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_lalib_p () -{ - test -f "$1" && - $SED -e 4q "$1" 2>/dev/null \ - | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 -} - -# func_lalib_unsafe_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function implements the same check as func_lalib_p without -# resorting to external programs. To this end, it redirects stdin and -# closes it afterwards, without saving the original file descriptor. -# As a safety measure, use it only where a negative result would be -# fatal anyway. Works if `file' does not exist. -func_lalib_unsafe_p () -{ - lalib_p=no - if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then - for lalib_p_l in 1 2 3 4 - do - read lalib_p_line - case "$lalib_p_line" in - \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; - esac - done - exec 0<&5 5<&- - fi - test "$lalib_p" = yes -} - -# func_ltwrapper_script_p file -# True iff FILE is a libtool wrapper script -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_script_p () -{ - func_lalib_p "$1" -} - -# func_ltwrapper_executable_p file -# True iff FILE is a libtool wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_executable_p () -{ - func_ltwrapper_exec_suffix= - case $1 in - *.exe) ;; - *) func_ltwrapper_exec_suffix=.exe ;; - esac - $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 -} - -# func_ltwrapper_scriptname file -# Assumes file is an ltwrapper_executable -# uses $file to determine the appropriate filename for a -# temporary ltwrapper_script. -func_ltwrapper_scriptname () -{ - func_dirname_and_basename "$1" "" "." - func_stripname '' '.exe' "$func_basename_result" - func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" -} - -# func_ltwrapper_p file -# True iff FILE is a libtool wrapper script or wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_p () -{ - func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" -} - - -# func_execute_cmds commands fail_cmd -# Execute tilde-delimited COMMANDS. -# If FAIL_CMD is given, eval that upon failure. -# FAIL_CMD may read-access the current command in variable CMD! -func_execute_cmds () -{ - $opt_debug - save_ifs=$IFS; IFS='~' - for cmd in $1; do - IFS=$save_ifs - eval cmd=\"$cmd\" - func_show_eval "$cmd" "${2-:}" - done - IFS=$save_ifs -} - - -# func_source file -# Source FILE, adding directory component if necessary. -# Note that it is not necessary on cygwin/mingw to append a dot to -# FILE even if both FILE and FILE.exe exist: automatic-append-.exe -# behavior happens only for exec(3), not for open(2)! Also, sourcing -# `FILE.' does not work on cygwin managed mounts. -func_source () -{ - $opt_debug - case $1 in - */* | *\\*) . "$1" ;; - *) . "./$1" ;; - esac -} - - -# func_resolve_sysroot PATH -# Replace a leading = in PATH with a sysroot. Store the result into -# func_resolve_sysroot_result -func_resolve_sysroot () -{ - func_resolve_sysroot_result=$1 - case $func_resolve_sysroot_result in - =*) - func_stripname '=' '' "$func_resolve_sysroot_result" - func_resolve_sysroot_result=$lt_sysroot$func_stripname_result - ;; - esac -} - -# func_replace_sysroot PATH -# If PATH begins with the sysroot, replace it with = and -# store the result into func_replace_sysroot_result. -func_replace_sysroot () -{ - case "$lt_sysroot:$1" in - ?*:"$lt_sysroot"*) - func_stripname "$lt_sysroot" '' "$1" - func_replace_sysroot_result="=$func_stripname_result" - ;; - *) - # Including no sysroot. - func_replace_sysroot_result=$1 - ;; - esac -} - -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () -{ - $opt_debug - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - func_append_quoted CC_quoted "$arg" - done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` - case $@ in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" - CC_quoted= - for arg in $CC; do - # Double-quote args containing other shell metacharacters. - func_append_quoted CC_quoted "$arg" - done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` - case "$@ " in - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - func_echo "unable to infer tagged configuration" - func_fatal_error "specify a tag with \`--tag'" -# else -# func_verbose "using $tagname tagged configuration" - fi - ;; - esac - fi -} - - - -# func_write_libtool_object output_name pic_name nonpic_name -# Create a libtool object file (analogous to a ".la" file), -# but don't create it if we're doing a dry run. -func_write_libtool_object () -{ - write_libobj=${1} - if test "$build_libtool_libs" = yes; then - write_lobj=\'${2}\' - else - write_lobj=none - fi - - if test "$build_old_libs" = yes; then - write_oldobj=\'${3}\' - else - write_oldobj=none - fi - - $opt_dry_run || { - cat >${write_libobj}T </dev/null` - if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then - func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | - $SED -e "$lt_sed_naive_backslashify"` - else - func_convert_core_file_wine_to_w32_result= - fi - fi -} -# end: func_convert_core_file_wine_to_w32 - - -# func_convert_core_path_wine_to_w32 ARG -# Helper function used by path conversion functions when $build is *nix, and -# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly -# configured wine environment available, with the winepath program in $build's -# $PATH. Assumes ARG has no leading or trailing path separator characters. -# -# ARG is path to be converted from $build format to win32. -# Result is available in $func_convert_core_path_wine_to_w32_result. -# Unconvertible file (directory) names in ARG are skipped; if no directory names -# are convertible, then the result may be empty. -func_convert_core_path_wine_to_w32 () -{ - $opt_debug - # unfortunately, winepath doesn't convert paths, only file names - func_convert_core_path_wine_to_w32_result="" - if test -n "$1"; then - oldIFS=$IFS - IFS=: - for func_convert_core_path_wine_to_w32_f in $1; do - IFS=$oldIFS - func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" - if test -n "$func_convert_core_file_wine_to_w32_result" ; then - if test -z "$func_convert_core_path_wine_to_w32_result"; then - func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" - else - func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" - fi - fi - done - IFS=$oldIFS - fi -} -# end: func_convert_core_path_wine_to_w32 - - -# func_cygpath ARGS... -# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when -# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) -# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or -# (2), returns the Cygwin file name or path in func_cygpath_result (input -# file name or path is assumed to be in w32 format, as previously converted -# from $build's *nix or MSYS format). In case (3), returns the w32 file name -# or path in func_cygpath_result (input file name or path is assumed to be in -# Cygwin format). Returns an empty string on error. -# -# ARGS are passed to cygpath, with the last one being the file name or path to -# be converted. -# -# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH -# environment variable; do not put it in $PATH. -func_cygpath () -{ - $opt_debug - if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then - func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` - if test "$?" -ne 0; then - # on failure, ensure result is empty - func_cygpath_result= - fi - else - func_cygpath_result= - func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" - fi -} -#end: func_cygpath - - -# func_convert_core_msys_to_w32 ARG -# Convert file name or path ARG from MSYS format to w32 format. Return -# result in func_convert_core_msys_to_w32_result. -func_convert_core_msys_to_w32 () -{ - $opt_debug - # awkward: cmd appends spaces to result - func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | - $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` -} -#end: func_convert_core_msys_to_w32 - - -# func_convert_file_check ARG1 ARG2 -# Verify that ARG1 (a file name in $build format) was converted to $host -# format in ARG2. Otherwise, emit an error message, but continue (resetting -# func_to_host_file_result to ARG1). -func_convert_file_check () -{ - $opt_debug - if test -z "$2" && test -n "$1" ; then - func_error "Could not determine host file name corresponding to" - func_error " \`$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback: - func_to_host_file_result="$1" - fi -} -# end func_convert_file_check - - -# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH -# Verify that FROM_PATH (a path in $build format) was converted to $host -# format in TO_PATH. Otherwise, emit an error message, but continue, resetting -# func_to_host_file_result to a simplistic fallback value (see below). -func_convert_path_check () -{ - $opt_debug - if test -z "$4" && test -n "$3"; then - func_error "Could not determine the host path corresponding to" - func_error " \`$3'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback. This is a deliberately simplistic "conversion" and - # should not be "improved". See libtool.info. - if test "x$1" != "x$2"; then - lt_replace_pathsep_chars="s|$1|$2|g" - func_to_host_path_result=`echo "$3" | - $SED -e "$lt_replace_pathsep_chars"` - else - func_to_host_path_result="$3" - fi - fi -} -# end func_convert_path_check - - -# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG -# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT -# and appending REPL if ORIG matches BACKPAT. -func_convert_path_front_back_pathsep () -{ - $opt_debug - case $4 in - $1 ) func_to_host_path_result="$3$func_to_host_path_result" - ;; - esac - case $4 in - $2 ) func_append func_to_host_path_result "$3" - ;; - esac -} -# end func_convert_path_front_back_pathsep - - -################################################## -# $build to $host FILE NAME CONVERSION FUNCTIONS # -################################################## -# invoked via `$to_host_file_cmd ARG' -# -# In each case, ARG is the path to be converted from $build to $host format. -# Result will be available in $func_to_host_file_result. - - -# func_to_host_file ARG -# Converts the file name ARG from $build format to $host format. Return result -# in func_to_host_file_result. -func_to_host_file () -{ - $opt_debug - $to_host_file_cmd "$1" -} -# end func_to_host_file - - -# func_to_tool_file ARG LAZY -# converts the file name ARG from $build format to toolchain format. Return -# result in func_to_tool_file_result. If the conversion in use is listed -# in (the comma separated) LAZY, no conversion takes place. -func_to_tool_file () -{ - $opt_debug - case ,$2, in - *,"$to_tool_file_cmd",*) - func_to_tool_file_result=$1 - ;; - *) - $to_tool_file_cmd "$1" - func_to_tool_file_result=$func_to_host_file_result - ;; - esac -} -# end func_to_tool_file - - -# func_convert_file_noop ARG -# Copy ARG to func_to_host_file_result. -func_convert_file_noop () -{ - func_to_host_file_result="$1" -} -# end func_convert_file_noop - - -# func_convert_file_msys_to_w32 ARG -# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic -# conversion to w32 is not available inside the cwrapper. Returns result in -# func_to_host_file_result. -func_convert_file_msys_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_msys_to_w32 "$1" - func_to_host_file_result="$func_convert_core_msys_to_w32_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_msys_to_w32 - - -# func_convert_file_cygwin_to_w32 ARG -# Convert file name ARG from Cygwin to w32 format. Returns result in -# func_to_host_file_result. -func_convert_file_cygwin_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - # because $build is cygwin, we call "the" cygpath in $PATH; no need to use - # LT_CYGPATH in this case. - func_to_host_file_result=`cygpath -m "$1"` - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_cygwin_to_w32 - - -# func_convert_file_nix_to_w32 ARG -# Convert file name ARG from *nix to w32 format. Requires a wine environment -# and a working winepath. Returns result in func_to_host_file_result. -func_convert_file_nix_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_file_wine_to_w32 "$1" - func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_nix_to_w32 - - -# func_convert_file_msys_to_cygwin ARG -# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. -# Returns result in func_to_host_file_result. -func_convert_file_msys_to_cygwin () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_msys_to_w32 "$1" - func_cygpath -u "$func_convert_core_msys_to_w32_result" - func_to_host_file_result="$func_cygpath_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_msys_to_cygwin - - -# func_convert_file_nix_to_cygwin ARG -# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed -# in a wine environment, working winepath, and LT_CYGPATH set. Returns result -# in func_to_host_file_result. -func_convert_file_nix_to_cygwin () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. - func_convert_core_file_wine_to_w32 "$1" - func_cygpath -u "$func_convert_core_file_wine_to_w32_result" - func_to_host_file_result="$func_cygpath_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_nix_to_cygwin - - -############################################# -# $build to $host PATH CONVERSION FUNCTIONS # -############################################# -# invoked via `$to_host_path_cmd ARG' -# -# In each case, ARG is the path to be converted from $build to $host format. -# The result will be available in $func_to_host_path_result. -# -# Path separators are also converted from $build format to $host format. If -# ARG begins or ends with a path separator character, it is preserved (but -# converted to $host format) on output. -# -# All path conversion functions are named using the following convention: -# file name conversion function : func_convert_file_X_to_Y () -# path conversion function : func_convert_path_X_to_Y () -# where, for any given $build/$host combination the 'X_to_Y' value is the -# same. If conversion functions are added for new $build/$host combinations, -# the two new functions must follow this pattern, or func_init_to_host_path_cmd -# will break. - - -# func_init_to_host_path_cmd -# Ensures that function "pointer" variable $to_host_path_cmd is set to the -# appropriate value, based on the value of $to_host_file_cmd. -to_host_path_cmd= -func_init_to_host_path_cmd () -{ - $opt_debug - if test -z "$to_host_path_cmd"; then - func_stripname 'func_convert_file_' '' "$to_host_file_cmd" - to_host_path_cmd="func_convert_path_${func_stripname_result}" - fi -} - - -# func_to_host_path ARG -# Converts the path ARG from $build format to $host format. Return result -# in func_to_host_path_result. -func_to_host_path () -{ - $opt_debug - func_init_to_host_path_cmd - $to_host_path_cmd "$1" -} -# end func_to_host_path - - -# func_convert_path_noop ARG -# Copy ARG to func_to_host_path_result. -func_convert_path_noop () -{ - func_to_host_path_result="$1" -} -# end func_convert_path_noop - - -# func_convert_path_msys_to_w32 ARG -# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic -# conversion to w32 is not available inside the cwrapper. Returns result in -# func_to_host_path_result. -func_convert_path_msys_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # Remove leading and trailing path separator characters from ARG. MSYS - # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; - # and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result="$func_convert_core_msys_to_w32_result" - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_msys_to_w32 - - -# func_convert_path_cygwin_to_w32 ARG -# Convert path ARG from Cygwin to w32 format. Returns result in -# func_to_host_file_result. -func_convert_path_cygwin_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_cygwin_to_w32 - - -# func_convert_path_nix_to_w32 ARG -# Convert path ARG from *nix to w32 format. Requires a wine environment and -# a working winepath. Returns result in func_to_host_file_result. -func_convert_path_nix_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_nix_to_w32 - - -# func_convert_path_msys_to_cygwin ARG -# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. -# Returns result in func_to_host_file_result. -func_convert_path_msys_to_cygwin () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" - func_cygpath -u -p "$func_convert_core_msys_to_w32_result" - func_to_host_path_result="$func_cygpath_result" - func_convert_path_check : : \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" : "$1" - fi -} -# end func_convert_path_msys_to_cygwin - - -# func_convert_path_nix_to_cygwin ARG -# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a -# a wine environment, working winepath, and LT_CYGPATH set. Returns result in -# func_to_host_file_result. -func_convert_path_nix_to_cygwin () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # Remove leading and trailing path separator characters from - # ARG. msys behavior is inconsistent here, cygpath turns them - # into '.;' and ';.', and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" - func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" - func_to_host_path_result="$func_cygpath_result" - func_convert_path_check : : \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" : "$1" - fi -} -# end func_convert_path_nix_to_cygwin - - -# func_mode_compile arg... -func_mode_compile () -{ - $opt_debug - # Get the compilation command and the source file. - base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_opt=yes - suppress_output= - arg_mode=normal - libobj= - later= - pie_flag= - - for arg - do - case $arg_mode in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; - - target ) - libobj="$arg" - arg_mode=normal - continue - ;; - - normal ) - # Accept any command-line options. - case $arg in - -o) - test -n "$libobj" && \ - func_fatal_error "you cannot specify \`-o' more than once" - arg_mode=target - continue - ;; - - -pie | -fpie | -fPIE) - func_append pie_flag " $arg" - continue - ;; - - -shared | -static | -prefer-pic | -prefer-non-pic) - func_append later " $arg" - continue - ;; - - -no-suppress) - suppress_opt=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - func_stripname '-Wc,' '' "$arg" - args=$func_stripname_result - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - func_append_quoted lastarg "$arg" - done - IFS="$save_ifs" - func_stripname ' ' '' "$lastarg" - lastarg=$func_stripname_result - - # Add the arguments to base_compile. - func_append base_compile " $lastarg" - continue - ;; - - *) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - func_append_quoted base_compile "$lastarg" - done # for arg - - case $arg_mode in - arg) - func_fatal_error "you must specify an argument for -Xcompile" - ;; - target) - func_fatal_error "you must specify a target with \`-o'" - ;; - *) - # Get the name of the library object. - test -z "$libobj" && { - func_basename "$srcfile" - libobj="$func_basename_result" - } - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - case $libobj in - *.[cCFSifmso] | \ - *.ada | *.adb | *.ads | *.asm | \ - *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ - *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) - func_xform "$libobj" - libobj=$func_xform_result - ;; - esac - - case $libobj in - *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; - *) - func_fatal_error "cannot determine name of library object from \`$libobj'" - ;; - esac - - func_infer_tag $base_compile - - for arg in $later; do - case $arg in - -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" - build_old_libs=no - continue - ;; - - -static) - build_libtool_libs=no - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no - continue - ;; - esac - done - - func_quote_for_eval "$libobj" - test "X$libobj" != "X$func_quote_for_eval_result" \ - && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ - && func_warning "libobj name \`$libobj' may not contain shell special characters." - func_dirname_and_basename "$obj" "/" "" - objname="$func_basename_result" - xdir="$func_dirname_result" - lobj=${xdir}$objdir/$objname - - test -z "$base_compile" && \ - func_fatal_help "you must specify a compilation command" - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2* | cegcc*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - else - output_obj= - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - $ECHO "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - func_append removelist " $output_obj" - $ECHO "$srcfile" > "$lockfile" - fi - - $opt_dry_run || $RM $removelist - func_append removelist " $lockfile" - trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 - - func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 - srcfile=$func_to_tool_file_result - func_quote_for_eval "$srcfile" - qsrcfile=$func_quote_for_eval_result - - # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - - if test "$pic_mode" != no; then - command="$base_compile $qsrcfile $pic_flag" - else - # Don't build PIC code - command="$base_compile $qsrcfile" - fi - - func_mkdir_p "$xdir$objdir" - - if test -z "$output_obj"; then - # Place PIC objects in $objdir - func_append command " -o $lobj" - fi - - func_show_eval_locale "$command" \ - 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - func_show_eval '$MV "$output_obj" "$lobj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - - # Allow error messages only from the first compilation. - if test "$suppress_opt" = yes; then - suppress_output=' >/dev/null 2>&1' - fi - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - if test "$pic_mode" != yes; then - # Don't build PIC code - command="$base_compile $qsrcfile$pie_flag" - else - command="$base_compile $qsrcfile $pic_flag" - fi - if test "$compiler_c_o" = yes; then - func_append command " -o $obj" - fi - - # Suppress compiler output if we already did a PIC compilation. - func_append command "$suppress_output" - func_show_eval_locale "$command" \ - '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - func_show_eval '$MV "$output_obj" "$obj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - fi - - $opt_dry_run || { - func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" - - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - removelist=$lockfile - $RM "$lockfile" - fi - } - - exit $EXIT_SUCCESS -} - -$opt_help || { - test "$opt_mode" = compile && func_mode_compile ${1+"$@"} -} - -func_mode_help () -{ - # We need to display help for each of the modes. - case $opt_mode in - "") - # Generic help is extracted from the usage comments - # at the start of this file. - func_help - ;; - - clean) - $ECHO \ -"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - - compile) - $ECHO \ -"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -no-suppress do not suppress compiler output for multiple passes - -prefer-pic try to build PIC objects only - -prefer-non-pic try to build non-PIC objects only - -shared do not build a \`.o' file suitable for static linking - -static only build a \`.o' file suitable for static linking - -Wc,FLAG pass FLAG directly to the compiler - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - - execute) - $ECHO \ -"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - - finish) - $ECHO \ -"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - - install) - $ECHO \ -"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The following components of INSTALL-COMMAND are treated specially: - - -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - - link) - $ECHO \ -"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -bindir BINDIR specify path to binaries directory (for systems where - libraries must be found in the PATH setting at runtime) - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -shared only do dynamic linking of libtool libraries - -shrext SUFFIX override the standard shared library file extension - -static do not do any dynamic linking of uninstalled libtool libraries - -static-libtool-libs - do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -weak LIBNAME declare that the target provides the LIBNAME interface - -Wc,FLAG - -Xcompiler FLAG pass linker-specific FLAG directly to the compiler - -Wl,FLAG - -Xlinker FLAG pass linker-specific FLAG directly to the linker - -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - - uninstall) - $ECHO \ -"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - - *) - func_fatal_help "invalid operation mode \`$opt_mode'" - ;; - esac - - echo - $ECHO "Try \`$progname --help' for more information about other modes." -} - -# Now that we've collected a possible --mode arg, show help if necessary -if $opt_help; then - if test "$opt_help" = :; then - func_mode_help - else - { - func_help noexit - for opt_mode in compile link execute install finish uninstall clean; do - func_mode_help - done - } | sed -n '1p; 2,$s/^Usage:/ or: /p' - { - func_help noexit - for opt_mode in compile link execute install finish uninstall clean; do - echo - func_mode_help - done - } | - sed '1d - /^When reporting/,/^Report/{ - H - d - } - $x - /information about other modes/d - /more detailed .*MODE/d - s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' - fi - exit $? -fi - - -# func_mode_execute arg... -func_mode_execute () -{ - $opt_debug - # The first argument is the command name. - cmd="$nonopt" - test -z "$cmd" && \ - func_fatal_help "you must specify a COMMAND" - - # Handle -dlopen flags immediately. - for file in $opt_dlopen; do - test -f "$file" \ - || func_fatal_help "\`$file' is not a file" - - dir= - case $file in - *.la) - func_resolve_sysroot "$file" - file=$func_resolve_sysroot_result - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$lib' is not a valid libtool archive" - - # Read the libtool library. - dlname= - library_names= - func_source "$file" - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && \ - func_warning "\`$file' was not linked with \`-export-dynamic'" - continue - fi - - func_dirname "$file" "" "." - dir="$func_dirname_result" - - if test -f "$dir/$objdir/$dlname"; then - func_append dir "/$objdir" - else - if test ! -f "$dir/$dlname"; then - func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" - fi - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - func_dirname "$file" "" "." - dir="$func_dirname_result" - ;; - - *) - func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -* | *.la | *.lo ) ;; - *) - # Do a test to see if this is really a libtool program. - if func_ltwrapper_script_p "$file"; then - func_source "$file" - # Transform arg to wrapped name. - file="$progdir/$program" - elif func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - func_source "$func_ltwrapper_scriptname_result" - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - func_append_quoted args "$file" - done - - if test "X$opt_dry_run" = Xfalse; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES - do - eval "if test \"\${save_$lt_var+set}\" = set; then - $lt_var=\$save_$lt_var; export $lt_var - else - $lt_unset $lt_var - fi" - done - - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" - echo "export $shlibpath_var" - fi - $ECHO "$cmd$args" - exit $EXIT_SUCCESS - fi -} - -test "$opt_mode" = execute && func_mode_execute ${1+"$@"} - - -# func_mode_finish arg... -func_mode_finish () -{ - $opt_debug - libs= - libdirs= - admincmds= - - for opt in "$nonopt" ${1+"$@"} - do - if test -d "$opt"; then - func_append libdirs " $opt" - - elif test -f "$opt"; then - if func_lalib_unsafe_p "$opt"; then - func_append libs " $opt" - else - func_warning "\`$opt' is not a valid libtool archive" - fi - - else - func_fatal_error "invalid argument \`$opt'" - fi - done - - if test -n "$libs"; then - if test -n "$lt_sysroot"; then - sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` - sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" - else - sysroot_cmd= - fi - - # Remove sysroot references - if $opt_dry_run; then - for lib in $libs; do - echo "removing references to $lt_sysroot and \`=' prefixes from $lib" - done - else - tmpdir=`func_mktempdir` - for lib in $libs; do - sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ - > $tmpdir/tmp-la - mv -f $tmpdir/tmp-la $lib - done - ${RM}r "$tmpdir" - fi - fi - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - func_execute_cmds "$finish_cmds" 'admincmds="$admincmds -'"$cmd"'"' - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $opt_dry_run || eval "$cmds" || func_append admincmds " - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - $opt_silent && exit $EXIT_SUCCESS - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - echo "----------------------------------------------------------------------" - echo "Libraries have been installed in:" - for libdir in $libdirs; do - $ECHO " $libdir" - done - echo - echo "If you ever happen to want to link against installed libraries" - echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" - fi - if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $ECHO " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $ECHO " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - echo - - echo "See any operating system documentation about shared libraries for" - case $host in - solaris2.[6789]|solaris2.1[0-9]) - echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" - echo "pages." - ;; - *) - echo "more information, such as the ld(1) and ld.so(8) manual pages." - ;; - esac - echo "----------------------------------------------------------------------" - fi - exit $EXIT_SUCCESS -} - -test "$opt_mode" = finish && func_mode_finish ${1+"$@"} - - -# func_mode_install arg... -func_mode_install () -{ - $opt_debug - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - case $nonopt in *shtool*) :;; *) false;; esac; then - # Aesthetically quote it. - func_quote_for_eval "$nonopt" - install_prog="$func_quote_for_eval_result " - arg=$1 - shift - else - install_prog= - arg=$nonopt - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - func_quote_for_eval "$arg" - func_append install_prog "$func_quote_for_eval_result" - install_shared_prog=$install_prog - case " $install_prog " in - *[\\\ /]cp\ *) install_cp=: ;; - *) install_cp=false ;; - esac - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - no_mode=: - for arg - do - arg2= - if test -n "$dest"; then - func_append files " $dest" - dest=$arg - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) - if $install_cp; then :; else - prev=$arg - fi - ;; - -g | -m | -o) - prev=$arg - ;; - -s) - stripme=" -s" - continue - ;; - -*) - ;; - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - if test "x$prev" = x-m && test -n "$install_override_mode"; then - arg2=$install_override_mode - no_mode=false - fi - prev= - else - dest=$arg - continue - fi - ;; - esac - - # Aesthetically quote the argument. - func_quote_for_eval "$arg" - func_append install_prog " $func_quote_for_eval_result" - if test -n "$arg2"; then - func_quote_for_eval "$arg2" - fi - func_append install_shared_prog " $func_quote_for_eval_result" - done - - test -z "$install_prog" && \ - func_fatal_help "you must specify an install program" - - test -n "$prev" && \ - func_fatal_help "the \`$prev' option requires an argument" - - if test -n "$install_override_mode" && $no_mode; then - if $install_cp; then :; else - func_quote_for_eval "$install_override_mode" - func_append install_shared_prog " -m $func_quote_for_eval_result" - fi - fi - - if test -z "$files"; then - if test -z "$dest"; then - func_fatal_help "no file or destination specified" - else - func_fatal_help "you must specify a destination" - fi - fi - - # Strip any trailing slash from the destination. - func_stripname '' '/' "$dest" - dest=$func_stripname_result - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - func_dirname_and_basename "$dest" "" "." - destdir="$func_dirname_result" - destname="$func_basename_result" - - # Not a directory, so check to see that there is only one file specified. - set dummy $files; shift - test "$#" -gt 1 && \ - func_fatal_help "\`$dest' is not a directory" - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - func_fatal_help "\`$destdir' must be an absolute directory name" - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - func_append staticlibs " $file" - ;; - - *.la) - func_resolve_sysroot "$file" - file=$func_resolve_sysroot_result - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$file' is not a valid libtool archive" - - library_names= - old_library= - relink_command= - func_source "$file" - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) func_append current_libdirs " $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) func_append future_libdirs " $libdir" ;; - esac - fi - - func_dirname "$file" "/" "" - dir="$func_dirname_result" - func_append dir "$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - test "$inst_prefix_dir" = "$destdir" && \ - func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - func_warning "relinking \`$file'" - func_show_eval "$relink_command" \ - 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' - fi - - # See the names of the shared library. - set dummy $library_names; shift - if test -n "$1"; then - realname="$1" - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ - 'exit $?' - tstripme="$stripme" - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - case $realname in - *.dll.a) - tstripme="" - ;; - esac - ;; - esac - if test -n "$tstripme" && test -n "$striplib"; then - func_show_eval "$striplib $destdir/$realname" 'exit $?' - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - # Try `ln -sf' first, because the `ln' binary might depend on - # the symlink we replace! Solaris /bin/ln does not understand -f, - # so we also need to try rm && ln -s. - for linkname - do - test "$linkname" != "$realname" \ - && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - func_execute_cmds "$postinstall_cmds" 'exit $?' - fi - - # Install the pseudo-library for information purposes. - func_basename "$file" - name="$func_basename_result" - instname="$dir/$name"i - func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' - - # Maybe install the static library, too. - test -n "$old_library" && func_append staticlibs " $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - func_lo2o "$destfile" - staticdest=$func_lo2o_result - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - func_fatal_help "cannot copy a libtool object to \`$destfile'" - ;; - esac - - # Install the libtool object if requested. - test -n "$destfile" && \ - func_show_eval "$install_prog $file $destfile" 'exit $?' - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - func_lo2o "$file" - staticobj=$func_lo2o_result - func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' - fi - exit $EXIT_SUCCESS - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - func_stripname '' '.exe' "$file" - file=$func_stripname_result - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin* | *mingw*) - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - wrapper=$func_ltwrapper_scriptname_result - else - func_stripname '' '.exe' "$file" - wrapper=$func_stripname_result - fi - ;; - *) - wrapper=$file - ;; - esac - if func_ltwrapper_script_p "$wrapper"; then - notinst_deplibs= - relink_command= - - func_source "$wrapper" - - # Check the variables that should have been set. - test -z "$generated_by_libtool_version" && \ - func_fatal_error "invalid libtool wrapper script \`$wrapper'" - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - func_source "$lib" - fi - libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - func_warning "\`$lib' has not been installed in \`$libdir'" - finalize=no - fi - done - - relink_command= - func_source "$wrapper" - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - $opt_dry_run || { - if test "$finalize" = yes; then - tmpdir=`func_mktempdir` - func_basename "$file$stripped_ext" - file="$func_basename_result" - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` - - $opt_silent || { - func_quote_for_expand "$relink_command" - eval "func_echo $func_quote_for_expand_result" - } - if eval "$relink_command"; then : - else - func_error "error: relink \`$file' with the above command before installing it" - $opt_dry_run || ${RM}r "$tmpdir" - continue - fi - file="$outputname" - else - func_warning "cannot relink \`$file'" - fi - } - else - # Install the binary that we compiled earlier. - file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyway - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - func_stripname '' '.exe' "$destfile" - destfile=$func_stripname_result - ;; - esac - ;; - esac - func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' - $opt_dry_run || if test -n "$outputname"; then - ${RM}r "$tmpdir" - fi - ;; - esac - done - - for file in $staticlibs; do - func_basename "$file" - name="$func_basename_result" - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 - tool_oldlib=$func_to_tool_file_result - - func_show_eval "$install_prog \$file \$oldlib" 'exit $?' - - if test -n "$stripme" && test -n "$old_striplib"; then - func_show_eval "$old_striplib $tool_oldlib" 'exit $?' - fi - - # Do each command in the postinstall commands. - func_execute_cmds "$old_postinstall_cmds" 'exit $?' - done - - test -n "$future_libdirs" && \ - func_warning "remember to run \`$progname --finish$future_libdirs'" - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - $opt_dry_run && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else - exit $EXIT_SUCCESS - fi -} - -test "$opt_mode" = install && func_mode_install ${1+"$@"} - - -# func_generate_dlsyms outputname originator pic_p -# Extract symbols from dlprefiles and create ${outputname}S.o with -# a dlpreopen symbol table. -func_generate_dlsyms () -{ - $opt_debug - my_outputname="$1" - my_originator="$2" - my_pic_p="${3-no}" - my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` - my_dlsyms= - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - my_dlsyms="${my_outputname}S.c" - else - func_error "not configured to extract global symbols from dlpreopened files" - fi - fi - - if test -n "$my_dlsyms"; then - case $my_dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${my_outputname}.nm" - - func_show_eval "$RM $nlist ${nlist}S ${nlist}T" - - # Parse the name list into a source file. - func_verbose "creating $output_objdir/$my_dlsyms" - - $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ -/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ -/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) -#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" -#endif - -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - func_verbose "generating symbol list for \`$output'" - - $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` - for progfile in $progfiles; do - func_to_tool_file "$progfile" func_convert_file_msys_to_w32 - func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" - $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $opt_dry_run || { - eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - if test -n "$export_symbols_regex"; then - $opt_dry_run || { - eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" - $opt_dry_run || { - $RM $export_symbols - eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - case $host in - *cygwin* | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' - ;; - esac - } - else - $opt_dry_run || { - eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' - eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - case $host in - *cygwin* | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' - ;; - esac - } - fi - fi - - for dlprefile in $dlprefiles; do - func_verbose "extracting global C symbols from \`$dlprefile'" - func_basename "$dlprefile" - name="$func_basename_result" - case $host in - *cygwin* | *mingw* | *cegcc* ) - # if an import library, we need to obtain dlname - if func_win32_import_lib_p "$dlprefile"; then - func_tr_sh "$dlprefile" - eval "curr_lafile=\$libfile_$func_tr_sh_result" - dlprefile_dlbasename="" - if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then - # Use subshell, to avoid clobbering current variable values - dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` - if test -n "$dlprefile_dlname" ; then - func_basename "$dlprefile_dlname" - dlprefile_dlbasename="$func_basename_result" - else - # no lafile. user explicitly requested -dlpreopen . - $sharedlib_from_linklib_cmd "$dlprefile" - dlprefile_dlbasename=$sharedlib_from_linklib_result - fi - fi - $opt_dry_run || { - if test -n "$dlprefile_dlbasename" ; then - eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' - else - func_warning "Could not compute DLL name from $name" - eval '$ECHO ": $name " >> "$nlist"' - fi - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | - $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" - } - else # not an import lib - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - fi - ;; - *) - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - ;; - esac - done - - $opt_dry_run || { - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $MV "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if $GREP -v "^: " < "$nlist" | - if sort -k 3 /dev/null 2>&1; then - sort -k 3 - else - sort +2 - fi | - uniq > "$nlist"S; then - : - else - $GREP -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' - else - echo '/* NONE */' >> "$output_objdir/$my_dlsyms" - fi - - echo >> "$output_objdir/$my_dlsyms" "\ - -/* The mapping between symbol names and symbols. */ -typedef struct { - const char *name; - void *address; -} lt_dlsymlist; -extern LT_DLSYM_CONST lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[]; -LT_DLSYM_CONST lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[] = -{\ - { \"$my_originator\", (void *) 0 }," - - case $need_lib_prefix in - no) - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - *) - eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - esac - echo >> "$output_objdir/$my_dlsyms" "\ - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_${my_prefix}_LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - } # !$opt_dry_run - - pic_flag_for_symtable= - case "$compile_command " in - *" -static "*) ;; - *) - case $host in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; - *-*-hpux*) - pic_flag_for_symtable=" $pic_flag" ;; - *) - if test "X$my_pic_p" != Xno; then - pic_flag_for_symtable=" $pic_flag" - fi - ;; - esac - ;; - esac - symtab_cflags= - for arg in $LTCFLAGS; do - case $arg in - -pie | -fpie | -fPIE) ;; - *) func_append symtab_cflags " $arg" ;; - esac - done - - # Now compile the dynamic symbol file. - func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' - - # Clean up the generated files. - func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' - - # Transform the symbol file into the correct name. - symfileobj="$output_objdir/${my_outputname}S.$objext" - case $host in - *cygwin* | *mingw* | *cegcc* ) - if test -f "$output_objdir/$my_outputname.def"; then - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - else - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` - fi - ;; - *) - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` - ;; - esac - ;; - *) - func_fatal_error "unknown suffix for \`$my_dlsyms'" - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` - fi -} - -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -# Despite the name, also deal with 64 bit binaries. -func_win32_libid () -{ - $opt_debug - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | - $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then - func_to_tool_file "$1" func_convert_file_msys_to_w32 - win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | - $SED -n -e ' - 1,100{ - / I /{ - s,.*,import, - p - q - } - }'` - case $win32_nmres in - import*) win32_libid_type="x86 archive import";; - *) win32_libid_type="x86 archive static";; - esac - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $ECHO "$win32_libid_type" -} - -# func_cygming_dll_for_implib ARG -# -# Platform-specific function to extract the -# name of the DLL associated with the specified -# import library ARG. -# Invoked by eval'ing the libtool variable -# $sharedlib_from_linklib_cmd -# Result is available in the variable -# $sharedlib_from_linklib_result -func_cygming_dll_for_implib () -{ - $opt_debug - sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` -} - -# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs -# -# The is the core of a fallback implementation of a -# platform-specific function to extract the name of the -# DLL associated with the specified import library LIBNAME. -# -# SECTION_NAME is either .idata$6 or .idata$7, depending -# on the platform and compiler that created the implib. -# -# Echos the name of the DLL associated with the -# specified import library. -func_cygming_dll_for_implib_fallback_core () -{ - $opt_debug - match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` - $OBJDUMP -s --section "$1" "$2" 2>/dev/null | - $SED '/^Contents of section '"$match_literal"':/{ - # Place marker at beginning of archive member dllname section - s/.*/====MARK====/ - p - d - } - # These lines can sometimes be longer than 43 characters, but - # are always uninteresting - /:[ ]*file format pe[i]\{,1\}-/d - /^In archive [^:]*:/d - # Ensure marker is printed - /^====MARK====/p - # Remove all lines with less than 43 characters - /^.\{43\}/!d - # From remaining lines, remove first 43 characters - s/^.\{43\}//' | - $SED -n ' - # Join marker and all lines until next marker into a single line - /^====MARK====/ b para - H - $ b para - b - :para - x - s/\n//g - # Remove the marker - s/^====MARK====// - # Remove trailing dots and whitespace - s/[\. \t]*$// - # Print - /./p' | - # we now have a list, one entry per line, of the stringified - # contents of the appropriate section of all members of the - # archive which possess that section. Heuristic: eliminate - # all those which have a first or second character that is - # a '.' (that is, objdump's representation of an unprintable - # character.) This should work for all archives with less than - # 0x302f exports -- but will fail for DLLs whose name actually - # begins with a literal '.' or a single character followed by - # a '.'. - # - # Of those that remain, print the first one. - $SED -e '/^\./d;/^.\./d;q' -} - -# func_cygming_gnu_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is a GNU/binutils-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_gnu_implib_p () -{ - $opt_debug - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` - test -n "$func_cygming_gnu_implib_tmp" -} - -# func_cygming_ms_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is an MS-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_ms_implib_p () -{ - $opt_debug - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` - test -n "$func_cygming_ms_implib_tmp" -} - -# func_cygming_dll_for_implib_fallback ARG -# Platform-specific function to extract the -# name of the DLL associated with the specified -# import library ARG. -# -# This fallback implementation is for use when $DLLTOOL -# does not support the --identify-strict option. -# Invoked by eval'ing the libtool variable -# $sharedlib_from_linklib_cmd -# Result is available in the variable -# $sharedlib_from_linklib_result -func_cygming_dll_for_implib_fallback () -{ - $opt_debug - if func_cygming_gnu_implib_p "$1" ; then - # binutils import library - sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` - elif func_cygming_ms_implib_p "$1" ; then - # ms-generated import library - sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` - else - # unknown - sharedlib_from_linklib_result="" - fi -} - - -# func_extract_an_archive dir oldlib -func_extract_an_archive () -{ - $opt_debug - f_ex_an_ar_dir="$1"; shift - f_ex_an_ar_oldlib="$1" - if test "$lock_old_archive_extraction" = yes; then - lockfile=$f_ex_an_ar_oldlib.lock - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - fi - func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ - 'stat=$?; rm -f "$lockfile"; exit $stat' - if test "$lock_old_archive_extraction" = yes; then - $opt_dry_run || rm -f "$lockfile" - fi - if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then - : - else - func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" - fi -} - - -# func_extract_archives gentop oldlib ... -func_extract_archives () -{ - $opt_debug - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - - for my_xlib in $my_oldlibs; do - # Extract the objects. - case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; - *) my_xabs=`pwd`"/$my_xlib" ;; - esac - func_basename "$my_xlib" - my_xlib="$func_basename_result" - my_xlib_u=$my_xlib - while :; do - case " $extracted_archives " in - *" $my_xlib_u "*) - func_arith $extracted_serial + 1 - extracted_serial=$func_arith_result - my_xlib_u=lt$extracted_serial-$my_xlib ;; - *) break ;; - esac - done - extracted_archives="$extracted_archives $my_xlib_u" - my_xdir="$my_gentop/$my_xlib_u" - - func_mkdir_p "$my_xdir" - - case $host in - *-darwin*) - func_verbose "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - $opt_dry_run || { - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`basename "$darwin_archive"` - darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` - if test -n "$darwin_arches"; then - darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - func_extract_an_archive "`pwd`" "${darwin_base_archive}" - cd "$darwin_curdir" - $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" - done # $darwin_arches - ## Okay now we've a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` - darwin_file= - darwin_files= - for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` - $LIPO -create -output "$darwin_file" $darwin_files - done # $darwin_filelist - $RM -rf unfat-$$ - cd "$darwin_orig_dir" - else - cd $darwin_orig_dir - func_extract_an_archive "$my_xdir" "$my_xabs" - fi # $darwin_arches - } # !$opt_dry_run - ;; - *) - func_extract_an_archive "$my_xdir" "$my_xabs" - ;; - esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` - done - - func_extract_archives_result="$my_oldobjs" -} - - -# func_emit_wrapper [arg=no] -# -# Emit a libtool wrapper script on stdout. -# Don't directly open a file because we may want to -# incorporate the script contents within a cygwin/mingw -# wrapper executable. Must ONLY be called from within -# func_mode_link because it depends on a number of variables -# set therein. -# -# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR -# variable will take. If 'yes', then the emitted script -# will assume that the directory in which it is stored is -# the $objdir directory. This is a cygwin/mingw-specific -# behavior. -func_emit_wrapper () -{ - func_emit_wrapper_arg1=${1-no} - - $ECHO "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='$sed_quote_subst' - -# Be Bourne compatible -if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variables: - generated_by_libtool_version='$macro_version' - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$ECHO are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - file=\"\$0\"" - - qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` - $ECHO "\ - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - ECHO=\"$qECHO\" - fi - -# Very basic option parsing. These options are (a) specific to -# the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ which is used only on -# windows platforms, and (c) all begin with the string "--lt-" -# (application programs are unlikely to have options which match -# this pattern). -# -# There are only two supported options: --lt-debug and -# --lt-dump-script. There is, deliberately, no --lt-help. -# -# The first argument to this parsing function should be the -# script's $0 value, followed by "$@". -lt_option_debug= -func_parse_lt_options () -{ - lt_script_arg0=\$0 - shift - for lt_opt - do - case \"\$lt_opt\" in - --lt-debug) lt_option_debug=1 ;; - --lt-dump-script) - lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` - test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. - lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` - cat \"\$lt_dump_D/\$lt_dump_F\" - exit 0 - ;; - --lt-*) - \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 - exit 1 - ;; - esac - done - - # Print the debug banner immediately: - if test -n \"\$lt_option_debug\"; then - echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 - fi -} - -# Used when --lt-debug. Prints its arguments to stdout -# (redirection is the responsibility of the caller) -func_lt_dump_args () -{ - lt_dump_args_N=1; - for lt_arg - do - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" - lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` - done -} - -# Core function for launching the target application -func_exec_program_core () -{ -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2* | *-cegcc*) - $ECHO "\ - if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 - func_lt_dump_args \${1+\"\$@\"} 1>&2 - fi - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $ECHO "\ - if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 - func_lt_dump_args \${1+\"\$@\"} 1>&2 - fi - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $ECHO "\ - \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 - exit 1 -} - -# A function to encapsulate launching the target application -# Strips options in the --lt-* namespace from \$@ and -# launches target application with the remaining arguments. -func_exec_program () -{ - case \" \$* \" in - *\\ --lt-*) - for lt_wr_arg - do - case \$lt_wr_arg in - --lt-*) ;; - *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; - esac - shift - done ;; - esac - func_exec_program_core \${1+\"\$@\"} -} - - # Parse options - func_parse_lt_options \"\$0\" \${1+\"\$@\"} - - # Find the directory that this script lives in. - thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` - done - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 - if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then - # special case for '.' - if test \"\$thisdir\" = \".\"; then - thisdir=\`pwd\` - fi - # remove .libs from thisdir - case \"\$thisdir\" in - *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; - $objdir ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $ECHO "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $MKDIR \"\$progdir\" - else - $RM \"\$progdir/\$file\" - fi" - - $ECHO "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $ECHO \"\$relink_command_output\" >&2 - $RM \"\$progdir/\$file\" - exit 1 - fi - fi - - $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $RM \"\$progdir/\$program\"; - $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $RM \"\$progdir/\$file\" - fi" - else - $ECHO "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $ECHO "\ - - if test -f \"\$progdir/\$program\"; then" - - # fixup the dll searchpath if we need to. - # - # Fix the DLL searchpath if we need to. Do this before prepending - # to shlibpath, because on Windows, both are PATH and uninstalled - # libraries must come first. - if test -n "$dllsearchpath"; then - $ECHO "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $ECHO "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` - - export $shlibpath_var -" - fi - - $ECHO "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. - func_exec_program \${1+\"\$@\"} - fi - else - # The program doesn't exist. - \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 - \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 - \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" -} - - -# func_emit_cwrapperexe_src -# emit the source code for a wrapper executable on stdout -# Must ONLY be called from within func_mode_link because -# it depends on a number of variable set therein. -func_emit_cwrapperexe_src () -{ - cat < -#include -#ifdef _MSC_VER -# include -# include -# include -#else -# include -# include -# ifdef __CYGWIN__ -# include -# endif -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -/* declarations of non-ANSI functions */ -#if defined(__MINGW32__) -# ifdef __STRICT_ANSI__ -int _putenv (const char *); -# endif -#elif defined(__CYGWIN__) -# ifdef __STRICT_ANSI__ -char *realpath (const char *, char *); -int putenv (char *); -int setenv (const char *, const char *, int); -# endif -/* #elif defined (other platforms) ... */ -#endif - -/* portability defines, excluding path handling macros */ -#if defined(_MSC_VER) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -# define S_IXUSR _S_IEXEC -# ifndef _INTPTR_T_DEFINED -# define _INTPTR_T_DEFINED -# define intptr_t int -# endif -#elif defined(__MINGW32__) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -#elif defined(__CYGWIN__) -# define HAVE_SETENV -# define FOPEN_WB "wb" -/* #elif defined (other platforms) ... */ -#endif - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef S_IXOTH -# define S_IXOTH 0 -#endif -#ifndef S_IXGRP -# define S_IXGRP 0 -#endif - -/* path handling portability macros */ -#ifndef DIR_SEPARATOR -# define DIR_SEPARATOR '/' -# define PATH_SEPARATOR ':' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -# define HAVE_DOS_BASED_FILE_SYSTEM -# define FOPEN_WB "wb" -# ifndef DIR_SEPARATOR_2 -# define DIR_SEPARATOR_2 '\\' -# endif -# ifndef PATH_SEPARATOR_2 -# define PATH_SEPARATOR_2 ';' -# endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#ifndef PATH_SEPARATOR_2 -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) -#else /* PATH_SEPARATOR_2 */ -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) -#endif /* PATH_SEPARATOR_2 */ - -#ifndef FOPEN_WB -# define FOPEN_WB "w" -#endif -#ifndef _O_BINARY -# define _O_BINARY 0 -#endif - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -#if defined(LT_DEBUGWRAPPER) -static int lt_debug = 1; -#else -static int lt_debug = 0; -#endif - -const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ - -void *xmalloc (size_t num); -char *xstrdup (const char *string); -const char *base_name (const char *name); -char *find_executable (const char *wrapper); -char *chase_symlinks (const char *pathspec); -int make_executable (const char *path); -int check_executable (const char *path); -char *strendzap (char *str, const char *pat); -void lt_debugprintf (const char *file, int line, const char *fmt, ...); -void lt_fatal (const char *file, int line, const char *message, ...); -static const char *nonnull (const char *s); -static const char *nonempty (const char *s); -void lt_setenv (const char *name, const char *value); -char *lt_extend_str (const char *orig_value, const char *add, int to_end); -void lt_update_exe_path (const char *name, const char *value); -void lt_update_lib_path (const char *name, const char *value); -char **prepare_spawn (char **argv); -void lt_dump_script (FILE *f); -EOF - - cat <= 0) - && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) - return 1; - else - return 0; -} - -int -make_executable (const char *path) -{ - int rval = 0; - struct stat st; - - lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", - nonempty (path)); - if ((!path) || (!*path)) - return 0; - - if (stat (path, &st) >= 0) - { - rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); - } - return rval; -} - -/* Searches for the full path of the wrapper. Returns - newly allocated full path name if found, NULL otherwise - Does not chase symlinks, even on platforms that support them. -*/ -char * -find_executable (const char *wrapper) -{ - int has_slash = 0; - const char *p; - const char *p_next; - /* static buffer for getcwd */ - char tmp[LT_PATHMAX + 1]; - int tmp_len; - char *concat_name; - - lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", - nonempty (wrapper)); - - if ((wrapper == NULL) || (*wrapper == '\0')) - return NULL; - - /* Absolute path? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - else - { -#endif - if (IS_DIR_SEPARATOR (wrapper[0])) - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - } -#endif - - for (p = wrapper; *p; p++) - if (*p == '/') - { - has_slash = 1; - break; - } - if (!has_slash) - { - /* no slashes; search PATH */ - const char *path = getenv ("PATH"); - if (path != NULL) - { - for (p = path; *p; p = p_next) - { - const char *q; - size_t p_len; - for (q = p; *q; q++) - if (IS_PATH_SEPARATOR (*q)) - break; - p_len = q - p; - p_next = (*q == '\0' ? q : q + 1); - if (p_len == 0) - { - /* empty path: current directory */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", - nonnull (strerror (errno))); - tmp_len = strlen (tmp); - concat_name = - XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - } - else - { - concat_name = - XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, p, p_len); - concat_name[p_len] = '/'; - strcpy (concat_name + p_len + 1, wrapper); - } - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - } - /* not found in PATH; assume curdir */ - } - /* Relative path | not found in path: prepend cwd */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", - nonnull (strerror (errno))); - tmp_len = strlen (tmp); - concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - return NULL; -} - -char * -chase_symlinks (const char *pathspec) -{ -#ifndef S_ISLNK - return xstrdup (pathspec); -#else - char buf[LT_PATHMAX]; - struct stat s; - char *tmp_pathspec = xstrdup (pathspec); - char *p; - int has_symlinks = 0; - while (strlen (tmp_pathspec) && !has_symlinks) - { - lt_debugprintf (__FILE__, __LINE__, - "checking path component for symlinks: %s\n", - tmp_pathspec); - if (lstat (tmp_pathspec, &s) == 0) - { - if (S_ISLNK (s.st_mode) != 0) - { - has_symlinks = 1; - break; - } - - /* search backwards for last DIR_SEPARATOR */ - p = tmp_pathspec + strlen (tmp_pathspec) - 1; - while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - p--; - if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - { - /* no more DIR_SEPARATORS left */ - break; - } - *p = '\0'; - } - else - { - lt_fatal (__FILE__, __LINE__, - "error accessing file \"%s\": %s", - tmp_pathspec, nonnull (strerror (errno))); - } - } - XFREE (tmp_pathspec); - - if (!has_symlinks) - { - return xstrdup (pathspec); - } - - tmp_pathspec = realpath (pathspec, buf); - if (tmp_pathspec == 0) - { - lt_fatal (__FILE__, __LINE__, - "could not follow symlinks for %s", pathspec); - } - return xstrdup (tmp_pathspec); -#endif -} - -char * -strendzap (char *str, const char *pat) -{ - size_t len, patlen; - - assert (str != NULL); - assert (pat != NULL); - - len = strlen (str); - patlen = strlen (pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp (str, pat) == 0) - *str = '\0'; - } - return str; -} - -void -lt_debugprintf (const char *file, int line, const char *fmt, ...) -{ - va_list args; - if (lt_debug) - { - (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); - va_start (args, fmt); - (void) vfprintf (stderr, fmt, args); - va_end (args); - } -} - -static void -lt_error_core (int exit_status, const char *file, - int line, const char *mode, - const char *message, va_list ap) -{ - fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *file, int line, const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); - va_end (ap); -} - -static const char * -nonnull (const char *s) -{ - return s ? s : "(null)"; -} - -static const char * -nonempty (const char *s) -{ - return (s && !*s) ? "(empty)" : nonnull (s); -} - -void -lt_setenv (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_setenv) setting '%s' to '%s'\n", - nonnull (name), nonnull (value)); - { -#ifdef HAVE_SETENV - /* always make a copy, for consistency with !HAVE_SETENV */ - char *str = xstrdup (value); - setenv (name, str, 1); -#else - int len = strlen (name) + 1 + strlen (value) + 1; - char *str = XMALLOC (char, len); - sprintf (str, "%s=%s", name, value); - if (putenv (str) != EXIT_SUCCESS) - { - XFREE (str); - } -#endif - } -} - -char * -lt_extend_str (const char *orig_value, const char *add, int to_end) -{ - char *new_value; - if (orig_value && *orig_value) - { - int orig_value_len = strlen (orig_value); - int add_len = strlen (add); - new_value = XMALLOC (char, add_len + orig_value_len + 1); - if (to_end) - { - strcpy (new_value, orig_value); - strcpy (new_value + orig_value_len, add); - } - else - { - strcpy (new_value, add); - strcpy (new_value + add_len, orig_value); - } - } - else - { - new_value = xstrdup (add); - } - return new_value; -} - -void -lt_update_exe_path (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", - nonnull (name), nonnull (value)); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - /* some systems can't cope with a ':'-terminated path #' */ - int len = strlen (new_value); - while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) - { - new_value[len-1] = '\0'; - } - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -void -lt_update_lib_path (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", - nonnull (name), nonnull (value)); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -EOF - case $host_os in - mingw*) - cat <<"EOF" - -/* Prepares an argument vector before calling spawn(). - Note that spawn() does not by itself call the command interpreter - (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : - ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&v); - v.dwPlatformId == VER_PLATFORM_WIN32_NT; - }) ? "cmd.exe" : "command.com"). - Instead it simply concatenates the arguments, separated by ' ', and calls - CreateProcess(). We must quote the arguments since Win32 CreateProcess() - interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a - special way: - - Space and tab are interpreted as delimiters. They are not treated as - delimiters if they are surrounded by double quotes: "...". - - Unescaped double quotes are removed from the input. Their only effect is - that within double quotes, space and tab are treated like normal - characters. - - Backslashes not followed by double quotes are not special. - - But 2*n+1 backslashes followed by a double quote become - n backslashes followed by a double quote (n >= 0): - \" -> " - \\\" -> \" - \\\\\" -> \\" - */ -#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -char ** -prepare_spawn (char **argv) -{ - size_t argc; - char **new_argv; - size_t i; - - /* Count number of arguments. */ - for (argc = 0; argv[argc] != NULL; argc++) - ; - - /* Allocate new argument vector. */ - new_argv = XMALLOC (char *, argc + 1); - - /* Put quoted arguments into the new argument vector. */ - for (i = 0; i < argc; i++) - { - const char *string = argv[i]; - - if (string[0] == '\0') - new_argv[i] = xstrdup ("\"\""); - else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) - { - int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); - size_t length; - unsigned int backslashes; - const char *s; - char *quoted_string; - char *p; - - length = 0; - backslashes = 0; - if (quote_around) - length++; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - length += backslashes + 1; - length++; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - length += backslashes + 1; - - quoted_string = XMALLOC (char, length + 1); - - p = quoted_string; - backslashes = 0; - if (quote_around) - *p++ = '"'; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - { - unsigned int j; - for (j = backslashes + 1; j > 0; j--) - *p++ = '\\'; - } - *p++ = c; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - { - unsigned int j; - for (j = backslashes; j > 0; j--) - *p++ = '\\'; - *p++ = '"'; - } - *p = '\0'; - - new_argv[i] = quoted_string; - } - else - new_argv[i] = (char *) string; - } - new_argv[argc] = NULL; - - return new_argv; -} -EOF - ;; - esac - - cat <<"EOF" -void lt_dump_script (FILE* f) -{ -EOF - func_emit_wrapper yes | - $SED -n -e ' -s/^\(.\{79\}\)\(..*\)/\1\ -\2/ -h -s/\([\\"]\)/\\\1/g -s/$/\\n/ -s/\([^\n]*\).*/ fputs ("\1", f);/p -g -D' - cat <<"EOF" -} -EOF -} -# end: func_emit_cwrapperexe_src - -# func_win32_import_lib_p ARG -# True if ARG is an import lib, as indicated by $file_magic_cmd -func_win32_import_lib_p () -{ - $opt_debug - case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in - *import*) : ;; - *) false ;; - esac -} - -# func_mode_link arg... -func_mode_link () -{ - $opt_debug - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - # It is impossible to link a dll without this setting, and - # we shouldn't force the makefile maintainer to figure out - # which system we are compiling for in order to pass an extra - # flag for every libtool invocation. - # allow_undefined=no - - # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll which has undefined symbols, in which case not - # even a static library is built. For now, we need to specify - # -no-undefined on the libtool link line when we can be certain - # that all symbols are satisfied, otherwise we get a static library. - allow_undefined=yes - ;; - *) - allow_undefined=yes - ;; - esac - libtool_args=$nonopt - base_compile="$nonopt $@" - compile_command=$nonopt - finalize_command=$nonopt - - compile_rpath= - finalize_rpath= - compile_shlibpath= - finalize_shlibpath= - convenience= - old_convenience= - deplibs= - old_deplibs= - compiler_flags= - linker_flags= - dllsearchpath= - lib_search_path=`pwd` - inst_prefix_dir= - new_inherited_linker_flags= - - avoid_version=no - bindir= - dlfiles= - dlprefiles= - dlself=no - export_dynamic=no - export_symbols= - export_symbols_regex= - generated= - libobjs= - ltlibs= - module=no - no_install=no - objs= - non_pic_objects= - precious_files_regex= - prefer_static_libs=no - preload=no - prev= - prevarg= - release= - rpath= - xrpath= - perm_rpath= - temp_rpath= - thread_safe=no - vinfo= - vinfo_number=no - weak_libs= - single_module="${wl}-single_module" - func_infer_tag $base_compile - - # We need to know -static, to get the right output filenames. - for arg - do - case $arg in - -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" - build_old_libs=no - break - ;; - -all-static | -static | -static-libtool-libs) - case $arg in - -all-static) - if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - func_warning "complete static linking is impossible in this configuration" - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - -static) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=built - ;; - -static-libtool-libs) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - esac - build_libtool_libs=no - build_old_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - shift - func_quote_for_eval "$arg" - qarg=$func_quote_for_eval_unquoted_result - func_append libtool_args " $func_quote_for_eval_result" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - func_append compile_command " @OUTPUT@" - func_append finalize_command " @OUTPUT@" - ;; - esac - - case $prev in - bindir) - bindir="$arg" - prev= - continue - ;; - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - func_append compile_command " @SYMFILE@" - func_append finalize_command " @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - func_append dlfiles " $arg" - else - func_append dlprefiles " $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - test -f "$arg" \ - || func_fatal_error "symbol file \`$arg' does not exist" - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - framework) - case $host in - *-*-darwin*) - case "$deplibs " in - *" $qarg.ltframework "*) ;; - *) func_append deplibs " $qarg.ltframework" # this is fixed later - ;; - esac - ;; - esac - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat "$save_arg"` - do -# func_append moreargs " $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - func_append dlfiles " $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - func_append dlprefiles " $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - done - else - func_fatal_error "link input file \`$arg' does not exist" - fi - arg=$save_arg - prev= - continue - ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) func_append rpath " $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) func_append xrpath " $arg" ;; - esac - fi - prev= - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; - weak) - func_append weak_libs " $arg" - prev= - continue - ;; - xcclinker) - func_append linker_flags " $qarg" - func_append compiler_flags " $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xcompiler) - func_append compiler_flags " $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xlinker) - func_append linker_flags " $qarg" - func_append compiler_flags " $wl$qarg" - prev= - func_append compile_command " $wl$qarg" - func_append finalize_command " $wl$qarg" - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n "$prev" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - # See comment for -static flag below, for more details. - func_append compile_command " $link_static_flag" - func_append finalize_command " $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - func_fatal_error "\`-allow-undefined' must not be used because it is the default" - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -bindir) - prev=bindir - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - func_fatal_error "more than one -exported-symbols argument is not allowed" - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -framework) - prev=framework - continue - ;; - - -inst-prefix-dir) - prev=inst_prefix - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - func_append compile_command " $arg" - func_append finalize_command " $arg" - ;; - esac - continue - ;; - - -L*) - func_stripname "-L" '' "$arg" - if test -z "$func_stripname_result"; then - if test "$#" -gt 0; then - func_fatal_error "require no space between \`-L' and \`$1'" - else - func_fatal_error "need path for \`-L' option" - fi - fi - func_resolve_sysroot "$func_stripname_result" - dir=$func_resolve_sysroot_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - test -z "$absdir" && \ - func_fatal_error "cannot determine absolute directory name of \`$dir'" - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "* | *" $arg "*) - # Will only happen for absolute or sysroot arguments - ;; - *) - # Preserve sysroot, but never include relative directories - case $dir in - [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; - *) func_append deplibs " -L$dir" ;; - esac - func_append lib_search_path " $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$dir:"*) ;; - ::) dllsearchpath=$dir;; - *) func_append dllsearchpath ":$dir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) func_append dllsearchpath ":$testbindir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - func_append deplibs " System.ltframework" - continue - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - test "X$arg" = "X-lc" && continue - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - test "X$arg" = "X-lc" && continue - ;; - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - func_append deplibs " $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # Tru64 UNIX uses -model [arg] to determine the layout of C++ - # classes, name mangling, and exception handling. - # Darwin uses the -arch flag to determine output architecture. - -model|-arch|-isysroot|--sysroot) - func_append compiler_flags " $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - prev=xcompiler - continue - ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ - |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) - func_append compiler_flags " $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - case "$new_inherited_linker_flags " in - *" $arg "*) ;; - * ) func_append new_inherited_linker_flags " $arg" ;; - esac - continue - ;; - - -multi_module) - single_module="${wl}-multi_module" - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) - # The PATH hackery in wrapper scripts is required on Windows - # and Darwin in order for the loader to find any dlls it needs. - func_warning "\`-no-install' is ignored for $host" - func_warning "assuming \`-no-fast-install' instead" - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -precious-files-regex) - prev=precious_regex - continue - ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - func_stripname '-R' '' "$arg" - dir=$func_stripname_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - =*) - func_stripname '=' '' "$dir" - dir=$lt_sysroot$func_stripname_result - ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) func_append xrpath " $dir" ;; - esac - continue - ;; - - -shared) - # The effects of -shared are defined in a previous loop. - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -static | -static-libtool-libs) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -weak) - prev=weak - continue - ;; - - -Wc,*) - func_stripname '-Wc,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - func_append arg " $func_quote_for_eval_result" - func_append compiler_flags " $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Wl,*) - func_stripname '-Wl,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - func_append arg " $wl$func_quote_for_eval_result" - func_append compiler_flags " $wl$func_quote_for_eval_result" - func_append linker_flags " $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # -msg_* for osf cc - -msg_*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - # Flags to be passed through unchanged, with rationale: - # -64, -mips[0-9] enable 64-bit mode for the SGI compiler - # -r[0-9][0-9]* specify processor for the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler - # +DA*, +DD* enable 64-bit mode for the HP compiler - # -q* compiler args for the IBM compiler - # -m*, -t[45]*, -txscale* architecture-specific flags for GCC - # -F/path path to uninstalled frameworks, gcc on darwin - # -p, -pg, --coverage, -fprofile-* profiling flags for GCC - # @file GCC response files - # -tp=* Portland pgcc target processor selection - # --sysroot=* for sysroot support - # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ - -O*|-flto*|-fwhopr*|-fuse-linker-plugin) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - func_append compile_command " $arg" - func_append finalize_command " $arg" - func_append compiler_flags " $arg" - continue - ;; - - # Some other compiler flag. - -* | +*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - *.$objext) - # A standard object. - func_append objs " $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - func_append dlfiles " $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - func_append dlprefiles " $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - ;; - - *.$libext) - # An archive. - func_append deplibs " $arg" - func_append old_deplibs " $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - func_resolve_sysroot "$arg" - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - func_append dlfiles " $func_resolve_sysroot_result" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - func_append dlprefiles " $func_resolve_sysroot_result" - prev= - else - func_append deplibs " $func_resolve_sysroot_result" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - done # argument parsing loop - - test -n "$prev" && \ - func_fatal_help "the \`$prevarg' option requires an argument" - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - func_basename "$output" - outputname="$func_basename_result" - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - func_dirname "$output" "/" "" - output_objdir="$func_dirname_result$objdir" - func_to_tool_file "$output_objdir/" - tool_output_objdir=$func_to_tool_file_result - # Create the object directory. - func_mkdir_p "$output_objdir" - - # Determine the type of output - case $output in - "") - func_fatal_help "you must specify an output file" - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - specialdeplibs= - - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - if $opt_preserve_dup_deps ; then - case "$libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append libs " $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if $opt_duplicate_compiler_generated_deps; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; - esac - func_append pre_post_deps " $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries - - case $linkmode in - lib) - passes="conv dlpreopen link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - - for pass in $passes; do - # The preopen pass in lib mode reverses $deplibs; put it back here - # so that -L comes before libs that need it for instance... - if test "$linkmode,$pass" = "lib,link"; then - ## FIXME: Find the place where the list is rebuilt in the wrong - ## order, and fix it there properly - tmp_deplibs= - for deplib in $deplibs; do - tmp_deplibs="$deplib $tmp_deplibs" - done - deplibs="$tmp_deplibs" - fi - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; - esac - fi - if test "$linkmode,$pass" = "lib,dlpreopen"; then - # Collect and forward deplibs of preopened libtool libs - for lib in $dlprefiles; do - # Ignore non-libtool-libs - dependency_libs= - func_resolve_sysroot "$lib" - case $lib in - *.la) func_source "$func_resolve_sysroot_result" ;; - esac - - # Collect preopened libtool deplibs, except any this library - # has declared as weak libs - for deplib in $dependency_libs; do - func_basename "$deplib" - deplib_base=$func_basename_result - case " $weak_libs " in - *" $deplib_base "*) ;; - *) func_append deplibs " $deplib" ;; - esac - done - done - libs="$dlprefiles" - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - - for deplib in $libs; do - lib= - found=no - case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ - |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - func_append compiler_flags " $deplib" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) func_append new_inherited_linker_flags " $deplib" ;; - esac - fi - fi - continue - ;; - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - func_warning "\`-l' is ignored for archives/objects" - continue - fi - func_stripname '-l' '' "$deplib" - name=$func_stripname_result - if test "$linkmode" = lib; then - searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" - else - searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" - fi - for searchdir in $searchdirs; do - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if func_lalib_p "$lib"; then - library_names= - old_library= - func_source "$lib" - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi - fi - ;; # -l - *.ltframework) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) func_append new_inherited_linker_flags " $deplib" ;; - esac - fi - fi - continue - ;; - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" - ;; - *) - func_warning "\`-L' is ignored for archives/objects" - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - func_stripname '-R' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - dir=$func_resolve_sysroot_result - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) func_append xrpath " $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) - func_resolve_sysroot "$deplib" - lib=$func_resolve_sysroot_result - ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - # Linking convenience modules into shared libraries is allowed, - # but linking other static libraries is non-portable. - case " $dlpreconveniencelibs " in - *" $deplib "*) ;; - *) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes - fi - ;; - pass_all) - valid_a_lib=yes - ;; - esac - if test "$valid_a_lib" != yes; then - echo - $ECHO "*** Warning: Trying to link with static lib archive $deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because the file extensions .$libext of this argument makes me believe" - echo "*** that it is just a static archive that I should not use here." - else - echo - $ECHO "*** Warning: Linking the shared library $output against the" - $ECHO "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - ;; - esac - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - func_append newdlprefiles " $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - func_append newdlfiles " $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - - if test "$found" = yes || test -f "$lib"; then : - else - func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" - fi - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$lib" \ - || func_fatal_error "\`$lib' is not a valid libtool archive" - - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - inherited_linker_flags= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - avoidtemprpath= - - - # Read the .la file - func_source "$lib" - - # Convert "-framework foo" to "foo.ltframework" - if test -n "$inherited_linker_flags"; then - tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` - for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do - case " $new_inherited_linker_flags " in - *" $tmp_inherited_linker_flag "*) ;; - *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; - esac - done - fi - dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && func_append dlfiles " $dlopen" - test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - # It is a libtool convenience library, so add in its objects. - func_append convenience " $ladir/$objdir/$old_library" - func_append old_convenience " $ladir/$objdir/$old_library" - elif test "$linkmode" != prog && test "$linkmode" != lib; then - func_fatal_error "\`$lib' is not a convenience library" - fi - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append tmp_libs " $deplib" - done - continue - fi # $pass = conv - - - # Get the name of the library we link against. - linklib= - if test -n "$old_library" && - { test "$prefer_static_libs" = yes || - test "$prefer_static_libs,$installed" = "built,no"; }; then - linklib=$old_library - else - for l in $old_library $library_names; do - linklib="$l" - done - fi - if test -z "$linklib"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - func_fatal_error "cannot -dlopen a convenience library: \`$lib'" - fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - func_append dlprefiles " $lib $dependency_libs" - else - func_append newdlfiles " $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - func_warning "cannot determine absolute directory name of \`$ladir'" - func_warning "passing it literally to the linker, although it might fail" - abs_ladir="$ladir" - fi - ;; - esac - func_basename "$lib" - laname="$func_basename_result" - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - func_warning "library \`$lib' was moved." - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$lt_sysroot$libdir" - absdir="$lt_sysroot$libdir" - fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes - else - if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" - # Remove this search path later - func_append notinst_path " $abs_ladir" - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - func_append notinst_path " $abs_ladir" - fi - fi # $installed = yes - func_stripname 'lib' '.la' "$laname" - name=$func_stripname_result - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir" && test "$linkmode" = prog; then - func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" - fi - case "$host" in - # special handling for platforms with PE-DLLs. - *cygwin* | *mingw* | *cegcc* ) - # Linker will automatically link against shared library if both - # static and shared are present. Therefore, ensure we extract - # symbols from the import library if a shared library is present - # (otherwise, the dlopen module name will be incorrect). We do - # this by putting the import library name into $newdlprefiles. - # We recover the dlopen module name by 'saving' the la file - # name in a special purpose variable, and (later) extracting the - # dlname from the la file. - if test -n "$dlname"; then - func_tr_sh "$dir/$linklib" - eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" - func_append newdlprefiles " $dir/$linklib" - else - func_append newdlprefiles " $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - func_append dlpreconveniencelibs " $dir/$old_library" - fi - ;; - * ) - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - func_append newdlprefiles " $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - func_append dlpreconveniencelibs " $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - func_append newdlprefiles " $dir/$dlname" - else - func_append newdlprefiles " $dir/$linklib" - fi - ;; - esac - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - func_append newlib_search_path " $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" - ;; - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append tmp_libs " $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { { test "$prefer_static_libs" = no || - test "$prefer_static_libs,$installed" = "built,yes"; } || - test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath:" in - *"$absdir:"*) ;; - *) func_append temp_rpath "$absdir:" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) func_append compile_rpath " $absdir" ;; - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - ;; - esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - use_static_libs=$prefer_static_libs - if test "$use_static_libs" = built && test "$installed" = yes; then - use_static_libs=no - fi - if test -n "$library_names" && - { test "$use_static_libs" = no || test -z "$old_library"; }; then - case $host in - *cygwin* | *mingw* | *cegcc*) - # No point in relinking DLLs because paths are not encoded - func_append notinst_deplibs " $lib" - need_relink=no - ;; - *) - if test "$installed" = no; then - func_append notinst_deplibs " $lib" - need_relink=yes - fi - ;; - esac - # This is a shared library - - # Warn about portability, can't link against -module's on some - # systems (darwin). Don't bleat about dlopened modules though! - dlopenmodule="" - for dlpremoduletest in $dlprefiles; do - if test "X$dlpremoduletest" = "X$lib"; then - dlopenmodule="$dlpremoduletest" - break - fi - done - if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then - echo - if test "$linkmode" = prog; then - $ECHO "*** Warning: Linking the executable $output against the loadable module" - else - $ECHO "*** Warning: Linking the shared library $output against the loadable module" - fi - $ECHO "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) func_append compile_rpath " $absdir" ;; - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - shift - realname="$1" - shift - libname=`eval "\\$ECHO \"$libname_spec\""` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw* | *cegcc*) - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - func_basename "$soroot" - soname="$func_basename_result" - func_stripname 'lib' '.dll' "$soname" - newlib=libimp-$func_stripname_result.a - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - func_verbose "extracting exported symbol list from \`$soname'" - func_execute_cmds "$extract_expsyms_cmds" 'exit $?' - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - func_verbose "generating import library for \`$soname'" - func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$opt_mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; - *-*-sysv4*uw2*) add_dir="-L$dir" ;; - *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ - *-*-unixware7*) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a (non-dlopened) module then we can not - # link against it, someone is ignoring the earlier warnings - if /usr/bin/file -L $add 2> /dev/null | - $GREP ": [^:]* bundle" >/dev/null ; then - if test "X$dlopenmodule" != "X$lib"; then - $ECHO "*** Warning: lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - echo - echo "*** And there doesn't seem to be a static archive available" - echo "*** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - elif test -n "$old_library"; then - add="$dir/$old_library" - fi - fi - esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$absdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - func_append add_dir " -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - func_fatal_configuration "unsupported hardcode properties" - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) func_append compile_shlibpath "$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && - test "$hardcode_minus_L" != yes && - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) func_append finalize_shlibpath "$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$opt_mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) func_append finalize_shlibpath "$libdir:" ;; - esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - func_append add_dir " -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - echo - $ECHO "*** Warning: This system can not link to static lib archive $lib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - echo "*** But as you try to build a module library, libtool will still create " - echo "*** a static module, that should work as long as the dlopening application" - echo "*** is linked with the -dlopen flag to resolve symbols at runtime." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) func_stripname '-R' '' "$libdir" - temp_xrpath=$func_stripname_result - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) func_append xrpath " $temp_xrpath";; - esac;; - *) func_append temp_deplibs " $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - func_append newlib_search_path " $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result";; - *) func_resolve_sysroot "$deplib" ;; - esac - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $func_resolve_sysroot_result "*) - func_append specialdeplibs " $func_resolve_sysroot_result" ;; - esac - fi - func_append tmp_libs " $func_resolve_sysroot_result" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - path= - case $deplib in - -L*) path="$deplib" ;; - *.la) - func_resolve_sysroot "$deplib" - deplib=$func_resolve_sysroot_result - func_dirname "$deplib" "" "." - dir=$func_dirname_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - func_warning "cannot determine absolute directory name of \`$dir'" - absdir="$dir" - fi - ;; - esac - if $GREP "^installed=no" $deplib > /dev/null; then - case $host in - *-*-darwin*) - depdepl= - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$absdir/$objdir/$depdepl" ; then - depdepl="$absdir/$objdir/$depdepl" - darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - if test -z "$darwin_install_name"; then - darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - fi - func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" - func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" - path= - fi - fi - ;; - *) - path="-L$absdir/$objdir" - ;; - esac - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - test "$absdir" != "$libdir" && \ - func_warning "\`$deplib' seems to be moved" - - path="-L$absdir" - fi - ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - if test "$pass" = link; then - if test "$linkmode" = "prog"; then - compile_deplibs="$new_inherited_linker_flags $compile_deplibs" - finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" - else - compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - fi - fi - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) func_append lib_search_path " $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) func_append tmp_libs " $deplib" ;; - esac - ;; - *) func_append tmp_libs " $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - func_append tmp_libs " $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - fi - if test "$linkmode" = prog || test "$linkmode" = lib; then - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for archives" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for archives" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for archives" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for archives" - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for archives" - - test -n "$release" && \ - func_warning "\`-release' is ignored for archives" - - test -n "$export_symbols$export_symbols_regex" && \ - func_warning "\`-export-symbols' is ignored for archives" - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - func_append objs "$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - func_stripname 'lib' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - ;; - *) - test "$module" = no && \ - func_fatal_help "libtool library \`$output' must begin with \`lib'" - - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - func_stripname '' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - else - func_stripname '' '.la' "$outputname" - libname=$func_stripname_result - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" - else - echo - $ECHO "*** Warning: Linking the shared library $output against the non-libtool" - $ECHO "*** objects $objs is not portable!" - func_append libobjs " $objs" - fi - fi - - test "$dlself" != no && \ - func_warning "\`-dlopen self' is ignored for libtool libraries" - - set dummy $rpath - shift - test "$#" -gt 1 && \ - func_warning "ignoring multiple \`-rpath's for a libtool library" - - install_libdir="$1" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for convenience libraries" - - test -n "$release" && \ - func_warning "\`-release' is ignored for convenience libraries" - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - shift - IFS="$save_ifs" - - test -n "$7" && \ - func_fatal_help "too many parameters to \`-version-info'" - - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$1" - number_minor="$2" - number_revision="$3" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - # correct linux to gnu/linux during the next big refactor - darwin|linux|osf|windows|none) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|qnx|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_minor" - lt_irix_increment=no - ;; - esac - ;; - no) - current="$1" - revision="$2" - age="$3" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "CURRENT \`$current' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $revision in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "REVISION \`$revision' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $age in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "AGE \`$age' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - if test "$age" -gt "$current"; then - func_error "AGE \`$age' is greater than the current interface number \`$current'" - func_fatal_error "\`$vinfo' is not valid version information" - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - func_arith $current + 1 - minor_current=$func_arith_result - xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current" - ;; - - irix | nonstopux) - if test "X$lt_irix_increment" = "Xno"; then - func_arith $current - $age - else - func_arith $current - $age + 1 - fi - major=$func_arith_result - - case $version_type in - nonstopux) verstring_prefix=nonstopux ;; - *) verstring_prefix=sgi ;; - esac - verstring="$verstring_prefix$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test "$loop" -ne 0; do - func_arith $revision - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) # correct to gnu/linux during the next big refactor - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - ;; - - osf) - func_arith $current - $age - major=.$func_arith_result - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - func_arith $current - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - func_append verstring ":${current}.0" - ;; - - qnx) - major=".$current" - versuffix=".$current" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - - *) - func_fatal_configuration "unknown library version type \`$version_type'" - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - func_warning "undefined symbols not allowed in $host shared libraries" - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - - fi - - func_generate_dlsyms "$libname" "$libname" "yes" - func_append libobjs " $symfileobj" - test "X$libobjs" = "X " && libobjs= - - if test "$opt_mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$ECHO "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext | *.gcno) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then - if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - fi - func_append removelist " $p" - ;; - *) ;; - esac - done - test -n "$removelist" && \ - func_show_eval "${RM}r \$removelist" - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - func_append oldlibs " $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - #for path in $notinst_path; do - # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` - # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` - # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` - #done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - func_replace_sysroot "$libdir" - func_append temp_xrpath " -R$func_replace_sysroot_result" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) func_append dlfiles " $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) func_append dlprefiles " $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - func_append deplibs " System.ltframework" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - func_append deplibs " -lc" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $opt_dry_run || $RM conftest.c - cat > conftest.c </dev/null` - $nocaseglob - else - potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` - fi - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null | - $GREP " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | - $SED -e 10q | - $EGREP "$file_magic_regex" > /dev/null; then - func_append newdeplibs " $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for file magic test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a file magic. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - func_append newdeplibs " $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - for a_deplib in $deplibs; do - case $a_deplib in - -l*) - func_stripname -l '' "$a_deplib" - name=$func_stripname_result - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - func_append newdeplibs " $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval "\\$ECHO \"$libname_spec\""` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ - $EGREP "$match_pattern_regex" > /dev/null; then - func_append newdeplibs " $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a regex pattern. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - func_append newdeplibs " $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` - done - fi - case $tmp_deplibs in - *[!\ \ ]*) - echo - if test "X$deplibs_check_method" = "Xnone"; then - echo "*** Warning: inter-library dependencies are not supported in this platform." - else - echo "*** Warning: inter-library dependencies are not known to be supported." - fi - echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - ;; - esac - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library with the System framework - newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - echo - echo "*** Warning: libtool could not satisfy all declared inter-library" - $ECHO "*** dependencies of module $libname. Therefore, libtool will create" - echo "*** a static module, that should work as long as the dlopening" - echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - echo "*** The inter-library dependencies that have been dropped here will be" - echo "*** automatically added whenever a program is linked with this library" - echo "*** or is declared to -dlopen it." - - if test "$allow_undefined" = no; then - echo - echo "*** Since this library must not contain undefined symbols," - echo "*** because either the platform does not support them or" - echo "*** it was explicitly requested with -no-undefined," - echo "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - case $host in - *-*-darwin*) - newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $deplibs " in - *" -L$path/$objdir "*) - func_append new_libs " -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) func_append new_libs " $deplib" ;; - esac - ;; - *) func_append new_libs " $deplib" ;; - esac - done - deplibs="$new_libs" - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - # Remove ${wl} instances when linking with ld. - # FIXME: should test the right _cmds variable. - case $archive_cmds in - *\$LD\ *) wl= ;; - esac - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$opt_mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - func_replace_sysroot "$libdir" - libdir=$func_replace_sysroot_result - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append dep_rpath " $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) func_append perm_rpath " $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - func_append rpath "$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval shared_ext=\"$shrext_cmds\" - eval library_names=\"$library_names_spec\" - set dummy $library_names - shift - realname="$1" - shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - linknames= - for link - do - func_append linknames " $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` - test "X$libobjs" = "X " && libobjs= - - delfiles= - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" - export_symbols="$output_objdir/$libname.uexp" - func_append delfiles " $export_symbols" - fi - - orig_export_symbols= - case $host_os in - cygwin* | mingw* | cegcc*) - if test -n "$export_symbols" && test -z "$export_symbols_regex"; then - # exporting using user supplied symfile - if test "x`$SED 1q $export_symbols`" != xEXPORTS; then - # and it's NOT already a .def file. Must figure out - # which of the given symbols are data symbols and tag - # them as such. So, trigger use of export_symbols_cmds. - # export_symbols gets reassigned inside the "prepare - # the list of exported symbols" if statement, so the - # include_expsyms logic still works. - orig_export_symbols="$export_symbols" - export_symbols= - always_export_symbols=yes - fi - fi - ;; - esac - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' - for cmd1 in $cmds; do - IFS="$save_ifs" - # Take the normal branch if the nm_file_list_spec branch - # doesn't work or if tool conversion is not needed. - case $nm_file_list_spec~$to_tool_file_cmd in - *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) - try_normal_branch=yes - eval cmd=\"$cmd1\" - func_len " $cmd" - len=$func_len_result - ;; - *) - try_normal_branch=no - ;; - esac - if test "$try_normal_branch" = yes \ - && { test "$len" -lt "$max_cmd_len" \ - || test "$max_cmd_len" -le -1; } - then - func_show_eval "$cmd" 'exit $?' - skipped_export=false - elif test -n "$nm_file_list_spec"; then - func_basename "$output" - output_la=$func_basename_result - save_libobjs=$libobjs - save_output=$output - output=${output_objdir}/${output_la}.nm - func_to_tool_file "$output" - libobjs=$nm_file_list_spec$func_to_tool_file_result - func_append delfiles " $output" - func_verbose "creating $NM input file list: $output" - for obj in $save_libobjs; do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" - done > "$output" - eval cmd=\"$cmd1\" - func_show_eval "$cmd" 'exit $?' - output=$save_output - libobjs=$save_libobjs - skipped_export=false - else - # The command line is too long to execute in one step. - func_verbose "using reloadable object file for export list..." - skipped_export=: - # Break out early, otherwise skipped_export may be - # set to false by a later but shorter cmd. - break - fi - done - IFS="$save_ifs" - if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' - fi - - if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - func_append delfiles " $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - func_append tmp_deplibs " $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec" && - test "$compiler_needs_object" = yes && - test -z "$libobjs"; then - # extract the archives, so we have objects to list. - # TODO: could optimize this to just extract one archive. - whole_archive_flag_spec= - fi - if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - else - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $convenience - func_append libobjs " $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - func_append linker_flags " $flag" - fi - - # Make a backup of the uninstalled library when relinking - if test "$opt_mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? - fi - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds - else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && - func_len " $test_cmds" && - len=$func_len_result && - test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise - # or, if using GNU ld and skipped_export is not :, use a linker - # script. - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - func_basename "$output" - output_la=$func_basename_result - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - last_robj= - k=1 - - if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then - output=${output_objdir}/${output_la}.lnkscript - func_verbose "creating GNU ld script: $output" - echo 'INPUT (' > $output - for obj in $save_libobjs - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" >> $output - done - echo ')' >> $output - func_append delfiles " $output" - func_to_tool_file "$output" - output=$func_to_tool_file_result - elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then - output=${output_objdir}/${output_la}.lnk - func_verbose "creating linker input file list: $output" - : > $output - set x $save_libobjs - shift - firstobj= - if test "$compiler_needs_object" = yes; then - firstobj="$1 " - shift - fi - for obj - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" >> $output - done - func_append delfiles " $output" - func_to_tool_file "$output" - output=$firstobj\"$file_list_spec$func_to_tool_file_result\" - else - if test -n "$save_libobjs"; then - func_verbose "creating reloadable object files..." - output=$output_objdir/$output_la-${k}.$objext - eval test_cmds=\"$reload_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - if test "X$objlist" = X || - test "$len" -lt "$max_cmd_len"; then - func_append objlist " $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - reload_objs=$objlist - eval concat_cmds=\"$reload_cmds\" - else - # All subsequent reloadable object files will link in - # the last one created. - reload_objs="$objlist $last_robj" - eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" - fi - last_robj=$output_objdir/$output_la-${k}.$objext - func_arith $k + 1 - k=$func_arith_result - output=$output_objdir/$output_la-${k}.$objext - objlist=" $obj" - func_len " $last_robj" - func_arith $len0 + $func_len_result - len=$func_arith_result - fi - done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - reload_objs="$objlist $last_robj" - eval concat_cmds=\"\${concat_cmds}$reload_cmds\" - if test -n "$last_robj"; then - eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" - fi - func_append delfiles " $output" - - else - output= - fi - - if ${skipped_export-false}; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - libobjs=$output - # Append the command to create the export file. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" - if test -n "$last_robj"; then - eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" - fi - fi - - test -n "$save_libobjs" && - func_verbose "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - if test -n "$export_symbols_regex" && ${skipped_export-false}; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - - if ${skipped_export-false}; then - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' - fi - - if test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - func_append delfiles " $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - fi - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - fi - - if test -n "$delfiles"; then - # Append the command to remove temporary files to $cmds. - eval cmds=\"\$cmds~\$RM $delfiles\" - fi - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $dlprefiles - func_append libobjs " $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? - - if test -n "$convenience"; then - if test -z "$whole_archive_flag_spec"; then - func_show_eval '${RM}r "$gentop"' - fi - fi - - exit $EXIT_SUCCESS - fi - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - obj) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for objects" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for objects" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for objects" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for objects" - - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for objects" - - test -n "$release" && \ - func_warning "\`-release' is ignored for objects" - - case $output in - *.lo) - test -n "$objs$old_deplibs" && \ - func_fatal_error "cannot build library object \`$output' from non-libtool objects" - - libobj=$output - func_lo2o "$libobj" - obj=$func_lo2o_result - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $opt_dry_run || $RM $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec and hope we can get by with - # turning comma into space.. - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" - reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` - else - gentop="$output_objdir/${obj}x" - func_append generated " $gentop" - - func_extract_archives $gentop $convenience - reload_conv_objs="$reload_objs $func_extract_archives_result" - fi - fi - - # If we're not building shared, we need to use non_pic_objs - test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" - - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" - func_execute_cmds "$reload_cmds" 'exit $?' - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? - exit $EXIT_SUCCESS - fi - - if test -n "$pic_flag" || test "$pic_mode" != default; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - func_execute_cmds "$reload_cmds" 'exit $?' - fi - - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - ;; - - prog) - case $host in - *cygwin*) func_stripname '' '.exe' "$output" - output=$func_stripname_result.exe;; - esac - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for programs" - - test -n "$release" && \ - func_warning "\`-release' is ignored for programs" - - test "$preload" = yes \ - && test "$dlopen_support" = unknown \ - && test "$dlopen_self" = unknown \ - && test "$dlopen_self_static" = unknown && \ - func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` - ;; - esac - - case $host in - *-*-darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - # But is supposedly fixed on 10.4 or later (yay!). - if test "$tagname" = CXX ; then - case ${MACOSX_DEPLOYMENT_TARGET-10.0} in - 10.[0123]) - func_append compile_command " ${wl}-bind_at_load" - func_append finalize_command " ${wl}-bind_at_load" - ;; - esac - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $compile_deplibs " in - *" -L$path/$objdir "*) - func_append new_libs " -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $compile_deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) func_append new_libs " $deplib" ;; - esac - ;; - *) func_append new_libs " $deplib" ;; - esac - done - compile_deplibs="$new_libs" - - - func_append compile_command " $compile_deplibs" - func_append finalize_command " $finalize_deplibs" - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append rpath " $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) func_append perm_rpath " $libdir" ;; - esac - fi - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$libdir:"*) ;; - ::) dllsearchpath=$libdir;; - *) func_append dllsearchpath ":$libdir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) func_append dllsearchpath ":$testbindir";; - esac - ;; - esac - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append rpath " $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) func_append finalize_perm_rpath " $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - fi - - func_generate_dlsyms "$outputname" "@PROGRAM@" "no" - - # template prelinking step - if test -n "$prelink_cmds"; then - func_execute_cmds "$prelink_cmds" 'exit $?' - fi - - wrappers_required=yes - case $host in - *cegcc* | *mingw32ce*) - # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. - wrappers_required=no - ;; - *cygwin* | *mingw* ) - if test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - *) - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - esac - if test "$wrappers_required" = no; then - # Replace the output file specification. - compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - exit_status=0 - func_show_eval "$link_command" 'exit_status=$?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - # Delete the generated files. - if test -f "$output_objdir/${outputname}S.${objext}"; then - func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' - fi - - exit $exit_status - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - func_append rpath "$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - func_append rpath "$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$no_install" = yes; then - # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" - # Replace the output file specification. - link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - # Delete the old output file. - $opt_dry_run || $RM $output - # Link the executable and exit - func_show_eval "$link_command" 'exit $?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - exit $EXIT_SUCCESS - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - func_warning "this platform does not like uninstalled shared libraries" - func_warning "\`$output' will be relinked during installation" - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname - - func_show_eval "$link_command" 'exit $?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output_objdir/$outputname" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - # Now create the wrapper script. - func_verbose "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - fi - - # Only actually do things if not in dry run mode. - $opt_dry_run || { - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) func_stripname '' '.exe' "$output" - output=$func_stripname_result ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - func_stripname '' '.exe' "$outputname" - outputname=$func_stripname_result ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - func_dirname_and_basename "$output" "" "." - output_name=$func_basename_result - output_path=$func_dirname_result - cwrappersource="$output_path/$objdir/lt-$output_name.c" - cwrapper="$output_path/$output_name.exe" - $RM $cwrappersource $cwrapper - trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - func_emit_cwrapperexe_src > $cwrappersource - - # The wrapper executable is built using the $host compiler, - # because it contains $host paths and files. If cross- - # compiling, it, like the target executable, must be - # executed on the $host or under an emulation environment. - $opt_dry_run || { - $LTCC $LTCFLAGS -o $cwrapper $cwrappersource - $STRIP $cwrapper - } - - # Now, create the wrapper script for func_source use: - func_ltwrapper_scriptname $cwrapper - $RM $func_ltwrapper_scriptname_result - trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 - $opt_dry_run || { - # note: this script will not be executed, so do not chmod. - if test "x$build" = "x$host" ; then - $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result - else - func_emit_wrapper no > $func_ltwrapper_scriptname_result - fi - } - ;; - * ) - $RM $output - trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 - - func_emit_wrapper no > $output - chmod +x $output - ;; - esac - } - exit $EXIT_SUCCESS - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save $symfileobj" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - if test "$preload" = yes && test -f "$symfileobj"; then - func_append oldobjs " $symfileobj" - fi - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $addlibs - func_append oldobjs " $func_extract_archives_result" - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds - else - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $dlprefiles - func_append oldobjs " $func_extract_archives_result" - fi - - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - func_basename "$obj" - $ECHO "$func_basename_result" - done | sort | sort -uc >/dev/null 2>&1); then - : - else - echo "copying selected object files to avoid basename conflicts..." - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - func_mkdir_p "$gentop" - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - func_basename "$obj" - objbase="$func_basename_result" - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - func_arith $counter + 1 - counter=$func_arith_result - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - func_append oldobjs " $gentop/$newobj" - ;; - *) func_append oldobjs " $obj" ;; - esac - done - fi - func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 - tool_oldlib=$func_to_tool_file_result - eval cmds=\"$old_archive_cmds\" - - func_len " $cmds" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - elif test -n "$archiver_list_spec"; then - func_verbose "using command file archive linking..." - for obj in $oldobjs - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" - done > $output_objdir/$libname.libcmd - func_to_tool_file "$output_objdir/$libname.libcmd" - oldobjs=" $archiver_list_spec$func_to_tool_file_result" - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - func_verbose "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - oldobjs= - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - eval test_cmds=\"$old_archive_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - for obj in $save_oldobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - func_append objlist " $obj" - if test "$len" -lt "$max_cmd_len"; then - : - else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= - len=$len0 - fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~\$old_archive_cmds\" - fi - fi - fi - func_execute_cmds "$cmds" 'exit $?' - done - - test -n "$generated" && \ - func_show_eval "${RM}r$generated" - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - func_verbose "creating $output" - - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi - - # Only create the output if not a dry run. - $opt_dry_run || { - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - func_basename "$deplib" - name="$func_basename_result" - func_resolve_sysroot "$deplib" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" - ;; - -L*) - func_stripname -L '' "$deplib" - func_replace_sysroot "$func_stripname_result" - func_append newdependency_libs " -L$func_replace_sysroot_result" - ;; - -R*) - func_stripname -R '' "$deplib" - func_replace_sysroot "$func_stripname_result" - func_append newdependency_libs " -R$func_replace_sysroot_result" - ;; - *) func_append newdependency_libs " $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - - for lib in $dlfiles; do - case $lib in - *.la) - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" - ;; - *) func_append newdlfiles " $lib" ;; - esac - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - *.la) - # Only pass preopened files to the pseudo-archive (for - # eventual linking with the app. that links it) if we - # didn't already link the preopened objects directly into - # the library: - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" - ;; - esac - done - dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - func_append newdlfiles " $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - func_append newdlprefiles " $abs" - done - dlprefiles="$newdlprefiles" - fi - $RM $output - # place dlname in correct position for cygwin - # In fact, it would be nice if we could use this code for all target - # systems that can't hard-code library paths into their executables - # and that have no shared library path variable independent of PATH, - # but it turns out we can't easily determine that from inspecting - # libtool variables, so we have to hard-code the OSs to which it - # applies here; at the moment, that means platforms that use the PE - # object format with DLL files. See the long comment at the top of - # tests/bindir.at for full details. - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) - # If a -bindir argument was supplied, place the dll there. - if test "x$bindir" != x ; - then - func_relative_path "$install_libdir" "$bindir" - tdlname=$func_relative_path_result$dlname - else - # Otherwise fall back on heuristic. - tdlname=../bin/$dlname - fi - ;; - esac - $ECHO > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags='$new_inherited_linker_flags' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Names of additional weak libraries provided by this library -weak_library_names='$weak_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $ECHO >> $output "\ -relink_command=\"$relink_command\"" - fi - done - } - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' - ;; - esac - exit $EXIT_SUCCESS -} - -{ test "$opt_mode" = link || test "$opt_mode" = relink; } && - func_mode_link ${1+"$@"} - - -# func_mode_uninstall arg... -func_mode_uninstall () -{ - $opt_debug - RM="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) func_append RM " $arg"; rmforce=yes ;; - -*) func_append RM " $arg" ;; - *) func_append files " $arg" ;; - esac - done - - test -z "$RM" && \ - func_fatal_help "you must specify an RM program" - - rmdirs= - - for file in $files; do - func_dirname "$file" "" "." - dir="$func_dirname_result" - if test "X$dir" = X.; then - odir="$objdir" - else - odir="$dir/$objdir" - fi - func_basename "$file" - name="$func_basename_result" - test "$opt_mode" = uninstall && odir="$dir" - - # Remember odir for removal later, being careful to avoid duplicates - if test "$opt_mode" = clean; then - case " $rmdirs " in - *" $odir "*) ;; - *) func_append rmdirs " $odir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if { test -L "$file"; } >/dev/null 2>&1 || - { test -h "$file"; } >/dev/null 2>&1 || - test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if func_lalib_p "$file"; then - func_source $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - func_append rmfiles " $odir/$n" - done - test -n "$old_library" && func_append rmfiles " $odir/$old_library" - - case "$opt_mode" in - clean) - case " $library_names " in - *" $dlname "*) ;; - *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; - esac - test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" - ;; - uninstall) - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - # FIXME: should reinstall the best remaining shared library. - ;; - esac - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if func_lalib_p "$file"; then - - # Read the .lo file - func_source $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" && - test "$pic_object" != none; then - func_append rmfiles " $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" && - test "$non_pic_object" != none; then - func_append rmfiles " $dir/$non_pic_object" - fi - fi - ;; - - *) - if test "$opt_mode" = clean ; then - noexename=$name - case $file in - *.exe) - func_stripname '' '.exe' "$file" - file=$func_stripname_result - func_stripname '' '.exe' "$name" - noexename=$func_stripname_result - # $file with .exe has already been added to rmfiles, - # add $file without .exe - func_append rmfiles " $file" - ;; - esac - # Do a test to see if this is a libtool program. - if func_ltwrapper_p "$file"; then - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - relink_command= - func_source $func_ltwrapper_scriptname_result - func_append rmfiles " $func_ltwrapper_scriptname_result" - else - relink_command= - func_source $dir/$noexename - fi - - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - func_append rmfiles " $odir/$name $odir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - func_append rmfiles " $odir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - func_append rmfiles " $odir/lt-${noexename}.c" - fi - fi - fi - ;; - esac - func_show_eval "$RM $rmfiles" 'exit_status=1' - done - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - func_show_eval "rmdir $dir >/dev/null 2>&1" - fi - done - - exit $exit_status -} - -{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && - func_mode_uninstall ${1+"$@"} - -test -z "$opt_mode" && { - help="$generic_help" - func_fatal_help "you must specify a MODE" -} - -test -z "$exec_cmd" && \ - func_fatal_help "invalid operation mode \`$opt_mode'" - -if test -n "$exec_cmd"; then - eval exec "$exec_cmd" - exit $EXIT_FAILURE -fi - -exit $exit_status - - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: -# vi:sw=2 - diff --git a/lib/3rdparty/libxml2/missing b/lib/3rdparty/libxml2/missing deleted file mode 100644 index 86a8fc31e3c..00000000000 --- a/lib/3rdparty/libxml2/missing +++ /dev/null @@ -1,331 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. - -scriptversion=2012-01-06.13; # UTC - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, -# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 1996. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: -sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' -sed_minuso='s/.* -o \([^ ]*\).*/\1/p' - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -msg="missing on your system" - -case $1 in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - autom4te touch the output file, or create a stub one - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - yacc create \`y.tab.[ch]', if possible, from existing .[ch] - -Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and -\`g' are ignored when checking the name. - -Send bug reports to ." - exit $? - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit $? - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - -esac - -# normalize program name to check for. -program=`echo "$1" | sed ' - s/^gnu-//; t - s/^gnu//; t - s/^g//; t'` - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). This is about non-GNU programs, so use $1 not -# $program. -case $1 in - lex*|yacc*) - # Not GNU programs, they don't have --version. - ;; - - *) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 - fi - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case $program in - aclocal*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case $f in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te*) - echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison*|yacc*) - echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if test $# -ne 1; then - eval LASTARG=\${$#} - case $LASTARG in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if test ! -f y.tab.h; then - echo >y.tab.h - fi - if test ! -f y.tab.c; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex*|flex*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if test $# -ne 1; then - eval LASTARG=\${$#} - case $LASTARG in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if test ! -f lex.yy.c; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit $? - fi - ;; - - makeinfo*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n ' - /^@setfilename/{ - s/.* \([^ ]*\) *$/\1/ - p - q - }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info - fi - # If the file does not exist, the user really needs makeinfo; - # let's fail without touching anything. - test -f $file || exit 1 - touch $file - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. - You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/lib/3rdparty/libxml2/nanohttp.c b/lib/3rdparty/libxml2/nanohttp.c index cb800c59600..04733b78c67 100644 --- a/lib/3rdparty/libxml2/nanohttp.c +++ b/lib/3rdparty/libxml2/nanohttp.c @@ -276,6 +276,8 @@ xmlNanoHTTPCleanup(void) { static void xmlNanoHTTPScanURL(xmlNanoHTTPCtxtPtr ctxt, const char *URL) { xmlURIPtr uri; + int len; + /* * Clear any existing data from the context */ @@ -307,7 +309,15 @@ xmlNanoHTTPScanURL(xmlNanoHTTPCtxtPtr ctxt, const char *URL) { } ctxt->protocol = xmlMemStrdup(uri->scheme); - ctxt->hostname = xmlMemStrdup(uri->server); + /* special case of IPv6 addresses, the [] need to be removed */ + if ((uri->server != NULL) && (*uri->server == '[')) { + len = strlen(uri->server); + if ((len > 2) && (uri->server[len - 1] == ']')) { + ctxt->hostname = (char *) xmlCharStrndup(uri->server + 1, len -2); + } else + ctxt->hostname = xmlMemStrdup(uri->server); + } else + ctxt->hostname = xmlMemStrdup(uri->server); if (uri->path != NULL) ctxt->path = xmlMemStrdup(uri->path); else diff --git a/lib/3rdparty/libxml2/parser.c b/lib/3rdparty/libxml2/parser.c index 192eaedfd88..ee429f333ea 100644 --- a/lib/3rdparty/libxml2/parser.c +++ b/lib/3rdparty/libxml2/parser.c @@ -122,7 +122,7 @@ xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID, */ static int xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size, - xmlEntityPtr ent) + xmlEntityPtr ent, size_t replacement) { size_t consumed = 0; @@ -130,7 +130,24 @@ xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size, return (0); if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP) return (1); - if (size != 0) { + if (replacement != 0) { + if (replacement < XML_MAX_TEXT_LENGTH) + return(0); + + /* + * If the volume of entity copy reaches 10 times the + * amount of parsed data and over the large text threshold + * then that's very likely to be an abuse. + */ + if (ctxt->input != NULL) { + consumed = ctxt->input->consumed + + (ctxt->input->cur - ctxt->input->base); + } + consumed += ctxt->sizeentities; + + if (replacement < XML_PARSER_NON_LINEAR * consumed) + return(0); + } else if (size != 0) { /* * Do the check based on the replacement size of the entity */ @@ -153,7 +170,7 @@ xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size, /* * use the number of parsed entities in the replacement */ - size = ent->checked; + size = ent->checked / 2; /* * The amount of data parsed counting entities size only once @@ -176,7 +193,6 @@ xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size, */ return (0); } - xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); return (1); } @@ -1540,7 +1556,7 @@ nsPush(xmlParserCtxtPtr ctxt, const xmlChar *prefix, const xmlChar *URL) { if (ctxt->options & XML_PARSE_NSCLEAN) { int i; - for (i = 0;i < ctxt->nsNr;i += 2) { + for (i = ctxt->nsNr - 2;i >= 0;i -= 2) { if (ctxt->nsTab[i] == prefix) { /* in scope */ if (ctxt->nsTab[i + 1] == URL) @@ -2025,6 +2041,7 @@ static void xmlSHRINK (xmlParserCtxtPtr ctxt) { static void xmlGROW (xmlParserCtxtPtr ctxt) { if ((((ctxt->input->end - ctxt->input->cur) > XML_MAX_LOOKUP_LIMIT) || ((ctxt->input->cur - ctxt->input->base) > XML_MAX_LOOKUP_LIMIT)) && + ((ctxt->input->buf) && (ctxt->input->buf->readcallback != (xmlInputReadCallback) xmlNop)) && ((ctxt->options & XML_PARSE_HUGE) == 0)) { xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, "Huge input lookup"); ctxt->instate = XML_PARSER_EOF; @@ -2532,6 +2549,8 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { NEXT; if ((ctxt->sax != NULL) && (ctxt->sax->getParameterEntity != NULL)) entity = ctxt->sax->getParameterEntity(ctxt->userData, name); + if (ctxt->instate == XML_PARSER_EOF) + return; if (entity == NULL) { /* @@ -2719,7 +2738,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, (ctxt->lastError.code == XML_ERR_INTERNAL_ERROR)) goto int_error; if (ent != NULL) - ctxt->nbentities += ent->checked; + ctxt->nbentities += ent->checked / 2; if ((ent != NULL) && (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { if (ent->content != NULL) { @@ -2742,7 +2761,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, while (*current != 0) { /* non input consuming loop */ buffer[nbchars++] = *current++; if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { - if (xmlParserEntityCheck(ctxt, nbchars, ent)) + if (xmlParserEntityCheck(ctxt, nbchars, ent, 0)) goto int_error; growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } @@ -2770,7 +2789,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP) goto int_error; if (ent != NULL) - ctxt->nbentities += ent->checked; + ctxt->nbentities += ent->checked / 2; if (ent != NULL) { if (ent->content == NULL) { xmlLoadEntityContent(ctxt, ent); @@ -2784,7 +2803,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, while (*current != 0) { /* non input consuming loop */ buffer[nbchars++] = *current++; if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { - if (xmlParserEntityCheck(ctxt, nbchars, ent)) + if (xmlParserEntityCheck(ctxt, nbchars, ent, 0)) goto int_error; growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } @@ -3435,7 +3454,7 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) { /** * xmlParseNCName: * @ctxt: an XML parser context - * @len: lenght of the string parsed + * @len: length of the string parsed * * parse an XML name. * @@ -3934,7 +3953,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { if ((len > XML_MAX_TEXT_LENGTH) && ((ctxt->options & XML_PARSE_HUGE) == 0)) { xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, - "AttValue lenght too long\n"); + "AttValue length too long\n"); goto mem_error; } if (c == 0) break; @@ -4027,10 +4046,16 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { * entities problems */ if ((ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) && - (ent->content != NULL)) { + (ent->content != NULL) && (ent->checked == 0)) { + unsigned long oldnbent = ctxt->nbentities; + rep = xmlStringDecodeEntities(ctxt, ent->content, XML_SUBSTITUTE_REF, 0, 0, 0); + + ent->checked = (ctxt->nbentities - oldnbent + 1) * 2; if (rep != NULL) { + if (xmlStrchr(rep, '<')) + ent->checked |= 1; xmlFree(rep); rep = NULL; } @@ -4075,7 +4100,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { goto error; if ((in_space) && (normalize)) { - while (buf[len - 1] == 0x20) len--; + while ((len > 0) && (buf[len - 1] == 0x20)) len--; } buf[len] = 0; if (RAW == '<') { @@ -4093,11 +4118,11 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { /* * There we potentially risk an overflow, don't allow attribute value of - * lenght more than INT_MAX it is a very reasonnable assumption ! + * length more than INT_MAX it is a very reasonnable assumption ! */ if (len >= INT_MAX) { xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, - "AttValue lenght too long\n"); + "AttValue length too long\n"); goto mem_error; } @@ -4983,7 +5008,8 @@ get_more: } if (buf != NULL) xmlFree(buf); - ctxt->instate = state; + if (ctxt->instate != XML_PARSER_EOF) + ctxt->instate = state; return; } if (buf != NULL) { @@ -5571,6 +5597,8 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) { } } } + if (ctxt->instate == XML_PARSER_EOF) + return; SKIP_BLANKS; if (RAW != '>') { xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_NOT_FINISHED, @@ -7196,13 +7224,15 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { * Store the number of entities needing parsing for this entity * content and do checkings */ - ent->checked = ctxt->nbentities - oldnbent; + ent->checked = (ctxt->nbentities - oldnbent + 1) * 2; + if ((ent->content != NULL) && (xmlStrchr(ent->content, '<'))) + ent->checked |= 1; if (ret == XML_ERR_ENTITY_LOOP) { xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); xmlFreeNodeList(list); return; } - if (xmlParserEntityCheck(ctxt, 0, ent)) { + if (xmlParserEntityCheck(ctxt, 0, ent, 0)) { xmlFreeNodeList(list); return; } @@ -7261,9 +7291,9 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { list = NULL; } if (ent->checked == 0) - ent->checked = 1; + ent->checked = 2; } else if (ent->checked != 1) { - ctxt->nbentities += ent->checked; + ctxt->nbentities += ent->checked / 2; } /* @@ -7359,6 +7389,13 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { (ctxt->parseMode == XML_PARSE_READER)) { xmlNodePtr nw = NULL, cur, firstChild = NULL; + /* + * We are copying here, make sure there is no abuse + */ + ctxt->sizeentcopy += ent->length; + if (xmlParserEntityCheck(ctxt, 0, ent, ctxt->sizeentcopy)) + return; + /* * when operating on a reader, the entities definitions * are always owning the entities subtree. @@ -7399,6 +7436,14 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { } else if ((list == NULL) || (ctxt->inputNr > 0)) { xmlNodePtr nw = NULL, cur, next, last, firstChild = NULL; + + /* + * We are copying here, make sure there is no abuse + */ + ctxt->sizeentcopy += ent->length; + if (xmlParserEntityCheck(ctxt, 0, ent, ctxt->sizeentcopy)) + return; + /* * Copy the entity child list and make it the new * entity child list. The goal is to make sure any @@ -7515,7 +7560,7 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) { NEXT; /* - * Predefined entites override any extra definition + * Predefined entities override any extra definition */ if ((ctxt->options & XML_PARSE_OLDSAX) == 0) { ent = xmlGetPredefinedEntity(name); @@ -7524,7 +7569,7 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) { } /* - * Increate the number of entity references parsed + * Increase the number of entity references parsed */ ctxt->nbentities++; @@ -7543,6 +7588,8 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) { ent = xmlSAX2GetEntity(ctxt, name); } } + if (ctxt->instate == XML_PARSER_EOF) + return(NULL); /* * [ WFC: Entity Declared ] * In a document without any DTD, a document with only an @@ -7609,11 +7656,13 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) { * not contain a <. */ else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) && - (ent != NULL) && (ent->content != NULL) && - (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) && - (xmlStrchr(ent->content, '<'))) { - xmlFatalErrMsgStr(ctxt, XML_ERR_LT_IN_ATTRIBUTE, - "'<' in entity '%s' is not allowed in attributes values\n", name); + (ent != NULL) && + (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY)) { + if ((ent->checked & 1) || ((ent->checked == 0) && + (ent->content != NULL) &&(xmlStrchr(ent->content, '<')))) { + xmlFatalErrMsgStr(ctxt, XML_ERR_LT_IN_ATTRIBUTE, + "'<' in entity '%s' is not allowed in attributes values\n", name); + } } /* @@ -7733,6 +7782,10 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) { ent = xmlSAX2GetEntity(ctxt, name); } } + if (ctxt->instate == XML_PARSER_EOF) { + xmlFree(name); + return(NULL); + } /* * [ WFC: Entity Declared ] @@ -7894,8 +7947,9 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt) */ if ((ctxt->sax != NULL) && (ctxt->sax->getParameterEntity != NULL)) - entity = ctxt->sax->getParameterEntity(ctxt->userData, - name); + entity = ctxt->sax->getParameterEntity(ctxt->userData, name); + if (ctxt->instate == XML_PARSER_EOF) + return; if (entity == NULL) { /* * [ WFC: Entity Declared ] @@ -8132,8 +8186,11 @@ xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) { */ if ((ctxt->sax != NULL) && (ctxt->sax->getParameterEntity != NULL)) - entity = ctxt->sax->getParameterEntity(ctxt->userData, - name); + entity = ctxt->sax->getParameterEntity(ctxt->userData, name); + if (ctxt->instate == XML_PARSER_EOF) { + xmlFree(name); + return(NULL); + } if (entity == NULL) { /* * [ WFC: Entity Declared ] @@ -8235,6 +8292,8 @@ xmlParseDocTypeDecl(xmlParserCtxtPtr ctxt) { if ((ctxt->sax != NULL) && (ctxt->sax->internalSubset != NULL) && (!ctxt->disableSAX)) ctxt->sax->internalSubset(ctxt->userData, name, ExternalID, URI); + if (ctxt->instate == XML_PARSER_EOF) + return; /* * Is there any internal subset declarations ? @@ -8897,7 +8956,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, if (((in - start) > XML_MAX_TEXT_LENGTH) && ((ctxt->options & XML_PARSE_HUGE) == 0)) { xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, - "AttValue lenght too long\n"); + "AttValue length too long\n"); return(NULL); } } @@ -8919,7 +8978,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, if (((in - start) > XML_MAX_TEXT_LENGTH) && ((ctxt->options & XML_PARSE_HUGE) == 0)) { xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, - "AttValue lenght too long\n"); + "AttValue length too long\n"); return(NULL); } } @@ -8948,7 +9007,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, if (((in - start) > XML_MAX_TEXT_LENGTH) && ((ctxt->options & XML_PARSE_HUGE) == 0)) { xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, - "AttValue lenght too long\n"); + "AttValue length too long\n"); return(NULL); } } @@ -8956,7 +9015,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, if (((in - start) > XML_MAX_TEXT_LENGTH) && ((ctxt->options & XML_PARSE_HUGE) == 0)) { xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, - "AttValue lenght too long\n"); + "AttValue length too long\n"); return(NULL); } if (*in != limit) goto need_complex; @@ -8978,7 +9037,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, if (((in - start) > XML_MAX_TEXT_LENGTH) && ((ctxt->options & XML_PARSE_HUGE) == 0)) { xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, - "AttValue lenght too long\n"); + "AttValue length too long\n"); return(NULL); } } @@ -8987,7 +9046,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, if (((in - start) > XML_MAX_TEXT_LENGTH) && ((ctxt->options & XML_PARSE_HUGE) == 0)) { xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, - "AttValue lenght too long\n"); + "AttValue length too long\n"); return(NULL); } if (*in != limit) goto need_complex; @@ -9993,6 +10052,8 @@ xmlParseElement(xmlParserCtxtPtr ctxt) { * Parse the content of the element: */ xmlParseContent(ctxt); + if (ctxt->instate == XML_PARSER_EOF) + return; if (!IS_BYTE_CHAR(RAW)) { xmlFatalErrMsgStrIntStr(ctxt, XML_ERR_TAG_NOT_FINISHED, "Premature end of data in tag %s line %d\n", @@ -10565,6 +10626,8 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) { */ if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator); + if (ctxt->instate == XML_PARSER_EOF) + return(-1); if ((ctxt->encoding == NULL) && ((ctxt->input->end - ctxt->input->cur) >= 4)) { @@ -10616,6 +10679,8 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) { } if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX)) ctxt->sax->startDocument(ctxt->userData); + if (ctxt->instate == XML_PARSER_EOF) + return(-1); /* * The Misc part of the Prolog @@ -10635,6 +10700,8 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) { if (RAW == '[') { ctxt->instate = XML_PARSER_DTD; xmlParseInternalSubset(ctxt); + if (ctxt->instate == XML_PARSER_EOF) + return(-1); } /* @@ -10645,6 +10712,8 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) { (!ctxt->disableSAX)) ctxt->sax->externalSubset(ctxt->userData, ctxt->intSubName, ctxt->extSubSystem, ctxt->extSubURI); + if (ctxt->instate == XML_PARSER_EOF) + return(-1); ctxt->inSubset = 0; xmlCleanSpecialAttr(ctxt); @@ -10785,6 +10854,8 @@ xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt) { } if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX)) ctxt->sax->startDocument(ctxt->userData); + if (ctxt->instate == XML_PARSER_EOF) + return(-1); /* * Doing validity checking on chunk doesn't make sense @@ -10795,6 +10866,8 @@ xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt) { ctxt->depth = 0; xmlParseContent(ctxt); + if (ctxt->instate == XML_PARSER_EOF) + return(-1); if ((RAW == '<') && (NXT(1) == '/')) { xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL); @@ -11102,7 +11175,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { } xmlParseGetLasts(ctxt, &lastlt, &lastgt); - while (1) { + while (ctxt->instate != XML_PARSER_EOF) { if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1)) return(0); @@ -11121,9 +11194,13 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { /* * If we are operating on converted input, try to flush * remainng chars to avoid them stalling in the non-converted - * buffer. + * buffer. But do not do this in document start where + * encoding="..." may not have been read and we work on a + * guessed encoding. */ - if (xmlBufIsEmpty(ctxt->input->buf->buffer) == 0) { + if ((ctxt->instate != XML_PARSER_START) && + (ctxt->input->buf->raw != NULL) && + (xmlBufIsEmpty(ctxt->input->buf->raw) == 0)) { size_t base = xmlBufGetInputBase(ctxt->input->buf->buffer, ctxt->input); size_t current = ctxt->input->cur - ctxt->input->base; @@ -11338,6 +11415,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { ctxt->sax->endElement(ctxt->userData, name); #endif /* LIBXML_SAX1_ENABLED */ } + if (ctxt->instate == XML_PARSER_EOF) + goto done; spacePop(ctxt); if (ctxt->nameNr == 0) { ctxt->instate = XML_PARSER_EPILOG; @@ -11528,6 +11607,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { ctxt->sax->characters(ctxt->userData, ctxt->input->cur, tmp); } + if (ctxt->instate == XML_PARSER_EOF) + goto done; SKIPL(tmp); ctxt->checkIndex = 0; } @@ -11563,6 +11644,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { ctxt->sax->characters(ctxt->userData, ctxt->input->cur, base); } + if (ctxt->instate == XML_PARSER_EOF) + goto done; SKIPL(base + 3); ctxt->checkIndex = 0; ctxt->instate = XML_PARSER_CONTENT; @@ -11596,6 +11679,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { "PP: Parsing PI\n"); #endif xmlParsePI(ctxt); + if (ctxt->instate == XML_PARSER_EOF) + goto done; ctxt->instate = XML_PARSER_MISC; ctxt->progressive = 1; ctxt->checkIndex = 0; @@ -11612,6 +11697,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { "PP: Parsing Comment\n"); #endif xmlParseComment(ctxt); + if (ctxt->instate == XML_PARSER_EOF) + goto done; ctxt->instate = XML_PARSER_MISC; ctxt->progressive = 1; ctxt->checkIndex = 0; @@ -11633,9 +11720,11 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { "PP: Parsing internal subset\n"); #endif ctxt->inSubset = 1; - ctxt->progressive = 1; + ctxt->progressive = 0; ctxt->checkIndex = 0; xmlParseDocTypeDecl(ctxt); + if (ctxt->instate == XML_PARSER_EOF) + goto done; if (RAW == '[') { ctxt->instate = XML_PARSER_DTD; #ifdef DEBUG_PUSH @@ -11695,6 +11784,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { "PP: Parsing PI\n"); #endif xmlParsePI(ctxt); + if (ctxt->instate == XML_PARSER_EOF) + goto done; ctxt->instate = XML_PARSER_PROLOG; ctxt->progressive = 1; } else if ((cur == '<') && (next == '!') && @@ -11709,6 +11800,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { "PP: Parsing Comment\n"); #endif xmlParseComment(ctxt); + if (ctxt->instate == XML_PARSER_EOF) + goto done; ctxt->instate = XML_PARSER_PROLOG; ctxt->progressive = 1; } else if ((cur == '<') && (next == '!') && @@ -11747,6 +11840,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { "PP: Parsing PI\n"); #endif xmlParsePI(ctxt); + if (ctxt->instate == XML_PARSER_EOF) + goto done; ctxt->instate = XML_PARSER_EPILOG; ctxt->progressive = 1; } else if ((cur == '<') && (next == '!') && @@ -11761,6 +11856,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { "PP: Parsing Comment\n"); #endif xmlParseComment(ctxt); + if (ctxt->instate == XML_PARSER_EOF) + goto done; ctxt->instate = XML_PARSER_EPILOG; ctxt->progressive = 1; } else if ((cur == '<') && (next == '!') && @@ -11891,6 +11988,8 @@ not_end_of_int_subset: found_end_int_subset: ctxt->checkIndex = 0; xmlParseInternalSubset(ctxt); + if (ctxt->instate == XML_PARSER_EOF) + goto done; ctxt->inSubset = 2; if ((ctxt->sax != NULL) && (!ctxt->disableSAX) && (ctxt->sax->externalSubset != NULL)) @@ -11898,6 +11997,8 @@ found_end_int_subset: ctxt->extSubSystem, ctxt->extSubURI); ctxt->inSubset = 0; xmlCleanSpecialAttr(ctxt); + if (ctxt->instate == XML_PARSER_EOF) + goto done; ctxt->instate = XML_PARSER_PROLOG; ctxt->checkIndex = 0; #ifdef DEBUG_PUSH @@ -12041,7 +12142,7 @@ xmlParseCheckTransition(xmlParserCtxtPtr ctxt, const char *chunk, int size) { } if ((ctxt->progressive == XML_PARSER_DTD) || (ctxt->instate == XML_PARSER_DTD)) { - if (memchr(chunk, ']', size) != NULL) + if (memchr(chunk, '>', size) != NULL) return(1); return(0); } @@ -12125,7 +12226,7 @@ xmldecl_done: remain = 0; } } - res =xmlParserInputBufferPush(ctxt->input->buf, size, chunk); + res = xmlParserInputBufferPush(ctxt->input->buf, size, chunk); if (res < 0) { ctxt->errNo = XML_PARSER_EOF; ctxt->disableSAX = 1; @@ -12142,14 +12243,17 @@ xmldecl_done: if ((in->encoder != NULL) && (in->buffer != NULL) && (in->raw != NULL)) { int nbchars; + size_t base = xmlBufGetInputBase(in->buffer, ctxt->input); + size_t current = ctxt->input->cur - ctxt->input->base; - nbchars = xmlCharEncInput(in); + nbchars = xmlCharEncInput(in, terminate); if (nbchars < 0) { /* TODO 2.6.0 */ xmlGenericError(xmlGenericErrorContext, "xmlParseChunk: encoder error\n"); return(XML_ERR_INVALID_ENCODING); } + xmlBufSetInputBaseCur(in->buffer, ctxt->input, base, current); } } } @@ -12171,6 +12275,9 @@ xmldecl_done: avail - old_avail))) xmlParseTryOrFinish(ctxt, terminate); } + if (ctxt->instate == XML_PARSER_EOF) + return(ctxt->errNo); + if ((ctxt->input != NULL) && (((ctxt->input->end - ctxt->input->cur) > XML_MAX_LOOKUP_LIMIT) || ((ctxt->input->cur - ctxt->input->base) > XML_MAX_LOOKUP_LIMIT)) && @@ -12189,7 +12296,14 @@ xmldecl_done: } if ((end_in_lf == 1) && (ctxt->input != NULL) && (ctxt->input->buf != NULL)) { + size_t base = xmlBufGetInputBase(ctxt->input->buf->buffer, + ctxt->input); + size_t current = ctxt->input->cur - ctxt->input->base; + xmlParserInputBufferPush(ctxt->input->buf, 1, "\r"); + + xmlBufSetInputBaseCur(ctxt->input->buf->buffer, ctxt->input, + base, current); } if (terminate) { /* @@ -12219,7 +12333,10 @@ xmldecl_done: } ctxt->instate = XML_PARSER_EOF; } - return((xmlParserErrors) ctxt->errNo); + if (ctxt->wellFormed == 0) + return((xmlParserErrors) ctxt->errNo); + else + return(0); } /************************************************************************ @@ -12364,6 +12481,7 @@ xmlStopParser(xmlParserCtxtPtr ctxt) { if (ctxt == NULL) return; ctxt->instate = XML_PARSER_EOF; + ctxt->errNo = XML_ERR_USER_STOP; ctxt->disableSAX = 1; if (ctxt->input != NULL) { ctxt->input->cur = BAD_CAST""; @@ -14749,6 +14867,7 @@ xmlCtxtReset(xmlParserCtxtPtr ctxt) ctxt->catalogs = NULL; ctxt->nbentities = 0; ctxt->sizeentities = 0; + ctxt->sizeentcopy = 0; xmlInitNodeInfoSeq(&ctxt->node_seq); if (ctxt->attsDefault != NULL) { diff --git a/lib/3rdparty/libxml2/parserInternals.c b/lib/3rdparty/libxml2/parserInternals.c index 35a90ab733a..f8a70410680 100644 --- a/lib/3rdparty/libxml2/parserInternals.c +++ b/lib/3rdparty/libxml2/parserInternals.c @@ -1201,7 +1201,7 @@ xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input, /* * convert as much as possible of the buffer */ - nbchars = xmlCharEncInput(input->buf); + nbchars = xmlCharEncInput(input->buf, 1); } else { /* * convert just enough to get @@ -1253,7 +1253,7 @@ xmlSwitchInputEncoding(xmlParserCtxtPtr ctxt, xmlParserInputPtr input, * xmlSwitchToEncodingInt: * @ctxt: the parser context * @handler: the encoding handler - * @len: the lenght to convert or -1 + * @len: the length to convert or -1 * * change the input functions when discovering the character encoding * of a given entity, and convert only @len bytes of the output, this @@ -1719,6 +1719,8 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt) ctxt->charset = XML_CHAR_ENCODING_UTF8; ctxt->catalogs = NULL; ctxt->nbentities = 0; + ctxt->sizeentities = 0; + ctxt->sizeentcopy = 0; ctxt->input_id = 1; xmlInitNodeInfoSeq(&ctxt->node_seq); return(0); diff --git a/lib/3rdparty/libxml2/regressions.py b/lib/3rdparty/libxml2/regressions.py deleted file mode 100644 index 0e813c2ea33..00000000000 --- a/lib/3rdparty/libxml2/regressions.py +++ /dev/null @@ -1,350 +0,0 @@ -#!/usr/bin/python -u -import glob, os, string, sys, thread, time -# import difflib -import libxml2 - -### -# -# This is a "Work in Progress" attempt at a python script to run the -# various regression tests. The rationale for this is that it should be -# possible to run this on most major platforms, including those (such as -# Windows) which don't support gnu Make. -# -# The script is driven by a parameter file which defines the various tests -# to be run, together with the unique settings for each of these tests. A -# script for Linux is included (regressions.xml), with comments indicating -# the significance of the various parameters. To run the tests under Windows, -# edit regressions.xml and remove the comment around the default parameter -# "" (i.e. make it point to the location of the binary executables). -# -# Note that this current version requires the Python bindings for libxml2 to -# have been previously installed and accessible -# -# See Copyright for the status of this software. -# William Brack (wbrack@mmm.com.hk) -# -### -defaultParams = {} # will be used as a dictionary to hold the parsed params - -# This routine is used for comparing the expected stdout / stdin with the results. -# The expected data has already been read in; the result is a file descriptor. -# Within the two sets of data, lines may begin with a path string. If so, the -# code "relativises" it by removing the path component. The first argument is a -# list already read in by a separate thread; the second is a file descriptor. -# The two 'base' arguments are to let me "relativise" the results files, allowing -# the script to be run from any directory. -def compFiles(res, expected, base1, base2): - l1 = len(base1) - exp = expected.readlines() - expected.close() - # the "relativisation" is done here - for i in range(len(res)): - j = string.find(res[i],base1) - if (j == 0) or ((j == 2) and (res[i][0:2] == './')): - col = string.find(res[i],':') - if col > 0: - start = string.rfind(res[i][:col], '/') - if start > 0: - res[i] = res[i][start+1:] - - for i in range(len(exp)): - j = string.find(exp[i],base2) - if (j == 0) or ((j == 2) and (exp[i][0:2] == './')): - col = string.find(exp[i],':') - if col > 0: - start = string.rfind(exp[i][:col], '/') - if start > 0: - exp[i] = exp[i][start+1:] - - ret = 0 - # ideally we would like to use difflib functions here to do a - # nice comparison of the two sets. Unfortunately, during testing - # (using python 2.3.3 and 2.3.4) the following code went into - # a dead loop under windows. I'll pursue this later. -# diff = difflib.ndiff(res, exp) -# diff = list(diff) -# for line in diff: -# if line[:2] != ' ': -# print string.strip(line) -# ret = -1 - - # the following simple compare is fine for when the two data sets - # (actual result vs. expected result) are equal, which should be true for - # us. Unfortunately, if the test fails it's not nice at all. - rl = len(res) - el = len(exp) - if el != rl: - print 'Length of expected is %d, result is %d' % (el, rl) - ret = -1 - for i in range(min(el, rl)): - if string.strip(res[i]) != string.strip(exp[i]): - print '+:%s-:%s' % (res[i], exp[i]) - ret = -1 - if el > rl: - for i in range(rl, el): - print '-:%s' % exp[i] - ret = -1 - elif rl > el: - for i in range (el, rl): - print '+:%s' % res[i] - ret = -1 - return ret - -# Separate threads to handle stdout and stderr are created to run this function -def readPfile(file, list, flag): - data = file.readlines() # no call by reference, so I cheat - for l in data: - list.append(l) - file.close() - flag.append('ok') - -# This routine runs the test program (e.g. xmllint) -def runOneTest(testDescription, filename, inbase, errbase): - if 'execpath' in testDescription: - dir = testDescription['execpath'] + '/' - else: - dir = '' - cmd = os.path.abspath(dir + testDescription['testprog']) - if 'flag' in testDescription: - for f in string.split(testDescription['flag']): - cmd += ' ' + f - if 'stdin' not in testDescription: - cmd += ' ' + inbase + filename - if 'extarg' in testDescription: - cmd += ' ' + testDescription['extarg'] - - noResult = 0 - expout = None - if 'resext' in testDescription: - if testDescription['resext'] == 'None': - noResult = 1 - else: - ext = '.' + testDescription['resext'] - else: - ext = '' - if not noResult: - try: - fname = errbase + filename + ext - expout = open(fname, 'rt') - except: - print "Can't open result file %s - bypassing test" % fname - return - - noErrors = 0 - if 'reserrext' in testDescription: - if testDescription['reserrext'] == 'None': - noErrors = 1 - else: - if len(testDescription['reserrext'])>0: - ext = '.' + testDescription['reserrext'] - else: - ext = '' - else: - ext = '' - if not noErrors: - try: - fname = errbase + filename + ext - experr = open(fname, 'rt') - except: - experr = None - else: - experr = None - - pin, pout, perr = os.popen3(cmd) - if 'stdin' in testDescription: - infile = open(inbase + filename, 'rt') - pin.writelines(infile.readlines()) - infile.close() - pin.close() - - # popen is great fun, but can lead to the old "deadly embrace", because - # synchronizing the writing (by the task being run) of stdout and stderr - # with respect to the reading (by this task) is basically impossible. I - # tried several ways to cheat, but the only way I have found which works - # is to do a *very* elementary multi-threading approach. We can only hope - # that Python threads are implemented on the target system (it's okay for - # Linux and Windows) - - th1Flag = [] # flags to show when threads finish - th2Flag = [] - outfile = [] # lists to contain the pipe data - errfile = [] - th1 = thread.start_new_thread(readPfile, (pout, outfile, th1Flag)) - th2 = thread.start_new_thread(readPfile, (perr, errfile, th2Flag)) - while (len(th1Flag)==0) or (len(th2Flag)==0): - time.sleep(0.001) - if not noResult: - ret = compFiles(outfile, expout, inbase, 'test/') - if ret != 0: - print 'trouble with %s' % cmd - else: - if len(outfile) != 0: - for l in outfile: - print l - print 'trouble with %s' % cmd - if experr != None: - ret = compFiles(errfile, experr, inbase, 'test/') - if ret != 0: - print 'trouble with %s' % cmd - else: - if not noErrors: - if len(errfile) != 0: - for l in errfile: - print l - print 'trouble with %s' % cmd - - if 'stdin' not in testDescription: - pin.close() - -# This routine is called by the parameter decoding routine whenever the end of a -# 'test' section is encountered. Depending upon file globbing, a large number of -# individual tests may be run. -def runTest(description): - testDescription = defaultParams.copy() # set defaults - testDescription.update(description) # override with current ent - if 'testname' in testDescription: - print "## %s" % testDescription['testname'] - if not 'file' in testDescription: - print "No file specified - can't run this test!" - return - # Set up the source and results directory paths from the decoded params - dir = '' - if 'srcdir' in testDescription: - dir += testDescription['srcdir'] + '/' - if 'srcsub' in testDescription: - dir += testDescription['srcsub'] + '/' - - rdir = '' - if 'resdir' in testDescription: - rdir += testDescription['resdir'] + '/' - if 'ressub' in testDescription: - rdir += testDescription['ressub'] + '/' - - testFiles = glob.glob(os.path.abspath(dir + testDescription['file'])) - if testFiles == []: - print "No files result from '%s'" % testDescription['file'] - return - - # Some test programs just don't work (yet). For now we exclude them. - count = 0 - excl = [] - if 'exclfile' in testDescription: - for f in string.split(testDescription['exclfile']): - glb = glob.glob(dir + f) - for g in glb: - excl.append(os.path.abspath(g)) - - # Run the specified test program - for f in testFiles: - if not os.path.isdir(f): - if f not in excl: - count = count + 1 - runOneTest(testDescription, os.path.basename(f), dir, rdir) - -# -# The following classes are used with the xmlreader interface to interpret the -# parameter file. Once a test section has been identified, runTest is called -# with a dictionary containing the parsed results of the interpretation. -# - -class testDefaults: - curText = '' # accumulates text content of parameter - - def addToDict(self, key): - txt = string.strip(self.curText) -# if txt == '': -# return - if key not in defaultParams: - defaultParams[key] = txt - else: - defaultParams[key] += ' ' + txt - - def processNode(self, reader, curClass): - if reader.Depth() == 2: - if reader.NodeType() == 1: - self.curText = '' # clear the working variable - elif reader.NodeType() == 15: - if (reader.Name() != '#text') and (reader.Name() != '#comment'): - self.addToDict(reader.Name()) - elif reader.Depth() == 3: - if reader.Name() == '#text': - self.curText += reader.Value() - - elif reader.NodeType() == 15: # end of element - print "Defaults have been set to:" - for k in defaultParams.keys(): - print " %s : '%s'" % (k, defaultParams[k]) - curClass = rootClass() - return curClass - - -class testClass: - def __init__(self): - self.testParams = {} # start with an empty set of params - self.curText = '' # and empty text - - def addToDict(self, key): - data = string.strip(self.curText) - if key not in self.testParams: - self.testParams[key] = data - else: - if self.testParams[key] != '': - data = ' ' + data - self.testParams[key] += data - - def processNode(self, reader, curClass): - if reader.Depth() == 2: - if reader.NodeType() == 1: - self.curText = '' # clear the working variable - if reader.Name() not in self.testParams: - self.testParams[reader.Name()] = '' - elif reader.NodeType() == 15: - if (reader.Name() != '#text') and (reader.Name() != '#comment'): - self.addToDict(reader.Name()) - elif reader.Depth() == 3: - if reader.Name() == '#text': - self.curText += reader.Value() - - elif reader.NodeType() == 15: # end of element - runTest(self.testParams) - curClass = rootClass() - return curClass - - -class rootClass: - def processNode(self, reader, curClass): - if reader.Depth() == 0: - return curClass - if reader.Depth() != 1: - print "Unexpected junk: Level %d, type %d, name %s" % ( - reader.Depth(), reader.NodeType(), reader.Name()) - return curClass - if reader.Name() == 'test': - curClass = testClass() - curClass.testParams = {} - elif reader.Name() == 'defaults': - curClass = testDefaults() - return curClass - -def streamFile(filename): - try: - reader = libxml2.newTextReaderFilename(filename) - except: - print "unable to open %s" % (filename) - return - - curClass = rootClass() - ret = reader.Read() - while ret == 1: - curClass = curClass.processNode(reader, curClass) - ret = reader.Read() - - if ret != 0: - print "%s : failed to parse" % (filename) - -# OK, we're finished with all the routines. Now for the main program:- -if len(sys.argv) != 2: - print "Usage: maketest {filename}" - sys.exit(-1) - -streamFile(sys.argv[1]) diff --git a/lib/3rdparty/libxml2/regressions.xml b/lib/3rdparty/libxml2/regressions.xml deleted file mode 100644 index c78838ac51e..00000000000 --- a/lib/3rdparty/libxml2/regressions.xml +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - noname - - . - xmllint - test - result - *.xml - err - - - - - XML Regression Tests - failed to load external entity - - - XML Entity Subst Regression Tests - noent - --noent - - - XML Namespaces Regression Tests - namespaces - namespaces - - - xml:id Regression Tests - testXPath - xmlid - xmlid - -i - id_*.xml - "id('bar')" - - - Error Cases Regression Tests - errors - errors - - - Error Cases Stream Regression Tests - errors - errors - str - --stream - - - Reader Regression Tests - rdr - --nonet - --debug - --stream - * - None - - - Walker Regression Tests - rdr - --nonet - --debug - --walker - * - None - - - Reader Entities Substitution Regression Tests - rde - --nonet - --debug - --stream - --noent - * - None - - - SAX Callbacks Regression Tests - testSAX - sax - * - utf16*.xml - None - - - XML Push Regression Tests - --push - failed to load external entity - - - HTML Regression Tests - testHTML - HTML - HTML - * - wired.html - - - Push HTML Regression Tests - testHTML - --push - HTML - HTML - * - - - HTML SAX Regression Tests - testHTML - --sax - HTML - HTML - sax - None - * - - - Push HTML SAX Regression Tests - testHTML - --sax - --push - HTML - HTML - sax - None - * - - - Valid Documents Regression Tests - VCM - VCM - None - None - * - --valid - --noout - --nowarning - - - Validity Checking Regression Tests - VC - VC - None - - * - --valid - --noout - - - General Documents Valid Regression Tests - valid - valid - * - --valid - - - URI Module Regression Tests (1) - testURI - URI - - URI - None - *.data - - -base "http://foo.com/path/to/index.html?orig#help" - - - URI Module Regression Tests (2) - testURI - URI - - URI - None - *.uri - - - XPath Regression Tests (1) - testXPath - XPath/expr - XPath/expr - * - -f - --expr - - - XInclude Regression Tests - XInclude/docs - XInclude - * - --nowarning - --xinclude - - - XInclude xmlReader Regression Tests - XInclude/docs - XInclude - rdr - * - --nowarning - --xinclude - --stream - --debug - - diff --git a/lib/3rdparty/libxml2/relaxng.c b/lib/3rdparty/libxml2/relaxng.c index f600d07e50c..370e314ceac 100644 --- a/lib/3rdparty/libxml2/relaxng.c +++ b/lib/3rdparty/libxml2/relaxng.c @@ -8347,7 +8347,7 @@ xmlRelaxNGValidatePushElement(xmlRelaxNGValidCtxtPtr ctxt, * xmlRelaxNGValidatePushCData: * @ctxt: the RelaxNG validation context * @data: some character data read - * @len: the lenght of the data + * @len: the length of the data * * check the CData parsed for validation in the current stack * diff --git a/lib/3rdparty/libxml2/runsuite.c b/lib/3rdparty/libxml2/runsuite.c deleted file mode 100644 index aaab13e1ee6..00000000000 --- a/lib/3rdparty/libxml2/runsuite.c +++ /dev/null @@ -1,1172 +0,0 @@ -/* - * runsuite.c: C program to run libxml2 againts published testsuites - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#include "libxml.h" -#include - -#if !defined(_WIN32) || defined(__CYGWIN__) -#include -#endif -#include -#include -#include -#include - -#include -#include -#include -#include -#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_XPATH_ENABLED) -#include - -#include -#include - -#include -#include -#include - -#define LOGFILE "runsuite.log" -static FILE *logfile = NULL; -static int verbose = 0; - - -/************************************************************************ - * * - * File name and path utilities * - * * - ************************************************************************/ - -static int checkTestFile(const char *filename) { - struct stat buf; - - if (stat(filename, &buf) == -1) - return(0); - -#if defined(_WIN32) && !defined(__CYGWIN__) - if (!(buf.st_mode & _S_IFREG)) - return(0); -#else - if (!S_ISREG(buf.st_mode)) - return(0); -#endif - - return(1); -} - -static xmlChar *composeDir(const xmlChar *dir, const xmlChar *path) { - char buf[500]; - - if (dir == NULL) return(xmlStrdup(path)); - if (path == NULL) return(NULL); - - snprintf(buf, 500, "%s/%s", (const char *) dir, (const char *) path); - return(xmlStrdup((const xmlChar *) buf)); -} - -/************************************************************************ - * * - * Libxml2 specific routines * - * * - ************************************************************************/ - -static int nb_tests = 0; -static int nb_errors = 0; -static int nb_internals = 0; -static int nb_schematas = 0; -static int nb_unimplemented = 0; -static int nb_leaks = 0; -static int extraMemoryFromResolver = 0; - -static int -fatalError(void) { - fprintf(stderr, "Exitting tests on fatal error\n"); - exit(1); -} - -/* - * that's needed to implement - */ -#define MAX_ENTITIES 20 -static char *testEntitiesName[MAX_ENTITIES]; -static char *testEntitiesValue[MAX_ENTITIES]; -static int nb_entities = 0; -static void resetEntities(void) { - int i; - - for (i = 0;i < nb_entities;i++) { - if (testEntitiesName[i] != NULL) - xmlFree(testEntitiesName[i]); - if (testEntitiesValue[i] != NULL) - xmlFree(testEntitiesValue[i]); - } - nb_entities = 0; -} -static int addEntity(char *name, char *content) { - if (nb_entities >= MAX_ENTITIES) { - fprintf(stderr, "Too many entities defined\n"); - return(-1); - } - testEntitiesName[nb_entities] = name; - testEntitiesValue[nb_entities] = content; - nb_entities++; - return(0); -} - -/* - * We need to trap calls to the resolver to not account memory for the catalog - * which is shared to the current running test. We also don't want to have - * network downloads modifying tests. - */ -static xmlParserInputPtr -testExternalEntityLoader(const char *URL, const char *ID, - xmlParserCtxtPtr ctxt) { - xmlParserInputPtr ret; - int i; - - for (i = 0;i < nb_entities;i++) { - if (!strcmp(testEntitiesName[i], URL)) { - ret = xmlNewStringInputStream(ctxt, - (const xmlChar *) testEntitiesValue[i]); - if (ret != NULL) { - ret->filename = (const char *) - xmlStrdup((xmlChar *)testEntitiesName[i]); - } - return(ret); - } - } - if (checkTestFile(URL)) { - ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); - } else { - int memused = xmlMemUsed(); - ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); - extraMemoryFromResolver += xmlMemUsed() - memused; - } -#if 0 - if (ret == NULL) { - fprintf(stderr, "Failed to find resource %s\n", URL); - } -#endif - - return(ret); -} - -/* - * Trapping the error messages at the generic level to grab the equivalent of - * stderr messages on CLI tools. - */ -static char testErrors[32769]; -static int testErrorsSize = 0; - -static void test_log(const char *msg, ...) { - va_list args; - if (logfile != NULL) { - fprintf(logfile, "\n------------\n"); - va_start(args, msg); - vfprintf(logfile, msg, args); - va_end(args); - fprintf(logfile, "%s", testErrors); - testErrorsSize = 0; testErrors[0] = 0; - } - if (verbose) { - va_start(args, msg); - vfprintf(stderr, msg, args); - va_end(args); - } -} - -static void -testErrorHandler(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) { - va_list args; - int res; - - if (testErrorsSize >= 32768) - return; - va_start(args, msg); - res = vsnprintf(&testErrors[testErrorsSize], - 32768 - testErrorsSize, - msg, args); - va_end(args); - if (testErrorsSize + res >= 32768) { - /* buffer is full */ - testErrorsSize = 32768; - testErrors[testErrorsSize] = 0; - } else { - testErrorsSize += res; - } - testErrors[testErrorsSize] = 0; -} - -static xmlXPathContextPtr ctxtXPath; - -static void -initializeLibxml2(void) { - xmlGetWarningsDefaultValue = 0; - xmlPedanticParserDefault(0); - - xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup); - xmlInitParser(); - xmlSetExternalEntityLoader(testExternalEntityLoader); - ctxtXPath = xmlXPathNewContext(NULL); - /* - * Deactivate the cache if created; otherwise we have to create/free it - * for every test, since it will confuse the memory leak detection. - * Note that normally this need not be done, since the cache is not - * created until set explicitely with xmlXPathContextSetCache(); - * but for test purposes it is sometimes usefull to activate the - * cache by default for the whole library. - */ - if (ctxtXPath->cache != NULL) - xmlXPathContextSetCache(ctxtXPath, 0, -1, 0); - /* used as default nanemspace in xstc tests */ - xmlXPathRegisterNs(ctxtXPath, BAD_CAST "ts", BAD_CAST "TestSuite"); - xmlXPathRegisterNs(ctxtXPath, BAD_CAST "xlink", - BAD_CAST "http://www.w3.org/1999/xlink"); - xmlSetGenericErrorFunc(NULL, testErrorHandler); -#ifdef LIBXML_SCHEMAS_ENABLED - xmlSchemaInitTypes(); - xmlRelaxNGInitTypes(); -#endif -} - -static xmlNodePtr -getNext(xmlNodePtr cur, const char *xpath) { - xmlNodePtr ret = NULL; - xmlXPathObjectPtr res; - xmlXPathCompExprPtr comp; - - if ((cur == NULL) || (cur->doc == NULL) || (xpath == NULL)) - return(NULL); - ctxtXPath->doc = cur->doc; - ctxtXPath->node = cur; - comp = xmlXPathCompile(BAD_CAST xpath); - if (comp == NULL) { - fprintf(stderr, "Failed to compile %s\n", xpath); - return(NULL); - } - res = xmlXPathCompiledEval(comp, ctxtXPath); - xmlXPathFreeCompExpr(comp); - if (res == NULL) - return(NULL); - if ((res->type == XPATH_NODESET) && - (res->nodesetval != NULL) && - (res->nodesetval->nodeNr > 0) && - (res->nodesetval->nodeTab != NULL)) - ret = res->nodesetval->nodeTab[0]; - xmlXPathFreeObject(res); - return(ret); -} - -static xmlChar * -getString(xmlNodePtr cur, const char *xpath) { - xmlChar *ret = NULL; - xmlXPathObjectPtr res; - xmlXPathCompExprPtr comp; - - if ((cur == NULL) || (cur->doc == NULL) || (xpath == NULL)) - return(NULL); - ctxtXPath->doc = cur->doc; - ctxtXPath->node = cur; - comp = xmlXPathCompile(BAD_CAST xpath); - if (comp == NULL) { - fprintf(stderr, "Failed to compile %s\n", xpath); - return(NULL); - } - res = xmlXPathCompiledEval(comp, ctxtXPath); - xmlXPathFreeCompExpr(comp); - if (res == NULL) - return(NULL); - if (res->type == XPATH_STRING) { - ret = res->stringval; - res->stringval = NULL; - } - xmlXPathFreeObject(res); - return(ret); -} - -/************************************************************************ - * * - * Test test/xsdtest/xsdtestsuite.xml * - * * - ************************************************************************/ - -static int -xsdIncorectTestCase(xmlNodePtr cur) { - xmlNodePtr test; - xmlBufferPtr buf; - xmlRelaxNGParserCtxtPtr pctxt; - xmlRelaxNGPtr rng = NULL; - int ret = 0, memt; - - cur = getNext(cur, "./incorrect[1]"); - if (cur == NULL) { - return(0); - } - - test = getNext(cur, "./*"); - if (test == NULL) { - test_log("Failed to find test in correct line %ld\n", - xmlGetLineNo(cur)); - return(1); - } - - memt = xmlMemUsed(); - extraMemoryFromResolver = 0; - /* - * dump the schemas to a buffer, then reparse it and compile the schemas - */ - buf = xmlBufferCreate(); - if (buf == NULL) { - fprintf(stderr, "out of memory !\n"); - fatalError(); - } - xmlNodeDump(buf, test->doc, test, 0, 0); - pctxt = xmlRelaxNGNewMemParserCtxt((const char *)buf->content, buf->use); - xmlRelaxNGSetParserErrors(pctxt, - (xmlRelaxNGValidityErrorFunc) testErrorHandler, - (xmlRelaxNGValidityWarningFunc) testErrorHandler, - pctxt); - rng = xmlRelaxNGParse(pctxt); - xmlRelaxNGFreeParserCtxt(pctxt); - if (rng != NULL) { - test_log("Failed to detect incorect RNG line %ld\n", - xmlGetLineNo(test)); - ret = 1; - goto done; - } - -done: - if (buf != NULL) - xmlBufferFree(buf); - if (rng != NULL) - xmlRelaxNGFree(rng); - xmlResetLastError(); - if ((memt < xmlMemUsed()) && (extraMemoryFromResolver == 0)) { - test_log("Validation of tests starting line %ld leaked %d\n", - xmlGetLineNo(cur), xmlMemUsed() - memt); - nb_leaks++; - } - return(ret); -} - -static void -installResources(xmlNodePtr tst, const xmlChar *base) { - xmlNodePtr test; - xmlBufferPtr buf; - xmlChar *name, *content, *res; - - buf = xmlBufferCreate(); - if (buf == NULL) { - fprintf(stderr, "out of memory !\n"); - fatalError(); - } - xmlNodeDump(buf, tst->doc, tst, 0, 0); - - while (tst != NULL) { - test = getNext(tst, "./*"); - if (test != NULL) { - xmlBufferEmpty(buf); - xmlNodeDump(buf, test->doc, test, 0, 0); - name = getString(tst, "string(@name)"); - content = xmlStrdup(buf->content); - if ((name != NULL) && (content != NULL)) { - res = composeDir(base, name); - xmlFree(name); - addEntity((char *) res, (char *) content); - } else { - if (name != NULL) xmlFree(name); - if (content != NULL) xmlFree(content); - } - } - tst = getNext(tst, "following-sibling::resource[1]"); - } - if (buf != NULL) - xmlBufferFree(buf); -} - -static void -installDirs(xmlNodePtr tst, const xmlChar *base) { - xmlNodePtr test; - xmlChar *name, *res; - - name = getString(tst, "string(@name)"); - if (name == NULL) - return; - res = composeDir(base, name); - xmlFree(name); - if (res == NULL) { - return; - } - /* Now process resources and subdir recursively */ - test = getNext(tst, "./resource[1]"); - if (test != NULL) { - installResources(test, res); - } - test = getNext(tst, "./dir[1]"); - while (test != NULL) { - installDirs(test, res); - test = getNext(test, "following-sibling::dir[1]"); - } - xmlFree(res); -} - -static int -xsdTestCase(xmlNodePtr tst) { - xmlNodePtr test, tmp, cur; - xmlBufferPtr buf; - xmlDocPtr doc = NULL; - xmlRelaxNGParserCtxtPtr pctxt; - xmlRelaxNGValidCtxtPtr ctxt; - xmlRelaxNGPtr rng = NULL; - int ret = 0, mem, memt; - xmlChar *dtd; - - resetEntities(); - testErrorsSize = 0; testErrors[0] = 0; - - tmp = getNext(tst, "./dir[1]"); - if (tmp != NULL) { - installDirs(tmp, NULL); - } - tmp = getNext(tst, "./resource[1]"); - if (tmp != NULL) { - installResources(tmp, NULL); - } - - cur = getNext(tst, "./correct[1]"); - if (cur == NULL) { - return(xsdIncorectTestCase(tst)); - } - - test = getNext(cur, "./*"); - if (test == NULL) { - fprintf(stderr, "Failed to find test in correct line %ld\n", - xmlGetLineNo(cur)); - return(1); - } - - memt = xmlMemUsed(); - extraMemoryFromResolver = 0; - /* - * dump the schemas to a buffer, then reparse it and compile the schemas - */ - buf = xmlBufferCreate(); - if (buf == NULL) { - fprintf(stderr, "out of memory !\n"); - fatalError(); - } - xmlNodeDump(buf, test->doc, test, 0, 0); - pctxt = xmlRelaxNGNewMemParserCtxt((const char *)buf->content, buf->use); - xmlRelaxNGSetParserErrors(pctxt, - (xmlRelaxNGValidityErrorFunc) testErrorHandler, - (xmlRelaxNGValidityWarningFunc) testErrorHandler, - pctxt); - rng = xmlRelaxNGParse(pctxt); - xmlRelaxNGFreeParserCtxt(pctxt); - if (extraMemoryFromResolver) - memt = 0; - - if (rng == NULL) { - test_log("Failed to parse RNGtest line %ld\n", - xmlGetLineNo(test)); - nb_errors++; - ret = 1; - goto done; - } - /* - * now scan all the siblings of correct to process the tests - */ - tmp = getNext(cur, "following-sibling::valid[1]"); - while (tmp != NULL) { - dtd = xmlGetProp(tmp, BAD_CAST "dtd"); - test = getNext(tmp, "./*"); - if (test == NULL) { - fprintf(stderr, "Failed to find test in line %ld\n", - xmlGetLineNo(tmp)); - - } else { - xmlBufferEmpty(buf); - if (dtd != NULL) - xmlBufferAdd(buf, dtd, -1); - xmlNodeDump(buf, test->doc, test, 0, 0); - - /* - * We are ready to run the test - */ - mem = xmlMemUsed(); - extraMemoryFromResolver = 0; - doc = xmlReadMemory((const char *)buf->content, buf->use, - "test", NULL, 0); - if (doc == NULL) { - test_log("Failed to parse valid instance line %ld\n", - xmlGetLineNo(tmp)); - nb_errors++; - } else { - nb_tests++; - ctxt = xmlRelaxNGNewValidCtxt(rng); - xmlRelaxNGSetValidErrors(ctxt, - (xmlRelaxNGValidityErrorFunc) testErrorHandler, - (xmlRelaxNGValidityWarningFunc) testErrorHandler, - ctxt); - ret = xmlRelaxNGValidateDoc(ctxt, doc); - xmlRelaxNGFreeValidCtxt(ctxt); - if (ret > 0) { - test_log("Failed to validate valid instance line %ld\n", - xmlGetLineNo(tmp)); - nb_errors++; - } else if (ret < 0) { - test_log("Internal error validating instance line %ld\n", - xmlGetLineNo(tmp)); - nb_errors++; - } - xmlFreeDoc(doc); - } - xmlResetLastError(); - if ((mem != xmlMemUsed()) && (extraMemoryFromResolver == 0)) { - test_log("Validation of instance line %ld leaked %d\n", - xmlGetLineNo(tmp), xmlMemUsed() - mem); - xmlMemoryDump(); - nb_leaks++; - } - } - if (dtd != NULL) - xmlFree(dtd); - tmp = getNext(tmp, "following-sibling::valid[1]"); - } - /* - * now scan all the siblings of correct to process the tests - */ - tmp = getNext(cur, "following-sibling::invalid[1]"); - while (tmp != NULL) { - test = getNext(tmp, "./*"); - if (test == NULL) { - fprintf(stderr, "Failed to find test in line %ld\n", - xmlGetLineNo(tmp)); - - } else { - xmlBufferEmpty(buf); - xmlNodeDump(buf, test->doc, test, 0, 0); - - /* - * We are ready to run the test - */ - mem = xmlMemUsed(); - extraMemoryFromResolver = 0; - doc = xmlReadMemory((const char *)buf->content, buf->use, - "test", NULL, 0); - if (doc == NULL) { - test_log("Failed to parse valid instance line %ld\n", - xmlGetLineNo(tmp)); - nb_errors++; - } else { - nb_tests++; - ctxt = xmlRelaxNGNewValidCtxt(rng); - xmlRelaxNGSetValidErrors(ctxt, - (xmlRelaxNGValidityErrorFunc) testErrorHandler, - (xmlRelaxNGValidityWarningFunc) testErrorHandler, - ctxt); - ret = xmlRelaxNGValidateDoc(ctxt, doc); - xmlRelaxNGFreeValidCtxt(ctxt); - if (ret == 0) { - test_log("Failed to detect invalid instance line %ld\n", - xmlGetLineNo(tmp)); - nb_errors++; - } else if (ret < 0) { - test_log("Internal error validating instance line %ld\n", - xmlGetLineNo(tmp)); - nb_errors++; - } - xmlFreeDoc(doc); - } - xmlResetLastError(); - if ((mem != xmlMemUsed()) && (extraMemoryFromResolver == 0)) { - test_log("Validation of instance line %ld leaked %d\n", - xmlGetLineNo(tmp), xmlMemUsed() - mem); - xmlMemoryDump(); - nb_leaks++; - } - } - tmp = getNext(tmp, "following-sibling::invalid[1]"); - } - -done: - if (buf != NULL) - xmlBufferFree(buf); - if (rng != NULL) - xmlRelaxNGFree(rng); - xmlResetLastError(); - if ((memt != xmlMemUsed()) && (memt != 0)) { - test_log("Validation of tests starting line %ld leaked %d\n", - xmlGetLineNo(cur), xmlMemUsed() - memt); - nb_leaks++; - } - return(ret); -} - -static int -xsdTestSuite(xmlNodePtr cur) { - if (verbose) { - xmlChar *doc = getString(cur, "string(documentation)"); - - if (doc != NULL) { - printf("Suite %s\n", doc); - xmlFree(doc); - } - } - cur = getNext(cur, "./testCase[1]"); - while (cur != NULL) { - xsdTestCase(cur); - cur = getNext(cur, "following-sibling::testCase[1]"); - } - - return(0); -} - -static int -xsdTest(void) { - xmlDocPtr doc; - xmlNodePtr cur; - const char *filename = "test/xsdtest/xsdtestsuite.xml"; - int ret = 0; - - doc = xmlReadFile(filename, NULL, XML_PARSE_NOENT); - if (doc == NULL) { - fprintf(stderr, "Failed to parse %s\n", filename); - return(-1); - } - printf("## XML Schemas datatypes test suite from James Clark\n"); - - cur = xmlDocGetRootElement(doc); - if ((cur == NULL) || (!xmlStrEqual(cur->name, BAD_CAST "testSuite"))) { - fprintf(stderr, "Unexpected format %s\n", filename); - ret = -1; - goto done; - } - - cur = getNext(cur, "./testSuite[1]"); - if ((cur == NULL) || (!xmlStrEqual(cur->name, BAD_CAST "testSuite"))) { - fprintf(stderr, "Unexpected format %s\n", filename); - ret = -1; - goto done; - } - while (cur != NULL) { - xsdTestSuite(cur); - cur = getNext(cur, "following-sibling::testSuite[1]"); - } - -done: - if (doc != NULL) - xmlFreeDoc(doc); - return(ret); -} - -static int -rngTestSuite(xmlNodePtr cur) { - if (verbose) { - xmlChar *doc = getString(cur, "string(documentation)"); - - if (doc != NULL) { - printf("Suite %s\n", doc); - xmlFree(doc); - } else { - doc = getString(cur, "string(section)"); - if (doc != NULL) { - printf("Section %s\n", doc); - xmlFree(doc); - } - } - } - cur = getNext(cur, "./testSuite[1]"); - while (cur != NULL) { - xsdTestSuite(cur); - cur = getNext(cur, "following-sibling::testSuite[1]"); - } - - return(0); -} - -static int -rngTest1(void) { - xmlDocPtr doc; - xmlNodePtr cur; - const char *filename = "test/relaxng/OASIS/spectest.xml"; - int ret = 0; - - doc = xmlReadFile(filename, NULL, XML_PARSE_NOENT); - if (doc == NULL) { - fprintf(stderr, "Failed to parse %s\n", filename); - return(-1); - } - printf("## Relax NG test suite from James Clark\n"); - - cur = xmlDocGetRootElement(doc); - if ((cur == NULL) || (!xmlStrEqual(cur->name, BAD_CAST "testSuite"))) { - fprintf(stderr, "Unexpected format %s\n", filename); - ret = -1; - goto done; - } - - cur = getNext(cur, "./testSuite[1]"); - if ((cur == NULL) || (!xmlStrEqual(cur->name, BAD_CAST "testSuite"))) { - fprintf(stderr, "Unexpected format %s\n", filename); - ret = -1; - goto done; - } - while (cur != NULL) { - rngTestSuite(cur); - cur = getNext(cur, "following-sibling::testSuite[1]"); - } - -done: - if (doc != NULL) - xmlFreeDoc(doc); - return(ret); -} - -static int -rngTest2(void) { - xmlDocPtr doc; - xmlNodePtr cur; - const char *filename = "test/relaxng/testsuite.xml"; - int ret = 0; - - doc = xmlReadFile(filename, NULL, XML_PARSE_NOENT); - if (doc == NULL) { - fprintf(stderr, "Failed to parse %s\n", filename); - return(-1); - } - printf("## Relax NG test suite for libxml2\n"); - - cur = xmlDocGetRootElement(doc); - if ((cur == NULL) || (!xmlStrEqual(cur->name, BAD_CAST "testSuite"))) { - fprintf(stderr, "Unexpected format %s\n", filename); - ret = -1; - goto done; - } - - cur = getNext(cur, "./testSuite[1]"); - if ((cur == NULL) || (!xmlStrEqual(cur->name, BAD_CAST "testSuite"))) { - fprintf(stderr, "Unexpected format %s\n", filename); - ret = -1; - goto done; - } - while (cur != NULL) { - xsdTestSuite(cur); - cur = getNext(cur, "following-sibling::testSuite[1]"); - } - -done: - if (doc != NULL) - xmlFreeDoc(doc); - return(ret); -} - -/************************************************************************ - * * - * Schemas test suites from W3C/NIST/MS/Sun * - * * - ************************************************************************/ - -static int -xstcTestInstance(xmlNodePtr cur, xmlSchemaPtr schemas, - const xmlChar *spath, const char *base) { - xmlChar *href = NULL; - xmlChar *path = NULL; - xmlChar *validity = NULL; - xmlSchemaValidCtxtPtr ctxt = NULL; - xmlDocPtr doc = NULL; - int ret = 0, mem; - - xmlResetLastError(); - testErrorsSize = 0; testErrors[0] = 0; - mem = xmlMemUsed(); - href = getString(cur, - "string(ts:instanceDocument/@xlink:href)"); - if ((href == NULL) || (href[0] == 0)) { - test_log("testGroup line %ld misses href for schemaDocument\n", - xmlGetLineNo(cur)); - ret = -1; - goto done; - } - path = xmlBuildURI(href, BAD_CAST base); - if (path == NULL) { - fprintf(stderr, - "Failed to build path to schemas testGroup line %ld : %s\n", - xmlGetLineNo(cur), href); - ret = -1; - goto done; - } - if (checkTestFile((const char *) path) <= 0) { - test_log("schemas for testGroup line %ld is missing: %s\n", - xmlGetLineNo(cur), path); - ret = -1; - goto done; - } - validity = getString(cur, - "string(ts:expected/@validity)"); - if (validity == NULL) { - fprintf(stderr, "instanceDocument line %ld misses expected validity\n", - xmlGetLineNo(cur)); - ret = -1; - goto done; - } - nb_tests++; - doc = xmlReadFile((const char *) path, NULL, XML_PARSE_NOENT); - if (doc == NULL) { - fprintf(stderr, "instance %s fails to parse\n", path); - ret = -1; - nb_errors++; - goto done; - } - - ctxt = xmlSchemaNewValidCtxt(schemas); - xmlSchemaSetValidErrors(ctxt, - (xmlSchemaValidityErrorFunc) testErrorHandler, - (xmlSchemaValidityWarningFunc) testErrorHandler, - ctxt); - ret = xmlSchemaValidateDoc(ctxt, doc); - - if (xmlStrEqual(validity, BAD_CAST "valid")) { - if (ret > 0) { - test_log("valid instance %s failed to validate against %s\n", - path, spath); - nb_errors++; - } else if (ret < 0) { - test_log("valid instance %s got internal error validating %s\n", - path, spath); - nb_internals++; - nb_errors++; - } - } else if (xmlStrEqual(validity, BAD_CAST "invalid")) { - if (ret == 0) { - test_log("Failed to detect invalid instance %s against %s\n", - path, spath); - nb_errors++; - } - } else { - test_log("instanceDocument line %ld has unexpected validity value%s\n", - xmlGetLineNo(cur), validity); - ret = -1; - goto done; - } - -done: - if (href != NULL) xmlFree(href); - if (path != NULL) xmlFree(path); - if (validity != NULL) xmlFree(validity); - if (ctxt != NULL) xmlSchemaFreeValidCtxt(ctxt); - if (doc != NULL) xmlFreeDoc(doc); - xmlResetLastError(); - if (mem != xmlMemUsed()) { - test_log("Validation of tests starting line %ld leaked %d\n", - xmlGetLineNo(cur), xmlMemUsed() - mem); - nb_leaks++; - } - return(ret); -} - -static int -xstcTestGroup(xmlNodePtr cur, const char *base) { - xmlChar *href = NULL; - xmlChar *path = NULL; - xmlChar *validity = NULL; - xmlSchemaPtr schemas = NULL; - xmlSchemaParserCtxtPtr ctxt; - xmlNodePtr instance; - int ret = 0, mem; - - xmlResetLastError(); - testErrorsSize = 0; testErrors[0] = 0; - mem = xmlMemUsed(); - href = getString(cur, - "string(ts:schemaTest/ts:schemaDocument/@xlink:href)"); - if ((href == NULL) || (href[0] == 0)) { - test_log("testGroup line %ld misses href for schemaDocument\n", - xmlGetLineNo(cur)); - ret = -1; - goto done; - } - path = xmlBuildURI(href, BAD_CAST base); - if (path == NULL) { - test_log("Failed to build path to schemas testGroup line %ld : %s\n", - xmlGetLineNo(cur), href); - ret = -1; - goto done; - } - if (checkTestFile((const char *) path) <= 0) { - test_log("schemas for testGroup line %ld is missing: %s\n", - xmlGetLineNo(cur), path); - ret = -1; - goto done; - } - validity = getString(cur, - "string(ts:schemaTest/ts:expected/@validity)"); - if (validity == NULL) { - test_log("testGroup line %ld misses expected validity\n", - xmlGetLineNo(cur)); - ret = -1; - goto done; - } - nb_tests++; - if (xmlStrEqual(validity, BAD_CAST "valid")) { - nb_schematas++; - ctxt = xmlSchemaNewParserCtxt((const char *) path); - xmlSchemaSetParserErrors(ctxt, - (xmlSchemaValidityErrorFunc) testErrorHandler, - (xmlSchemaValidityWarningFunc) testErrorHandler, - ctxt); - schemas = xmlSchemaParse(ctxt); - xmlSchemaFreeParserCtxt(ctxt); - if (schemas == NULL) { - test_log("valid schemas %s failed to parse\n", - path); - ret = 1; - nb_errors++; - } - if ((ret == 0) && (strstr(testErrors, "nimplemented") != NULL)) { - test_log("valid schemas %s hit an unimplemented block\n", - path); - ret = 1; - nb_unimplemented++; - nb_errors++; - } - instance = getNext(cur, "./ts:instanceTest[1]"); - while (instance != NULL) { - if (schemas != NULL) { - xstcTestInstance(instance, schemas, path, base); - } else { - /* - * We'll automatically mark the instances as failed - * if the schema was broken. - */ - nb_errors++; - } - instance = getNext(instance, - "following-sibling::ts:instanceTest[1]"); - } - } else if (xmlStrEqual(validity, BAD_CAST "invalid")) { - nb_schematas++; - ctxt = xmlSchemaNewParserCtxt((const char *) path); - xmlSchemaSetParserErrors(ctxt, - (xmlSchemaValidityErrorFunc) testErrorHandler, - (xmlSchemaValidityWarningFunc) testErrorHandler, - ctxt); - schemas = xmlSchemaParse(ctxt); - xmlSchemaFreeParserCtxt(ctxt); - if (schemas != NULL) { - test_log("Failed to detect error in schemas %s\n", - path); - nb_errors++; - ret = 1; - } - if ((ret == 0) && (strstr(testErrors, "nimplemented") != NULL)) { - nb_unimplemented++; - test_log("invalid schemas %s hit an unimplemented block\n", - path); - ret = 1; - nb_errors++; - } - } else { - test_log("testGroup line %ld misses unexpected validity value%s\n", - xmlGetLineNo(cur), validity); - ret = -1; - goto done; - } - -done: - if (href != NULL) xmlFree(href); - if (path != NULL) xmlFree(path); - if (validity != NULL) xmlFree(validity); - if (schemas != NULL) xmlSchemaFree(schemas); - xmlResetLastError(); - if ((mem != xmlMemUsed()) && (extraMemoryFromResolver == 0)) { - test_log("Processing test line %ld %s leaked %d\n", - xmlGetLineNo(cur), path, xmlMemUsed() - mem); - nb_leaks++; - } - return(ret); -} - -static int -xstcMetadata(const char *metadata, const char *base) { - xmlDocPtr doc; - xmlNodePtr cur; - xmlChar *contributor; - xmlChar *name; - int ret = 0; - - doc = xmlReadFile(metadata, NULL, XML_PARSE_NOENT); - if (doc == NULL) { - fprintf(stderr, "Failed to parse %s\n", metadata); - return(-1); - } - - cur = xmlDocGetRootElement(doc); - if ((cur == NULL) || (!xmlStrEqual(cur->name, BAD_CAST "testSet"))) { - fprintf(stderr, "Unexpected format %s\n", metadata); - return(-1); - } - contributor = xmlGetProp(cur, BAD_CAST "contributor"); - if (contributor == NULL) { - contributor = xmlStrdup(BAD_CAST "Unknown"); - } - name = xmlGetProp(cur, BAD_CAST "name"); - if (name == NULL) { - name = xmlStrdup(BAD_CAST "Unknown"); - } - printf("## %s test suite for Schemas version %s\n", contributor, name); - xmlFree(contributor); - xmlFree(name); - - cur = getNext(cur, "./ts:testGroup[1]"); - if ((cur == NULL) || (!xmlStrEqual(cur->name, BAD_CAST "testGroup"))) { - fprintf(stderr, "Unexpected format %s\n", metadata); - ret = -1; - goto done; - } - while (cur != NULL) { - xstcTestGroup(cur, base); - cur = getNext(cur, "following-sibling::ts:testGroup[1]"); - } - -done: - xmlFreeDoc(doc); - return(ret); -} - -/************************************************************************ - * * - * The driver for the tests * - * * - ************************************************************************/ - -int -main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - int ret = 0; - int old_errors, old_tests, old_leaks; - - logfile = fopen(LOGFILE, "w"); - if (logfile == NULL) { - fprintf(stderr, - "Could not open the log file, running in verbose mode\n"); - verbose = 1; - } - initializeLibxml2(); - - if ((argc >= 2) && (!strcmp(argv[1], "-v"))) - verbose = 1; - - - old_errors = nb_errors; - old_tests = nb_tests; - old_leaks = nb_leaks; - xsdTest(); - if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) - printf("Ran %d tests, no errors\n", nb_tests - old_tests); - else - printf("Ran %d tests, %d errors, %d leaks\n", - nb_tests - old_tests, - nb_errors - old_errors, - nb_leaks - old_leaks); - old_errors = nb_errors; - old_tests = nb_tests; - old_leaks = nb_leaks; - rngTest1(); - if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) - printf("Ran %d tests, no errors\n", nb_tests - old_tests); - else - printf("Ran %d tests, %d errors, %d leaks\n", - nb_tests - old_tests, - nb_errors - old_errors, - nb_leaks - old_leaks); - old_errors = nb_errors; - old_tests = nb_tests; - old_leaks = nb_leaks; - rngTest2(); - if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) - printf("Ran %d tests, no errors\n", nb_tests - old_tests); - else - printf("Ran %d tests, %d errors, %d leaks\n", - nb_tests - old_tests, - nb_errors - old_errors, - nb_leaks - old_leaks); - old_errors = nb_errors; - old_tests = nb_tests; - old_leaks = nb_leaks; - nb_internals = 0; - nb_schematas = 0; - xstcMetadata("xstc/Tests/Metadata/NISTXMLSchemaDatatypes.testSet", - "xstc/Tests/Metadata/"); - if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) - printf("Ran %d tests (%d schemata), no errors\n", - nb_tests - old_tests, nb_schematas); - else - printf("Ran %d tests (%d schemata), %d errors (%d internals), %d leaks\n", - nb_tests - old_tests, - nb_schematas, - nb_errors - old_errors, - nb_internals, - nb_leaks - old_leaks); - old_errors = nb_errors; - old_tests = nb_tests; - old_leaks = nb_leaks; - nb_internals = 0; - nb_schematas = 0; - xstcMetadata("xstc/Tests/Metadata/SunXMLSchema1-0-20020116.testSet", - "xstc/Tests/"); - if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) - printf("Ran %d tests (%d schemata), no errors\n", - nb_tests - old_tests, nb_schematas); - else - printf("Ran %d tests (%d schemata), %d errors (%d internals), %d leaks\n", - nb_tests - old_tests, - nb_schematas, - nb_errors - old_errors, - nb_internals, - nb_leaks - old_leaks); - old_errors = nb_errors; - old_tests = nb_tests; - old_leaks = nb_leaks; - nb_internals = 0; - nb_schematas = 0; - xstcMetadata("xstc/Tests/Metadata/MSXMLSchema1-0-20020116.testSet", - "xstc/Tests/"); - if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) - printf("Ran %d tests (%d schemata), no errors\n", - nb_tests - old_tests, nb_schematas); - else - printf("Ran %d tests (%d schemata), %d errors (%d internals), %d leaks\n", - nb_tests - old_tests, - nb_schematas, - nb_errors - old_errors, - nb_internals, - nb_leaks - old_leaks); - - if ((nb_errors == 0) && (nb_leaks == 0)) { - ret = 0; - printf("Total %d tests, no errors\n", - nb_tests); - } else { - ret = 1; - printf("Total %d tests, %d errors, %d leaks\n", - nb_tests, nb_errors, nb_leaks); - } - xmlXPathFreeContext(ctxtXPath); - xmlCleanupParser(); - xmlMemoryDump(); - - if (logfile != NULL) - fclose(logfile); - return(ret); -} -#else /* !SCHEMAS */ -int -main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - fprintf(stderr, "runsuite requires support for schemas and xpath in libxml2\n"); -} -#endif diff --git a/lib/3rdparty/libxml2/runtest.c b/lib/3rdparty/libxml2/runtest.c deleted file mode 100644 index c6517a39847..00000000000 --- a/lib/3rdparty/libxml2/runtest.c +++ /dev/null @@ -1,4467 +0,0 @@ -/* - * runtest.c: C program to run libxml2 regression tests without - * requiring make or Python, and reducing platform dependancies - * to a strict minimum. - * - * To compile on Unixes: - * cc -o runtest `xml2-config --cflags` runtest.c `xml2-config --libs` -lpthread - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#include "libxml.h" -#include - -#if !defined(_WIN32) || defined(__CYGWIN__) -#include -#endif -#include -#include -#include -#include - -#include -#include -#include - -#ifdef LIBXML_OUTPUT_ENABLED -#ifdef LIBXML_READER_ENABLED -#include -#endif - -#ifdef LIBXML_XINCLUDE_ENABLED -#include -#endif - -#ifdef LIBXML_XPATH_ENABLED -#include -#include -#ifdef LIBXML_XPTR_ENABLED -#include -#endif -#endif - -#ifdef LIBXML_SCHEMAS_ENABLED -#include -#include -#include -#endif - -#ifdef LIBXML_PATTERN_ENABLED -#include -#endif - -#ifdef LIBXML_C14N_ENABLED -#include -#endif - -#ifdef LIBXML_HTML_ENABLED -#include -#include - -/* - * pseudo flag for the unification of HTML and XML tests - */ -#define XML_PARSE_HTML 1 << 24 -#endif - -#if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED) -#include -#include -#include -#include -#include -#endif - -/* - * O_BINARY is just for Windows compatibility - if it isn't defined - * on this system, avoid any compilation error - */ -#ifdef O_BINARY -#define RD_FLAGS O_RDONLY | O_BINARY -#else -#define RD_FLAGS O_RDONLY -#endif - -typedef int (*functest) (const char *filename, const char *result, - const char *error, int options); - -typedef struct testDesc testDesc; -typedef testDesc *testDescPtr; -struct testDesc { - const char *desc; /* descripton of the test */ - functest func; /* function implementing the test */ - const char *in; /* glob to path for input files */ - const char *out; /* output directory */ - const char *suffix;/* suffix for output files */ - const char *err; /* suffix for error output files */ - int options; /* parser options for the test */ -}; - -static int checkTestFile(const char *filename); - -#if defined(_WIN32) && !defined(__CYGWIN__) - -#include -#include - -typedef struct -{ - size_t gl_pathc; /* Count of paths matched so far */ - char **gl_pathv; /* List of matched pathnames. */ - size_t gl_offs; /* Slots to reserve in 'gl_pathv'. */ -} glob_t; - -#define GLOB_DOOFFS 0 -static int glob(const char *pattern, int flags, - int errfunc(const char *epath, int eerrno), - glob_t *pglob) { - glob_t *ret; - WIN32_FIND_DATA FindFileData; - HANDLE hFind; - unsigned int nb_paths = 0; - char directory[500]; - int len; - - if ((pattern == NULL) || (pglob == NULL)) return(-1); - - strncpy(directory, pattern, 499); - for (len = strlen(directory);len >= 0;len--) { - if (directory[len] == '/') { - len++; - directory[len] = 0; - break; - } - } - if (len <= 0) - len = 0; - - - ret = pglob; - memset(ret, 0, sizeof(glob_t)); - - hFind = FindFirstFileA(pattern, &FindFileData); - if (hFind == INVALID_HANDLE_VALUE) - return(0); - nb_paths = 20; - ret->gl_pathv = (char **) malloc(nb_paths * sizeof(char *)); - if (ret->gl_pathv == NULL) { - FindClose(hFind); - return(-1); - } - strncpy(directory + len, FindFileData.cFileName, 499 - len); - ret->gl_pathv[ret->gl_pathc] = strdup(directory); - if (ret->gl_pathv[ret->gl_pathc] == NULL) - goto done; - ret->gl_pathc++; - while(FindNextFileA(hFind, &FindFileData)) { - if (FindFileData.cFileName[0] == '.') - continue; - if (ret->gl_pathc + 2 > nb_paths) { - char **tmp = realloc(ret->gl_pathv, nb_paths * 2 * sizeof(char *)); - if (tmp == NULL) - break; - ret->gl_pathv = tmp; - nb_paths *= 2; - } - strncpy(directory + len, FindFileData.cFileName, 499 - len); - ret->gl_pathv[ret->gl_pathc] = strdup(directory); - if (ret->gl_pathv[ret->gl_pathc] == NULL) - break; - ret->gl_pathc++; - } - ret->gl_pathv[ret->gl_pathc] = NULL; - -done: - FindClose(hFind); - return(0); -} - - - -static void globfree(glob_t *pglob) { - unsigned int i; - if (pglob == NULL) - return; - - for (i = 0;i < pglob->gl_pathc;i++) { - if (pglob->gl_pathv[i] != NULL) - free(pglob->gl_pathv[i]); - } -} - -#else -#include -#endif - -/************************************************************************ - * * - * Libxml2 specific routines * - * * - ************************************************************************/ - -static int nb_tests = 0; -static int nb_errors = 0; -static int nb_leaks = 0; -static int extraMemoryFromResolver = 0; - -static int -fatalError(void) { - fprintf(stderr, "Exitting tests on fatal error\n"); - exit(1); -} - -/* - * We need to trap calls to the resolver to not account memory for the catalog - * which is shared to the current running test. We also don't want to have - * network downloads modifying tests. - */ -static xmlParserInputPtr -testExternalEntityLoader(const char *URL, const char *ID, - xmlParserCtxtPtr ctxt) { - xmlParserInputPtr ret; - - if (checkTestFile(URL)) { - ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); - } else { - int memused = xmlMemUsed(); - ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); - extraMemoryFromResolver += xmlMemUsed() - memused; - } - - return(ret); -} - -/* - * Trapping the error messages at the generic level to grab the equivalent of - * stderr messages on CLI tools. - */ -static char testErrors[32769]; -static int testErrorsSize = 0; - -static void XMLCDECL -testErrorHandler(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) { - va_list args; - int res; - - if (testErrorsSize >= 32768) - return; - va_start(args, msg); - res = vsnprintf(&testErrors[testErrorsSize], - 32768 - testErrorsSize, - msg, args); - va_end(args); - if (testErrorsSize + res >= 32768) { - /* buffer is full */ - testErrorsSize = 32768; - testErrors[testErrorsSize] = 0; - } else { - testErrorsSize += res; - } - testErrors[testErrorsSize] = 0; -} - -static void XMLCDECL -channel(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) { - va_list args; - int res; - - if (testErrorsSize >= 32768) - return; - va_start(args, msg); - res = vsnprintf(&testErrors[testErrorsSize], - 32768 - testErrorsSize, - msg, args); - va_end(args); - if (testErrorsSize + res >= 32768) { - /* buffer is full */ - testErrorsSize = 32768; - testErrors[testErrorsSize] = 0; - } else { - testErrorsSize += res; - } - testErrors[testErrorsSize] = 0; -} - -/** - * xmlParserPrintFileContext: - * @input: an xmlParserInputPtr input - * - * Displays current context within the input content for error tracking - */ - -static void -xmlParserPrintFileContextInternal(xmlParserInputPtr input , - xmlGenericErrorFunc chanl, void *data ) { - const xmlChar *cur, *base; - unsigned int n, col; /* GCC warns if signed, because compared with sizeof() */ - xmlChar content[81]; /* space for 80 chars + line terminator */ - xmlChar *ctnt; - - if (input == NULL) return; - cur = input->cur; - base = input->base; - /* skip backwards over any end-of-lines */ - while ((cur > base) && ((*(cur) == '\n') || (*(cur) == '\r'))) { - cur--; - } - n = 0; - /* search backwards for beginning-of-line (to max buff size) */ - while ((n++ < (sizeof(content)-1)) && (cur > base) && - (*(cur) != '\n') && (*(cur) != '\r')) - cur--; - if ((*(cur) == '\n') || (*(cur) == '\r')) cur++; - /* calculate the error position in terms of the current position */ - col = input->cur - cur; - /* search forward for end-of-line (to max buff size) */ - n = 0; - ctnt = content; - /* copy selected text to our buffer */ - while ((*cur != 0) && (*(cur) != '\n') && - (*(cur) != '\r') && (n < sizeof(content)-1)) { - *ctnt++ = *cur++; - n++; - } - *ctnt = 0; - /* print out the selected text */ - chanl(data ,"%s\n", content); - /* create blank line with problem pointer */ - n = 0; - ctnt = content; - /* (leave buffer space for pointer + line terminator) */ - while ((nfile; - line = err->line; - code = err->code; - domain = err->domain; - level = err->level; - node = err->node; - if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) || - (domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) || - (domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) { - ctxt = err->ctxt; - } - str = err->message; - - if (code == XML_ERR_OK) - return; - - if ((node != NULL) && (node->type == XML_ELEMENT_NODE)) - name = node->name; - - /* - * Maintain the compatibility with the legacy error handling - */ - if (ctxt != NULL) { - input = ctxt->input; - if ((input != NULL) && (input->filename == NULL) && - (ctxt->inputNr > 1)) { - cur = input; - input = ctxt->inputTab[ctxt->inputNr - 2]; - } - if (input != NULL) { - if (input->filename) - channel(data, "%s:%d: ", input->filename, input->line); - else if ((line != 0) && (domain == XML_FROM_PARSER)) - channel(data, "Entity: line %d: ", input->line); - } - } else { - if (file != NULL) - channel(data, "%s:%d: ", file, line); - else if ((line != 0) && (domain == XML_FROM_PARSER)) - channel(data, "Entity: line %d: ", line); - } - if (name != NULL) { - channel(data, "element %s: ", name); - } - if (code == XML_ERR_OK) - return; - switch (domain) { - case XML_FROM_PARSER: - channel(data, "parser "); - break; - case XML_FROM_NAMESPACE: - channel(data, "namespace "); - break; - case XML_FROM_DTD: - case XML_FROM_VALID: - channel(data, "validity "); - break; - case XML_FROM_HTML: - channel(data, "HTML parser "); - break; - case XML_FROM_MEMORY: - channel(data, "memory "); - break; - case XML_FROM_OUTPUT: - channel(data, "output "); - break; - case XML_FROM_IO: - channel(data, "I/O "); - break; - case XML_FROM_XINCLUDE: - channel(data, "XInclude "); - break; - case XML_FROM_XPATH: - channel(data, "XPath "); - break; - case XML_FROM_XPOINTER: - channel(data, "parser "); - break; - case XML_FROM_REGEXP: - channel(data, "regexp "); - break; - case XML_FROM_MODULE: - channel(data, "module "); - break; - case XML_FROM_SCHEMASV: - channel(data, "Schemas validity "); - break; - case XML_FROM_SCHEMASP: - channel(data, "Schemas parser "); - break; - case XML_FROM_RELAXNGP: - channel(data, "Relax-NG parser "); - break; - case XML_FROM_RELAXNGV: - channel(data, "Relax-NG validity "); - break; - case XML_FROM_CATALOG: - channel(data, "Catalog "); - break; - case XML_FROM_C14N: - channel(data, "C14N "); - break; - case XML_FROM_XSLT: - channel(data, "XSLT "); - break; - default: - break; - } - if (code == XML_ERR_OK) - return; - switch (level) { - case XML_ERR_NONE: - channel(data, ": "); - break; - case XML_ERR_WARNING: - channel(data, "warning : "); - break; - case XML_ERR_ERROR: - channel(data, "error : "); - break; - case XML_ERR_FATAL: - channel(data, "error : "); - break; - } - if (code == XML_ERR_OK) - return; - if (str != NULL) { - int len; - len = xmlStrlen((const xmlChar *)str); - if ((len > 0) && (str[len - 1] != '\n')) - channel(data, "%s\n", str); - else - channel(data, "%s", str); - } else { - channel(data, "%s\n", "out of memory error"); - } - if (code == XML_ERR_OK) - return; - - if (ctxt != NULL) { - xmlParserPrintFileContextInternal(input, channel, data); - if (cur != NULL) { - if (cur->filename) - channel(data, "%s:%d: \n", cur->filename, cur->line); - else if ((line != 0) && (domain == XML_FROM_PARSER)) - channel(data, "Entity: line %d: \n", cur->line); - xmlParserPrintFileContextInternal(cur, channel, data); - } - } - if ((domain == XML_FROM_XPATH) && (err->str1 != NULL) && - (err->int1 < 100) && - (err->int1 < xmlStrlen((const xmlChar *)err->str1))) { - xmlChar buf[150]; - int i; - - channel(data, "%s\n", err->str1); - for (i=0;i < err->int1;i++) - buf[i] = ' '; - buf[i++] = '^'; - buf[i] = 0; - channel(data, "%s\n", buf); - } -} - -static void -initializeLibxml2(void) { - xmlGetWarningsDefaultValue = 0; - xmlPedanticParserDefault(0); - - xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup); - xmlInitParser(); - xmlSetExternalEntityLoader(testExternalEntityLoader); - xmlSetStructuredErrorFunc(NULL, testStructuredErrorHandler); -#ifdef LIBXML_SCHEMAS_ENABLED - xmlSchemaInitTypes(); - xmlRelaxNGInitTypes(); -#endif -} - - -/************************************************************************ - * * - * File name and path utilities * - * * - ************************************************************************/ - -static const char *baseFilename(const char *filename) { - const char *cur; - if (filename == NULL) - return(NULL); - cur = &filename[strlen(filename)]; - while ((cur > filename) && (*cur != '/')) - cur--; - if (*cur == '/') - return(cur + 1); - return(cur); -} - -static char *resultFilename(const char *filename, const char *out, - const char *suffix) { - const char *base; - char res[500]; - char suffixbuff[500]; - -/************* - if ((filename[0] == 't') && (filename[1] == 'e') && - (filename[2] == 's') && (filename[3] == 't') && - (filename[4] == '/')) - filename = &filename[5]; - *************/ - - base = baseFilename(filename); - if (suffix == NULL) - suffix = ".tmp"; - if (out == NULL) - out = ""; - - strncpy(suffixbuff,suffix,499); -#ifdef VMS - if(strstr(base,".") && suffixbuff[0]=='.') - suffixbuff[0]='_'; -#endif - - snprintf(res, 499, "%s%s%s", out, base, suffixbuff); - res[499] = 0; - return(strdup(res)); -} - -static int checkTestFile(const char *filename) { - struct stat buf; - - if (stat(filename, &buf) == -1) - return(0); - -#if defined(_WIN32) && !defined(__CYGWIN__) - if (!(buf.st_mode & _S_IFREG)) - return(0); -#else - if (!S_ISREG(buf.st_mode)) - return(0); -#endif - - return(1); -} - -static int compareFiles(const char *r1, const char *r2) { - int res1, res2; - int fd1, fd2; - char bytes1[4096]; - char bytes2[4096]; - - fd1 = open(r1, RD_FLAGS); - if (fd1 < 0) - return(-1); - fd2 = open(r2, RD_FLAGS); - if (fd2 < 0) { - close(fd1); - return(-1); - } - while (1) { - res1 = read(fd1, bytes1, 4096); - res2 = read(fd2, bytes2, 4096); - if ((res1 != res2) || (res1 < 0)) { - close(fd1); - close(fd2); - return(1); - } - if (res1 == 0) - break; - if (memcmp(bytes1, bytes2, res1) != 0) { - close(fd1); - close(fd2); - return(1); - } - } - close(fd1); - close(fd2); - return(0); -} - -static int compareFileMem(const char *filename, const char *mem, int size) { - int res; - int fd; - char bytes[4096]; - int idx = 0; - struct stat info; - - if (stat(filename, &info) < 0) - return(-1); - if (info.st_size != size) - return(-1); - fd = open(filename, RD_FLAGS); - if (fd < 0) - return(-1); - while (idx < size) { - res = read(fd, bytes, 4096); - if (res <= 0) - break; - if (res + idx > size) - break; - if (memcmp(bytes, &mem[idx], res) != 0) { - int ix; - for (ix=0; ix 0) { - siz += res; - } - close(fd); -#if !defined(_WIN32) - if (siz != info.st_size) { - free(base); - return(-1); - } -#endif - base[siz] = 0; - *mem = base; - *size = siz; - return(0); -} - -static int unloadMem(const char *mem) { - free((char *)mem); - return(0); -} - -/************************************************************************ - * * - * Tests implementations * - * * - ************************************************************************/ - -/************************************************************************ - * * - * Parse to SAX based tests * - * * - ************************************************************************/ - -static FILE *SAXdebug = NULL; - -/* - * empty SAX block - */ -static xmlSAXHandler emptySAXHandlerStruct = { - NULL, /* internalSubset */ - NULL, /* isStandalone */ - NULL, /* hasInternalSubset */ - NULL, /* hasExternalSubset */ - NULL, /* resolveEntity */ - NULL, /* getEntity */ - NULL, /* entityDecl */ - NULL, /* notationDecl */ - NULL, /* attributeDecl */ - NULL, /* elementDecl */ - NULL, /* unparsedEntityDecl */ - NULL, /* setDocumentLocator */ - NULL, /* startDocument */ - NULL, /* endDocument */ - NULL, /* startElement */ - NULL, /* endElement */ - NULL, /* reference */ - NULL, /* characters */ - NULL, /* ignorableWhitespace */ - NULL, /* processingInstruction */ - NULL, /* comment */ - NULL, /* xmlParserWarning */ - NULL, /* xmlParserError */ - NULL, /* xmlParserError */ - NULL, /* getParameterEntity */ - NULL, /* cdataBlock; */ - NULL, /* externalSubset; */ - 1, - NULL, - NULL, /* startElementNs */ - NULL, /* endElementNs */ - NULL /* xmlStructuredErrorFunc */ -}; - -static xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct; -static int callbacks = 0; -static int quiet = 0; - -/** - * isStandaloneDebug: - * @ctxt: An XML parser context - * - * Is this document tagged standalone ? - * - * Returns 1 if true - */ -static int -isStandaloneDebug(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - if (quiet) - return(0); - fprintf(SAXdebug, "SAX.isStandalone()\n"); - return(0); -} - -/** - * hasInternalSubsetDebug: - * @ctxt: An XML parser context - * - * Does this document has an internal subset - * - * Returns 1 if true - */ -static int -hasInternalSubsetDebug(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - if (quiet) - return(0); - fprintf(SAXdebug, "SAX.hasInternalSubset()\n"); - return(0); -} - -/** - * hasExternalSubsetDebug: - * @ctxt: An XML parser context - * - * Does this document has an external subset - * - * Returns 1 if true - */ -static int -hasExternalSubsetDebug(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - if (quiet) - return(0); - fprintf(SAXdebug, "SAX.hasExternalSubset()\n"); - return(0); -} - -/** - * internalSubsetDebug: - * @ctxt: An XML parser context - * - * Does this document has an internal subset - */ -static void -internalSubsetDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, - const xmlChar *ExternalID, const xmlChar *SystemID) -{ - callbacks++; - if (quiet) - return; - fprintf(SAXdebug, "SAX.internalSubset(%s,", name); - if (ExternalID == NULL) - fprintf(SAXdebug, " ,"); - else - fprintf(SAXdebug, " %s,", ExternalID); - if (SystemID == NULL) - fprintf(SAXdebug, " )\n"); - else - fprintf(SAXdebug, " %s)\n", SystemID); -} - -/** - * externalSubsetDebug: - * @ctxt: An XML parser context - * - * Does this document has an external subset - */ -static void -externalSubsetDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, - const xmlChar *ExternalID, const xmlChar *SystemID) -{ - callbacks++; - if (quiet) - return; - fprintf(SAXdebug, "SAX.externalSubset(%s,", name); - if (ExternalID == NULL) - fprintf(SAXdebug, " ,"); - else - fprintf(SAXdebug, " %s,", ExternalID); - if (SystemID == NULL) - fprintf(SAXdebug, " )\n"); - else - fprintf(SAXdebug, " %s)\n", SystemID); -} - -/** - * resolveEntityDebug: - * @ctxt: An XML parser context - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * Special entity resolver, better left to the parser, it has - * more context than the application layer. - * The default behaviour is to NOT resolve the entities, in that case - * the ENTITY_REF nodes are built in the structure (and the parameter - * values). - * - * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. - */ -static xmlParserInputPtr -resolveEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *publicId, const xmlChar *systemId) -{ - callbacks++; - if (quiet) - return(NULL); - /* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */ - - - fprintf(SAXdebug, "SAX.resolveEntity("); - if (publicId != NULL) - fprintf(SAXdebug, "%s", (char *)publicId); - else - fprintf(SAXdebug, " "); - if (systemId != NULL) - fprintf(SAXdebug, ", %s)\n", (char *)systemId); - else - fprintf(SAXdebug, ", )\n"); -/********* - if (systemId != NULL) { - return(xmlNewInputFromFile(ctxt, (char *) systemId)); - } - *********/ - return(NULL); -} - -/** - * getEntityDebug: - * @ctxt: An XML parser context - * @name: The entity name - * - * Get an entity by name - * - * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. - */ -static xmlEntityPtr -getEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name) -{ - callbacks++; - if (quiet) - return(NULL); - fprintf(SAXdebug, "SAX.getEntity(%s)\n", name); - return(NULL); -} - -/** - * getParameterEntityDebug: - * @ctxt: An XML parser context - * @name: The entity name - * - * Get a parameter entity by name - * - * Returns the xmlParserInputPtr - */ -static xmlEntityPtr -getParameterEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name) -{ - callbacks++; - if (quiet) - return(NULL); - fprintf(SAXdebug, "SAX.getParameterEntity(%s)\n", name); - return(NULL); -} - - -/** - * entityDeclDebug: - * @ctxt: An XML parser context - * @name: the entity name - * @type: the entity type - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @content: the entity value (without processing). - * - * An entity definition has been parsed - */ -static void -entityDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, int type, - const xmlChar *publicId, const xmlChar *systemId, xmlChar *content) -{ -const xmlChar *nullstr = BAD_CAST "(null)"; - /* not all libraries handle printing null pointers nicely */ - if (publicId == NULL) - publicId = nullstr; - if (systemId == NULL) - systemId = nullstr; - if (content == NULL) - content = (xmlChar *)nullstr; - callbacks++; - if (quiet) - return; - fprintf(SAXdebug, "SAX.entityDecl(%s, %d, %s, %s, %s)\n", - name, type, publicId, systemId, content); -} - -/** - * attributeDeclDebug: - * @ctxt: An XML parser context - * @name: the attribute name - * @type: the attribute type - * - * An attribute definition has been parsed - */ -static void -attributeDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar * elem, - const xmlChar * name, int type, int def, - const xmlChar * defaultValue, xmlEnumerationPtr tree) -{ - callbacks++; - if (quiet) - return; - if (defaultValue == NULL) - fprintf(SAXdebug, "SAX.attributeDecl(%s, %s, %d, %d, NULL, ...)\n", - elem, name, type, def); - else - fprintf(SAXdebug, "SAX.attributeDecl(%s, %s, %d, %d, %s, ...)\n", - elem, name, type, def, defaultValue); - xmlFreeEnumeration(tree); -} - -/** - * elementDeclDebug: - * @ctxt: An XML parser context - * @name: the element name - * @type: the element type - * @content: the element value (without processing). - * - * An element definition has been parsed - */ -static void -elementDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, int type, - xmlElementContentPtr content ATTRIBUTE_UNUSED) -{ - callbacks++; - if (quiet) - return; - fprintf(SAXdebug, "SAX.elementDecl(%s, %d, ...)\n", - name, type); -} - -/** - * notationDeclDebug: - * @ctxt: An XML parser context - * @name: The name of the notation - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * What to do when a notation declaration has been parsed. - */ -static void -notationDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, - const xmlChar *publicId, const xmlChar *systemId) -{ - callbacks++; - if (quiet) - return; - fprintf(SAXdebug, "SAX.notationDecl(%s, %s, %s)\n", - (char *) name, (char *) publicId, (char *) systemId); -} - -/** - * unparsedEntityDeclDebug: - * @ctxt: An XML parser context - * @name: The name of the entity - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @notationName: the name of the notation - * - * What to do when an unparsed entity declaration is parsed - */ -static void -unparsedEntityDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, - const xmlChar *publicId, const xmlChar *systemId, - const xmlChar *notationName) -{ -const xmlChar *nullstr = BAD_CAST "(null)"; - - if (publicId == NULL) - publicId = nullstr; - if (systemId == NULL) - systemId = nullstr; - if (notationName == NULL) - notationName = nullstr; - callbacks++; - if (quiet) - return; - fprintf(SAXdebug, "SAX.unparsedEntityDecl(%s, %s, %s, %s)\n", - (char *) name, (char *) publicId, (char *) systemId, - (char *) notationName); -} - -/** - * setDocumentLocatorDebug: - * @ctxt: An XML parser context - * @loc: A SAX Locator - * - * Receive the document locator at startup, actually xmlDefaultSAXLocator - * Everything is available on the context, so this is useless in our case. - */ -static void -setDocumentLocatorDebug(void *ctx ATTRIBUTE_UNUSED, xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED) -{ - callbacks++; - if (quiet) - return; - fprintf(SAXdebug, "SAX.setDocumentLocator()\n"); -} - -/** - * startDocumentDebug: - * @ctxt: An XML parser context - * - * called when the document start being processed. - */ -static void -startDocumentDebug(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - if (quiet) - return; - fprintf(SAXdebug, "SAX.startDocument()\n"); -} - -/** - * endDocumentDebug: - * @ctxt: An XML parser context - * - * called when the document end has been detected. - */ -static void -endDocumentDebug(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - if (quiet) - return; - fprintf(SAXdebug, "SAX.endDocument()\n"); -} - -/** - * startElementDebug: - * @ctxt: An XML parser context - * @name: The element name - * - * called when an opening tag has been processed. - */ -static void -startElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar **atts) -{ - int i; - - callbacks++; - if (quiet) - return; - fprintf(SAXdebug, "SAX.startElement(%s", (char *) name); - if (atts != NULL) { - for (i = 0;(atts[i] != NULL);i++) { - fprintf(SAXdebug, ", %s='", atts[i++]); - if (atts[i] != NULL) - fprintf(SAXdebug, "%s'", atts[i]); - } - } - fprintf(SAXdebug, ")\n"); -} - -/** - * endElementDebug: - * @ctxt: An XML parser context - * @name: The element name - * - * called when the end of an element has been detected. - */ -static void -endElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name) -{ - callbacks++; - if (quiet) - return; - fprintf(SAXdebug, "SAX.endElement(%s)\n", (char *) name); -} - -/** - * charactersDebug: - * @ctxt: An XML parser context - * @ch: a xmlChar string - * @len: the number of xmlChar - * - * receiving some chars from the parser. - * Question: how much at a time ??? - */ -static void -charactersDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len) -{ - char output[40]; - int i; - - callbacks++; - if (quiet) - return; - for (i = 0;(i= size) { -#ifdef LIBXML_HTML_ENABLED - if (options & XML_PARSE_HTML) - htmlParseChunk(ctxt, base + cur, size - cur, 1); - else -#endif - xmlParseChunk(ctxt, base + cur, size - cur, 1); - break; - } else { -#ifdef LIBXML_HTML_ENABLED - if (options & XML_PARSE_HTML) - htmlParseChunk(ctxt, base + cur, 1024, 0); - else -#endif - xmlParseChunk(ctxt, base + cur, 1024, 0); - cur += 1024; - } - } - doc = ctxt->myDoc; -#ifdef LIBXML_HTML_ENABLED - if (options & XML_PARSE_HTML) - res = 1; - else -#endif - res = ctxt->wellFormed; - xmlFreeParserCtxt(ctxt); - free((char *)base); - if (!res) { - xmlFreeDoc(doc); - fprintf(stderr, "Failed to parse %s\n", filename); - return(-1); - } -#ifdef LIBXML_HTML_ENABLED - if (options & XML_PARSE_HTML) - htmlDocDumpMemory(doc, (xmlChar **) &base, &size); - else -#endif - xmlDocDumpMemory(doc, (xmlChar **) &base, &size); - xmlFreeDoc(doc); - res = compareFileMem(result, base, size); - if ((base == NULL) || (res != 0)) { - if (base != NULL) - xmlFree((char *)base); - fprintf(stderr, "Result for %s failed\n", filename); - return(-1); - } - xmlFree((char *)base); - if (err != NULL) { - res = compareFileMem(err, testErrors, testErrorsSize); - if (res != 0) { - fprintf(stderr, "Error for %s failed\n", filename); - return(-1); - } - } - return(0); -} -#endif - -/** - * memParseTest: - * @filename: the file to parse - * @result: the file with expected result - * @err: the file with error messages: unused - * - * Parse a file using the old xmlReadMemory API, then serialize back - * reparse the result and serialize again, then check for deviation - * in serialization. - * - * Returns 0 in case of success, an error code otherwise - */ -static int -memParseTest(const char *filename, const char *result, - const char *err ATTRIBUTE_UNUSED, - int options ATTRIBUTE_UNUSED) { - xmlDocPtr doc; - const char *base; - int size, res; - - nb_tests++; - /* - * load and parse the memory - */ - if (loadMem(filename, &base, &size) != 0) { - fprintf(stderr, "Failed to load %s\n", filename); - return(-1); - } - - doc = xmlReadMemory(base, size, filename, NULL, 0); - unloadMem(base); - if (doc == NULL) { - return(1); - } - xmlDocDumpMemory(doc, (xmlChar **) &base, &size); - xmlFreeDoc(doc); - res = compareFileMem(result, base, size); - if ((base == NULL) || (res != 0)) { - if (base != NULL) - xmlFree((char *)base); - fprintf(stderr, "Result for %s failed\n", filename); - return(-1); - } - xmlFree((char *)base); - return(0); -} - -/** - * noentParseTest: - * @filename: the file to parse - * @result: the file with expected result - * @err: the file with error messages: unused - * - * Parse a file with entity resolution, then serialize back - * reparse the result and serialize again, then check for deviation - * in serialization. - * - * Returns 0 in case of success, an error code otherwise - */ -static int -noentParseTest(const char *filename, const char *result, - const char *err ATTRIBUTE_UNUSED, - int options) { - xmlDocPtr doc; - char *temp; - int res = 0; - - nb_tests++; - /* - * base of the test, parse with the old API - */ - doc = xmlReadFile(filename, NULL, options); - if (doc == NULL) - return(1); - temp = resultFilename(filename, "", ".res"); - if (temp == NULL) { - fprintf(stderr, "Out of memory\n"); - fatalError(); - } - xmlSaveFile(temp, doc); - if (compareFiles(temp, result)) { - res = 1; - } - xmlFreeDoc(doc); - - /* - * Parse the saved result to make sure the round trip is okay - */ - doc = xmlReadFile(filename, NULL, options); - if (doc == NULL) - return(1); - xmlSaveFile(temp, doc); - if (compareFiles(temp, result)) { - res = 1; - } - xmlFreeDoc(doc); - - if (temp != NULL) { - unlink(temp); - free(temp); - } - return(res); -} - -/** - * errParseTest: - * @filename: the file to parse - * @result: the file with expected result - * @err: the file with error messages - * - * Parse a file using the xmlReadFile API and check for errors. - * - * Returns 0 in case of success, an error code otherwise - */ -static int -errParseTest(const char *filename, const char *result, const char *err, - int options) { - xmlDocPtr doc; - const char *base = NULL; - int size, res = 0; - - nb_tests++; -#ifdef LIBXML_HTML_ENABLED - if (options & XML_PARSE_HTML) { - doc = htmlReadFile(filename, NULL, options); - } else -#endif -#ifdef LIBXML_XINCLUDE_ENABLED - if (options & XML_PARSE_XINCLUDE) { - doc = xmlReadFile(filename, NULL, options); - xmlXIncludeProcessFlags(doc, options); - } else -#endif - { - xmlGetWarningsDefaultValue = 1; - doc = xmlReadFile(filename, NULL, options); - } - xmlGetWarningsDefaultValue = 0; - if (result) { - if (doc == NULL) { - base = ""; - size = 0; - } else { -#ifdef LIBXML_HTML_ENABLED - if (options & XML_PARSE_HTML) { - htmlDocDumpMemory(doc, (xmlChar **) &base, &size); - } else -#endif - xmlDocDumpMemory(doc, (xmlChar **) &base, &size); - } - res = compareFileMem(result, base, size); - } - if (doc != NULL) { - if (base != NULL) - xmlFree((char *)base); - xmlFreeDoc(doc); - } - if (res != 0) { - fprintf(stderr, "Result for %s failed\n", filename); - return(-1); - } - if (err != NULL) { - res = compareFileMem(err, testErrors, testErrorsSize); - if (res != 0) { - fprintf(stderr, "Error for %s failed\n", filename); - return(-1); - } - } else if (options & XML_PARSE_DTDVALID) { - if (testErrorsSize != 0) - fprintf(stderr, "Validation for %s failed\n", filename); - } - - return(0); -} - -#ifdef LIBXML_READER_ENABLED -/************************************************************************ - * * - * Reader based tests * - * * - ************************************************************************/ - -static void processNode(FILE *out, xmlTextReaderPtr reader) { - const xmlChar *name, *value; - int type, empty; - - type = xmlTextReaderNodeType(reader); - empty = xmlTextReaderIsEmptyElement(reader); - - name = xmlTextReaderConstName(reader); - if (name == NULL) - name = BAD_CAST "--"; - - value = xmlTextReaderConstValue(reader); - - - fprintf(out, "%d %d %s %d %d", - xmlTextReaderDepth(reader), - type, - name, - empty, - xmlTextReaderHasValue(reader)); - if (value == NULL) - fprintf(out, "\n"); - else { - fprintf(out, " %s\n", value); - } -} -static int -streamProcessTest(const char *filename, const char *result, const char *err, - xmlTextReaderPtr reader, const char *rng) { - int ret; - char *temp = NULL; - FILE *t = NULL; - - if (reader == NULL) - return(-1); - - nb_tests++; - if (result != NULL) { - temp = resultFilename(filename, "", ".res"); - if (temp == NULL) { - fprintf(stderr, "Out of memory\n"); - fatalError(); - } - t = fopen(temp, "wb"); - if (t == NULL) { - fprintf(stderr, "Can't open temp file %s\n", temp); - free(temp); - return(-1); - } - } -#ifdef LIBXML_SCHEMAS_ENABLED - if (rng != NULL) { - ret = xmlTextReaderRelaxNGValidate(reader, rng); - if (ret < 0) { - testErrorHandler(NULL, "Relax-NG schema %s failed to compile\n", - rng); - fclose(t); - if (temp != NULL) { - unlink(temp); - free(temp); - } - return(0); - } - } -#endif - xmlGetWarningsDefaultValue = 1; - ret = xmlTextReaderRead(reader); - while (ret == 1) { - if ((t != NULL) && (rng == NULL)) - processNode(t, reader); - ret = xmlTextReaderRead(reader); - } - if (ret != 0) { - testErrorHandler(NULL, "%s : failed to parse\n", filename); - } - if (rng != NULL) { - if (xmlTextReaderIsValid(reader) != 1) { - testErrorHandler(NULL, "%s fails to validate\n", filename); - } else { - testErrorHandler(NULL, "%s validates\n", filename); - } - } - xmlGetWarningsDefaultValue = 0; - if (t != NULL) { - fclose(t); - ret = compareFiles(temp, result); - if (temp != NULL) { - unlink(temp); - free(temp); - } - if (ret) { - fprintf(stderr, "Result for %s failed\n", filename); - return(-1); - } - } - if (err != NULL) { - ret = compareFileMem(err, testErrors, testErrorsSize); - if (ret != 0) { - fprintf(stderr, "Error for %s failed\n", filename); - printf("%s", testErrors); - return(-1); - } - } - - return(0); -} - -/** - * streamParseTest: - * @filename: the file to parse - * @result: the file with expected result - * @err: the file with error messages - * - * Parse a file using the reader API and check for errors. - * - * Returns 0 in case of success, an error code otherwise - */ -static int -streamParseTest(const char *filename, const char *result, const char *err, - int options) { - xmlTextReaderPtr reader; - int ret; - - reader = xmlReaderForFile(filename, NULL, options); - ret = streamProcessTest(filename, result, err, reader, NULL); - xmlFreeTextReader(reader); - return(ret); -} - -/** - * walkerParseTest: - * @filename: the file to parse - * @result: the file with expected result - * @err: the file with error messages - * - * Parse a file using the walker, i.e. a reader built from a atree. - * - * Returns 0 in case of success, an error code otherwise - */ -static int -walkerParseTest(const char *filename, const char *result, const char *err, - int options) { - xmlDocPtr doc; - xmlTextReaderPtr reader; - int ret; - - doc = xmlReadFile(filename, NULL, options); - if (doc == NULL) { - fprintf(stderr, "Failed to parse %s\n", filename); - return(-1); - } - reader = xmlReaderWalker(doc); - ret = streamProcessTest(filename, result, err, reader, NULL); - xmlFreeTextReader(reader); - xmlFreeDoc(doc); - return(ret); -} - -/** - * streamMemParseTest: - * @filename: the file to parse - * @result: the file with expected result - * @err: the file with error messages - * - * Parse a file using the reader API from memory and check for errors. - * - * Returns 0 in case of success, an error code otherwise - */ -static int -streamMemParseTest(const char *filename, const char *result, const char *err, - int options) { - xmlTextReaderPtr reader; - int ret; - const char *base; - int size; - - /* - * load and parse the memory - */ - if (loadMem(filename, &base, &size) != 0) { - fprintf(stderr, "Failed to load %s\n", filename); - return(-1); - } - reader = xmlReaderForMemory(base, size, filename, NULL, options); - ret = streamProcessTest(filename, result, err, reader, NULL); - free((char *)base); - xmlFreeTextReader(reader); - return(ret); -} -#endif - -#ifdef LIBXML_XPATH_ENABLED -#ifdef LIBXML_DEBUG_ENABLED -/************************************************************************ - * * - * XPath and XPointer based tests * - * * - ************************************************************************/ - -static FILE *xpathOutput; -static xmlDocPtr xpathDocument; - -static void -testXPath(const char *str, int xptr, int expr) { - xmlXPathObjectPtr res; - xmlXPathContextPtr ctxt; - - nb_tests++; -#if defined(LIBXML_XPTR_ENABLED) - if (xptr) { - ctxt = xmlXPtrNewContext(xpathDocument, NULL, NULL); - res = xmlXPtrEval(BAD_CAST str, ctxt); - } else { -#endif - ctxt = xmlXPathNewContext(xpathDocument); - ctxt->node = xmlDocGetRootElement(xpathDocument); - if (expr) - res = xmlXPathEvalExpression(BAD_CAST str, ctxt); - else { - /* res = xmlXPathEval(BAD_CAST str, ctxt); */ - xmlXPathCompExprPtr comp; - - comp = xmlXPathCompile(BAD_CAST str); - if (comp != NULL) { - res = xmlXPathCompiledEval(comp, ctxt); - xmlXPathFreeCompExpr(comp); - } else - res = NULL; - } -#if defined(LIBXML_XPTR_ENABLED) - } -#endif - xmlXPathDebugDumpObject(xpathOutput, res, 0); - xmlXPathFreeObject(res); - xmlXPathFreeContext(ctxt); -} - -/** - * xpathExprTest: - * @filename: the file to parse - * @result: the file with expected result - * @err: the file with error messages - * - * Parse a file containing XPath standalone expressions and evaluate them - * - * Returns 0 in case of success, an error code otherwise - */ -static int -xpathCommonTest(const char *filename, const char *result, - int xptr, int expr) { - FILE *input; - char expression[5000]; - int len, ret = 0; - char *temp; - - temp = resultFilename(filename, "", ".res"); - if (temp == NULL) { - fprintf(stderr, "Out of memory\n"); - fatalError(); - } - xpathOutput = fopen(temp, "wb"); - if (xpathOutput == NULL) { - fprintf(stderr, "failed to open output file %s\n", temp); - free(temp); - return(-1); - } - - input = fopen(filename, "rb"); - if (input == NULL) { - xmlGenericError(xmlGenericErrorContext, - "Cannot open %s for reading\n", filename); - free(temp); - return(-1); - } - while (fgets(expression, 4500, input) != NULL) { - len = strlen(expression); - len--; - while ((len >= 0) && - ((expression[len] == '\n') || (expression[len] == '\t') || - (expression[len] == '\r') || (expression[len] == ' '))) len--; - expression[len + 1] = 0; - if (len >= 0) { - fprintf(xpathOutput, - "\n========================\nExpression: %s\n", - expression) ; - testXPath(expression, xptr, expr); - } - } - - fclose(input); - fclose(xpathOutput); - if (result != NULL) { - ret = compareFiles(temp, result); - if (ret) { - fprintf(stderr, "Result for %s failed\n", filename); - } - } - - if (temp != NULL) { - unlink(temp); - free(temp); - } - return(ret); -} - -/** - * xpathExprTest: - * @filename: the file to parse - * @result: the file with expected result - * @err: the file with error messages - * - * Parse a file containing XPath standalone expressions and evaluate them - * - * Returns 0 in case of success, an error code otherwise - */ -static int -xpathExprTest(const char *filename, const char *result, - const char *err ATTRIBUTE_UNUSED, - int options ATTRIBUTE_UNUSED) { - return(xpathCommonTest(filename, result, 0, 1)); -} - -/** - * xpathDocTest: - * @filename: the file to parse - * @result: the file with expected result - * @err: the file with error messages - * - * Parse a file containing XPath expressions and evaluate them against - * a set of corresponding documents. - * - * Returns 0 in case of success, an error code otherwise - */ -static int -xpathDocTest(const char *filename, - const char *resul ATTRIBUTE_UNUSED, - const char *err ATTRIBUTE_UNUSED, - int options) { - - char pattern[500]; - char result[500]; - glob_t globbuf; - size_t i; - int ret = 0, res; - - xpathDocument = xmlReadFile(filename, NULL, - options | XML_PARSE_DTDATTR | XML_PARSE_NOENT); - if (xpathDocument == NULL) { - fprintf(stderr, "Failed to load %s\n", filename); - return(-1); - } - - snprintf(pattern, 499, "./test/XPath/tests/%s*", baseFilename(filename)); - pattern[499] = 0; - globbuf.gl_offs = 0; - glob(pattern, GLOB_DOOFFS, NULL, &globbuf); - for (i = 0;i < globbuf.gl_pathc;i++) { - snprintf(result, 499, "result/XPath/tests/%s", - baseFilename(globbuf.gl_pathv[i])); - res = xpathCommonTest(globbuf.gl_pathv[i], &result[0], 0, 0); - if (res != 0) - ret = res; - } - globfree(&globbuf); - - xmlFreeDoc(xpathDocument); - return(ret); -} - -#ifdef LIBXML_XPTR_ENABLED -/** - * xptrDocTest: - * @filename: the file to parse - * @result: the file with expected result - * @err: the file with error messages - * - * Parse a file containing XPath expressions and evaluate them against - * a set of corresponding documents. - * - * Returns 0 in case of success, an error code otherwise - */ -static int -xptrDocTest(const char *filename, - const char *resul ATTRIBUTE_UNUSED, - const char *err ATTRIBUTE_UNUSED, - int options) { - - char pattern[500]; - char result[500]; - glob_t globbuf; - size_t i; - int ret = 0, res; - - xpathDocument = xmlReadFile(filename, NULL, - options | XML_PARSE_DTDATTR | XML_PARSE_NOENT); - if (xpathDocument == NULL) { - fprintf(stderr, "Failed to load %s\n", filename); - return(-1); - } - - snprintf(pattern, 499, "./test/XPath/xptr/%s*", baseFilename(filename)); - pattern[499] = 0; - globbuf.gl_offs = 0; - glob(pattern, GLOB_DOOFFS, NULL, &globbuf); - for (i = 0;i < globbuf.gl_pathc;i++) { - snprintf(result, 499, "result/XPath/xptr/%s", - baseFilename(globbuf.gl_pathv[i])); - res = xpathCommonTest(globbuf.gl_pathv[i], &result[0], 1, 0); - if (res != 0) - ret = res; - } - globfree(&globbuf); - - xmlFreeDoc(xpathDocument); - return(ret); -} -#endif /* LIBXML_XPTR_ENABLED */ - -/** - * xmlidDocTest: - * @filename: the file to parse - * @result: the file with expected result - * @err: the file with error messages - * - * Parse a file containing xml:id and check for errors and verify - * that XPath queries will work on them as expected. - * - * Returns 0 in case of success, an error code otherwise - */ -static int -xmlidDocTest(const char *filename, - const char *result, - const char *err, - int options) { - - int res = 0; - int ret = 0; - char *temp; - - xpathDocument = xmlReadFile(filename, NULL, - options | XML_PARSE_DTDATTR | XML_PARSE_NOENT); - if (xpathDocument == NULL) { - fprintf(stderr, "Failed to load %s\n", filename); - return(-1); - } - - temp = resultFilename(filename, "", ".res"); - if (temp == NULL) { - fprintf(stderr, "Out of memory\n"); - fatalError(); - } - xpathOutput = fopen(temp, "wb"); - if (xpathOutput == NULL) { - fprintf(stderr, "failed to open output file %s\n", temp); - xmlFreeDoc(xpathDocument); - free(temp); - return(-1); - } - - testXPath("id('bar')", 0, 0); - - fclose(xpathOutput); - if (result != NULL) { - ret = compareFiles(temp, result); - if (ret) { - fprintf(stderr, "Result for %s failed\n", filename); - res = 1; - } - } - - if (temp != NULL) { - unlink(temp); - free(temp); - } - xmlFreeDoc(xpathDocument); - - if (err != NULL) { - ret = compareFileMem(err, testErrors, testErrorsSize); - if (ret != 0) { - fprintf(stderr, "Error for %s failed\n", filename); - res = 1; - } - } - return(res); -} - -#endif /* LIBXML_DEBUG_ENABLED */ -#endif /* XPATH */ -/************************************************************************ - * * - * URI based tests * - * * - ************************************************************************/ - -static void -handleURI(const char *str, const char *base, FILE *o) { - int ret; - xmlURIPtr uri; - xmlChar *res = NULL; - - uri = xmlCreateURI(); - - if (base == NULL) { - ret = xmlParseURIReference(uri, str); - if (ret != 0) - fprintf(o, "%s : error %d\n", str, ret); - else { - xmlNormalizeURIPath(uri->path); - xmlPrintURI(o, uri); - fprintf(o, "\n"); - } - } else { - res = xmlBuildURI((xmlChar *)str, (xmlChar *) base); - if (res != NULL) { - fprintf(o, "%s\n", (char *) res); - } - else - fprintf(o, "::ERROR::\n"); - } - if (res != NULL) - xmlFree(res); - xmlFreeURI(uri); -} - -/** - * uriCommonTest: - * @filename: the file to parse - * @result: the file with expected result - * @err: the file with error messages - * - * Parse a file containing URI and check for errors - * - * Returns 0 in case of success, an error code otherwise - */ -static int -uriCommonTest(const char *filename, - const char *result, - const char *err, - const char *base) { - char *temp; - FILE *o, *f; - char str[1024]; - int res = 0, i, ret; - - temp = resultFilename(filename, "", ".res"); - if (temp == NULL) { - fprintf(stderr, "Out of memory\n"); - fatalError(); - } - o = fopen(temp, "wb"); - if (o == NULL) { - fprintf(stderr, "failed to open output file %s\n", temp); - free(temp); - return(-1); - } - f = fopen(filename, "rb"); - if (f == NULL) { - fprintf(stderr, "failed to open input file %s\n", filename); - fclose(o); - if (temp != NULL) { - unlink(temp); - free(temp); - } - return(-1); - } - - while (1) { - /* - * read one line in string buffer. - */ - if (fgets (&str[0], sizeof (str) - 1, f) == NULL) - break; - - /* - * remove the ending spaces - */ - i = strlen(str); - while ((i > 0) && - ((str[i - 1] == '\n') || (str[i - 1] == '\r') || - (str[i - 1] == ' ') || (str[i - 1] == '\t'))) { - i--; - str[i] = 0; - } - nb_tests++; - handleURI(str, base, o); - } - - fclose(f); - fclose(o); - - if (result != NULL) { - ret = compareFiles(temp, result); - if (ret) { - fprintf(stderr, "Result for %s failed\n", filename); - res = 1; - } - } - if (err != NULL) { - ret = compareFileMem(err, testErrors, testErrorsSize); - if (ret != 0) { - fprintf(stderr, "Error for %s failed\n", filename); - res = 1; - } - } - - if (temp != NULL) { - unlink(temp); - free(temp); - } - return(res); -} - -/** - * uriParseTest: - * @filename: the file to parse - * @result: the file with expected result - * @err: the file with error messages - * - * Parse a file containing URI and check for errors - * - * Returns 0 in case of success, an error code otherwise - */ -static int -uriParseTest(const char *filename, - const char *result, - const char *err, - int options ATTRIBUTE_UNUSED) { - return(uriCommonTest(filename, result, err, NULL)); -} - -/** - * uriBaseTest: - * @filename: the file to parse - * @result: the file with expected result - * @err: the file with error messages - * - * Parse a file containing URI, compose them against a fixed base and - * check for errors - * - * Returns 0 in case of success, an error code otherwise - */ -static int -uriBaseTest(const char *filename, - const char *result, - const char *err, - int options ATTRIBUTE_UNUSED) { - return(uriCommonTest(filename, result, err, - "http://foo.com/path/to/index.html?orig#help")); -} - -static int urip_success = 1; -static int urip_current = 0; -static const char *urip_testURLs[] = { - "urip://example.com/a b.html", - "urip://example.com/a%20b.html", - "file:///path/to/a b.html", - "file:///path/to/a%20b.html", - "/path/to/a b.html", - "/path/to/a%20b.html", - "urip://example.com/r" "\xe9" "sum" "\xe9" ".html", - "urip://example.com/test?a=1&b=2%263&c=4#foo", - NULL -}; -static const char *urip_rcvsURLs[] = { - /* it is an URI the strings must be escaped */ - "urip://example.com/a%20b.html", - /* check that % escaping is not broken */ - "urip://example.com/a%20b.html", - /* it's an URI path the strings must be escaped */ - "file:///path/to/a%20b.html", - /* check that % escaping is not broken */ - "file:///path/to/a%20b.html", - /* this is not an URI, this is a path, so this should not be escaped */ - "/path/to/a b.html", - /* check that paths with % are not broken */ - "/path/to/a%20b.html", - /* out of context the encoding can't be guessed byte by byte conversion */ - "urip://example.com/r%E9sum%E9.html", - /* verify we don't destroy URIs especially the query part */ - "urip://example.com/test?a=1&b=2%263&c=4#foo", - NULL -}; -static const char *urip_res = ""; -static const char *urip_cur = NULL; -static int urip_rlen; - -/** - * uripMatch: - * @URI: an URI to test - * - * Check for an urip: query - * - * Returns 1 if yes and 0 if another Input module should be used - */ -static int -uripMatch(const char * URI) { - if ((URI == NULL) || (!strcmp(URI, "file:///etc/xml/catalog"))) - return(0); - /* Verify we received the escaped URL */ - if (strcmp(urip_rcvsURLs[urip_current], URI)) - urip_success = 0; - return(1); -} - -/** - * uripOpen: - * @URI: an URI to test - * - * Return a pointer to the urip: query handler, in this example simply - * the urip_current pointer... - * - * Returns an Input context or NULL in case or error - */ -static void * -uripOpen(const char * URI) { - if ((URI == NULL) || (!strcmp(URI, "file:///etc/xml/catalog"))) - return(NULL); - /* Verify we received the escaped URL */ - if (strcmp(urip_rcvsURLs[urip_current], URI)) - urip_success = 0; - urip_cur = urip_res; - urip_rlen = strlen(urip_res); - return((void *) urip_cur); -} - -/** - * uripClose: - * @context: the read context - * - * Close the urip: query handler - * - * Returns 0 or -1 in case of error - */ -static int -uripClose(void * context) { - if (context == NULL) return(-1); - urip_cur = NULL; - urip_rlen = 0; - return(0); -} - -/** - * uripRead: - * @context: the read context - * @buffer: where to store data - * @len: number of bytes to read - * - * Implement an urip: query read. - * - * Returns the number of bytes read or -1 in case of error - */ -static int -uripRead(void * context, char * buffer, int len) { - const char *ptr = (const char *) context; - - if ((context == NULL) || (buffer == NULL) || (len < 0)) - return(-1); - - if (len > urip_rlen) len = urip_rlen; - memcpy(buffer, ptr, len); - urip_rlen -= len; - return(len); -} - -static int -urip_checkURL(const char *URL) { - xmlDocPtr doc; - - doc = xmlReadFile(URL, NULL, 0); - if (doc == NULL) - return(-1); - xmlFreeDoc(doc); - return(1); -} - -/** - * uriPathTest: - * @filename: ignored - * @result: ignored - * @err: ignored - * - * Run a set of tests to check how Path and URI are handled before - * being passed to the I/O layer - * - * Returns 0 in case of success, an error code otherwise - */ -static int -uriPathTest(const char *filename ATTRIBUTE_UNUSED, - const char *result ATTRIBUTE_UNUSED, - const char *err ATTRIBUTE_UNUSED, - int options ATTRIBUTE_UNUSED) { - int parsed; - int failures = 0; - - /* - * register the new I/O handlers - */ - if (xmlRegisterInputCallbacks(uripMatch, uripOpen, uripRead, uripClose) < 0) - { - fprintf(stderr, "failed to register HTTP handler\n"); - return(-1); - } - - for (urip_current = 0;urip_testURLs[urip_current] != NULL;urip_current++) { - urip_success = 1; - parsed = urip_checkURL(urip_testURLs[urip_current]); - if (urip_success != 1) { - fprintf(stderr, "failed the URL passing test for %s", - urip_testURLs[urip_current]); - failures++; - } else if (parsed != 1) { - fprintf(stderr, "failed the parsing test for %s", - urip_testURLs[urip_current]); - failures++; - } - nb_tests++; - } - - xmlPopInputCallbacks(); - return(failures); -} - -#ifdef LIBXML_SCHEMAS_ENABLED -/************************************************************************ - * * - * Schemas tests * - * * - ************************************************************************/ -static int -schemasOneTest(const char *sch, - const char *filename, - const char *result, - const char *err, - int options, - xmlSchemaPtr schemas) { - xmlDocPtr doc; - xmlSchemaValidCtxtPtr ctxt; - int ret = 0; - int validResult = 0; - char *temp; - FILE *schemasOutput; - - doc = xmlReadFile(filename, NULL, options); - if (doc == NULL) { - fprintf(stderr, "failed to parse instance %s for %s\n", filename, sch); - return(-1); - } - - temp = resultFilename(result, "", ".res"); - if (temp == NULL) { - fprintf(stderr, "Out of memory\n"); - fatalError(); - } - schemasOutput = fopen(temp, "wb"); - if (schemasOutput == NULL) { - fprintf(stderr, "failed to open output file %s\n", temp); - xmlFreeDoc(doc); - free(temp); - return(-1); - } - - ctxt = xmlSchemaNewValidCtxt(schemas); - xmlSchemaSetValidErrors(ctxt, - (xmlSchemaValidityErrorFunc) testErrorHandler, - (xmlSchemaValidityWarningFunc) testErrorHandler, - ctxt); - validResult = xmlSchemaValidateDoc(ctxt, doc); - if (validResult == 0) { - fprintf(schemasOutput, "%s validates\n", filename); - } else if (validResult > 0) { - fprintf(schemasOutput, "%s fails to validate\n", filename); - } else { - fprintf(schemasOutput, "%s validation generated an internal error\n", - filename); - } - fclose(schemasOutput); - if (result) { - if (compareFiles(temp, result)) { - fprintf(stderr, "Result for %s on %s failed\n", filename, sch); - ret = 1; - } - } - if (temp != NULL) { - unlink(temp); - free(temp); - } - - if ((validResult != 0) && (err != NULL)) { - if (compareFileMem(err, testErrors, testErrorsSize)) { - fprintf(stderr, "Error for %s on %s failed\n", filename, sch); - ret = 1; - } - } - - xmlSchemaFreeValidCtxt(ctxt); - xmlFreeDoc(doc); - return(ret); -} -/** - * schemasTest: - * @filename: the schemas file - * @result: the file with expected result - * @err: the file with error messages - * - * Parse a file containing URI, compose them against a fixed base and - * check for errors - * - * Returns 0 in case of success, an error code otherwise - */ -static int -schemasTest(const char *filename, - const char *resul ATTRIBUTE_UNUSED, - const char *errr ATTRIBUTE_UNUSED, - int options) { - const char *base = baseFilename(filename); - const char *base2; - const char *instance; - xmlSchemaParserCtxtPtr ctxt; - xmlSchemaPtr schemas; - int res = 0, len, ret; - char pattern[500]; - char prefix[500]; - char result[500]; - char err[500]; - glob_t globbuf; - size_t i; - char count = 0; - - /* first compile the schemas if possible */ - ctxt = xmlSchemaNewParserCtxt(filename); - xmlSchemaSetParserErrors(ctxt, - (xmlSchemaValidityErrorFunc) testErrorHandler, - (xmlSchemaValidityWarningFunc) testErrorHandler, - ctxt); - schemas = xmlSchemaParse(ctxt); - xmlSchemaFreeParserCtxt(ctxt); - - /* - * most of the mess is about the output filenames generated by the Makefile - */ - len = strlen(base); - if ((len > 499) || (len < 5)) { - xmlSchemaFree(schemas); - return(-1); - } - len -= 4; /* remove trailing .xsd */ - if (base[len - 2] == '_') { - len -= 2; /* remove subtest number */ - } - if (base[len - 2] == '_') { - len -= 2; /* remove subtest number */ - } - memcpy(prefix, base, len); - prefix[len] = 0; - - snprintf(pattern, 499, "./test/schemas/%s_?.xml", prefix); - pattern[499] = 0; - - if (base[len] == '_') { - len += 2; - memcpy(prefix, base, len); - prefix[len] = 0; - } - - globbuf.gl_offs = 0; - glob(pattern, GLOB_DOOFFS, NULL, &globbuf); - for (i = 0;i < globbuf.gl_pathc;i++) { - testErrorsSize = 0; - testErrors[0] = 0; - instance = globbuf.gl_pathv[i]; - base2 = baseFilename(instance); - len = strlen(base2); - if ((len > 6) && (base2[len - 6] == '_')) { - count = base2[len - 5]; - snprintf(result, 499, "result/schemas/%s_%c", - prefix, count); - result[499] = 0; - snprintf(err, 499, "result/schemas/%s_%c.err", - prefix, count); - err[499] = 0; - } else { - fprintf(stderr, "don't know how to process %s\n", instance); - continue; - } - if (schemas == NULL) { - } else { - nb_tests++; - ret = schemasOneTest(filename, instance, result, err, - options, schemas); - if (ret != 0) - res = ret; - } - } - globfree(&globbuf); - xmlSchemaFree(schemas); - - return(res); -} - -/************************************************************************ - * * - * Schemas tests * - * * - ************************************************************************/ -static int -rngOneTest(const char *sch, - const char *filename, - const char *result, - const char *err, - int options, - xmlRelaxNGPtr schemas) { - xmlDocPtr doc; - xmlRelaxNGValidCtxtPtr ctxt; - int ret = 0; - char *temp; - FILE *schemasOutput; - - doc = xmlReadFile(filename, NULL, options); - if (doc == NULL) { - fprintf(stderr, "failed to parse instance %s for %s\n", filename, sch); - return(-1); - } - - temp = resultFilename(result, "", ".res"); - if (temp == NULL) { - fprintf(stderr, "Out of memory\n"); - fatalError(); - } - schemasOutput = fopen(temp, "wb"); - if (schemasOutput == NULL) { - fprintf(stderr, "failed to open output file %s\n", temp); - xmlFreeDoc(doc); - free(temp); - return(-1); - } - - ctxt = xmlRelaxNGNewValidCtxt(schemas); - xmlRelaxNGSetValidErrors(ctxt, - (xmlRelaxNGValidityErrorFunc) testErrorHandler, - (xmlRelaxNGValidityWarningFunc) testErrorHandler, - ctxt); - ret = xmlRelaxNGValidateDoc(ctxt, doc); - if (ret == 0) { - testErrorHandler(NULL, "%s validates\n", filename); - } else if (ret > 0) { - testErrorHandler(NULL, "%s fails to validate\n", filename); - } else { - testErrorHandler(NULL, "%s validation generated an internal error\n", - filename); - } - fclose(schemasOutput); - ret = 0; - if (result) { - if (compareFiles(temp, result)) { - fprintf(stderr, "Result for %s on %s failed\n", filename, sch); - ret = 1; - } - } - if (temp != NULL) { - unlink(temp); - free(temp); - } - - if (err != NULL) { - if (compareFileMem(err, testErrors, testErrorsSize)) { - fprintf(stderr, "Error for %s on %s failed\n", filename, sch); - ret = 1; - printf("%s", testErrors); - } - } - - - xmlRelaxNGFreeValidCtxt(ctxt); - xmlFreeDoc(doc); - return(ret); -} -/** - * rngTest: - * @filename: the schemas file - * @result: the file with expected result - * @err: the file with error messages - * - * Parse an RNG schemas and then apply it to the related .xml - * - * Returns 0 in case of success, an error code otherwise - */ -static int -rngTest(const char *filename, - const char *resul ATTRIBUTE_UNUSED, - const char *errr ATTRIBUTE_UNUSED, - int options) { - const char *base = baseFilename(filename); - const char *base2; - const char *instance; - xmlRelaxNGParserCtxtPtr ctxt; - xmlRelaxNGPtr schemas; - int res = 0, len, ret = 0; - char pattern[500]; - char prefix[500]; - char result[500]; - char err[500]; - glob_t globbuf; - size_t i; - char count = 0; - - /* first compile the schemas if possible */ - ctxt = xmlRelaxNGNewParserCtxt(filename); - xmlRelaxNGSetParserErrors(ctxt, - (xmlRelaxNGValidityErrorFunc) testErrorHandler, - (xmlRelaxNGValidityWarningFunc) testErrorHandler, - ctxt); - schemas = xmlRelaxNGParse(ctxt); - xmlRelaxNGFreeParserCtxt(ctxt); - - /* - * most of the mess is about the output filenames generated by the Makefile - */ - len = strlen(base); - if ((len > 499) || (len < 5)) { - xmlRelaxNGFree(schemas); - return(-1); - } - len -= 4; /* remove trailing .rng */ - memcpy(prefix, base, len); - prefix[len] = 0; - - snprintf(pattern, 499, "./test/relaxng/%s_?.xml", prefix); - pattern[499] = 0; - - globbuf.gl_offs = 0; - glob(pattern, GLOB_DOOFFS, NULL, &globbuf); - for (i = 0;i < globbuf.gl_pathc;i++) { - testErrorsSize = 0; - testErrors[0] = 0; - instance = globbuf.gl_pathv[i]; - base2 = baseFilename(instance); - len = strlen(base2); - if ((len > 6) && (base2[len - 6] == '_')) { - count = base2[len - 5]; - snprintf(result, 499, "result/relaxng/%s_%c", - prefix, count); - result[499] = 0; - snprintf(err, 499, "result/relaxng/%s_%c.err", - prefix, count); - err[499] = 0; - } else { - fprintf(stderr, "don't know how to process %s\n", instance); - continue; - } - if (schemas == NULL) { - } else { - nb_tests++; - ret = rngOneTest(filename, instance, result, err, - options, schemas); - if (res != 0) - ret = res; - } - } - globfree(&globbuf); - xmlRelaxNGFree(schemas); - - return(ret); -} - -#ifdef LIBXML_READER_ENABLED -/** - * rngStreamTest: - * @filename: the schemas file - * @result: the file with expected result - * @err: the file with error messages - * - * Parse a set of files with streaming, applying an RNG schemas - * - * Returns 0 in case of success, an error code otherwise - */ -static int -rngStreamTest(const char *filename, - const char *resul ATTRIBUTE_UNUSED, - const char *errr ATTRIBUTE_UNUSED, - int options) { - const char *base = baseFilename(filename); - const char *base2; - const char *instance; - int res = 0, len, ret; - char pattern[500]; - char prefix[500]; - char result[500]; - char err[500]; - glob_t globbuf; - size_t i; - char count = 0; - xmlTextReaderPtr reader; - int disable_err = 0; - - /* - * most of the mess is about the output filenames generated by the Makefile - */ - len = strlen(base); - if ((len > 499) || (len < 5)) { - fprintf(stderr, "len(base) == %d !\n", len); - return(-1); - } - len -= 4; /* remove trailing .rng */ - memcpy(prefix, base, len); - prefix[len] = 0; - - /* - * strictly unifying the error messages is nearly impossible this - * hack is also done in the Makefile - */ - if ((!strcmp(prefix, "tutor10_1")) || (!strcmp(prefix, "tutor10_2")) || - (!strcmp(prefix, "tutor3_2")) || (!strcmp(prefix, "307377")) || - (!strcmp(prefix, "tutor8_2"))) - disable_err = 1; - - snprintf(pattern, 499, "./test/relaxng/%s_?.xml", prefix); - pattern[499] = 0; - - globbuf.gl_offs = 0; - glob(pattern, GLOB_DOOFFS, NULL, &globbuf); - for (i = 0;i < globbuf.gl_pathc;i++) { - testErrorsSize = 0; - testErrors[0] = 0; - instance = globbuf.gl_pathv[i]; - base2 = baseFilename(instance); - len = strlen(base2); - if ((len > 6) && (base2[len - 6] == '_')) { - count = base2[len - 5]; - snprintf(result, 499, "result/relaxng/%s_%c", - prefix, count); - result[499] = 0; - snprintf(err, 499, "result/relaxng/%s_%c.err", - prefix, count); - err[499] = 0; - } else { - fprintf(stderr, "don't know how to process %s\n", instance); - continue; - } - reader = xmlReaderForFile(instance, NULL, options); - if (reader == NULL) { - fprintf(stderr, "Failed to build reder for %s\n", instance); - } - if (disable_err == 1) - ret = streamProcessTest(instance, result, NULL, reader, filename); - else - ret = streamProcessTest(instance, result, err, reader, filename); - xmlFreeTextReader(reader); - if (ret != 0) { - fprintf(stderr, "instance %s failed\n", instance); - res = ret; - } - } - globfree(&globbuf); - - return(res); -} -#endif /* READER */ - -#endif - -#ifdef LIBXML_PATTERN_ENABLED -#ifdef LIBXML_READER_ENABLED -/************************************************************************ - * * - * Patterns tests * - * * - ************************************************************************/ -static void patternNode(FILE *out, xmlTextReaderPtr reader, - const char *pattern, xmlPatternPtr patternc, - xmlStreamCtxtPtr patstream) { - xmlChar *path = NULL; - int match = -1; - int type, empty; - - type = xmlTextReaderNodeType(reader); - empty = xmlTextReaderIsEmptyElement(reader); - - if (type == XML_READER_TYPE_ELEMENT) { - /* do the check only on element start */ - match = xmlPatternMatch(patternc, xmlTextReaderCurrentNode(reader)); - - if (match) { - path = xmlGetNodePath(xmlTextReaderCurrentNode(reader)); - fprintf(out, "Node %s matches pattern %s\n", path, pattern); - } - } - if (patstream != NULL) { - int ret; - - if (type == XML_READER_TYPE_ELEMENT) { - ret = xmlStreamPush(patstream, - xmlTextReaderConstLocalName(reader), - xmlTextReaderConstNamespaceUri(reader)); - if (ret < 0) { - fprintf(out, "xmlStreamPush() failure\n"); - xmlFreeStreamCtxt(patstream); - patstream = NULL; - } else if (ret != match) { - if (path == NULL) { - path = xmlGetNodePath( - xmlTextReaderCurrentNode(reader)); - } - fprintf(out, - "xmlPatternMatch and xmlStreamPush disagree\n"); - fprintf(out, - " pattern %s node %s\n", - pattern, path); - } - - - } - if ((type == XML_READER_TYPE_END_ELEMENT) || - ((type == XML_READER_TYPE_ELEMENT) && (empty))) { - ret = xmlStreamPop(patstream); - if (ret < 0) { - fprintf(out, "xmlStreamPop() failure\n"); - xmlFreeStreamCtxt(patstream); - patstream = NULL; - } - } - } - if (path != NULL) - xmlFree(path); -} - -/** - * patternTest: - * @filename: the schemas file - * @result: the file with expected result - * @err: the file with error messages - * - * Parse a set of files with streaming, applying an RNG schemas - * - * Returns 0 in case of success, an error code otherwise - */ -static int -patternTest(const char *filename, - const char *resul ATTRIBUTE_UNUSED, - const char *err ATTRIBUTE_UNUSED, - int options) { - xmlPatternPtr patternc = NULL; - xmlStreamCtxtPtr patstream = NULL; - FILE *o, *f; - char str[1024]; - char xml[500]; - char result[500]; - int len, i; - int ret = 0, res; - char *temp; - xmlTextReaderPtr reader; - xmlDocPtr doc; - - len = strlen(filename); - len -= 4; - memcpy(xml, filename, len); - xml[len] = 0; - snprintf(result, 499, "result/pattern/%s", baseFilename(xml)); - result[499] = 0; - memcpy(xml + len, ".xml", 5); - - if (!checkTestFile(xml)) { - fprintf(stderr, "Missing xml file %s\n", xml); - return(-1); - } - if (!checkTestFile(result)) { - fprintf(stderr, "Missing result file %s\n", result); - return(-1); - } - f = fopen(filename, "rb"); - if (f == NULL) { - fprintf(stderr, "Failed to open %s\n", filename); - return(-1); - } - temp = resultFilename(filename, "", ".res"); - if (temp == NULL) { - fprintf(stderr, "Out of memory\n"); - fatalError(); - } - o = fopen(temp, "wb"); - if (o == NULL) { - fprintf(stderr, "failed to open output file %s\n", temp); - fclose(f); - free(temp); - return(-1); - } - while (1) { - /* - * read one line in string buffer. - */ - if (fgets (&str[0], sizeof (str) - 1, f) == NULL) - break; - - /* - * remove the ending spaces - */ - i = strlen(str); - while ((i > 0) && - ((str[i - 1] == '\n') || (str[i - 1] == '\r') || - (str[i - 1] == ' ') || (str[i - 1] == '\t'))) { - i--; - str[i] = 0; - } - doc = xmlReadFile(xml, NULL, options); - if (doc == NULL) { - fprintf(stderr, "Failed to parse %s\n", xml); - ret = 1; - } else { - xmlNodePtr root; - const xmlChar *namespaces[22]; - int j; - xmlNsPtr ns; - - root = xmlDocGetRootElement(doc); - for (ns = root->nsDef, j = 0;ns != NULL && j < 20;ns=ns->next) { - namespaces[j++] = ns->href; - namespaces[j++] = ns->prefix; - } - namespaces[j++] = NULL; - namespaces[j] = NULL; - - patternc = xmlPatterncompile((const xmlChar *) str, doc->dict, - 0, &namespaces[0]); - if (patternc == NULL) { - testErrorHandler(NULL, - "Pattern %s failed to compile\n", str); - xmlFreeDoc(doc); - ret = 1; - continue; - } - patstream = xmlPatternGetStreamCtxt(patternc); - if (patstream != NULL) { - ret = xmlStreamPush(patstream, NULL, NULL); - if (ret < 0) { - fprintf(stderr, "xmlStreamPush() failure\n"); - xmlFreeStreamCtxt(patstream); - patstream = NULL; - } - } - nb_tests++; - - reader = xmlReaderWalker(doc); - res = xmlTextReaderRead(reader); - while (res == 1) { - patternNode(o, reader, str, patternc, patstream); - res = xmlTextReaderRead(reader); - } - if (res != 0) { - fprintf(o, "%s : failed to parse\n", filename); - } - xmlFreeTextReader(reader); - xmlFreeDoc(doc); - xmlFreeStreamCtxt(patstream); - patstream = NULL; - xmlFreePattern(patternc); - - } - } - - fclose(f); - fclose(o); - - ret = compareFiles(temp, result); - if (ret) { - fprintf(stderr, "Result for %s failed\n", filename); - ret = 1; - } - if (temp != NULL) { - unlink(temp); - free(temp); - } - return(ret); -} -#endif /* READER */ -#endif /* PATTERN */ -#ifdef LIBXML_C14N_ENABLED -/************************************************************************ - * * - * Canonicalization tests * - * * - ************************************************************************/ -static xmlXPathObjectPtr -load_xpath_expr (xmlDocPtr parent_doc, const char* filename) { - xmlXPathObjectPtr xpath; - xmlDocPtr doc; - xmlChar *expr; - xmlXPathContextPtr ctx; - xmlNodePtr node; - xmlNsPtr ns; - - /* - * load XPath expr as a file - */ - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; - xmlSubstituteEntitiesDefault(1); - - doc = xmlReadFile(filename, NULL, XML_PARSE_DTDATTR | XML_PARSE_NOENT); - if (doc == NULL) { - fprintf(stderr, "Error: unable to parse file \"%s\"\n", filename); - return(NULL); - } - - /* - * Check the document is of the right kind - */ - if(xmlDocGetRootElement(doc) == NULL) { - fprintf(stderr,"Error: empty document for file \"%s\"\n", filename); - xmlFreeDoc(doc); - return(NULL); - } - - node = doc->children; - while(node != NULL && !xmlStrEqual(node->name, (const xmlChar *)"XPath")) { - node = node->next; - } - - if(node == NULL) { - fprintf(stderr,"Error: XPath element expected in the file \"%s\"\n", filename); - xmlFreeDoc(doc); - return(NULL); - } - - expr = xmlNodeGetContent(node); - if(expr == NULL) { - fprintf(stderr,"Error: XPath content element is NULL \"%s\"\n", filename); - xmlFreeDoc(doc); - return(NULL); - } - - ctx = xmlXPathNewContext(parent_doc); - if(ctx == NULL) { - fprintf(stderr,"Error: unable to create new context\n"); - xmlFree(expr); - xmlFreeDoc(doc); - return(NULL); - } - - /* - * Register namespaces - */ - ns = node->nsDef; - while(ns != NULL) { - if(xmlXPathRegisterNs(ctx, ns->prefix, ns->href) != 0) { - fprintf(stderr,"Error: unable to register NS with prefix=\"%s\" and href=\"%s\"\n", ns->prefix, ns->href); - xmlFree(expr); - xmlXPathFreeContext(ctx); - xmlFreeDoc(doc); - return(NULL); - } - ns = ns->next; - } - - /* - * Evaluate xpath - */ - xpath = xmlXPathEvalExpression(expr, ctx); - if(xpath == NULL) { - fprintf(stderr,"Error: unable to evaluate xpath expression\n"); -xmlFree(expr); - xmlXPathFreeContext(ctx); - xmlFreeDoc(doc); - return(NULL); - } - - /* print_xpath_nodes(xpath->nodesetval); */ - - xmlFree(expr); - xmlXPathFreeContext(ctx); - xmlFreeDoc(doc); - return(xpath); -} - -/* - * Macro used to grow the current buffer. - */ -#define xxx_growBufferReentrant() { \ - buffer_size *= 2; \ - buffer = (xmlChar **) \ - xmlRealloc(buffer, buffer_size * sizeof(xmlChar*)); \ - if (buffer == NULL) { \ - perror("realloc failed"); \ - return(NULL); \ - } \ -} - -static xmlChar ** -parse_list(xmlChar *str) { - xmlChar **buffer; - xmlChar **out = NULL; - int buffer_size = 0; - int len; - - if(str == NULL) { - return(NULL); - } - - len = xmlStrlen(str); - if((str[0] == '\'') && (str[len - 1] == '\'')) { - str[len - 1] = '\0'; - str++; - } - /* - * allocate an translation buffer. - */ - buffer_size = 1000; - buffer = (xmlChar **) xmlMalloc(buffer_size * sizeof(xmlChar*)); - if (buffer == NULL) { - perror("malloc failed"); - return(NULL); - } - out = buffer; - - while(*str != '\0') { - if (out - buffer > buffer_size - 10) { - int indx = out - buffer; - - xxx_growBufferReentrant(); - out = &buffer[indx]; - } - (*out++) = str; - while(*str != ',' && *str != '\0') ++str; - if(*str == ',') *(str++) = '\0'; - } - (*out) = NULL; - return buffer; -} - -static int -c14nRunTest(const char* xml_filename, int with_comments, int mode, - const char* xpath_filename, const char *ns_filename, - const char* result_file) { - xmlDocPtr doc; - xmlXPathObjectPtr xpath = NULL; - xmlChar *result = NULL; - int ret; - xmlChar **inclusive_namespaces = NULL; - const char *nslist = NULL; - int nssize; - - - /* - * build an XML tree from a the file; we need to add default - * attributes and resolve all character and entities references - */ - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; - xmlSubstituteEntitiesDefault(1); - - doc = xmlReadFile(xml_filename, NULL, XML_PARSE_DTDATTR | XML_PARSE_NOENT); - if (doc == NULL) { - fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_filename); - return(-1); - } - - /* - * Check the document is of the right kind - */ - if(xmlDocGetRootElement(doc) == NULL) { - fprintf(stderr,"Error: empty document for file \"%s\"\n", xml_filename); - xmlFreeDoc(doc); - return(-1); - } - - /* - * load xpath file if specified - */ - if(xpath_filename) { - xpath = load_xpath_expr(doc, xpath_filename); - if(xpath == NULL) { - fprintf(stderr,"Error: unable to evaluate xpath expression\n"); - xmlFreeDoc(doc); - return(-1); - } - } - - if (ns_filename != NULL) { - if (loadMem(ns_filename, &nslist, &nssize)) { - fprintf(stderr,"Error: unable to evaluate xpath expression\n"); - if(xpath != NULL) xmlXPathFreeObject(xpath); - xmlFreeDoc(doc); - return(-1); - } - inclusive_namespaces = parse_list((xmlChar *) nslist); - } - - /* - * Canonical form - */ - /* fprintf(stderr,"File \"%s\" loaded: start canonization\n", xml_filename); */ - ret = xmlC14NDocDumpMemory(doc, - (xpath) ? xpath->nodesetval : NULL, - mode, inclusive_namespaces, - with_comments, &result); - if (ret >= 0) { - if(result != NULL) { - if (compareFileMem(result_file, (const char *) result, ret)) { - fprintf(stderr, "Result mismatch for %s\n", xml_filename); - fprintf(stderr, "RESULT:\n%s\n", (const char*)result); - ret = -1; - } - } - } else { - fprintf(stderr,"Error: failed to canonicalize XML file \"%s\" (ret=%d)\n", xml_filename, ret); - ret = -1; - } - - /* - * Cleanup - */ - if (result != NULL) xmlFree(result); - if(xpath != NULL) xmlXPathFreeObject(xpath); - if (inclusive_namespaces != NULL) xmlFree(inclusive_namespaces); - if (nslist != NULL) free((char *) nslist); - xmlFreeDoc(doc); - - return(ret); -} - -static int -c14nCommonTest(const char *filename, int with_comments, int mode, - const char *subdir) { - char buf[500]; - char prefix[500]; - const char *base; - int len; - char *result = NULL; - char *xpath = NULL; - char *ns = NULL; - int ret = 0; - - base = baseFilename(filename); - len = strlen(base); - len -= 4; - memcpy(prefix, base, len); - prefix[len] = 0; - - snprintf(buf, 499, "result/c14n/%s/%s", subdir,prefix); - if (!checkTestFile(buf)) { - fprintf(stderr, "Missing result file %s", buf); - return(-1); - } - result = strdup(buf); - snprintf(buf, 499, "test/c14n/%s/%s.xpath", subdir,prefix); - if (checkTestFile(buf)) { - xpath = strdup(buf); - } - snprintf(buf, 499, "test/c14n/%s/%s.ns", subdir,prefix); - if (checkTestFile(buf)) { - ns = strdup(buf); - } - - nb_tests++; - if (c14nRunTest(filename, with_comments, mode, - xpath, ns, result) < 0) - ret = 1; - - if (result != NULL) free(result); - if (xpath != NULL) free(xpath); - if (ns != NULL) free(ns); - return(ret); -} - -static int -c14nWithCommentTest(const char *filename, - const char *resul ATTRIBUTE_UNUSED, - const char *err ATTRIBUTE_UNUSED, - int options ATTRIBUTE_UNUSED) { - return(c14nCommonTest(filename, 1, XML_C14N_1_0, "with-comments")); -} -static int -c14nWithoutCommentTest(const char *filename, - const char *resul ATTRIBUTE_UNUSED, - const char *err ATTRIBUTE_UNUSED, - int options ATTRIBUTE_UNUSED) { - return(c14nCommonTest(filename, 0, XML_C14N_1_0, "without-comments")); -} -static int -c14nExcWithoutCommentTest(const char *filename, - const char *resul ATTRIBUTE_UNUSED, - const char *err ATTRIBUTE_UNUSED, - int options ATTRIBUTE_UNUSED) { - return(c14nCommonTest(filename, 0, XML_C14N_EXCLUSIVE_1_0, "exc-without-comments")); -} -static int -c14n11WithoutCommentTest(const char *filename, - const char *resul ATTRIBUTE_UNUSED, - const char *err ATTRIBUTE_UNUSED, - int options ATTRIBUTE_UNUSED) { - return(c14nCommonTest(filename, 0, XML_C14N_1_1, "1-1-without-comments")); -} -#endif -#if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED) && defined (LIBXML_SAX1_ENABLED) -/************************************************************************ - * * - * Catalog and threads test * - * * - ************************************************************************/ - -/* - * mostly a cut and paste from testThreads.c - */ -#define MAX_ARGC 20 - -static const char *catalog = "test/threads/complex.xml"; -static const char *testfiles[] = { - "test/threads/abc.xml", - "test/threads/acb.xml", - "test/threads/bac.xml", - "test/threads/bca.xml", - "test/threads/cab.xml", - "test/threads/cba.xml", - "test/threads/invalid.xml", -}; - -static const char *Okay = "OK"; -static const char *Failed = "Failed"; - -#ifndef xmlDoValidityCheckingDefaultValue -#error xmlDoValidityCheckingDefaultValue is not a macro -#endif -#ifndef xmlGenericErrorContext -#error xmlGenericErrorContext is not a macro -#endif - -static void * -thread_specific_data(void *private_data) -{ - xmlDocPtr myDoc; - const char *filename = (const char *) private_data; - int okay = 1; - - if (!strcmp(filename, "test/threads/invalid.xml")) { - xmlDoValidityCheckingDefaultValue = 0; - xmlGenericErrorContext = stdout; - } else { - xmlDoValidityCheckingDefaultValue = 1; - xmlGenericErrorContext = stderr; - } - myDoc = xmlParseFile(filename); - if (myDoc) { - xmlFreeDoc(myDoc); - } else { - printf("parse failed\n"); - okay = 0; - } - if (!strcmp(filename, "test/threads/invalid.xml")) { - if (xmlDoValidityCheckingDefaultValue != 0) { - printf("ValidityCheckingDefaultValue override failed\n"); - okay = 0; - } - if (xmlGenericErrorContext != stdout) { - printf("xmlGenericErrorContext override failed\n"); - okay = 0; - } - } else { - if (xmlDoValidityCheckingDefaultValue != 1) { - printf("ValidityCheckingDefaultValue override failed\n"); - okay = 0; - } - if (xmlGenericErrorContext != stderr) { - printf("xmlGenericErrorContext override failed\n"); - okay = 0; - } - } - if (okay == 0) - return ((void *) Failed); - return ((void *) Okay); -} - -#if defined WIN32 -#include -#include - -#define TEST_REPEAT_COUNT 500 - -static HANDLE tid[MAX_ARGC]; - -static DWORD WINAPI -win32_thread_specific_data(void *private_data) -{ - return((DWORD) thread_specific_data(private_data)); -} - -static int -testThread(void) -{ - unsigned int i, repeat; - unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]); - DWORD results[MAX_ARGC]; - BOOL ret; - int res = 0; - - xmlInitParser(); - for (repeat = 0; repeat < TEST_REPEAT_COUNT; repeat++) { - xmlLoadCatalog(catalog); - nb_tests++; - - for (i = 0; i < num_threads; i++) { - results[i] = 0; - tid[i] = (HANDLE) - 1; - } - - for (i = 0; i < num_threads; i++) { - DWORD useless; - - tid[i] = CreateThread(NULL, 0, - win32_thread_specific_data, - (void *) testfiles[i], 0, - &useless); - if (tid[i] == NULL) { - fprintf(stderr, "CreateThread failed\n"); - return(1); - } - } - - if (WaitForMultipleObjects(num_threads, tid, TRUE, INFINITE) == - WAIT_FAILED) { - fprintf(stderr, "WaitForMultipleObjects failed\n"); - return(1); - } - - for (i = 0; i < num_threads; i++) { - ret = GetExitCodeThread(tid[i], &results[i]); - if (ret == 0) { - fprintf(stderr, "GetExitCodeThread failed\n"); - return(1); - } - CloseHandle(tid[i]); - } - - xmlCatalogCleanup(); - for (i = 0; i < num_threads; i++) { - if (results[i] != (DWORD) Okay) { - fprintf(stderr, "Thread %d handling %s failed\n", - i, testfiles[i]); - res = 1; - } - } - } - - return (res); -} - -#elif defined __BEOS__ -#include - -static thread_id tid[MAX_ARGC]; - -static int -testThread(void) -{ - unsigned int i, repeat; - unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]); - void *results[MAX_ARGC]; - status_t ret; - int res = 0; - - xmlInitParser(); - for (repeat = 0; repeat < 500; repeat++) { - xmlLoadCatalog(catalog); - for (i = 0; i < num_threads; i++) { - results[i] = NULL; - tid[i] = (thread_id) - 1; - } - for (i = 0; i < num_threads; i++) { - tid[i] = - spawn_thread(thread_specific_data, "xmlTestThread", - B_NORMAL_PRIORITY, (void *) testfiles[i]); - if (tid[i] < B_OK) { - fprintf(stderr, "beos_thread_create failed\n"); - return (1); - } - printf("beos_thread_create %d -> %d\n", i, tid[i]); - } - for (i = 0; i < num_threads; i++) { - ret = wait_for_thread(tid[i], &results[i]); - printf("beos_thread_wait %d -> %d\n", i, ret); - if (ret != B_OK) { - fprintf(stderr, "beos_thread_wait failed\n"); - return (1); - } - } - - xmlCatalogCleanup(); - ret = B_OK; - for (i = 0; i < num_threads; i++) - if (results[i] != (void *) Okay) { - printf("Thread %d handling %s failed\n", i, testfiles[i]); - ret = B_ERROR; - } - } - if (ret != B_OK) - return(1); - return (0); -} - -#elif defined HAVE_PTHREAD_H -#include - -static pthread_t tid[MAX_ARGC]; - -static int -testThread(void) -{ - unsigned int i, repeat; - unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]); - void *results[MAX_ARGC]; - int ret; - int res = 0; - - xmlInitParser(); - - for (repeat = 0; repeat < 500; repeat++) { - xmlLoadCatalog(catalog); - nb_tests++; - - for (i = 0; i < num_threads; i++) { - results[i] = NULL; - tid[i] = (pthread_t) - 1; - } - - for (i = 0; i < num_threads; i++) { - ret = pthread_create(&tid[i], 0, thread_specific_data, - (void *) testfiles[i]); - if (ret != 0) { - fprintf(stderr, "pthread_create failed\n"); - return (1); - } - } - for (i = 0; i < num_threads; i++) { - ret = pthread_join(tid[i], &results[i]); - if (ret != 0) { - fprintf(stderr, "pthread_join failed\n"); - return (1); - } - } - - xmlCatalogCleanup(); - for (i = 0; i < num_threads; i++) - if (results[i] != (void *) Okay) { - fprintf(stderr, "Thread %d handling %s failed\n", - i, testfiles[i]); - res = 1; - } - } - return (res); -} - -#else -static int -testThread(void) -{ - fprintf(stderr, - "Specific platform thread support not detected\n"); - return (-1); -} -#endif -static int -threadsTest(const char *filename ATTRIBUTE_UNUSED, - const char *resul ATTRIBUTE_UNUSED, - const char *err ATTRIBUTE_UNUSED, - int options ATTRIBUTE_UNUSED) { - return(testThread()); -} -#endif -/************************************************************************ - * * - * Tests Descriptions * - * * - ************************************************************************/ - -static -testDesc testDescriptions[] = { - { "XML regression tests" , - oldParseTest, "./test/*", "result/", "", NULL, - 0 }, - { "XML regression tests on memory" , - memParseTest, "./test/*", "result/", "", NULL, - 0 }, - { "XML entity subst regression tests" , - noentParseTest, "./test/*", "result/noent/", "", NULL, - XML_PARSE_NOENT }, - { "XML Namespaces regression tests", - errParseTest, "./test/namespaces/*", "result/namespaces/", "", ".err", - 0 }, - { "Error cases regression tests", - errParseTest, "./test/errors/*.xml", "result/errors/", "", ".err", - 0 }, -#ifdef LIBXML_READER_ENABLED - { "Error cases stream regression tests", - streamParseTest, "./test/errors/*.xml", "result/errors/", NULL, ".str", - 0 }, - { "Reader regression tests", - streamParseTest, "./test/*", "result/", ".rdr", NULL, - 0 }, - { "Reader entities substitution regression tests", - streamParseTest, "./test/*", "result/", ".rde", NULL, - XML_PARSE_NOENT }, - { "Reader on memory regression tests", - streamMemParseTest, "./test/*", "result/", ".rdr", NULL, - 0 }, - { "Walker regression tests", - walkerParseTest, "./test/*", "result/", ".rdr", NULL, - 0 }, -#endif -#ifdef LIBXML_SAX1_ENABLED - { "SAX1 callbacks regression tests" , - saxParseTest, "./test/*", "result/", ".sax", NULL, - XML_PARSE_SAX1 }, - { "SAX2 callbacks regression tests" , - saxParseTest, "./test/*", "result/", ".sax2", NULL, - 0 }, -#endif -#ifdef LIBXML_PUSH_ENABLED - { "XML push regression tests" , - pushParseTest, "./test/*", "result/", "", NULL, - 0 }, -#endif -#ifdef LIBXML_HTML_ENABLED - { "HTML regression tests" , - errParseTest, "./test/HTML/*", "result/HTML/", "", ".err", - XML_PARSE_HTML }, -#ifdef LIBXML_PUSH_ENABLED - { "Push HTML regression tests" , - pushParseTest, "./test/HTML/*", "result/HTML/", "", ".err", - XML_PARSE_HTML }, -#endif -#ifdef LIBXML_SAX1_ENABLED - { "HTML SAX regression tests" , - saxParseTest, "./test/HTML/*", "result/HTML/", ".sax", NULL, - XML_PARSE_HTML }, -#endif -#endif -#ifdef LIBXML_VALID_ENABLED - { "Valid documents regression tests" , - errParseTest, "./test/VCM/*", NULL, NULL, NULL, - XML_PARSE_DTDVALID }, - { "Validity checking regression tests" , - errParseTest, "./test/VC/*", "result/VC/", NULL, "", - XML_PARSE_DTDVALID }, - { "General documents valid regression tests" , - errParseTest, "./test/valid/*", "result/valid/", "", ".err", - XML_PARSE_DTDVALID }, -#endif -#ifdef LIBXML_XINCLUDE_ENABLED - { "XInclude regression tests" , - errParseTest, "./test/XInclude/docs/*", "result/XInclude/", "", NULL, - /* Ignore errors at this point ".err", */ - XML_PARSE_XINCLUDE }, -#ifdef LIBXML_READER_ENABLED - { "XInclude xmlReader regression tests", - streamParseTest, "./test/XInclude/docs/*", "result/XInclude/", ".rdr", - /* Ignore errors at this point ".err", */ - NULL, XML_PARSE_XINCLUDE }, -#endif - { "XInclude regression tests stripping include nodes" , - errParseTest, "./test/XInclude/docs/*", "result/XInclude/", "", NULL, - /* Ignore errors at this point ".err", */ - XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE }, -#ifdef LIBXML_READER_ENABLED - { "XInclude xmlReader regression tests stripping include nodes", - streamParseTest, "./test/XInclude/docs/*", "result/XInclude/", ".rdr", - /* Ignore errors at this point ".err", */ - NULL, XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE }, -#endif -#endif -#ifdef LIBXML_XPATH_ENABLED -#ifdef LIBXML_DEBUG_ENABLED - { "XPath expressions regression tests" , - xpathExprTest, "./test/XPath/expr/*", "result/XPath/expr/", "", NULL, - 0 }, - { "XPath document queries regression tests" , - xpathDocTest, "./test/XPath/docs/*", NULL, NULL, NULL, - 0 }, -#ifdef LIBXML_XPTR_ENABLED - { "XPointer document queries regression tests" , - xptrDocTest, "./test/XPath/docs/*", NULL, NULL, NULL, - 0 }, -#endif - { "xml:id regression tests" , - xmlidDocTest, "./test/xmlid/*", "result/xmlid/", "", ".err", - 0 }, -#endif -#endif - { "URI parsing tests" , - uriParseTest, "./test/URI/*.uri", "result/URI/", "", NULL, - 0 }, - { "URI base composition tests" , - uriBaseTest, "./test/URI/*.data", "result/URI/", "", NULL, - 0 }, - { "Path URI conversion tests" , - uriPathTest, NULL, NULL, NULL, NULL, - 0 }, -#ifdef LIBXML_SCHEMAS_ENABLED - { "Schemas regression tests" , - schemasTest, "./test/schemas/*_*.xsd", NULL, NULL, NULL, - 0 }, - { "Relax-NG regression tests" , - rngTest, "./test/relaxng/*.rng", NULL, NULL, NULL, - XML_PARSE_DTDATTR | XML_PARSE_NOENT }, -#ifdef LIBXML_READER_ENABLED - { "Relax-NG streaming regression tests" , - rngStreamTest, "./test/relaxng/*.rng", NULL, NULL, NULL, - XML_PARSE_DTDATTR | XML_PARSE_NOENT }, -#endif -#endif -#ifdef LIBXML_PATTERN_ENABLED -#ifdef LIBXML_READER_ENABLED - { "Pattern regression tests" , - patternTest, "./test/pattern/*.pat", "result/pattern/", NULL, NULL, - 0 }, -#endif -#endif -#ifdef LIBXML_C14N_ENABLED - { "C14N with comments regression tests" , - c14nWithCommentTest, "./test/c14n/with-comments/*.xml", NULL, NULL, NULL, - 0 }, - { "C14N without comments regression tests" , - c14nWithoutCommentTest, "./test/c14n/without-comments/*.xml", NULL, NULL, NULL, - 0 }, - { "C14N exclusive without comments regression tests" , - c14nExcWithoutCommentTest, "./test/c14n/exc-without-comments/*.xml", NULL, NULL, NULL, - 0 }, - { "C14N 1.1 without comments regression tests" , - c14n11WithoutCommentTest, "./test/c14n/1-1-without-comments/*.xml", NULL, NULL, NULL, - 0 }, -#endif -#if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_SAX1_ENABLED) - { "Catalog and Threads regression tests" , - threadsTest, NULL, NULL, NULL, NULL, - 0 }, -#endif - {NULL, NULL, NULL, NULL, NULL, NULL, 0} -}; - -/************************************************************************ - * * - * The main code driving the tests * - * * - ************************************************************************/ - -static int -launchTests(testDescPtr tst) { - int res = 0, err = 0; - size_t i; - char *result; - char *error; - int mem; - - if (tst == NULL) return(-1); - if (tst->in != NULL) { - glob_t globbuf; - - globbuf.gl_offs = 0; - glob(tst->in, GLOB_DOOFFS, NULL, &globbuf); - for (i = 0;i < globbuf.gl_pathc;i++) { - if (!checkTestFile(globbuf.gl_pathv[i])) - continue; - if (tst->suffix != NULL) { - result = resultFilename(globbuf.gl_pathv[i], tst->out, - tst->suffix); - if (result == NULL) { - fprintf(stderr, "Out of memory !\n"); - fatalError(); - } - } else { - result = NULL; - } - if (tst->err != NULL) { - error = resultFilename(globbuf.gl_pathv[i], tst->out, - tst->err); - if (error == NULL) { - fprintf(stderr, "Out of memory !\n"); - fatalError(); - } - } else { - error = NULL; - } - if ((result) &&(!checkTestFile(result))) { - fprintf(stderr, "Missing result file %s\n", result); - } else if ((error) &&(!checkTestFile(error))) { - fprintf(stderr, "Missing error file %s\n", error); - } else { - mem = xmlMemUsed(); - extraMemoryFromResolver = 0; - testErrorsSize = 0; - testErrors[0] = 0; - res = tst->func(globbuf.gl_pathv[i], result, error, - tst->options | XML_PARSE_COMPACT); - xmlResetLastError(); - if (res != 0) { - fprintf(stderr, "File %s generated an error\n", - globbuf.gl_pathv[i]); - nb_errors++; - err++; - } - else if (xmlMemUsed() != mem) { - if ((xmlMemUsed() != mem) && - (extraMemoryFromResolver == 0)) { - fprintf(stderr, "File %s leaked %d bytes\n", - globbuf.gl_pathv[i], xmlMemUsed() - mem); - nb_leaks++; - err++; - } - } - testErrorsSize = 0; - } - if (result) - free(result); - if (error) - free(error); - } - globfree(&globbuf); - } else { - testErrorsSize = 0; - testErrors[0] = 0; - extraMemoryFromResolver = 0; - res = tst->func(NULL, NULL, NULL, tst->options); - if (res != 0) { - nb_errors++; - err++; - } - } - return(err); -} - -static int verbose = 0; -static int tests_quiet = 0; - -static int -runtest(int i) { - int ret = 0, res; - int old_errors, old_tests, old_leaks; - - old_errors = nb_errors; - old_tests = nb_tests; - old_leaks = nb_leaks; - if ((tests_quiet == 0) && (testDescriptions[i].desc != NULL)) - printf("## %s\n", testDescriptions[i].desc); - res = launchTests(&testDescriptions[i]); - if (res != 0) - ret++; - if (verbose) { - if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) - printf("Ran %d tests, no errors\n", nb_tests - old_tests); - else - printf("Ran %d tests, %d errors, %d leaks\n", - nb_tests - old_tests, - nb_errors - old_errors, - nb_leaks - old_leaks); - } - return(ret); -} - -int -main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - int i, a, ret = 0; - int subset = 0; - - initializeLibxml2(); - - for (a = 1; a < argc;a++) { - if (!strcmp(argv[a], "-v")) - verbose = 1; - else if (!strcmp(argv[a], "-quiet")) - tests_quiet = 1; - else { - for (i = 0; testDescriptions[i].func != NULL; i++) { - if (strstr(testDescriptions[i].desc, argv[a])) { - ret += runtest(i); - subset++; - } - } - } - } - if (subset == 0) { - for (i = 0; testDescriptions[i].func != NULL; i++) { - ret += runtest(i); - } - } - if ((nb_errors == 0) && (nb_leaks == 0)) { - ret = 0; - printf("Total %d tests, no errors\n", - nb_tests); - } else { - ret = 1; - printf("Total %d tests, %d errors, %d leaks\n", - nb_tests, nb_errors, nb_leaks); - } - xmlCleanupParser(); - xmlMemoryDump(); - - return(ret); -} - -#else /* ! LIBXML_OUTPUT_ENABLED */ -int -main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - fprintf(stderr, "runtest requires output to be enabled in libxml2\n"); - return(1); -} -#endif diff --git a/lib/3rdparty/libxml2/runxmlconf.c b/lib/3rdparty/libxml2/runxmlconf.c deleted file mode 100644 index cef20f484b5..00000000000 --- a/lib/3rdparty/libxml2/runxmlconf.c +++ /dev/null @@ -1,607 +0,0 @@ -/* - * runsuite.c: C program to run libxml2 againts published testsuites - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#include "libxml.h" -#include - -#ifdef LIBXML_XPATH_ENABLED - -#if !defined(_WIN32) || defined(__CYGWIN__) -#include -#endif -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#define LOGFILE "runxmlconf.log" -static FILE *logfile = NULL; -static int verbose = 0; - -#define NB_EXPECTED_ERRORS 15 - - -const char *skipped_tests[] = { -/* http://lists.w3.org/Archives/Public/public-xml-testsuite/2008Jul/0000.html */ - "rmt-ns10-035", - NULL -}; - -/************************************************************************ - * * - * File name and path utilities * - * * - ************************************************************************/ - -static int checkTestFile(const char *filename) { - struct stat buf; - - if (stat(filename, &buf) == -1) - return(0); - -#if defined(_WIN32) && !defined(__CYGWIN__) - if (!(buf.st_mode & _S_IFREG)) - return(0); -#else - if (!S_ISREG(buf.st_mode)) - return(0); -#endif - - return(1); -} - -static xmlChar *composeDir(const xmlChar *dir, const xmlChar *path) { - char buf[500]; - - if (dir == NULL) return(xmlStrdup(path)); - if (path == NULL) return(NULL); - - snprintf(buf, 500, "%s/%s", (const char *) dir, (const char *) path); - return(xmlStrdup((const xmlChar *) buf)); -} - -/************************************************************************ - * * - * Libxml2 specific routines * - * * - ************************************************************************/ - -static int nb_skipped = 0; -static int nb_tests = 0; -static int nb_errors = 0; -static int nb_leaks = 0; - -/* - * We need to trap calls to the resolver to not account memory for the catalog - * and not rely on any external resources. - */ -static xmlParserInputPtr -testExternalEntityLoader(const char *URL, const char *ID ATTRIBUTE_UNUSED, - xmlParserCtxtPtr ctxt) { - xmlParserInputPtr ret; - - ret = xmlNewInputFromFile(ctxt, (const char *) URL); - - return(ret); -} - -/* - * Trapping the error messages at the generic level to grab the equivalent of - * stderr messages on CLI tools. - */ -static char testErrors[32769]; -static int testErrorsSize = 0; -static int nbError = 0; -static int nbFatal = 0; - -static void test_log(const char *msg, ...) { - va_list args; - if (logfile != NULL) { - fprintf(logfile, "\n------------\n"); - va_start(args, msg); - vfprintf(logfile, msg, args); - va_end(args); - fprintf(logfile, "%s", testErrors); - testErrorsSize = 0; testErrors[0] = 0; - } - if (verbose) { - va_start(args, msg); - vfprintf(stderr, msg, args); - va_end(args); - } -} - -static void -testErrorHandler(void *userData ATTRIBUTE_UNUSED, xmlErrorPtr error) { - int res; - - if (testErrorsSize >= 32768) - return; - res = snprintf(&testErrors[testErrorsSize], - 32768 - testErrorsSize, - "%s:%d: %s\n", (error->file ? error->file : "entity"), - error->line, error->message); - if (error->level == XML_ERR_FATAL) - nbFatal++; - else if (error->level == XML_ERR_ERROR) - nbError++; - if (testErrorsSize + res >= 32768) { - /* buffer is full */ - testErrorsSize = 32768; - testErrors[testErrorsSize] = 0; - } else { - testErrorsSize += res; - } - testErrors[testErrorsSize] = 0; -} - -static xmlXPathContextPtr ctxtXPath; - -static void -initializeLibxml2(void) { - xmlGetWarningsDefaultValue = 0; - xmlPedanticParserDefault(0); - - xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup); - xmlInitParser(); - xmlSetExternalEntityLoader(testExternalEntityLoader); - ctxtXPath = xmlXPathNewContext(NULL); - /* - * Deactivate the cache if created; otherwise we have to create/free it - * for every test, since it will confuse the memory leak detection. - * Note that normally this need not be done, since the cache is not - * created until set explicitely with xmlXPathContextSetCache(); - * but for test purposes it is sometimes usefull to activate the - * cache by default for the whole library. - */ - if (ctxtXPath->cache != NULL) - xmlXPathContextSetCache(ctxtXPath, 0, -1, 0); - xmlSetStructuredErrorFunc(NULL, testErrorHandler); -} - -/************************************************************************ - * * - * Run the xmlconf test if found * - * * - ************************************************************************/ - -static int -xmlconfTestInvalid(const char *id, const char *filename, int options) { - xmlDocPtr doc; - xmlParserCtxtPtr ctxt; - int ret = 1; - - ctxt = xmlNewParserCtxt(); - if (ctxt == NULL) { - test_log("test %s : %s out of memory\n", - id, filename); - return(0); - } - doc = xmlCtxtReadFile(ctxt, filename, NULL, options); - if (doc == NULL) { - test_log("test %s : %s invalid document turned not well-formed too\n", - id, filename); - } else { - /* invalidity should be reported both in the context and in the document */ - if ((ctxt->valid != 0) || (doc->properties & XML_DOC_DTDVALID)) { - test_log("test %s : %s failed to detect invalid document\n", - id, filename); - nb_errors++; - ret = 0; - } - xmlFreeDoc(doc); - } - xmlFreeParserCtxt(ctxt); - return(ret); -} - -static int -xmlconfTestValid(const char *id, const char *filename, int options) { - xmlDocPtr doc; - xmlParserCtxtPtr ctxt; - int ret = 1; - - ctxt = xmlNewParserCtxt(); - if (ctxt == NULL) { - test_log("test %s : %s out of memory\n", - id, filename); - return(0); - } - doc = xmlCtxtReadFile(ctxt, filename, NULL, options); - if (doc == NULL) { - test_log("test %s : %s failed to parse a valid document\n", - id, filename); - nb_errors++; - ret = 0; - } else { - /* validity should be reported both in the context and in the document */ - if ((ctxt->valid == 0) || ((doc->properties & XML_DOC_DTDVALID) == 0)) { - test_log("test %s : %s failed to validate a valid document\n", - id, filename); - nb_errors++; - ret = 0; - } - xmlFreeDoc(doc); - } - xmlFreeParserCtxt(ctxt); - return(ret); -} - -static int -xmlconfTestNotNSWF(const char *id, const char *filename, int options) { - xmlDocPtr doc; - int ret = 1; - - /* - * In case of Namespace errors, libxml2 will still parse the document - * but log a Namesapce error. - */ - doc = xmlReadFile(filename, NULL, options); - if (doc == NULL) { - test_log("test %s : %s failed to parse the XML\n", - id, filename); - nb_errors++; - ret = 0; - } else { - if ((xmlLastError.code == XML_ERR_OK) || - (xmlLastError.domain != XML_FROM_NAMESPACE)) { - test_log("test %s : %s failed to detect namespace error\n", - id, filename); - nb_errors++; - ret = 0; - } - xmlFreeDoc(doc); - } - return(ret); -} - -static int -xmlconfTestNotWF(const char *id, const char *filename, int options) { - xmlDocPtr doc; - int ret = 1; - - doc = xmlReadFile(filename, NULL, options); - if (doc != NULL) { - test_log("test %s : %s failed to detect not well formedness\n", - id, filename); - nb_errors++; - xmlFreeDoc(doc); - ret = 0; - } - return(ret); -} - -static int -xmlconfTestItem(xmlDocPtr doc, xmlNodePtr cur) { - int ret = -1; - xmlChar *type = NULL; - xmlChar *filename = NULL; - xmlChar *uri = NULL; - xmlChar *base = NULL; - xmlChar *id = NULL; - xmlChar *rec = NULL; - xmlChar *version = NULL; - xmlChar *entities = NULL; - xmlChar *edition = NULL; - int options = 0; - int nstest = 0; - int mem, final; - int i; - - testErrorsSize = 0; testErrors[0] = 0; - nbError = 0; - nbFatal = 0; - id = xmlGetProp(cur, BAD_CAST "ID"); - if (id == NULL) { - test_log("test missing ID, line %ld\n", xmlGetLineNo(cur)); - goto error; - } - for (i = 0;skipped_tests[i] != NULL;i++) { - if (!strcmp(skipped_tests[i], (char *) id)) { - test_log("Skipping test %s from skipped list\n", (char *) id); - ret = 0; - nb_skipped++; - goto error; - } - } - type = xmlGetProp(cur, BAD_CAST "TYPE"); - if (type == NULL) { - test_log("test %s missing TYPE\n", (char *) id); - goto error; - } - uri = xmlGetProp(cur, BAD_CAST "URI"); - if (uri == NULL) { - test_log("test %s missing URI\n", (char *) id); - goto error; - } - base = xmlNodeGetBase(doc, cur); - filename = composeDir(base, uri); - if (!checkTestFile((char *) filename)) { - test_log("test %s missing file %s \n", id, - (filename ? (char *)filename : "NULL")); - goto error; - } - - version = xmlGetProp(cur, BAD_CAST "VERSION"); - - entities = xmlGetProp(cur, BAD_CAST "ENTITIES"); - if (!xmlStrEqual(entities, BAD_CAST "none")) { - options |= XML_PARSE_DTDLOAD; - options |= XML_PARSE_NOENT; - } - rec = xmlGetProp(cur, BAD_CAST "RECOMMENDATION"); - if ((rec == NULL) || - (xmlStrEqual(rec, BAD_CAST "XML1.0")) || - (xmlStrEqual(rec, BAD_CAST "XML1.0-errata2e")) || - (xmlStrEqual(rec, BAD_CAST "XML1.0-errata3e")) || - (xmlStrEqual(rec, BAD_CAST "XML1.0-errata4e"))) { - if ((version != NULL) && (!xmlStrEqual(version, BAD_CAST "1.0"))) { - test_log("Skipping test %s for %s\n", (char *) id, - (char *) version); - ret = 0; - nb_skipped++; - goto error; - } - ret = 1; - } else if ((xmlStrEqual(rec, BAD_CAST "NS1.0")) || - (xmlStrEqual(rec, BAD_CAST "NS1.0-errata1e"))) { - ret = 1; - nstest = 1; - } else { - test_log("Skipping test %s for REC %s\n", (char *) id, (char *) rec); - ret = 0; - nb_skipped++; - goto error; - } - edition = xmlGetProp(cur, BAD_CAST "EDITION"); - if ((edition != NULL) && (xmlStrchr(edition, '5') == NULL)) { - /* test limited to all versions before 5th */ - options |= XML_PARSE_OLD10; - } - - /* - * Reset errors and check memory usage before the test - */ - xmlResetLastError(); - testErrorsSize = 0; testErrors[0] = 0; - mem = xmlMemUsed(); - - if (xmlStrEqual(type, BAD_CAST "not-wf")) { - if (nstest == 0) - xmlconfTestNotWF((char *) id, (char *) filename, options); - else - xmlconfTestNotNSWF((char *) id, (char *) filename, options); - } else if (xmlStrEqual(type, BAD_CAST "valid")) { - options |= XML_PARSE_DTDVALID; - xmlconfTestValid((char *) id, (char *) filename, options); - } else if (xmlStrEqual(type, BAD_CAST "invalid")) { - options |= XML_PARSE_DTDVALID; - xmlconfTestInvalid((char *) id, (char *) filename, options); - } else if (xmlStrEqual(type, BAD_CAST "error")) { - test_log("Skipping error test %s \n", (char *) id); - ret = 0; - nb_skipped++; - goto error; - } else { - test_log("test %s unknown TYPE value %s\n", (char *) id, (char *)type); - ret = -1; - goto error; - } - - /* - * Reset errors and check memory usage after the test - */ - xmlResetLastError(); - final = xmlMemUsed(); - if (final > mem) { - test_log("test %s : %s leaked %d bytes\n", - id, filename, final - mem); - nb_leaks++; - xmlMemDisplayLast(logfile, final - mem); - } - nb_tests++; - -error: - if (type != NULL) - xmlFree(type); - if (entities != NULL) - xmlFree(entities); - if (edition != NULL) - xmlFree(edition); - if (version != NULL) - xmlFree(version); - if (filename != NULL) - xmlFree(filename); - if (uri != NULL) - xmlFree(uri); - if (base != NULL) - xmlFree(base); - if (id != NULL) - xmlFree(id); - if (rec != NULL) - xmlFree(rec); - return(ret); -} - -static int -xmlconfTestCases(xmlDocPtr doc, xmlNodePtr cur, int level) { - xmlChar *profile; - int ret = 0; - int tests = 0; - int output = 0; - - if (level == 1) { - profile = xmlGetProp(cur, BAD_CAST "PROFILE"); - if (profile != NULL) { - output = 1; - level++; - printf("Test cases: %s\n", (char *) profile); - xmlFree(profile); - } - } - cur = cur->children; - while (cur != NULL) { - /* look only at elements we ignore everything else */ - if (cur->type == XML_ELEMENT_NODE) { - if (xmlStrEqual(cur->name, BAD_CAST "TESTCASES")) { - ret += xmlconfTestCases(doc, cur, level); - } else if (xmlStrEqual(cur->name, BAD_CAST "TEST")) { - if (xmlconfTestItem(doc, cur) >= 0) - ret++; - tests++; - } else { - fprintf(stderr, "Unhandled element %s\n", (char *)cur->name); - } - } - cur = cur->next; - } - if (output == 1) { - if (tests > 0) - printf("Test cases: %d tests\n", tests); - } - return(ret); -} - -static int -xmlconfTestSuite(xmlDocPtr doc, xmlNodePtr cur) { - xmlChar *profile; - int ret = 0; - - profile = xmlGetProp(cur, BAD_CAST "PROFILE"); - if (profile != NULL) { - printf("Test suite: %s\n", (char *) profile); - xmlFree(profile); - } else - printf("Test suite\n"); - cur = cur->children; - while (cur != NULL) { - /* look only at elements we ignore everything else */ - if (cur->type == XML_ELEMENT_NODE) { - if (xmlStrEqual(cur->name, BAD_CAST "TESTCASES")) { - ret += xmlconfTestCases(doc, cur, 1); - } else { - fprintf(stderr, "Unhandled element %s\n", (char *)cur->name); - } - } - cur = cur->next; - } - return(ret); -} - -static void -xmlconfInfo(void) { - fprintf(stderr, " you need to fetch and extract the\n"); - fprintf(stderr, " latest XML Conformance Test Suites\n"); - fprintf(stderr, " http://www.w3.org/XML/Test/xmlts20080827.tar.gz\n"); - fprintf(stderr, " see http://www.w3.org/XML/Test/ for informations\n"); -} - -static int -xmlconfTest(void) { - const char *confxml = "xmlconf/xmlconf.xml"; - xmlDocPtr doc; - xmlNodePtr cur; - int ret = 0; - - if (!checkTestFile(confxml)) { - fprintf(stderr, "%s is missing \n", confxml); - xmlconfInfo(); - return(-1); - } - doc = xmlReadFile(confxml, NULL, XML_PARSE_NOENT); - if (doc == NULL) { - fprintf(stderr, "%s is corrupted \n", confxml); - xmlconfInfo(); - return(-1); - } - - cur = xmlDocGetRootElement(doc); - if ((cur == NULL) || (!xmlStrEqual(cur->name, BAD_CAST "TESTSUITE"))) { - fprintf(stderr, "Unexpected format %s\n", confxml); - xmlconfInfo(); - ret = -1; - } else { - ret = xmlconfTestSuite(doc, cur); - } - xmlFreeDoc(doc); - return(ret); -} - -/************************************************************************ - * * - * The driver for the tests * - * * - ************************************************************************/ - -int -main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - int ret = 0; - int old_errors, old_tests, old_leaks; - - logfile = fopen(LOGFILE, "w"); - if (logfile == NULL) { - fprintf(stderr, - "Could not open the log file, running in verbose mode\n"); - verbose = 1; - } - initializeLibxml2(); - - if ((argc >= 2) && (!strcmp(argv[1], "-v"))) - verbose = 1; - - - old_errors = nb_errors; - old_tests = nb_tests; - old_leaks = nb_leaks; - xmlconfTest(); - if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) - printf("Ran %d tests, no errors\n", nb_tests - old_tests); - else - printf("Ran %d tests, %d errors, %d leaks\n", - nb_tests - old_tests, - nb_errors - old_errors, - nb_leaks - old_leaks); - if ((nb_errors == 0) && (nb_leaks == 0)) { - ret = 0; - printf("Total %d tests, no errors\n", - nb_tests); - } else { - ret = 1; - printf("Total %d tests, %d errors, %d leaks\n", - nb_tests, nb_errors, nb_leaks); - printf("See %s for detailed output\n", LOGFILE); - if ((nb_leaks == 0) && (nb_errors == NB_EXPECTED_ERRORS)) { - printf("%d errors were expected\n", nb_errors); - ret = 0; - } - } - xmlXPathFreeContext(ctxtXPath); - xmlCleanupParser(); - xmlMemoryDump(); - - if (logfile != NULL) - fclose(logfile); - return(ret); -} - -#else /* ! LIBXML_XPATH_ENABLED */ -#include -int -main(int argc, char **argv) { - fprintf(stderr, "%s need XPath support\n", argv[0]); -} -#endif diff --git a/lib/3rdparty/libxml2/testAutomata.c b/lib/3rdparty/libxml2/testAutomata.c deleted file mode 100644 index 6c4de9002e4..00000000000 --- a/lib/3rdparty/libxml2/testAutomata.c +++ /dev/null @@ -1,309 +0,0 @@ -/* - * testRegexp.c: simple module for testing regular expressions - * - * See Copyright for the status of this software. - * - * Daniel Veillard - */ - -#include "libxml.h" -#ifdef LIBXML_AUTOMATA_ENABLED -#include - -#include -#include - -static int scanNumber(char **ptr) { - int ret = 0; - char *cur; - - cur = *ptr; - while ((*cur >= '0') && (*cur <= '9')) { - ret = ret * 10 + (*cur - '0'); - cur++; - } - *ptr = cur; - return(ret); -} - -static void -testRegexpFile(const char *filename) { - FILE *input; - char expr[5000]; - int len; - int ret; - int i; - xmlAutomataPtr am; - xmlAutomataStatePtr states[1000]; - xmlRegexpPtr regexp = NULL; - xmlRegExecCtxtPtr exec = NULL; - - for (i = 0;i<1000;i++) - states[i] = NULL; - - input = fopen(filename, "r"); - if (input == NULL) { - xmlGenericError(xmlGenericErrorContext, - "Cannot open %s for reading\n", filename); - return; - } - - am = xmlNewAutomata(); - if (am == NULL) { - xmlGenericError(xmlGenericErrorContext, - "Cannot create automata\n"); - fclose(input); - return; - } - states[0] = xmlAutomataGetInitState(am); - if (states[0] == NULL) { - xmlGenericError(xmlGenericErrorContext, - "Cannot get start state\n"); - xmlFreeAutomata(am); - fclose(input); - return; - } - ret = 0; - - while (fgets(expr, 4500, input) != NULL) { - if (expr[0] == '#') - continue; - len = strlen(expr); - len--; - while ((len >= 0) && - ((expr[len] == '\n') || (expr[len] == '\t') || - (expr[len] == '\r') || (expr[len] == ' '))) len--; - expr[len + 1] = 0; - if (len >= 0) { - if ((am != NULL) && (expr[0] == 't') && (expr[1] == ' ')) { - char *ptr = &expr[2]; - int from, to; - - from = scanNumber(&ptr); - if (*ptr != ' ') { - xmlGenericError(xmlGenericErrorContext, - "Bad line %s\n", expr); - break; - } - if (states[from] == NULL) - states[from] = xmlAutomataNewState(am); - ptr++; - to = scanNumber(&ptr); - if (*ptr != ' ') { - xmlGenericError(xmlGenericErrorContext, - "Bad line %s\n", expr); - break; - } - if (states[to] == NULL) - states[to] = xmlAutomataNewState(am); - ptr++; - xmlAutomataNewTransition(am, states[from], states[to], - BAD_CAST ptr, NULL); - } else if ((am != NULL) && (expr[0] == 'e') && (expr[1] == ' ')) { - char *ptr = &expr[2]; - int from, to; - - from = scanNumber(&ptr); - if (*ptr != ' ') { - xmlGenericError(xmlGenericErrorContext, - "Bad line %s\n", expr); - break; - } - if (states[from] == NULL) - states[from] = xmlAutomataNewState(am); - ptr++; - to = scanNumber(&ptr); - if (states[to] == NULL) - states[to] = xmlAutomataNewState(am); - xmlAutomataNewEpsilon(am, states[from], states[to]); - } else if ((am != NULL) && (expr[0] == 'f') && (expr[1] == ' ')) { - char *ptr = &expr[2]; - int state; - - state = scanNumber(&ptr); - if (states[state] == NULL) { - xmlGenericError(xmlGenericErrorContext, - "Bad state %d : %s\n", state, expr); - break; - } - xmlAutomataSetFinalState(am, states[state]); - } else if ((am != NULL) && (expr[0] == 'c') && (expr[1] == ' ')) { - char *ptr = &expr[2]; - int from, to; - int min, max; - - from = scanNumber(&ptr); - if (*ptr != ' ') { - xmlGenericError(xmlGenericErrorContext, - "Bad line %s\n", expr); - break; - } - if (states[from] == NULL) - states[from] = xmlAutomataNewState(am); - ptr++; - to = scanNumber(&ptr); - if (*ptr != ' ') { - xmlGenericError(xmlGenericErrorContext, - "Bad line %s\n", expr); - break; - } - if (states[to] == NULL) - states[to] = xmlAutomataNewState(am); - ptr++; - min = scanNumber(&ptr); - if (*ptr != ' ') { - xmlGenericError(xmlGenericErrorContext, - "Bad line %s\n", expr); - break; - } - ptr++; - max = scanNumber(&ptr); - if (*ptr != ' ') { - xmlGenericError(xmlGenericErrorContext, - "Bad line %s\n", expr); - break; - } - ptr++; - xmlAutomataNewCountTrans(am, states[from], states[to], - BAD_CAST ptr, min, max, NULL); - } else if ((am != NULL) && (expr[0] == '-') && (expr[1] == '-')) { - /* end of the automata */ - regexp = xmlAutomataCompile(am); - xmlFreeAutomata(am); - am = NULL; - if (regexp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "Failed to compile the automata"); - break; - } - } else if ((expr[0] == '=') && (expr[1] == '>')) { - if (regexp == NULL) { - printf("=> failed not compiled\n"); - } else { - if (exec == NULL) - exec = xmlRegNewExecCtxt(regexp, NULL, NULL); - if (ret == 0) { - ret = xmlRegExecPushString(exec, NULL, NULL); - } - if (ret == 1) - printf("=> Passed\n"); - else if ((ret == 0) || (ret == -1)) - printf("=> Failed\n"); - else if (ret < 0) - printf("=> Error\n"); - xmlRegFreeExecCtxt(exec); - exec = NULL; - } - ret = 0; - } else if (regexp != NULL) { - if (exec == NULL) - exec = xmlRegNewExecCtxt(regexp, NULL, NULL); - ret = xmlRegExecPushString(exec, BAD_CAST expr, NULL); - } else { - xmlGenericError(xmlGenericErrorContext, - "Unexpected line %s\n", expr); - } - } - } - fclose(input); - if (regexp != NULL) - xmlRegFreeRegexp(regexp); - if (exec != NULL) - xmlRegFreeExecCtxt(exec); - if (am != NULL) - xmlFreeAutomata(am); -} - -int main(int argc, char **argv) { - - xmlInitMemory(); - - if (argc == 1) { - int ret; - xmlAutomataPtr am; - xmlAutomataStatePtr start, cur; - xmlRegexpPtr regexp; - xmlRegExecCtxtPtr exec; - - am = xmlNewAutomata(); - start = xmlAutomataGetInitState(am); - - /* generate a[ba]*a */ - cur = xmlAutomataNewTransition(am, start, NULL, BAD_CAST"a", NULL); - xmlAutomataNewTransition(am, cur, cur, BAD_CAST"b", NULL); - xmlAutomataNewTransition(am, cur, cur, BAD_CAST"a", NULL); - cur = xmlAutomataNewCountTrans(am, cur, NULL, BAD_CAST"a", 2, 3, NULL); - xmlAutomataSetFinalState(am, cur); - - /* compile it in a regexp and free the automata */ - regexp = xmlAutomataCompile(am); - xmlFreeAutomata(am); - - /* test the regexp */ - xmlRegexpPrint(stdout, regexp); - exec = xmlRegNewExecCtxt(regexp, NULL, NULL); - ret = xmlRegExecPushString(exec, BAD_CAST"a", NULL); - if (ret == 1) - printf("final\n"); - else if (ret < 0) - printf("error\n"); - ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL); - if (ret == 1) - printf("final\n"); - else if (ret < 0) - printf("error\n"); - ret =xmlRegExecPushString(exec, BAD_CAST"b", NULL); - if (ret == 1) - printf("final\n"); - else if (ret < 0) - printf("error\n"); - ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL); - if (ret == 1) - printf("final\n"); - else if (ret < 0) - printf("error\n"); - ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL); - if (ret == 1) - printf("final\n"); - else if (ret < 0) - printf("error\n"); - ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL); - if (ret == 1) - printf("final\n"); - else if (ret < 0) - printf("error\n"); - ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL); - if (ret == 1) - printf("final\n"); - else if (ret < 0) - printf("error\n"); - if (ret == 0) { - ret = xmlRegExecPushString(exec, NULL, NULL); - if (ret == 1) - printf("final\n"); - else if (ret < 0) - printf("error\n"); - } - xmlRegFreeExecCtxt(exec); - - /* free the regexp */ - xmlRegFreeRegexp(regexp); - } else { - int i; - - for (i = 1;i < argc;i++) - testRegexpFile(argv[i]); - } - - xmlCleanupParser(); - xmlMemoryDump(); - return(0); -} - -#else -#include -int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - printf("%s : Automata support not compiled in\n", argv[0]); - return(0); -} -#endif /* LIBXML_AUTOMATA_ENABLED */ diff --git a/lib/3rdparty/libxml2/testC14N.c b/lib/3rdparty/libxml2/testC14N.c deleted file mode 100644 index 86e58f27e40..00000000000 --- a/lib/3rdparty/libxml2/testC14N.c +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Canonical XML implementation test program - * (http://www.w3.org/TR/2001/REC-xml-c14n-20010315) - * - * See Copyright for the status of this software. - * - * Author: Aleksey Sanin - */ -#include "libxml.h" -#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - -#include -#include -#ifndef STDOUT_FILENO -#ifdef HAVE_UNISTD_H -#include -#else -#define STDOUT_FILENO fileno(stdout) -#endif /* HAVE_UNISTD_H */ -#endif -#ifdef HAVE_STDLIB_H -#include -#endif - -#include -#include -#include -#include - -#include - - -static void usage(const char *name) { - fprintf(stderr, - "Usage: %s [] []\n", - name); - fprintf(stderr, "where is one of following:\n"); - fprintf(stderr, - "--with-comments \t XML file canonicalization v1.0 w comments \n"); - fprintf(stderr, - "--without-comments \t XML file canonicalization v1.0 w/o comments\n"); - fprintf(stderr, - "--1-1-with-comments \t XML file canonicalization v1.1 w comments\n"); - fprintf(stderr, - "--1-1-without-comments \t XML file canonicalization v1.1 w/o comments\n"); - fprintf(stderr, - "--exc-with-comments \t Exclusive XML file canonicalization v1.0 w comments\n"); - fprintf(stderr, - "--exc-without-comments\t Exclusive XML file canonicalization v1.0 w/o comments\n"); -} - -static xmlXPathObjectPtr -load_xpath_expr (xmlDocPtr parent_doc, const char* filename); - -static xmlChar **parse_list(xmlChar *str); - -/* static void print_xpath_nodes(xmlNodeSetPtr nodes); */ - -static int -test_c14n(const char* xml_filename, int with_comments, int mode, - const char* xpath_filename, xmlChar **inclusive_namespaces) { - xmlDocPtr doc; - xmlXPathObjectPtr xpath = NULL; - xmlChar *result = NULL; - int ret; - - /* - * build an XML tree from a the file; we need to add default - * attributes and resolve all character and entities references - */ - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; - xmlSubstituteEntitiesDefault(1); - - doc = xmlReadFile(xml_filename, NULL, XML_PARSE_DTDATTR | XML_PARSE_NOENT); - if (doc == NULL) { - fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_filename); - return(-1); - } - - /* - * Check the document is of the right kind - */ - if(xmlDocGetRootElement(doc) == NULL) { - fprintf(stderr,"Error: empty document for file \"%s\"\n", xml_filename); - xmlFreeDoc(doc); - return(-1); - } - - /* - * load xpath file if specified - */ - if(xpath_filename) { - xpath = load_xpath_expr(doc, xpath_filename); - if(xpath == NULL) { - fprintf(stderr,"Error: unable to evaluate xpath expression\n"); - xmlFreeDoc(doc); - return(-1); - } - } - - /* - * Canonical form - */ - /* fprintf(stderr,"File \"%s\" loaded: start canonization\n", xml_filename); */ - ret = xmlC14NDocDumpMemory(doc, - (xpath) ? xpath->nodesetval : NULL, - mode, inclusive_namespaces, - with_comments, &result); - if(ret >= 0) { - if(result != NULL) { - if (write(STDOUT_FILENO, result, ret) == -1) { - fprintf(stderr, "Can't write data\n"); - } - xmlFree(result); - } - } else { - fprintf(stderr,"Error: failed to canonicalize XML file \"%s\" (ret=%d)\n", xml_filename, ret); - if(result != NULL) xmlFree(result); - xmlFreeDoc(doc); - return(-1); - } - - /* - * Cleanup - */ - if(xpath != NULL) xmlXPathFreeObject(xpath); - xmlFreeDoc(doc); - - return(ret); -} - -int main(int argc, char **argv) { - int ret = -1; - - /* - * Init libxml - */ - xmlInitParser(); - LIBXML_TEST_VERSION - - /* - * Parse command line and process file - */ - if( argc < 3 ) { - fprintf(stderr, "Error: wrong number of arguments.\n"); - usage(argv[0]); - } else if(strcmp(argv[1], "--with-comments") == 0) { - ret = test_c14n(argv[2], 1, XML_C14N_1_0, (argc > 3) ? argv[3] : NULL, NULL); - } else if(strcmp(argv[1], "--without-comments") == 0) { - ret = test_c14n(argv[2], 0, XML_C14N_1_0, (argc > 3) ? argv[3] : NULL, NULL); - } else if(strcmp(argv[1], "--1-1-with-comments") == 0) { - ret = test_c14n(argv[2], 1, XML_C14N_1_1, (argc > 3) ? argv[3] : NULL, NULL); - } else if(strcmp(argv[1], "--1-1-without-comments") == 0) { - ret = test_c14n(argv[2], 0, XML_C14N_1_1, (argc > 3) ? argv[3] : NULL, NULL); - } else if(strcmp(argv[1], "--exc-with-comments") == 0) { - xmlChar **list; - - /* load exclusive namespace from command line */ - list = (argc > 4) ? parse_list((xmlChar *)argv[4]) : NULL; - ret = test_c14n(argv[2], 1, XML_C14N_EXCLUSIVE_1_0, (argc > 3) ? argv[3] : NULL, list); - if(list != NULL) xmlFree(list); - } else if(strcmp(argv[1], "--exc-without-comments") == 0) { - xmlChar **list; - - /* load exclusive namespace from command line */ - list = (argc > 4) ? parse_list((xmlChar *)argv[4]) : NULL; - ret = test_c14n(argv[2], 0, XML_C14N_EXCLUSIVE_1_0, (argc > 3) ? argv[3] : NULL, list); - if(list != NULL) xmlFree(list); - } else { - fprintf(stderr, "Error: bad option.\n"); - usage(argv[0]); - } - - /* - * Shutdown libxml - */ - xmlCleanupParser(); - xmlMemoryDump(); - - return((ret >= 0) ? 0 : 1); -} - -/* - * Macro used to grow the current buffer. - */ -#define growBufferReentrant() { \ - buffer_size *= 2; \ - buffer = (xmlChar **) \ - xmlRealloc(buffer, buffer_size * sizeof(xmlChar*)); \ - if (buffer == NULL) { \ - perror("realloc failed"); \ - return(NULL); \ - } \ -} - -static xmlChar ** -parse_list(xmlChar *str) { - xmlChar **buffer; - xmlChar **out = NULL; - int buffer_size = 0; - int len; - - if(str == NULL) { - return(NULL); - } - - len = xmlStrlen(str); - if((str[0] == '\'') && (str[len - 1] == '\'')) { - str[len - 1] = '\0'; - str++; - } - /* - * allocate an translation buffer. - */ - buffer_size = 1000; - buffer = (xmlChar **) xmlMalloc(buffer_size * sizeof(xmlChar*)); - if (buffer == NULL) { - perror("malloc failed"); - return(NULL); - } - out = buffer; - - while(*str != '\0') { - if (out - buffer > buffer_size - 10) { - int indx = out - buffer; - - growBufferReentrant(); - out = &buffer[indx]; - } - (*out++) = str; - while(*str != ',' && *str != '\0') ++str; - if(*str == ',') *(str++) = '\0'; - } - (*out) = NULL; - return buffer; -} - -static xmlXPathObjectPtr -load_xpath_expr (xmlDocPtr parent_doc, const char* filename) { - xmlXPathObjectPtr xpath; - xmlDocPtr doc; - xmlChar *expr; - xmlXPathContextPtr ctx; - xmlNodePtr node; - xmlNsPtr ns; - - /* - * load XPath expr as a file - */ - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; - xmlSubstituteEntitiesDefault(1); - - doc = xmlReadFile(filename, NULL, XML_PARSE_DTDATTR | XML_PARSE_NOENT); - if (doc == NULL) { - fprintf(stderr, "Error: unable to parse file \"%s\"\n", filename); - return(NULL); - } - - /* - * Check the document is of the right kind - */ - if(xmlDocGetRootElement(doc) == NULL) { - fprintf(stderr,"Error: empty document for file \"%s\"\n", filename); - xmlFreeDoc(doc); - return(NULL); - } - - node = doc->children; - while(node != NULL && !xmlStrEqual(node->name, (const xmlChar *)"XPath")) { - node = node->next; - } - - if(node == NULL) { - fprintf(stderr,"Error: XPath element expected in the file \"%s\"\n", filename); - xmlFreeDoc(doc); - return(NULL); - } - - expr = xmlNodeGetContent(node); - if(expr == NULL) { - fprintf(stderr,"Error: XPath content element is NULL \"%s\"\n", filename); - xmlFreeDoc(doc); - return(NULL); - } - - ctx = xmlXPathNewContext(parent_doc); - if(ctx == NULL) { - fprintf(stderr,"Error: unable to create new context\n"); - xmlFree(expr); - xmlFreeDoc(doc); - return(NULL); - } - - /* - * Register namespaces - */ - ns = node->nsDef; - while(ns != NULL) { - if(xmlXPathRegisterNs(ctx, ns->prefix, ns->href) != 0) { - fprintf(stderr,"Error: unable to register NS with prefix=\"%s\" and href=\"%s\"\n", ns->prefix, ns->href); - xmlFree(expr); - xmlXPathFreeContext(ctx); - xmlFreeDoc(doc); - return(NULL); - } - ns = ns->next; - } - - /* - * Evaluate xpath - */ - xpath = xmlXPathEvalExpression(expr, ctx); - if(xpath == NULL) { - fprintf(stderr,"Error: unable to evaluate xpath expression\n"); - xmlFree(expr); - xmlXPathFreeContext(ctx); - xmlFreeDoc(doc); - return(NULL); - } - - /* print_xpath_nodes(xpath->nodesetval); */ - - xmlFree(expr); - xmlXPathFreeContext(ctx); - xmlFreeDoc(doc); - return(xpath); -} - -/* -static void -print_xpath_nodes(xmlNodeSetPtr nodes) { - xmlNodePtr cur; - int i; - - if(nodes == NULL ){ - fprintf(stderr, "Error: no nodes set defined\n"); - return; - } - - fprintf(stderr, "Nodes Set:\n-----\n"); - for(i = 0; i < nodes->nodeNr; ++i) { - if(nodes->nodeTab[i]->type == XML_NAMESPACE_DECL) { - xmlNsPtr ns; - - ns = (xmlNsPtr)nodes->nodeTab[i]; - cur = (xmlNodePtr)ns->next; - fprintf(stderr, "namespace \"%s\"=\"%s\" for node %s:%s\n", - ns->prefix, ns->href, - (cur->ns) ? cur->ns->prefix : BAD_CAST "", cur->name); - } else if(nodes->nodeTab[i]->type == XML_ELEMENT_NODE) { - cur = nodes->nodeTab[i]; - fprintf(stderr, "element node \"%s:%s\"\n", - (cur->ns) ? cur->ns->prefix : BAD_CAST "", cur->name); - } else { - cur = nodes->nodeTab[i]; - fprintf(stderr, "node \"%s\": type %d\n", cur->name, cur->type); - } - } -} -*/ - -#else -#include -int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - printf("%s : XPath/Canonicalization and output support not compiled in\n", argv[0]); - return(0); -} -#endif /* LIBXML_C14N_ENABLED */ - - diff --git a/lib/3rdparty/libxml2/testHTML.c b/lib/3rdparty/libxml2/testHTML.c deleted file mode 100644 index 9b42778c80d..00000000000 --- a/lib/3rdparty/libxml2/testHTML.c +++ /dev/null @@ -1,880 +0,0 @@ -/* - * testHTML.c : a small tester program for HTML input. - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#include "libxml.h" - -#ifdef LIBXML_HTML_ENABLED - -#include -#include - - -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif - -#include -#include -#include -#include -#include -#include - -#ifdef LIBXML_DEBUG_ENABLED -static int debug = 0; -#endif -static int copy = 0; -static int sax = 0; -static int repeat = 0; -static int noout = 0; -#ifdef LIBXML_PUSH_ENABLED -static int push = 0; -#endif /* LIBXML_PUSH_ENABLED */ -static char *encoding = NULL; -static int options = 0; - -static xmlSAXHandler emptySAXHandlerStruct = { - NULL, /* internalSubset */ - NULL, /* isStandalone */ - NULL, /* hasInternalSubset */ - NULL, /* hasExternalSubset */ - NULL, /* resolveEntity */ - NULL, /* getEntity */ - NULL, /* entityDecl */ - NULL, /* notationDecl */ - NULL, /* attributeDecl */ - NULL, /* elementDecl */ - NULL, /* unparsedEntityDecl */ - NULL, /* setDocumentLocator */ - NULL, /* startDocument */ - NULL, /* endDocument */ - NULL, /* startElement */ - NULL, /* endElement */ - NULL, /* reference */ - NULL, /* characters */ - NULL, /* ignorableWhitespace */ - NULL, /* processingInstruction */ - NULL, /* comment */ - NULL, /* xmlParserWarning */ - NULL, /* xmlParserError */ - NULL, /* xmlParserError */ - NULL, /* getParameterEntity */ - NULL, /* cdataBlock */ - NULL, /* externalSubset */ - 1, /* initialized */ - NULL, /* private */ - NULL, /* startElementNsSAX2Func */ - NULL, /* endElementNsSAX2Func */ - NULL /* xmlStructuredErrorFunc */ -}; - -static xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct; -extern xmlSAXHandlerPtr debugSAXHandler; - -/************************************************************************ - * * - * Debug Handlers * - * * - ************************************************************************/ - -/** - * isStandaloneDebug: - * @ctxt: An XML parser context - * - * Is this document tagged standalone ? - * - * Returns 1 if true - */ -static int -isStandaloneDebug(void *ctx ATTRIBUTE_UNUSED) -{ - fprintf(stdout, "SAX.isStandalone()\n"); - return(0); -} - -/** - * hasInternalSubsetDebug: - * @ctxt: An XML parser context - * - * Does this document has an internal subset - * - * Returns 1 if true - */ -static int -hasInternalSubsetDebug(void *ctx ATTRIBUTE_UNUSED) -{ - fprintf(stdout, "SAX.hasInternalSubset()\n"); - return(0); -} - -/** - * hasExternalSubsetDebug: - * @ctxt: An XML parser context - * - * Does this document has an external subset - * - * Returns 1 if true - */ -static int -hasExternalSubsetDebug(void *ctx ATTRIBUTE_UNUSED) -{ - fprintf(stdout, "SAX.hasExternalSubset()\n"); - return(0); -} - -/** - * hasInternalSubsetDebug: - * @ctxt: An XML parser context - * - * Does this document has an internal subset - */ -static void -internalSubsetDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, - const xmlChar *ExternalID, const xmlChar *SystemID) -{ - fprintf(stdout, "SAX.internalSubset(%s,", name); - if (ExternalID == NULL) - fprintf(stdout, " ,"); - else - fprintf(stdout, " %s,", ExternalID); - if (SystemID == NULL) - fprintf(stdout, " )\n"); - else - fprintf(stdout, " %s)\n", SystemID); -} - -/** - * resolveEntityDebug: - * @ctxt: An XML parser context - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * Special entity resolver, better left to the parser, it has - * more context than the application layer. - * The default behaviour is to NOT resolve the entities, in that case - * the ENTITY_REF nodes are built in the structure (and the parameter - * values). - * - * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. - */ -static xmlParserInputPtr -resolveEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *publicId, const xmlChar *systemId) -{ - /* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */ - - - fprintf(stdout, "SAX.resolveEntity("); - if (publicId != NULL) - fprintf(stdout, "%s", (char *)publicId); - else - fprintf(stdout, " "); - if (systemId != NULL) - fprintf(stdout, ", %s)\n", (char *)systemId); - else - fprintf(stdout, ", )\n"); -/********* - if (systemId != NULL) { - return(xmlNewInputFromFile(ctxt, (char *) systemId)); - } - *********/ - return(NULL); -} - -/** - * getEntityDebug: - * @ctxt: An XML parser context - * @name: The entity name - * - * Get an entity by name - * - * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. - */ -static xmlEntityPtr -getEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name) -{ - fprintf(stdout, "SAX.getEntity(%s)\n", name); - return(NULL); -} - -/** - * getParameterEntityDebug: - * @ctxt: An XML parser context - * @name: The entity name - * - * Get a parameter entity by name - * - * Returns the xmlParserInputPtr - */ -static xmlEntityPtr -getParameterEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name) -{ - fprintf(stdout, "SAX.getParameterEntity(%s)\n", name); - return(NULL); -} - - -/** - * entityDeclDebug: - * @ctxt: An XML parser context - * @name: the entity name - * @type: the entity type - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @content: the entity value (without processing). - * - * An entity definition has been parsed - */ -static void -entityDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, int type, - const xmlChar *publicId, const xmlChar *systemId, xmlChar *content) -{ - fprintf(stdout, "SAX.entityDecl(%s, %d, %s, %s, %s)\n", - name, type, publicId, systemId, content); -} - -/** - * attributeDeclDebug: - * @ctxt: An XML parser context - * @name: the attribute name - * @type: the attribute type - * - * An attribute definition has been parsed - */ -static void -attributeDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *elem, const xmlChar *name, - int type, int def, const xmlChar *defaultValue, - xmlEnumerationPtr tree ATTRIBUTE_UNUSED) -{ - fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, %s, ...)\n", - elem, name, type, def, defaultValue); -} - -/** - * elementDeclDebug: - * @ctxt: An XML parser context - * @name: the element name - * @type: the element type - * @content: the element value (without processing). - * - * An element definition has been parsed - */ -static void -elementDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, int type, - xmlElementContentPtr content ATTRIBUTE_UNUSED) -{ - fprintf(stdout, "SAX.elementDecl(%s, %d, ...)\n", - name, type); -} - -/** - * notationDeclDebug: - * @ctxt: An XML parser context - * @name: The name of the notation - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * What to do when a notation declaration has been parsed. - */ -static void -notationDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, - const xmlChar *publicId, const xmlChar *systemId) -{ - fprintf(stdout, "SAX.notationDecl(%s, %s, %s)\n", - (char *) name, (char *) publicId, (char *) systemId); -} - -/** - * unparsedEntityDeclDebug: - * @ctxt: An XML parser context - * @name: The name of the entity - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @notationName: the name of the notation - * - * What to do when an unparsed entity declaration is parsed - */ -static void -unparsedEntityDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, - const xmlChar *publicId, const xmlChar *systemId, - const xmlChar *notationName) -{ - fprintf(stdout, "SAX.unparsedEntityDecl(%s, %s, %s, %s)\n", - (char *) name, (char *) publicId, (char *) systemId, - (char *) notationName); -} - -/** - * setDocumentLocatorDebug: - * @ctxt: An XML parser context - * @loc: A SAX Locator - * - * Receive the document locator at startup, actually xmlDefaultSAXLocator - * Everything is available on the context, so this is useless in our case. - */ -static void -setDocumentLocatorDebug(void *ctx ATTRIBUTE_UNUSED, xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED) -{ - fprintf(stdout, "SAX.setDocumentLocator()\n"); -} - -/** - * startDocumentDebug: - * @ctxt: An XML parser context - * - * called when the document start being processed. - */ -static void -startDocumentDebug(void *ctx ATTRIBUTE_UNUSED) -{ - fprintf(stdout, "SAX.startDocument()\n"); -} - -/** - * endDocumentDebug: - * @ctxt: An XML parser context - * - * called when the document end has been detected. - */ -static void -endDocumentDebug(void *ctx ATTRIBUTE_UNUSED) -{ - fprintf(stdout, "SAX.endDocument()\n"); -} - -/** - * startElementDebug: - * @ctxt: An XML parser context - * @name: The element name - * - * called when an opening tag has been processed. - */ -static void -startElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar **atts) -{ - int i; - - fprintf(stdout, "SAX.startElement(%s", (char *) name); - if (atts != NULL) { - for (i = 0;(atts[i] != NULL);i++) { - fprintf(stdout, ", %s", atts[i++]); - if (atts[i] != NULL) { - unsigned char output[40]; - const unsigned char *att = atts[i]; - int outlen, attlen; - fprintf(stdout, "='"); - while ((attlen = strlen((char*)att)) > 0) { - outlen = sizeof output - 1; - htmlEncodeEntities(output, &outlen, att, &attlen, '\''); - output[outlen] = 0; - fprintf(stdout, "%s", (char *) output); - att += attlen; - } - fprintf(stdout, "'"); - } - } - } - fprintf(stdout, ")\n"); -} - -/** - * endElementDebug: - * @ctxt: An XML parser context - * @name: The element name - * - * called when the end of an element has been detected. - */ -static void -endElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name) -{ - fprintf(stdout, "SAX.endElement(%s)\n", (char *) name); -} - -/** - * charactersDebug: - * @ctxt: An XML parser context - * @ch: a xmlChar string - * @len: the number of xmlChar - * - * receiving some chars from the parser. - * Question: how much at a time ??? - */ -static void -charactersDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len) -{ - unsigned char output[40]; - int inlen = len, outlen = 30; - - htmlEncodeEntities(output, &outlen, ch, &inlen, 0); - output[outlen] = 0; - - fprintf(stdout, "SAX.characters(%s, %d)\n", output, len); -} - -/** - * cdataDebug: - * @ctxt: An XML parser context - * @ch: a xmlChar string - * @len: the number of xmlChar - * - * receiving some cdata chars from the parser. - * Question: how much at a time ??? - */ -static void -cdataDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len) -{ - unsigned char output[40]; - int inlen = len, outlen = 30; - - htmlEncodeEntities(output, &outlen, ch, &inlen, 0); - output[outlen] = 0; - - fprintf(stdout, "SAX.cdata(%s, %d)\n", output, len); -} - -/** - * referenceDebug: - * @ctxt: An XML parser context - * @name: The entity name - * - * called when an entity reference is detected. - */ -static void -referenceDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name) -{ - fprintf(stdout, "SAX.reference(%s)\n", name); -} - -/** - * ignorableWhitespaceDebug: - * @ctxt: An XML parser context - * @ch: a xmlChar string - * @start: the first char in the string - * @len: the number of xmlChar - * - * receiving some ignorable whitespaces from the parser. - * Question: how much at a time ??? - */ -static void -ignorableWhitespaceDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len) -{ - char output[40]; - int i; - - for (i = 0;(i 0) { - ctxt = htmlCreatePushParserCtxt(emptySAXHandler, NULL, - chars, res, filename, XML_CHAR_ENCODING_NONE); - while ((res = fread(chars, 1, size, f)) > 0) { - htmlParseChunk(ctxt, chars, res, 0); - } - htmlParseChunk(ctxt, chars, 0, 1); - doc = ctxt->myDoc; - htmlFreeParserCtxt(ctxt); - } - if (doc != NULL) { - fprintf(stdout, "htmlSAXParseFile returned non-NULL\n"); - xmlFreeDoc(doc); - } - fclose(f); - } - if (!noout) { -#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - f = fopen(filename, "rb"); -#else - f = fopen(filename, "r"); -#endif - if (f != NULL) { - int res, size = 3; - char chars[4096]; - htmlParserCtxtPtr ctxt; - - /* if (repeat) */ - size = 4096; - res = fread(chars, 1, 4, f); - if (res > 0) { - ctxt = htmlCreatePushParserCtxt(debugSAXHandler, NULL, - chars, res, filename, XML_CHAR_ENCODING_NONE); - while ((res = fread(chars, 1, size, f)) > 0) { - htmlParseChunk(ctxt, chars, res, 0); - } - htmlParseChunk(ctxt, chars, 0, 1); - doc = ctxt->myDoc; - htmlFreeParserCtxt(ctxt); - } - if (doc != NULL) { - fprintf(stdout, "htmlSAXParseFile returned non-NULL\n"); - xmlFreeDoc(doc); - } - fclose(f); - } - } - } else { -#endif /* LIBXML_PUSH_ENABLED */ - doc = htmlSAXParseFile(filename, NULL, emptySAXHandler, NULL); - if (doc != NULL) { - fprintf(stdout, "htmlSAXParseFile returned non-NULL\n"); - xmlFreeDoc(doc); - } - - if (!noout) { - /* - * Debug callback - */ - doc = htmlSAXParseFile(filename, NULL, debugSAXHandler, NULL); - if (doc != NULL) { - fprintf(stdout, "htmlSAXParseFile returned non-NULL\n"); - xmlFreeDoc(doc); - } - } -#ifdef LIBXML_PUSH_ENABLED - } -#endif /* LIBXML_PUSH_ENABLED */ -} - -static void -parseAndPrintFile(char *filename) { - htmlDocPtr doc = NULL; - - /* - * build an HTML tree from a string; - */ -#ifdef LIBXML_PUSH_ENABLED - if (push) { - FILE *f; - -#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - f = fopen(filename, "rb"); -#else - f = fopen(filename, "r"); -#endif - if (f != NULL) { - int res, size = 3; - char chars[4096]; - htmlParserCtxtPtr ctxt; - - /* if (repeat) */ - size = 4096; - res = fread(chars, 1, 4, f); - if (res > 0) { - ctxt = htmlCreatePushParserCtxt(NULL, NULL, - chars, res, filename, XML_CHAR_ENCODING_NONE); - while ((res = fread(chars, 1, size, f)) > 0) { - htmlParseChunk(ctxt, chars, res, 0); - } - htmlParseChunk(ctxt, chars, 0, 1); - doc = ctxt->myDoc; - htmlFreeParserCtxt(ctxt); - } - fclose(f); - } - } else { - doc = htmlReadFile(filename, NULL, options); - } -#else - doc = htmlReadFile(filename,NULL,options); -#endif - if (doc == NULL) { - xmlGenericError(xmlGenericErrorContext, - "Could not parse %s\n", filename); - } - -#ifdef LIBXML_TREE_ENABLED - /* - * test intermediate copy if needed. - */ - if (copy) { - htmlDocPtr tmp; - - tmp = doc; - doc = xmlCopyDoc(doc, 1); - xmlFreeDoc(tmp); - } -#endif - -#ifdef LIBXML_OUTPUT_ENABLED - /* - * print it. - */ - if (!noout) { -#ifdef LIBXML_DEBUG_ENABLED - if (!debug) { - if (encoding) - htmlSaveFileEnc("-", doc, encoding); - else - htmlDocDump(stdout, doc); - } else - xmlDebugDumpDocument(stdout, doc); -#else - if (encoding) - htmlSaveFileEnc("-", doc, encoding); - else - htmlDocDump(stdout, doc); -#endif - } -#endif /* LIBXML_OUTPUT_ENABLED */ - - /* - * free it. - */ - xmlFreeDoc(doc); -} - -int main(int argc, char **argv) { - int i, count; - int files = 0; - - for (i = 1; i < argc ; i++) { -#ifdef LIBXML_DEBUG_ENABLED - if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) - debug++; - else -#endif - if ((!strcmp(argv[i], "-copy")) || (!strcmp(argv[i], "--copy"))) - copy++; -#ifdef LIBXML_PUSH_ENABLED - else if ((!strcmp(argv[i], "-push")) || (!strcmp(argv[i], "--push"))) - push++; -#endif /* LIBXML_PUSH_ENABLED */ - else if ((!strcmp(argv[i], "-sax")) || (!strcmp(argv[i], "--sax"))) - sax++; - else if ((!strcmp(argv[i], "-noout")) || (!strcmp(argv[i], "--noout"))) - noout++; - else if ((!strcmp(argv[i], "-repeat")) || - (!strcmp(argv[i], "--repeat"))) - repeat++; - else if ((!strcmp(argv[i], "-encode")) || - (!strcmp(argv[i], "--encode"))) { - i++; - encoding = argv[i]; - } - } - for (i = 1; i < argc ; i++) { - if ((!strcmp(argv[i], "-encode")) || - (!strcmp(argv[i], "--encode"))) { - i++; - continue; - } - if (argv[i][0] != '-') { - if (repeat) { - for (count = 0;count < 100 * repeat;count++) { - if (sax) - parseSAXFile(argv[i]); - else - parseAndPrintFile(argv[i]); - } - } else { - if (sax) - parseSAXFile(argv[i]); - else - parseAndPrintFile(argv[i]); - } - files ++; - } - } - if (files == 0) { - printf("Usage : %s [--debug] [--copy] [--copy] HTMLfiles ...\n", - argv[0]); - printf("\tParse the HTML files and output the result of the parsing\n"); -#ifdef LIBXML_DEBUG_ENABLED - printf("\t--debug : dump a debug tree of the in-memory document\n"); -#endif - printf("\t--copy : used to test the internal copy implementation\n"); - printf("\t--sax : debug the sequence of SAX callbacks\n"); - printf("\t--repeat : parse the file 100 times, for timing\n"); - printf("\t--noout : do not print the result\n"); -#ifdef LIBXML_PUSH_ENABLED - printf("\t--push : use the push mode parser\n"); -#endif /* LIBXML_PUSH_ENABLED */ - printf("\t--encode encoding : output in the given encoding\n"); - } - xmlCleanupParser(); - xmlMemoryDump(); - - return(0); -} -#else /* !LIBXML_HTML_ENABLED */ -#include -int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - printf("%s : HTML support not compiled in\n", argv[0]); - return(0); -} -#endif diff --git a/lib/3rdparty/libxml2/testModule.c b/lib/3rdparty/libxml2/testModule.c deleted file mode 100644 index e399f5c040d..00000000000 --- a/lib/3rdparty/libxml2/testModule.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * testModule.c : a small tester program for xmlModule - * - * See Copyright for the status of this software. - * - * joelwreed@comcast.net - */ - -#include "libxml.h" -#ifdef LIBXML_MODULES_ENABLED -#include - -#include -#include -#include -#include - -#include -#include -#include - -#ifdef _WIN32 -#define MODULE_PATH "." -#include /* for _MAX_PATH */ -#ifndef __MINGW32__ -#define PATH_MAX _MAX_PATH -#endif -#else -#define MODULE_PATH ".libs" -#endif - -/* Used for SCO Openserver*/ -#ifndef PATH_MAX -#ifdef _POSIX_PATH_MAX -#define PATH_MAX _POSIX_PATH_MAX -#else -#define PATH_MAX 4096 -#endif -#endif - -typedef int (*hello_world_t)(void); - -int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - xmlChar filename[PATH_MAX]; - xmlModulePtr module = NULL; - hello_world_t hello_world = NULL; - - /* build the module filename, and confirm the module exists */ - xmlStrPrintf(filename, sizeof(filename), - (const xmlChar*) "%s/testdso%s", - (const xmlChar*)MODULE_PATH, - (const xmlChar*)LIBXML_MODULE_EXTENSION); - - module = xmlModuleOpen((const char*)filename, 0); - if (module) - { - if (xmlModuleSymbol(module, "hello_world", (void **) &hello_world)) { - fprintf(stderr, "Failure to lookup\n"); - return(1); - } - if (hello_world == NULL) { - fprintf(stderr, "Lookup returned NULL\n"); - return(1); - } - - (*hello_world)(); - - xmlModuleClose(module); - } - - xmlMemoryDump(); - - return(0); -} - -#else -#include -int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - printf("%s : Module support not compiled in\n", argv[0]); - return(0); -} -#endif /* LIBXML_SCHEMAS_ENABLED */ diff --git a/lib/3rdparty/libxml2/testReader.c b/lib/3rdparty/libxml2/testReader.c deleted file mode 100644 index 8f8e26d5b74..00000000000 --- a/lib/3rdparty/libxml2/testReader.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * testSAX.c : a small tester program for parsing using the SAX API. - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#include "libxml.h" - -#ifdef LIBXML_READER_ENABLED -#include -#include - -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_STRING_H -#include -#endif - - -#include - -static int debug = 0; -static int dump = 0; -static int noent = 0; -static int count = 0; -static int valid = 0; -static int consumed = 0; - -static void usage(const char *progname) { - printf("Usage : %s [options] XMLfiles ...\n", progname); - printf("\tParse the XML files using the xmlTextReader API\n"); - printf("\t --count: count the number of attribute and elements\n"); - printf("\t --valid: validate the document\n"); - printf("\t --consumed: count the number of bytes consumed\n"); - exit(1); -} -static int elem, attrs; - -static void processNode(xmlTextReaderPtr reader) { - int type; - - type = xmlTextReaderNodeType(reader); - if (count) { - if (type == 1) { - elem++; - attrs += xmlTextReaderAttributeCount(reader); - } - } -} - -static void handleFile(const char *filename) { - xmlTextReaderPtr reader; - int ret; - - if (count) { - elem = 0; - attrs = 0; - } - - reader = xmlNewTextReaderFilename(filename); - if (reader != NULL) { - if (valid) - xmlTextReaderSetParserProp(reader, XML_PARSER_VALIDATE, 1); - - /* - * Process all nodes in sequence - */ - ret = xmlTextReaderRead(reader); - while (ret == 1) { - processNode(reader); - ret = xmlTextReaderRead(reader); - } - - /* - * Done, cleanup and status - */ - if (consumed) - printf("%ld bytes consumed by parser\n", xmlTextReaderByteConsumed(reader)); - xmlFreeTextReader(reader); - if (ret != 0) { - printf("%s : failed to parse\n", filename); - } else if (count) - printf("%s : %d elements, %d attributes\n", filename, elem, attrs); - } else { - fprintf(stderr, "Unable to open %s\n", filename); - } -} - -int main(int argc, char **argv) { - int i; - int files = 0; - - if (argc <= 1) { - usage(argv[0]); - return(1); - } - LIBXML_TEST_VERSION - for (i = 1; i < argc ; i++) { - if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) - debug++; - else if ((!strcmp(argv[i], "-dump")) || (!strcmp(argv[i], "--dump"))) - dump++; - else if ((!strcmp(argv[i], "-count")) || (!strcmp(argv[i], "--count"))) - count++; - else if ((!strcmp(argv[i], "-consumed")) || (!strcmp(argv[i], "--consumed"))) - consumed++; - else if ((!strcmp(argv[i], "-valid")) || (!strcmp(argv[i], "--valid"))) - valid++; - else if ((!strcmp(argv[i], "-noent")) || - (!strcmp(argv[i], "--noent"))) - noent++; - } - if (noent != 0) xmlSubstituteEntitiesDefault(1); - for (i = 1; i < argc ; i++) { - if (argv[i][0] != '-') { - handleFile(argv[i]); - files ++; - } - } - xmlCleanupParser(); - xmlMemoryDump(); - - return(0); -} -#else -int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - printf("%s : xmlReader parser support not compiled in\n", argv[0]); - return(0); -} -#endif /* LIBXML_READER_ENABLED */ diff --git a/lib/3rdparty/libxml2/testRegexp.c b/lib/3rdparty/libxml2/testRegexp.c deleted file mode 100644 index 21dac945bc2..00000000000 --- a/lib/3rdparty/libxml2/testRegexp.c +++ /dev/null @@ -1,402 +0,0 @@ -/* - * testRegexp.c: simple module for testing regular expressions - * - * See Copyright for the status of this software. - * - * Daniel Veillard - */ - -#include "libxml.h" -#ifdef LIBXML_REGEXP_ENABLED -#include - -#include -#include - -static int repeat = 0; -static int debug = 0; - -static void testRegexp(xmlRegexpPtr comp, const char *value) { - int ret; - - ret = xmlRegexpExec(comp, (const xmlChar *) value); - if (ret == 1) - printf("%s: Ok\n", value); - else if (ret == 0) - printf("%s: Fail\n", value); - else - printf("%s: Error: %d\n", value, ret); - if (repeat) { - int j; - for (j = 0;j < 999999;j++) - xmlRegexpExec(comp, (const xmlChar *) value); - } -} - -static void -testRegexpFile(const char *filename) { - xmlRegexpPtr comp = NULL; - FILE *input; - char expression[5000]; - int len; - - input = fopen(filename, "r"); - if (input == NULL) { - xmlGenericError(xmlGenericErrorContext, - "Cannot open %s for reading\n", filename); - return; - } - while (fgets(expression, 4500, input) != NULL) { - len = strlen(expression); - len--; - while ((len >= 0) && - ((expression[len] == '\n') || (expression[len] == '\t') || - (expression[len] == '\r') || (expression[len] == ' '))) len--; - expression[len + 1] = 0; - if (len >= 0) { - if (expression[0] == '#') - continue; - if ((expression[0] == '=') && (expression[1] == '>')) { - char *pattern = &expression[2]; - - if (comp != NULL) { - xmlRegFreeRegexp(comp); - comp = NULL; - } - printf("Regexp: %s\n", pattern) ; - comp = xmlRegexpCompile((const xmlChar *) pattern); - if (comp == NULL) { - printf(" failed to compile\n"); - break; - } - } else if (comp == NULL) { - printf("Regexp: %s\n", expression) ; - comp = xmlRegexpCompile((const xmlChar *) expression); - if (comp == NULL) { - printf(" failed to compile\n"); - break; - } - } else if (comp != NULL) { - testRegexp(comp, expression); - } - } - } - fclose(input); - if (comp != NULL) - xmlRegFreeRegexp(comp); -} - -#ifdef LIBXML_EXPR_ENABLED -static void -runFileTest(xmlExpCtxtPtr ctxt, const char *filename) { - xmlExpNodePtr expr = NULL, sub; - FILE *input; - char expression[5000]; - int len; - - input = fopen(filename, "r"); - if (input == NULL) { - xmlGenericError(xmlGenericErrorContext, - "Cannot open %s for reading\n", filename); - return; - } - while (fgets(expression, 4500, input) != NULL) { - len = strlen(expression); - len--; - while ((len >= 0) && - ((expression[len] == '\n') || (expression[len] == '\t') || - (expression[len] == '\r') || (expression[len] == ' '))) len--; - expression[len + 1] = 0; - if (len >= 0) { - if (expression[0] == '#') - continue; - if ((expression[0] == '=') && (expression[1] == '>')) { - char *str = &expression[2]; - - if (expr != NULL) { - xmlExpFree(ctxt, expr); - if (xmlExpCtxtNbNodes(ctxt) != 0) - printf(" Parse/free of Expression leaked %d\n", - xmlExpCtxtNbNodes(ctxt)); - expr = NULL; - } - printf("Expression: %s\n", str) ; - expr = xmlExpParse(ctxt, str); - if (expr == NULL) { - printf(" parsing Failed\n"); - break; - } - } else if (expr != NULL) { - int expect = -1; - int nodes1, nodes2; - - if (expression[0] == '0') - expect = 0; - if (expression[0] == '1') - expect = 1; - printf("Subexp: %s", expression + 2) ; - nodes1 = xmlExpCtxtNbNodes(ctxt); - sub = xmlExpParse(ctxt, expression + 2); - if (sub == NULL) { - printf(" parsing Failed\n"); - break; - } else { - int ret; - - nodes2 = xmlExpCtxtNbNodes(ctxt); - ret = xmlExpSubsume(ctxt, expr, sub); - - if ((expect == 1) && (ret == 1)) { - printf(" => accept, Ok\n"); - } else if ((expect == 0) && (ret == 0)) { - printf(" => reject, Ok\n"); - } else if ((expect == 1) && (ret == 0)) { - printf(" => reject, Failed\n"); - } else if ((expect == 0) && (ret == 1)) { - printf(" => accept, Failed\n"); - } else { - printf(" => fail internally\n"); - } - if (xmlExpCtxtNbNodes(ctxt) > nodes2) { - printf(" Subsume leaked %d\n", - xmlExpCtxtNbNodes(ctxt) - nodes2); - nodes1 += xmlExpCtxtNbNodes(ctxt) - nodes2; - } - xmlExpFree(ctxt, sub); - if (xmlExpCtxtNbNodes(ctxt) > nodes1) { - printf(" Parse/free leaked %d\n", - xmlExpCtxtNbNodes(ctxt) - nodes1); - } - } - - } - } - } - if (expr != NULL) { - xmlExpFree(ctxt, expr); - if (xmlExpCtxtNbNodes(ctxt) != 0) - printf(" Parse/free of Expression leaked %d\n", - xmlExpCtxtNbNodes(ctxt)); - } - fclose(input); -} - -static void -testReduce(xmlExpCtxtPtr ctxt, xmlExpNodePtr expr, const char *tst) { - xmlBufferPtr xmlExpBuf; - xmlExpNodePtr sub, deriv; - xmlExpBuf = xmlBufferCreate(); - - sub = xmlExpParse(ctxt, tst); - if (sub == NULL) { - printf("Subset %s failed to parse\n", tst); - return; - } - xmlExpDump(xmlExpBuf, sub); - printf("Subset parsed as: %s\n", - (const char *) xmlBufferContent(xmlExpBuf)); - deriv = xmlExpExpDerive(ctxt, expr, sub); - if (deriv == NULL) { - printf("Derivation led to an internal error, report this !\n"); - return; - } else { - xmlBufferEmpty(xmlExpBuf); - xmlExpDump(xmlExpBuf, deriv); - if (xmlExpIsNillable(deriv)) - printf("Resulting nillable derivation: %s\n", - (const char *) xmlBufferContent(xmlExpBuf)); - else - printf("Resulting derivation: %s\n", - (const char *) xmlBufferContent(xmlExpBuf)); - xmlExpFree(ctxt, deriv); - } - xmlExpFree(ctxt, sub); -} - -static void -exprDebug(xmlExpCtxtPtr ctxt, xmlExpNodePtr expr) { - xmlBufferPtr xmlExpBuf; - xmlExpNodePtr deriv; - const char *list[40]; - int ret; - - xmlExpBuf = xmlBufferCreate(); - - if (expr == NULL) { - printf("Failed to parse\n"); - return; - } - xmlExpDump(xmlExpBuf, expr); - printf("Parsed as: %s\n", (const char *) xmlBufferContent(xmlExpBuf)); - printf("Max token input = %d\n", xmlExpMaxToken(expr)); - if (xmlExpIsNillable(expr) == 1) - printf("Is nillable\n"); - ret = xmlExpGetLanguage(ctxt, expr, (const xmlChar **) &list[0], 40); - if (ret < 0) - printf("Failed to get list: %d\n", ret); - else { - int i; - - printf("Language has %d strings, testing string derivations\n", ret); - for (i = 0;i < ret;i++) { - deriv = xmlExpStringDerive(ctxt, expr, BAD_CAST list[i], -1); - if (deriv == NULL) { - printf(" %s -> derivation failed\n", list[i]); - } else { - xmlBufferEmpty(xmlExpBuf); - xmlExpDump(xmlExpBuf, deriv); - printf(" %s -> %s\n", list[i], - (const char *) xmlBufferContent(xmlExpBuf)); - } - xmlExpFree(ctxt, deriv); - } - } - xmlBufferFree(xmlExpBuf); -} -#endif - -static void usage(const char *name) { - fprintf(stderr, "Usage: %s [flags]\n", name); - fprintf(stderr, "Testing tool for libxml2 string and pattern regexps\n"); - fprintf(stderr, " --debug: switch on debugging\n"); - fprintf(stderr, " --repeat: loop on the operation\n"); -#ifdef LIBXML_EXPR_ENABLED - fprintf(stderr, " --expr: test xmlExp and not xmlRegexp\n"); -#endif - fprintf(stderr, " --input filename: use the given filename for regexp\n"); - fprintf(stderr, " --input filename: use the given filename for exp\n"); -} - -int main(int argc, char **argv) { - xmlRegexpPtr comp = NULL; -#ifdef LIBXML_EXPR_ENABLED - xmlExpNodePtr expr = NULL; - int use_exp = 0; - xmlExpCtxtPtr ctxt = NULL; -#endif - const char *pattern = NULL; - char *filename = NULL; - int i; - - xmlInitMemory(); - - if (argc <= 1) { - usage(argv[0]); - return(1); - } - for (i = 1; i < argc ; i++) { - if (!strcmp(argv[i], "-")) - break; - - if (argv[i][0] != '-') - continue; - if (!strcmp(argv[i], "--")) - break; - - if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) { - debug++; - } else if ((!strcmp(argv[i], "-repeat")) || - (!strcmp(argv[i], "--repeat"))) { - repeat++; -#ifdef LIBXML_EXPR_ENABLED - } else if ((!strcmp(argv[i], "-expr")) || - (!strcmp(argv[i], "--expr"))) { - use_exp++; -#endif - } else if ((!strcmp(argv[i], "-i")) || (!strcmp(argv[i], "-f")) || - (!strcmp(argv[i], "--input"))) - filename = argv[++i]; - else { - fprintf(stderr, "Unknown option %s\n", argv[i]); - usage(argv[0]); - } - } - -#ifdef LIBXML_EXPR_ENABLED - if (use_exp) - ctxt = xmlExpNewCtxt(0, NULL); -#endif - - if (filename != NULL) { -#ifdef LIBXML_EXPR_ENABLED - if (use_exp) - runFileTest(ctxt, filename); - else -#endif - testRegexpFile(filename); - } else { - int data = 0; -#ifdef LIBXML_EXPR_ENABLED - - if (use_exp) { - for (i = 1; i < argc ; i++) { - if (strcmp(argv[i], "--") == 0) - data = 1; - else if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0) || - (data == 1)) { - if (pattern == NULL) { - pattern = argv[i]; - printf("Testing expr %s:\n", pattern); - expr = xmlExpParse(ctxt, pattern); - if (expr == NULL) { - printf(" failed to compile\n"); - break; - } - if (debug) { - exprDebug(ctxt, expr); - } - } else { - testReduce(ctxt, expr, argv[i]); - } - } - } - if (expr != NULL) { - xmlExpFree(ctxt, expr); - expr = NULL; - } - } else -#endif - { - for (i = 1; i < argc ; i++) { - if (strcmp(argv[i], "--") == 0) - data = 1; - else if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0) || - (data == 1)) { - if (pattern == NULL) { - pattern = argv[i]; - printf("Testing %s:\n", pattern); - comp = xmlRegexpCompile((const xmlChar *) pattern); - if (comp == NULL) { - printf(" failed to compile\n"); - break; - } - if (debug) - xmlRegexpPrint(stdout, comp); - } else { - testRegexp(comp, argv[i]); - } - } - } - if (comp != NULL) - xmlRegFreeRegexp(comp); - } - } -#ifdef LIBXML_EXPR_ENABLED - if (ctxt != NULL) { - printf("Ops: %d nodes, %d cons\n", - xmlExpCtxtNbNodes(ctxt), xmlExpCtxtNbCons(ctxt)); - xmlExpFreeCtxt(ctxt); - } -#endif - xmlCleanupParser(); - xmlMemoryDump(); - return(0); -} - -#else -#include -int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - printf("%s : Regexp support not compiled in\n", argv[0]); - return(0); -} -#endif /* LIBXML_REGEXP_ENABLED */ diff --git a/lib/3rdparty/libxml2/testRelax.c b/lib/3rdparty/libxml2/testRelax.c deleted file mode 100644 index 8e94a7a8194..00000000000 --- a/lib/3rdparty/libxml2/testRelax.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * testRelax.c : a small tester program for RelaxNG validation - * - * See Copyright for the status of this software. - * - * Daniel.Veillard@w3.org - */ - -#include "libxml.h" -#ifdef LIBXML_SCHEMAS_ENABLED - -#include -#include - -#include -#include -#include - - -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_SYS_MMAN_H -#include -/* seems needed for Solaris */ -#ifndef MAP_FAILED -#define MAP_FAILED ((void *) -1) -#endif -#endif - -#include -#include -#include - -#ifdef LIBXML_DEBUG_ENABLED -static int debug = 0; -#endif -static int noout = 0; -static int tree = 0; -#ifdef HAVE_MMAP -static int memory = 0; -#endif - - -int main(int argc, char **argv) { - int i; - int files = 0; - xmlRelaxNGPtr schema = NULL; - - for (i = 1; i < argc ; i++) { -#ifdef LIBXML_DEBUG_ENABLED - if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) - debug++; - else -#endif -#ifdef HAVE_MMAP - if ((!strcmp(argv[i], "-memory")) || (!strcmp(argv[i], "--memory"))) { - memory++; - } else -#endif - if ((!strcmp(argv[i], "-noout")) || (!strcmp(argv[i], "--noout"))) { - noout++; - } else - if ((!strcmp(argv[i], "-tree")) || (!strcmp(argv[i], "--tree"))) { - tree++; - } - } - xmlLineNumbersDefault(1); - xmlSubstituteEntitiesDefault(1); - for (i = 1; i < argc ; i++) { - if (argv[i][0] != '-') { - if (schema == NULL) { - xmlRelaxNGParserCtxtPtr ctxt; - -#ifdef HAVE_MMAP - if (memory) { - int fd; - struct stat info; - const char *base; - if (stat(argv[i], &info) < 0) - break; - if ((fd = open(argv[i], O_RDONLY)) < 0) - break; - base = mmap(NULL, info.st_size, PROT_READ, - MAP_SHARED, fd, 0) ; - if (base == (void *) MAP_FAILED) - break; - - ctxt = xmlRelaxNGNewMemParserCtxt((char *)base,info.st_size); - - xmlRelaxNGSetParserErrors(ctxt, - (xmlRelaxNGValidityErrorFunc) fprintf, - (xmlRelaxNGValidityWarningFunc) fprintf, - stderr); - schema = xmlRelaxNGParse(ctxt); - xmlRelaxNGFreeParserCtxt(ctxt); - munmap((char *) base, info.st_size); - } else -#endif - { - ctxt = xmlRelaxNGNewParserCtxt(argv[i]); - xmlRelaxNGSetParserErrors(ctxt, - (xmlRelaxNGValidityErrorFunc) fprintf, - (xmlRelaxNGValidityWarningFunc) fprintf, - stderr); - schema = xmlRelaxNGParse(ctxt); - xmlRelaxNGFreeParserCtxt(ctxt); - } - if (schema == NULL) { - printf("Relax-NG schema %s failed to compile\n", argv[i]); - files = -1; - break; - } -#ifdef LIBXML_OUTPUT_ENABLED -#ifdef LIBXML_DEBUG_ENABLED - if (debug) - xmlRelaxNGDump(stdout, schema); -#endif - if (tree) - xmlRelaxNGDumpTree(stdout, schema); -#endif /* LIBXML_OUTPUT_ENABLED */ - } else { - xmlDocPtr doc; - - doc = xmlReadFile(argv[i],NULL,0); - - if (doc == NULL) { - fprintf(stderr, "Could not parse %s\n", argv[i]); - } else { - xmlRelaxNGValidCtxtPtr ctxt; - int ret; - - ctxt = xmlRelaxNGNewValidCtxt(schema); - xmlRelaxNGSetValidErrors(ctxt, - (xmlRelaxNGValidityErrorFunc) fprintf, - (xmlRelaxNGValidityWarningFunc) fprintf, - stderr); - ret = xmlRelaxNGValidateDoc(ctxt, doc); - if (ret == 0) { - printf("%s validates\n", argv[i]); - } else if (ret > 0) { - printf("%s fails to validate\n", argv[i]); - } else { - printf("%s validation generated an internal error\n", - argv[i]); - } - xmlRelaxNGFreeValidCtxt(ctxt); - xmlFreeDoc(doc); - } - } - files ++; - } - } - if (schema != NULL) - xmlRelaxNGFree(schema); - if (files == 0) { - printf("Usage : %s [--debug] [--noout] schemas XMLfiles ...\n", - argv[0]); - printf("\tParse the HTML files and output the result of the parsing\n"); -#ifdef LIBXML_DEBUG_ENABLED - printf("\t--debug : dump a debug tree of the in-memory document\n"); -#endif - printf("\t--noout : do not print the result\n"); - printf("\t--tree : print the intermediate Relax-NG document tree\n"); -#ifdef HAVE_MMAP - printf("\t--memory : test the schemas in memory parsing\n"); -#endif - } - xmlRelaxNGCleanupTypes(); - xmlCleanupParser(); - xmlMemoryDump(); - - return(0); -} - -#else -#include -int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - printf("%s : RelaxNG support not compiled in\n", argv[0]); - return(0); -} -#endif /* LIBXML_SCHEMAS_ENABLED */ diff --git a/lib/3rdparty/libxml2/testSAX.c b/lib/3rdparty/libxml2/testSAX.c deleted file mode 100644 index 81c4b93d62e..00000000000 --- a/lib/3rdparty/libxml2/testSAX.c +++ /dev/null @@ -1,1198 +0,0 @@ -/* - * testSAX.c : a small tester program for parsing using the SAX API. - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#include "libxml.h" - -#ifdef HAVE_SYS_TIME_H -#include -#endif -#ifdef HAVE_SYS_TIMEB_H -#include -#endif -#ifdef HAVE_TIME_H -#include -#endif - -#ifdef LIBXML_SAX1_ENABLED -#include -#include - -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_STRING_H -#include -#endif - - -#include -#include -#include -#include /* only for xmlNewInputFromFile() */ -#include -#include -#include - -static int debug = 0; -static int copy = 0; -static int recovery = 0; -static int push = 0; -static int speed = 0; -static int noent = 0; -static int quiet = 0; -static int nonull = 0; -static int sax2 = 0; -static int repeat = 0; -static int callbacks = 0; -static int timing = 0; - -/* - * Timing routines. - */ -/* - * Internal timing routines to remove the necessity to have unix-specific - * function calls - */ - -#ifndef HAVE_GETTIMEOFDAY -#ifdef HAVE_SYS_TIMEB_H -#ifdef HAVE_SYS_TIME_H -#ifdef HAVE_FTIME - -static int -my_gettimeofday(struct timeval *tvp, void *tzp) -{ - struct timeb timebuffer; - - ftime(&timebuffer); - if (tvp) { - tvp->tv_sec = timebuffer.time; - tvp->tv_usec = timebuffer.millitm * 1000L; - } - return (0); -} -#define HAVE_GETTIMEOFDAY 1 -#define gettimeofday my_gettimeofday - -#endif /* HAVE_FTIME */ -#endif /* HAVE_SYS_TIME_H */ -#endif /* HAVE_SYS_TIMEB_H */ -#endif /* !HAVE_GETTIMEOFDAY */ - -#if defined(HAVE_GETTIMEOFDAY) -static struct timeval begin, end; - -/* - * startTimer: call where you want to start timing - */ -static void -startTimer(void) -{ - gettimeofday(&begin, NULL); -} - -/* - * endTimer: call where you want to stop timing and to print out a - * message about the timing performed; format is a printf - * type argument - */ -static void XMLCDECL -endTimer(const char *fmt, ...) -{ - long msec; - va_list ap; - - gettimeofday(&end, NULL); - msec = end.tv_sec - begin.tv_sec; - msec *= 1000; - msec += (end.tv_usec - begin.tv_usec) / 1000; - -#ifndef HAVE_STDARG_H -#error "endTimer required stdarg functions" -#endif - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - - fprintf(stderr, " took %ld ms\n", msec); -} -#elif defined(HAVE_TIME_H) -/* - * No gettimeofday function, so we have to make do with calling clock. - * This is obviously less accurate, but there's little we can do about - * that. - */ -#ifndef CLOCKS_PER_SEC -#define CLOCKS_PER_SEC 100 -#endif - -static clock_t begin, end; -static void -startTimer(void) -{ - begin = clock(); -} -static void XMLCDECL -endTimer(const char *fmt, ...) -{ - long msec; - va_list ap; - - end = clock(); - msec = ((end - begin) * 1000) / CLOCKS_PER_SEC; - -#ifndef HAVE_STDARG_H -#error "endTimer required stdarg functions" -#endif - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fprintf(stderr, " took %ld ms\n", msec); -} -#else - -/* - * We don't have a gettimeofday or time.h, so we just don't do timing - */ -static void -startTimer(void) -{ - /* - * Do nothing - */ -} -static void XMLCDECL -endTimer(char *format, ...) -{ - /* - * We cannot do anything because we don't have a timing function - */ -#ifdef HAVE_STDARG_H - va_start(ap, format); - vfprintf(stderr, format, ap); - va_end(ap); - fprintf(stderr, " was not timed\n", msec); -#else - /* We don't have gettimeofday, time or stdarg.h, what crazy world is - * this ?! - */ -#endif -} -#endif - -/* - * empty SAX block - */ -static xmlSAXHandler emptySAXHandlerStruct = { - NULL, /* internalSubset */ - NULL, /* isStandalone */ - NULL, /* hasInternalSubset */ - NULL, /* hasExternalSubset */ - NULL, /* resolveEntity */ - NULL, /* getEntity */ - NULL, /* entityDecl */ - NULL, /* notationDecl */ - NULL, /* attributeDecl */ - NULL, /* elementDecl */ - NULL, /* unparsedEntityDecl */ - NULL, /* setDocumentLocator */ - NULL, /* startDocument */ - NULL, /* endDocument */ - NULL, /* startElement */ - NULL, /* endElement */ - NULL, /* reference */ - NULL, /* characters */ - NULL, /* ignorableWhitespace */ - NULL, /* processingInstruction */ - NULL, /* comment */ - NULL, /* xmlParserWarning */ - NULL, /* xmlParserError */ - NULL, /* xmlParserError */ - NULL, /* getParameterEntity */ - NULL, /* cdataBlock; */ - NULL, /* externalSubset; */ - 1, - NULL, - NULL, /* startElementNs */ - NULL, /* endElementNs */ - NULL /* xmlStructuredErrorFunc */ -}; - -static xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct; -extern xmlSAXHandlerPtr debugSAXHandler; - -/************************************************************************ - * * - * Debug Handlers * - * * - ************************************************************************/ - -/** - * isStandaloneDebug: - * @ctxt: An XML parser context - * - * Is this document tagged standalone ? - * - * Returns 1 if true - */ -static int -isStandaloneDebug(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - if (quiet) - return(0); - fprintf(stdout, "SAX.isStandalone()\n"); - return(0); -} - -/** - * hasInternalSubsetDebug: - * @ctxt: An XML parser context - * - * Does this document has an internal subset - * - * Returns 1 if true - */ -static int -hasInternalSubsetDebug(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - if (quiet) - return(0); - fprintf(stdout, "SAX.hasInternalSubset()\n"); - return(0); -} - -/** - * hasExternalSubsetDebug: - * @ctxt: An XML parser context - * - * Does this document has an external subset - * - * Returns 1 if true - */ -static int -hasExternalSubsetDebug(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - if (quiet) - return(0); - fprintf(stdout, "SAX.hasExternalSubset()\n"); - return(0); -} - -/** - * internalSubsetDebug: - * @ctxt: An XML parser context - * - * Does this document has an internal subset - */ -static void -internalSubsetDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, - const xmlChar *ExternalID, const xmlChar *SystemID) -{ - callbacks++; - if (quiet) - return; - fprintf(stdout, "SAX.internalSubset(%s,", name); - if (ExternalID == NULL) - fprintf(stdout, " ,"); - else - fprintf(stdout, " %s,", ExternalID); - if (SystemID == NULL) - fprintf(stdout, " )\n"); - else - fprintf(stdout, " %s)\n", SystemID); -} - -/** - * externalSubsetDebug: - * @ctxt: An XML parser context - * - * Does this document has an external subset - */ -static void -externalSubsetDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, - const xmlChar *ExternalID, const xmlChar *SystemID) -{ - callbacks++; - if (quiet) - return; - fprintf(stdout, "SAX.externalSubset(%s,", name); - if (ExternalID == NULL) - fprintf(stdout, " ,"); - else - fprintf(stdout, " %s,", ExternalID); - if (SystemID == NULL) - fprintf(stdout, " )\n"); - else - fprintf(stdout, " %s)\n", SystemID); -} - -/** - * resolveEntityDebug: - * @ctxt: An XML parser context - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * Special entity resolver, better left to the parser, it has - * more context than the application layer. - * The default behaviour is to NOT resolve the entities, in that case - * the ENTITY_REF nodes are built in the structure (and the parameter - * values). - * - * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. - */ -static xmlParserInputPtr -resolveEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *publicId, const xmlChar *systemId) -{ - callbacks++; - if (quiet) - return(NULL); - /* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */ - - - fprintf(stdout, "SAX.resolveEntity("); - if (publicId != NULL) - fprintf(stdout, "%s", (char *)publicId); - else - fprintf(stdout, " "); - if (systemId != NULL) - fprintf(stdout, ", %s)\n", (char *)systemId); - else - fprintf(stdout, ", )\n"); -/********* - if (systemId != NULL) { - return(xmlNewInputFromFile(ctxt, (char *) systemId)); - } - *********/ - return(NULL); -} - -/** - * getEntityDebug: - * @ctxt: An XML parser context - * @name: The entity name - * - * Get an entity by name - * - * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. - */ -static xmlEntityPtr -getEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name) -{ - callbacks++; - if (quiet) - return(NULL); - fprintf(stdout, "SAX.getEntity(%s)\n", name); - return(NULL); -} - -/** - * getParameterEntityDebug: - * @ctxt: An XML parser context - * @name: The entity name - * - * Get a parameter entity by name - * - * Returns the xmlParserInputPtr - */ -static xmlEntityPtr -getParameterEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name) -{ - callbacks++; - if (quiet) - return(NULL); - fprintf(stdout, "SAX.getParameterEntity(%s)\n", name); - return(NULL); -} - - -/** - * entityDeclDebug: - * @ctxt: An XML parser context - * @name: the entity name - * @type: the entity type - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @content: the entity value (without processing). - * - * An entity definition has been parsed - */ -static void -entityDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, int type, - const xmlChar *publicId, const xmlChar *systemId, xmlChar *content) -{ -const xmlChar *nullstr = BAD_CAST "(null)"; - /* not all libraries handle printing null pointers nicely */ - if (publicId == NULL) - publicId = nullstr; - if (systemId == NULL) - systemId = nullstr; - if (content == NULL) - content = (xmlChar *)nullstr; - callbacks++; - if (quiet) - return; - fprintf(stdout, "SAX.entityDecl(%s, %d, %s, %s, %s)\n", - name, type, publicId, systemId, content); -} - -/** - * attributeDeclDebug: - * @ctxt: An XML parser context - * @name: the attribute name - * @type: the attribute type - * - * An attribute definition has been parsed - */ -static void -attributeDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar * elem, - const xmlChar * name, int type, int def, - const xmlChar * defaultValue, xmlEnumerationPtr tree) -{ - callbacks++; - if (quiet) - return; - if (defaultValue == NULL) - fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, NULL, ...)\n", - elem, name, type, def); - else - fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, %s, ...)\n", - elem, name, type, def, defaultValue); - xmlFreeEnumeration(tree); -} - -/** - * elementDeclDebug: - * @ctxt: An XML parser context - * @name: the element name - * @type: the element type - * @content: the element value (without processing). - * - * An element definition has been parsed - */ -static void -elementDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, int type, - xmlElementContentPtr content ATTRIBUTE_UNUSED) -{ - callbacks++; - if (quiet) - return; - fprintf(stdout, "SAX.elementDecl(%s, %d, ...)\n", - name, type); -} - -/** - * notationDeclDebug: - * @ctxt: An XML parser context - * @name: The name of the notation - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * What to do when a notation declaration has been parsed. - */ -static void -notationDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, - const xmlChar *publicId, const xmlChar *systemId) -{ - callbacks++; - if (quiet) - return; - fprintf(stdout, "SAX.notationDecl(%s, %s, %s)\n", - (char *) name, (char *) publicId, (char *) systemId); -} - -/** - * unparsedEntityDeclDebug: - * @ctxt: An XML parser context - * @name: The name of the entity - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @notationName: the name of the notation - * - * What to do when an unparsed entity declaration is parsed - */ -static void -unparsedEntityDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, - const xmlChar *publicId, const xmlChar *systemId, - const xmlChar *notationName) -{ -const xmlChar *nullstr = BAD_CAST "(null)"; - - if (publicId == NULL) - publicId = nullstr; - if (systemId == NULL) - systemId = nullstr; - if (notationName == NULL) - notationName = nullstr; - callbacks++; - if (quiet) - return; - fprintf(stdout, "SAX.unparsedEntityDecl(%s, %s, %s, %s)\n", - (char *) name, (char *) publicId, (char *) systemId, - (char *) notationName); -} - -/** - * setDocumentLocatorDebug: - * @ctxt: An XML parser context - * @loc: A SAX Locator - * - * Receive the document locator at startup, actually xmlDefaultSAXLocator - * Everything is available on the context, so this is useless in our case. - */ -static void -setDocumentLocatorDebug(void *ctx ATTRIBUTE_UNUSED, xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED) -{ - callbacks++; - if (quiet) - return; - fprintf(stdout, "SAX.setDocumentLocator()\n"); -} - -/** - * startDocumentDebug: - * @ctxt: An XML parser context - * - * called when the document start being processed. - */ -static void -startDocumentDebug(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - if (quiet) - return; - fprintf(stdout, "SAX.startDocument()\n"); -} - -/** - * endDocumentDebug: - * @ctxt: An XML parser context - * - * called when the document end has been detected. - */ -static void -endDocumentDebug(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - if (quiet) - return; - fprintf(stdout, "SAX.endDocument()\n"); -} - -/** - * startElementDebug: - * @ctxt: An XML parser context - * @name: The element name - * - * called when an opening tag has been processed. - */ -static void -startElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar **atts) -{ - int i; - - callbacks++; - if (quiet) - return; - fprintf(stdout, "SAX.startElement(%s", (char *) name); - if (atts != NULL) { - for (i = 0;(atts[i] != NULL);i++) { - fprintf(stdout, ", %s='", atts[i++]); - if (atts[i] != NULL) - fprintf(stdout, "%s'", atts[i]); - } - } - fprintf(stdout, ")\n"); -} - -/** - * endElementDebug: - * @ctxt: An XML parser context - * @name: The element name - * - * called when the end of an element has been detected. - */ -static void -endElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name) -{ - callbacks++; - if (quiet) - return; - fprintf(stdout, "SAX.endElement(%s)\n", (char *) name); -} - -/** - * charactersDebug: - * @ctxt: An XML parser context - * @ch: a xmlChar string - * @len: the number of xmlChar - * - * receiving some chars from the parser. - * Question: how much at a time ??? - */ -static void -charactersDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len) -{ - char output[40]; - int i; - - callbacks++; - if (quiet) - return; - for (i = 0;(i 0) { - ctxt = xmlCreatePushParserCtxt(emptySAXHandler, NULL, - chars, ret, filename); - while ((ret = fread(chars, 1, 3, f)) > 0) { - xmlParseChunk(ctxt, chars, ret, 0); - } - xmlParseChunk(ctxt, chars, 0, 1); - xmlFreeParserCtxt(ctxt); - } - fclose(f); - } else { - xmlGenericError(xmlGenericErrorContext, - "Cannot read file %s\n", filename); - } - } - /* - * Debug callback - */ -#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - f = fopen(filename, "rb"); -#else - f = fopen(filename, "r"); -#endif - if (f != NULL) { - int ret; - char chars[10]; - xmlParserCtxtPtr ctxt; - - ret = fread(chars, 1, 4, f); - if (ret > 0) { - if (sax2) - ctxt = xmlCreatePushParserCtxt(debugSAX2Handler, NULL, - chars, ret, filename); - else - ctxt = xmlCreatePushParserCtxt(debugSAXHandler, NULL, - chars, ret, filename); - while ((ret = fread(chars, 1, 3, f)) > 0) { - xmlParseChunk(ctxt, chars, ret, 0); - } - ret = xmlParseChunk(ctxt, chars, 0, 1); - xmlFreeParserCtxt(ctxt); - if (ret != 0) { - fprintf(stdout, - "xmlSAXUserParseFile returned error %d\n", ret); - } - } - fclose(f); - } - } else { -#endif /* LIBXML_PUSH_ENABLED */ - if (!speed) { - /* - * Empty callbacks for checking - */ - if ((!quiet) && (!nonull)) { - res = xmlSAXUserParseFile(emptySAXHandler, NULL, filename); - if (res != 0) { - fprintf(stdout, "xmlSAXUserParseFile returned error %d\n", res); - } - } - - /* - * Debug callback - */ - callbacks = 0; - if (repeat) { - int i; - for (i = 0;i < 99;i++) { - if (sax2) - res = xmlSAXUserParseFile(debugSAX2Handler, NULL, - filename); - else - res = xmlSAXUserParseFile(debugSAXHandler, NULL, - filename); - } - } - if (sax2) - res = xmlSAXUserParseFile(debugSAX2Handler, NULL, filename); - else - res = xmlSAXUserParseFile(debugSAXHandler, NULL, filename); - if (res != 0) { - fprintf(stdout, "xmlSAXUserParseFile returned error %d\n", res); - } - if (quiet) - fprintf(stdout, "%d callbacks generated\n", callbacks); - } else { - /* - * test 100x the SAX parse - */ - int i; - - for (i = 0; i<100;i++) - res = xmlSAXUserParseFile(emptySAXHandler, NULL, filename); - if (res != 0) { - fprintf(stdout, "xmlSAXUserParseFile returned error %d\n", res); - } - } -#ifdef LIBXML_PUSH_ENABLED - } -#endif -} - - -int main(int argc, char **argv) { - int i; - int files = 0; - - LIBXML_TEST_VERSION /* be safe, plus calls xmlInitParser */ - - for (i = 1; i < argc ; i++) { - if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) - debug++; - else if ((!strcmp(argv[i], "-copy")) || (!strcmp(argv[i], "--copy"))) - copy++; - else if ((!strcmp(argv[i], "-recover")) || - (!strcmp(argv[i], "--recover"))) - recovery++; - else if ((!strcmp(argv[i], "-push")) || - (!strcmp(argv[i], "--push"))) -#ifdef LIBXML_PUSH_ENABLED - push++; -#else - fprintf(stderr,"'push' not enabled in library - ignoring\n"); -#endif /* LIBXML_PUSH_ENABLED */ - else if ((!strcmp(argv[i], "-speed")) || - (!strcmp(argv[i], "--speed"))) - speed++; - else if ((!strcmp(argv[i], "-timing")) || - (!strcmp(argv[i], "--timing"))) { - nonull++; - timing++; - quiet++; - } else if ((!strcmp(argv[i], "-repeat")) || - (!strcmp(argv[i], "--repeat"))) { - repeat++; - quiet++; - } else if ((!strcmp(argv[i], "-noent")) || - (!strcmp(argv[i], "--noent"))) - noent++; - else if ((!strcmp(argv[i], "-quiet")) || - (!strcmp(argv[i], "--quiet"))) - quiet++; - else if ((!strcmp(argv[i], "-sax2")) || - (!strcmp(argv[i], "--sax2"))) - sax2++; - else if ((!strcmp(argv[i], "-nonull")) || - (!strcmp(argv[i], "--nonull"))) - nonull++; - } - if (noent != 0) xmlSubstituteEntitiesDefault(1); - for (i = 1; i < argc ; i++) { - if (argv[i][0] != '-') { - if (timing) { - startTimer(); - } - parseAndPrintFile(argv[i]); - if (timing) { - endTimer("Parsing"); - } - files ++; - } - } - xmlCleanupParser(); - xmlMemoryDump(); - - return(0); -} -#else -int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - printf("%s : SAX1 parsing support not compiled in\n", argv[0]); - return(0); -} -#endif /* LIBXML_SAX1_ENABLED */ diff --git a/lib/3rdparty/libxml2/testSchemas.c b/lib/3rdparty/libxml2/testSchemas.c deleted file mode 100644 index b98e6313e43..00000000000 --- a/lib/3rdparty/libxml2/testSchemas.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * testSchemas.c : a small tester program for Schema validation - * - * See Copyright for the status of this software. - * - * Daniel.Veillard@w3.org - */ - -#include "libxml.h" -#ifdef LIBXML_SCHEMAS_ENABLED - -#include -#include - -#include -#include -#include - - -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_SYS_MMAN_H -#include -/* seems needed for Solaris */ -#ifndef MAP_FAILED -#define MAP_FAILED ((void *) -1) -#endif -#endif - -#include -#include -#include -#include - -#ifdef LIBXML_DEBUG_ENABLED -static int debug = 0; -#endif -static int noout = 0; -#ifdef HAVE_MMAP -static int memory = 0; -#endif - - -int main(int argc, char **argv) { - int i; - int files = 0; - xmlSchemaPtr schema = NULL; - - for (i = 1; i < argc ; i++) { -#ifdef LIBXML_DEBUG_ENABLED - if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) - debug++; - else -#endif -#ifdef HAVE_MMAP - if ((!strcmp(argv[i], "-memory")) || (!strcmp(argv[i], "--memory"))) { - memory++; - } else -#endif - if ((!strcmp(argv[i], "-noout")) || (!strcmp(argv[i], "--noout"))) { - noout++; - } - } - xmlLineNumbersDefault(1); - for (i = 1; i < argc ; i++) { - if (argv[i][0] != '-') { - if (schema == NULL) { - xmlSchemaParserCtxtPtr ctxt; - -#ifdef HAVE_MMAP - if (memory) { - int fd; - struct stat info; - const char *base; - if (stat(argv[i], &info) < 0) - break; - if ((fd = open(argv[i], O_RDONLY)) < 0) - break; - base = mmap(NULL, info.st_size, PROT_READ, - MAP_SHARED, fd, 0) ; - if (base == (void *) MAP_FAILED) - break; - - ctxt = xmlSchemaNewMemParserCtxt((char *)base,info.st_size); - - xmlSchemaSetParserErrors(ctxt, - (xmlSchemaValidityErrorFunc) fprintf, - (xmlSchemaValidityWarningFunc) fprintf, - stderr); - schema = xmlSchemaParse(ctxt); - xmlSchemaFreeParserCtxt(ctxt); - munmap((char *) base, info.st_size); - } else -#endif - { - ctxt = xmlSchemaNewParserCtxt(argv[i]); - xmlSchemaSetParserErrors(ctxt, - (xmlSchemaValidityErrorFunc) fprintf, - (xmlSchemaValidityWarningFunc) fprintf, - stderr); - schema = xmlSchemaParse(ctxt); - xmlSchemaFreeParserCtxt(ctxt); - } -#ifdef LIBXML_OUTPUT_ENABLED -#ifdef LIBXML_DEBUG_ENABLED - if (debug) - xmlSchemaDump(stdout, schema); -#endif -#endif /* LIBXML_OUTPUT_ENABLED */ - if (schema == NULL) - goto failed_schemas; - } else { - xmlDocPtr doc; - - doc = xmlReadFile(argv[i],NULL,0); - - if (doc == NULL) { - fprintf(stderr, "Could not parse %s\n", argv[i]); - } else { - xmlSchemaValidCtxtPtr ctxt; - int ret; - - ctxt = xmlSchemaNewValidCtxt(schema); - xmlSchemaSetValidErrors(ctxt, - (xmlSchemaValidityErrorFunc) fprintf, - (xmlSchemaValidityWarningFunc) fprintf, - stderr); - ret = xmlSchemaValidateDoc(ctxt, doc); - if (ret == 0) { - printf("%s validates\n", argv[i]); - } else if (ret > 0) { - printf("%s fails to validate\n", argv[i]); - } else { - printf("%s validation generated an internal error\n", - argv[i]); - } - xmlSchemaFreeValidCtxt(ctxt); - xmlFreeDoc(doc); - } - } - files ++; - } - } - if (schema != NULL) - xmlSchemaFree(schema); - if (files == 0) { - printf("Usage : %s [--debug] [--noout] schemas XMLfiles ...\n", - argv[0]); - printf("\tParse the HTML files and output the result of the parsing\n"); -#ifdef LIBXML_DEBUG_ENABLED - printf("\t--debug : dump a debug tree of the in-memory document\n"); -#endif - printf("\t--noout : do not print the result\n"); -#ifdef HAVE_MMAP - printf("\t--memory : test the schemas in memory parsing\n"); -#endif - } -failed_schemas: - xmlSchemaCleanupTypes(); - xmlCleanupParser(); - xmlMemoryDump(); - - return(0); -} - -#else -#include -int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - printf("%s : Schemas support not compiled in\n", argv[0]); - return(0); -} -#endif /* LIBXML_SCHEMAS_ENABLED */ diff --git a/lib/3rdparty/libxml2/testThreads.c b/lib/3rdparty/libxml2/testThreads.c deleted file mode 100644 index bff53912ecb..00000000000 --- a/lib/3rdparty/libxml2/testThreads.c +++ /dev/null @@ -1,200 +0,0 @@ -#include "libxml.h" - -#include -#include - -#if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_SAX1_ENABLED) -#include -#include -#include -#include -#ifdef HAVE_PTHREAD_H -#include -#elif defined HAVE_BEOS_THREADS -#include -#endif -#include -#if !defined(_MSC_VER) -#include -#endif -#include - -#define MAX_ARGC 20 -#ifdef HAVE_PTHREAD_H -static pthread_t tid[MAX_ARGC]; -#elif defined HAVE_BEOS_THREADS -static thread_id tid[MAX_ARGC]; -#endif - -static const char *catalog = "test/threads/complex.xml"; -static const char *testfiles[] = { - "test/threads/abc.xml", - "test/threads/acb.xml", - "test/threads/bac.xml", - "test/threads/bca.xml", - "test/threads/cab.xml", - "test/threads/cba.xml", - "test/threads/invalid.xml", -}; - -static const char *Okay = "OK"; -static const char *Failed = "Failed"; - -#ifndef xmlDoValidityCheckingDefaultValue -#error xmlDoValidityCheckingDefaultValue is not a macro -#endif -#ifndef xmlGenericErrorContext -#error xmlGenericErrorContext is not a macro -#endif - -static void * -thread_specific_data(void *private_data) -{ - xmlDocPtr myDoc; - const char *filename = (const char *) private_data; - int okay = 1; - - if (!strcmp(filename, "test/threads/invalid.xml")) { - xmlDoValidityCheckingDefaultValue = 0; - xmlGenericErrorContext = stdout; - } else { - xmlDoValidityCheckingDefaultValue = 1; - xmlGenericErrorContext = stderr; - } - myDoc = xmlParseFile(filename); - if (myDoc) { - xmlFreeDoc(myDoc); - } else { - printf("parse failed\n"); - okay = 0; - } - if (!strcmp(filename, "test/threads/invalid.xml")) { - if (xmlDoValidityCheckingDefaultValue != 0) { - printf("ValidityCheckingDefaultValue override failed\n"); - okay = 0; - } - if (xmlGenericErrorContext != stdout) { - printf("xmlGenericErrorContext override failed\n"); - okay = 0; - } - } else { - if (xmlDoValidityCheckingDefaultValue != 1) { - printf("ValidityCheckingDefaultValue override failed\n"); - okay = 0; - } - if (xmlGenericErrorContext != stderr) { - printf("xmlGenericErrorContext override failed\n"); - okay = 0; - } - } - if (okay == 0) - return((void *) Failed); - return ((void *) Okay); -} - -#ifdef HAVE_PTHREAD_H -int -main(void) -{ - unsigned int i, repeat; - unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]); - void *results[MAX_ARGC]; - int ret; - - xmlInitParser(); - for (repeat = 0;repeat < 500;repeat++) { - xmlLoadCatalog(catalog); - - memset(results, 0, sizeof(*results)*num_threads); - memset(tid, 0xff, sizeof(*tid)*num_threads); - - for (i = 0; i < num_threads; i++) { - ret = pthread_create(&tid[i], NULL, thread_specific_data, - (void *) testfiles[i]); - if (ret != 0) { - perror("pthread_create"); - exit(1); - } - } - for (i = 0; i < num_threads; i++) { - ret = pthread_join(tid[i], &results[i]); - if (ret != 0) { - perror("pthread_join"); - exit(1); - } - } - - xmlCatalogCleanup(); - for (i = 0; i < num_threads; i++) - if (results[i] != (void *) Okay) - printf("Thread %d handling %s failed\n", i, testfiles[i]); - } - xmlCleanupParser(); - xmlMemoryDump(); - return (0); -} -#elif defined HAVE_BEOS_THREADS -int -main(void) -{ - unsigned int i, repeat; - unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]); - void *results[MAX_ARGC]; - status_t ret; - - xmlInitParser(); - printf("Parser initialized\n"); - for (repeat = 0;repeat < 500;repeat++) { - printf("repeat: %d\n",repeat); - xmlLoadCatalog(catalog); - printf("loaded catalog: %s\n", catalog); - for (i = 0; i < num_threads; i++) { - results[i] = NULL; - tid[i] = (thread_id) -1; - } - printf("cleaned threads\n"); - for (i = 0; i < num_threads; i++) { - tid[i] = spawn_thread(thread_specific_data, "xmlTestThread", B_NORMAL_PRIORITY, (void *) testfiles[i]); - if (tid[i] < B_OK) { - perror("beos_thread_create"); - exit(1); - } - printf("beos_thread_create %d -> %d\n", i, tid[i]); - } - for (i = 0; i < num_threads; i++) { - ret = wait_for_thread(tid[i], &results[i]); - printf("beos_thread_wait %d -> %d\n", i, ret); - if (ret != B_OK) { - perror("beos_thread_wait"); - exit(1); - } - } - - xmlCatalogCleanup(); - ret = B_OK; - for (i = 0; i < num_threads; i++) - if (results[i] != (void *) Okay) { - printf("Thread %d handling %s failed\n", i, testfiles[i]); - ret = B_ERROR; - } - } - xmlCleanupParser(); - xmlMemoryDump(); - - if (ret == B_OK) - printf("testThread : BeOS : SUCCESS!\n"); - else - printf("testThread : BeOS : FAILED!\n"); - - return (0); -} -#endif /* pthreads or BeOS threads */ - -#else /* !LIBXML_THREADS_ENABLED */ -int -main(void) -{ - fprintf(stderr, "libxml was not compiled with thread or catalog support\n"); - return (0); -} -#endif diff --git a/lib/3rdparty/libxml2/testThreadsWin32.c b/lib/3rdparty/libxml2/testThreadsWin32.c deleted file mode 100644 index 3d1a5ba23ad..00000000000 --- a/lib/3rdparty/libxml2/testThreadsWin32.c +++ /dev/null @@ -1,150 +0,0 @@ -#include "libxml.h" -#include -#include - -#if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED) -#include -#include -#include -#include -#include -#include -#include - -#define MAX_ARGC 20 -#define TEST_REPEAT_COUNT 500 - -static HANDLE tid[MAX_ARGC]; - -static const char *catalog = "test/threads/complex.xml"; -static char *testfiles[] = { - "test/threads/abc.xml", - "test/threads/acb.xml", - "test/threads/bac.xml", - "test/threads/bca.xml", - "test/threads/cab.xml", - "test/threads/cba.xml", - "test/threads/invalid.xml", -}; - -const char *Okay = "OK"; -const char *Failed = "Failed"; - -#ifndef xmlDoValidityCheckingDefaultValue -#error xmlDoValidityCheckingDefaultValue is not a macro -#endif -#ifndef xmlGenericErrorContext -#error xmlGenericErrorContext is not a macro -#endif - -static DWORD WINAPI -thread_specific_data(void *private_data) -{ - xmlDocPtr myDoc; - const char *filename = (const char *) private_data; - int okay = 1; - - if (!strcmp(filename, "test/threads/invalid.xml")) { - xmlDoValidityCheckingDefaultValue = 0; - xmlGenericErrorContext = stdout; - } else { - xmlDoValidityCheckingDefaultValue = 1; - xmlGenericErrorContext = stderr; - } - myDoc = xmlParseFile(filename); - if (myDoc) { - xmlFreeDoc(myDoc); - } else { - printf("parse failed\n"); - okay = 0; - } - if (!strcmp(filename, "test/threads/invalid.xml")) { - if (xmlDoValidityCheckingDefaultValue != 0) { - printf("ValidityCheckingDefaultValue override failed\n"); - okay = 0; - } - if (xmlGenericErrorContext != stdout) { - printf("xmlGenericErrorContext override failed\n"); - okay = 0; - } - } else { - if (xmlDoValidityCheckingDefaultValue != 1) { - printf("ValidityCheckingDefaultValue override failed\n"); - okay = 0; - } - if (xmlGenericErrorContext != stderr) { - printf("xmlGenericErrorContext override failed\n"); - okay = 0; - } - } - if (okay == 0) - return ((DWORD) Failed); - return ((DWORD) Okay); -} - -int -main() -{ - unsigned int i, repeat; - unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]); - DWORD results[MAX_ARGC]; - BOOL ret; - - xmlInitParser(); - for (repeat = 0;repeat < TEST_REPEAT_COUNT;repeat++) - { - xmlLoadCatalog(catalog); - - for (i = 0; i < num_threads; i++) - { - results[i] = 0; - tid[i] = (HANDLE) -1; - } - - for (i = 0; i < num_threads; i++) - { - DWORD useless; - tid[i] = CreateThread(NULL, 0, - thread_specific_data, testfiles[i], 0, &useless); - if (tid[i] == NULL) - { - perror("CreateThread"); - exit(1); - } - } - - if (WaitForMultipleObjects (num_threads, tid, TRUE, INFINITE) == WAIT_FAILED) - perror ("WaitForMultipleObjects failed"); - - for (i = 0; i < num_threads; i++) - { - ret = GetExitCodeThread (tid[i], &results[i]); - if (ret == 0) - { - perror("GetExitCodeThread"); - exit(1); - } - CloseHandle (tid[i]); - } - - xmlCatalogCleanup(); - for (i = 0; i < num_threads; i++) { - if (results[i] != (DWORD) Okay) - printf("Thread %d handling %s failed\n", i, testfiles[i]); - } - } - - xmlCleanupParser(); - xmlMemoryDump(); - - return (0); -} - -#else /* !LIBXML_THREADS_ENABLED */ -int -main() -{ - fprintf(stderr, "libxml was not compiled with thread or catalog support\n"); - return (0); -} -#endif diff --git a/lib/3rdparty/libxml2/testURI.c b/lib/3rdparty/libxml2/testURI.c deleted file mode 100644 index d20989d4b35..00000000000 --- a/lib/3rdparty/libxml2/testURI.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * testURI.c : a small tester program for XML input. - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#include "libxml.h" - -#include -#include -#include - -#include -#include -#include - -static const char *base = NULL; -static int escape = 0; -static int debug = 0; - -static void handleURI(const char *str) { - int ret; - xmlURIPtr uri; - xmlChar *res = NULL, *parsed = NULL; - - uri = xmlCreateURI(); - - if (base == NULL) { - ret = xmlParseURIReference(uri, str); - if (ret != 0) - printf("%s : error %d\n", str, ret); - else { - if (debug) { - if (uri->scheme) printf("scheme: %s\n", uri->scheme); - if (uri->opaque) printf("opaque: %s\n", uri->opaque); - if (uri->authority) printf("authority: %s\n", uri->authority); - if (uri->server) printf("server: %s\n", uri->server); - if (uri->user) printf("user: %s\n", uri->user); - if (uri->port != 0) printf("port: %d\n", uri->port); - if (uri->path) printf("path: %s\n", uri->path); - if (uri->query) printf("query: %s\n", uri->query); - if (uri->fragment) printf("fragment: %s\n", uri->fragment); - if (uri->query_raw) printf("query_raw: %s\n", uri->query_raw); - if (uri->cleanup != 0) printf("cleanup\n"); - } - xmlNormalizeURIPath(uri->path); - if (escape != 0) { - parsed = xmlSaveUri(uri); - res = xmlURIEscape(parsed); - printf("%s\n", (char *) res); - - } else { - xmlPrintURI(stdout, uri); - printf("\n"); - } - } - } else { - res = xmlBuildURI((xmlChar *)str, (xmlChar *) base); - if (res != NULL) { - printf("%s\n", (char *) res); - } - else - printf("::ERROR::\n"); - } - if (res != NULL) - xmlFree(res); - if (parsed != NULL) - xmlFree(parsed); - xmlFreeURI(uri); -} - -int main(int argc, char **argv) { - int i, arg = 1; - - if ((argc > arg) && (argv[arg] != NULL) && - ((!strcmp(argv[arg], "-base")) || (!strcmp(argv[arg], "--base")))) { - arg++; - base = argv[arg]; - if (base != NULL) - arg++; - } - if ((argc > arg) && (argv[arg] != NULL) && - ((!strcmp(argv[arg], "-escape")) || (!strcmp(argv[arg], "--escape")))) { - arg++; - escape++; - } - if ((argc > arg) && (argv[arg] != NULL) && - ((!strcmp(argv[arg], "-debug")) || (!strcmp(argv[arg], "--debug")))) { - arg++; - debug++; - } - if (argv[arg] == NULL) { - char str[1024]; - - while (1) { - /* - * read one line in string buffer. - */ - if (fgets (&str[0], sizeof (str) - 1, stdin) == NULL) - break; - - /* - * remove the ending spaces - */ - i = strlen(str); - while ((i > 0) && - ((str[i - 1] == '\n') || (str[i - 1] == '\r') || - (str[i - 1] == ' ') || (str[i - 1] == '\t'))) { - i--; - str[i] = 0; - } - handleURI(str); - } - } else { - while (argv[arg] != NULL) { - handleURI(argv[arg]); - arg++; - } - } - xmlMemoryDump(); - return(0); -} diff --git a/lib/3rdparty/libxml2/testXPath.c b/lib/3rdparty/libxml2/testXPath.c deleted file mode 100644 index ebb9ff7bbd8..00000000000 --- a/lib/3rdparty/libxml2/testXPath.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * testXPath.c : a small tester program for XPath. - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#include "libxml.h" -#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED) - -#include - -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if defined(LIBXML_XPTR_ENABLED) -#include -static int xptr = 0; -#endif -static int debug = 0; -static int valid = 0; -static int expr = 0; -static int tree = 0; -static int nocdata = 0; -static xmlDocPtr document = NULL; - -/* - * Default document - */ -static xmlChar buffer[] = -"\n\ -\n\ - \n\ - Welcome to Gnome\n\ - \n\ - \n\ - The Linux adventure\n\ -

bla bla bla ...

\n\ - \n\ -

...

\n\ -
\n\ - \n\ - Chapter 2\n\ -

this is chapter 2 ...

\n\ -
\n\ - \n\ - Chapter 3\n\ -

this is chapter 3 ...

\n\ -
\n\ -
\n\ -"; - - -static void -testXPath(const char *str) { - xmlXPathObjectPtr res; - xmlXPathContextPtr ctxt; - -#if defined(LIBXML_XPTR_ENABLED) - if (xptr) { - ctxt = xmlXPtrNewContext(document, NULL, NULL); - res = xmlXPtrEval(BAD_CAST str, ctxt); - } else { -#endif - ctxt = xmlXPathNewContext(document); - ctxt->node = xmlDocGetRootElement(document); - if (expr) - res = xmlXPathEvalExpression(BAD_CAST str, ctxt); - else { - /* res = xmlXPathEval(BAD_CAST str, ctxt); */ - xmlXPathCompExprPtr comp; - - comp = xmlXPathCompile(BAD_CAST str); - if (comp != NULL) { - if (tree) - xmlXPathDebugDumpCompExpr(stdout, comp, 0); - - res = xmlXPathCompiledEval(comp, ctxt); - xmlXPathFreeCompExpr(comp); - } else - res = NULL; - } -#if defined(LIBXML_XPTR_ENABLED) - } -#endif - xmlXPathDebugDumpObject(stdout, res, 0); - xmlXPathFreeObject(res); - xmlXPathFreeContext(ctxt); -} - -static void -testXPathFile(const char *filename) { - FILE *input; - char expression[5000]; - int len; - - input = fopen(filename, "r"); - if (input == NULL) { - xmlGenericError(xmlGenericErrorContext, - "Cannot open %s for reading\n", filename); - return; - } - while (fgets(expression, 4500, input) != NULL) { - len = strlen(expression); - len--; - while ((len >= 0) && - ((expression[len] == '\n') || (expression[len] == '\t') || - (expression[len] == '\r') || (expression[len] == ' '))) len--; - expression[len + 1] = 0; - if (len >= 0) { - printf("\n========================\nExpression: %s\n", expression) ; - testXPath(expression); - } - } - - fclose(input); -} - -int main(int argc, char **argv) { - int i; - int strings = 0; - int usefile = 0; - char *filename = NULL; - - for (i = 1; i < argc ; i++) { -#if defined(LIBXML_XPTR_ENABLED) - if ((!strcmp(argv[i], "-xptr")) || (!strcmp(argv[i], "--xptr"))) - xptr++; - else -#endif - if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) - debug++; - else if ((!strcmp(argv[i], "-valid")) || (!strcmp(argv[i], "--valid"))) - valid++; - else if ((!strcmp(argv[i], "-expr")) || (!strcmp(argv[i], "--expr"))) - expr++; - else if ((!strcmp(argv[i], "-tree")) || (!strcmp(argv[i], "--tree"))) - tree++; - else if ((!strcmp(argv[i], "-nocdata")) || - (!strcmp(argv[i], "--nocdata"))) - nocdata++; - else if ((!strcmp(argv[i], "-i")) || (!strcmp(argv[i], "--input"))) - filename = argv[++i]; - else if ((!strcmp(argv[i], "-f")) || (!strcmp(argv[i], "--file"))) - usefile++; - } - if (valid != 0) xmlDoValidityCheckingDefaultValue = 1; - xmlLoadExtDtdDefaultValue |= XML_DETECT_IDS; - xmlLoadExtDtdDefaultValue |= XML_COMPLETE_ATTRS; - xmlSubstituteEntitiesDefaultValue = 1; -#ifdef LIBXML_SAX1_ENABLED - if (nocdata != 0) { - xmlDefaultSAXHandlerInit(); - xmlDefaultSAXHandler.cdataBlock = NULL; - } -#endif - if (document == NULL) { - if (filename == NULL) - document = xmlReadDoc(buffer,NULL,NULL,XML_PARSE_COMPACT); - else - document = xmlReadFile(filename,NULL,XML_PARSE_COMPACT); - } - for (i = 1; i < argc ; i++) { - if ((!strcmp(argv[i], "-i")) || (!strcmp(argv[i], "--input"))) { - i++; continue; - } - if (argv[i][0] != '-') { - if (usefile) - testXPathFile(argv[i]); - else - testXPath(argv[i]); - strings ++; - } - } - if (strings == 0) { - printf("Usage : %s [--debug] [--copy] stringsorfiles ...\n", - argv[0]); - printf("\tParse the XPath strings and output the result of the parsing\n"); - printf("\t--debug : dump a debug version of the result\n"); - printf("\t--valid : switch on DTD support in the parser\n"); -#if defined(LIBXML_XPTR_ENABLED) - printf("\t--xptr : expressions are XPointer expressions\n"); -#endif - printf("\t--expr : debug XPath expressions only\n"); - printf("\t--tree : show the compiled XPath tree\n"); - printf("\t--nocdata : do not generate CDATA nodes\n"); - printf("\t--input filename : or\n"); - printf("\t-i filename : read the document from filename\n"); - printf("\t--file : or\n"); - printf("\t-f : read queries from files, args\n"); - } - if (document != NULL) - xmlFreeDoc(document); - xmlCleanupParser(); - xmlMemoryDump(); - - return(0); -} -#else -#include -int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - printf("%s : XPath/Debug support not compiled in\n", argv[0]); - return(0); -} -#endif /* LIBXML_XPATH_ENABLED */ diff --git a/lib/3rdparty/libxml2/testapi.c b/lib/3rdparty/libxml2/testapi.c deleted file mode 100644 index 48656b3b086..00000000000 --- a/lib/3rdparty/libxml2/testapi.c +++ /dev/null @@ -1,52060 +0,0 @@ -/* - * testapi.c: libxml2 API tester program. - * - * Automatically generated by gentest.py from libxml2-api.xml - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#include "libxml.h" -#include - -#include /* for putenv() */ -#include -#include -#include - - -static int testlibxml2(void); -static int test_module(const char *module); - -static int generic_errors = 0; -static int call_tests = 0; -static int function_tests = 0; - -static xmlChar chartab[1024]; -static int inttab[1024]; -static unsigned long longtab[1024]; - -static xmlDocPtr api_doc = NULL; -static xmlDtdPtr api_dtd = NULL; -static xmlNodePtr api_root = NULL; -static xmlAttrPtr api_attr = NULL; -static xmlNsPtr api_ns = NULL; - -static void -structured_errors(void *userData ATTRIBUTE_UNUSED, - xmlErrorPtr error ATTRIBUTE_UNUSED) { - generic_errors++; -} - -static void -free_api_doc(void) { - xmlFreeDoc(api_doc); - api_doc = NULL; - api_dtd = NULL; - api_root = NULL; - api_attr = NULL; - api_ns = NULL; -} - -static xmlDocPtr -get_api_doc(void) { - if (api_doc == NULL) { - api_doc = xmlReadMemory("]>", 88, "root_test", NULL, 0); - api_root = NULL; - api_attr = NULL; - } - return(api_doc); -} - -static xmlDtdPtr -get_api_dtd(void) { - if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) { - get_api_doc(); - if ((api_doc != NULL) && (api_doc->children != NULL) && - (api_doc->children->type == XML_DTD_NODE)) - api_dtd = (xmlDtdPtr) api_doc->children; - } - return(api_dtd); -} - -static xmlNodePtr -get_api_root(void) { - if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) { - get_api_doc(); - if ((api_doc != NULL) && (api_doc->children != NULL) && - (api_doc->children->next != NULL) && - (api_doc->children->next->type == XML_ELEMENT_NODE)) - api_root = api_doc->children->next; - } - return(api_root); -} - -static xmlNsPtr -get_api_ns(void) { - get_api_root(); - if (api_root != NULL) - api_ns = api_root->nsDef; - return(api_ns); -} - -static xmlAttrPtr -get_api_attr(void) { -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) - static int nr = 0; - xmlChar name[20]; -#endif - - if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) { - get_api_root(); - } - if (api_root == NULL) - return(NULL); - if (api_root->properties != NULL) { - api_attr = api_root->properties; - return(api_root->properties); - } - api_attr = NULL; -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) - snprintf((char *) name, 20, "foo%d", nr++); - api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar"); -#endif - return(api_attr); -} - -static int quiet = 0; - -int main(int argc, char **argv) { - int ret; - int blocks, mem; - -#ifdef HAVE_PUTENV - /* access to the proxy can slow up regression tests a lot */ - putenv((char *) "http_proxy="); -#endif - - memset(chartab, 0, sizeof(chartab)); - strncpy((char *) chartab, " chartab\n", 20); - memset(inttab, 0, sizeof(inttab)); - memset(longtab, 0, sizeof(longtab)); - - xmlInitParser(); -#ifdef LIBXML_SCHEMAS_ENABLED - xmlRelaxNGInitTypes(); -#endif - - LIBXML_TEST_VERSION - - xmlSetStructuredErrorFunc(NULL, structured_errors); - - if (argc >= 2) { - if (!strcmp(argv[1], "-q")) { - quiet = 1; - if (argc >= 3) - ret = test_module(argv[2]); - else - ret = testlibxml2(); - } else { - ret = test_module(argv[1]); - } - } else - ret = testlibxml2(); - - xmlCleanupParser(); - blocks = xmlMemBlocks(); - mem = xmlMemUsed(); - if ((blocks != 0) || (mem != 0)) { - printf("testapi leaked %d bytes in %d blocks\n", mem, blocks); - } - xmlMemoryDump(); - - return (ret != 0); -} - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - We manually define xmlErrMemory because it's normal declaration - is "hidden" by #ifdef IN_LIBXML -*/ -void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra); - -/* - We need some "remote" addresses, but want to avoid getting into - name resolution delays, so we use these -*/ -#define REMOTE1GOOD "http://localhost/" -#define REMOTE1BAD "http:http://http" -#define REMOTE2GOOD "ftp://localhost/foo" - -#define gen_nb_void_ptr 2 - -static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#if 0 -#define gen_nb_const_void_ptr 2 - -static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return((const void *) "immutable string"); - return(NULL); -} -static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - -#define gen_nb_userdata 3 - -static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return((void *) &call_tests); - if (no == 1) return((void *) -1); - return(NULL); -} -static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - - -#define gen_nb_int 4 - -static int gen_int(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(0); - if (no == 1) return(1); - if (no == 2) return(-1); - if (no == 3) return(122); - return(-1); -} - -static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_parseroptions 5 - -static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER); - if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA); - if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN); - if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT); - return(XML_PARSE_SAX1); -} - -static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#if 0 -#define gen_nb_long 5 - -static long gen_long(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(0); - if (no == 1) return(1); - if (no == 2) return(-1); - if (no == 3) return(122); - return(-1); -} - -static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - -#define gen_nb_xmlChar 4 - -static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return('a'); - if (no == 1) return(' '); - if (no == 2) return((xmlChar) '\xf8'); - return(0); -} - -static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_unsigned_int 3 - -static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(0); - if (no == 1) return(1); - if (no == 2) return(122); - return((unsigned int) -1); -} - -static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_unsigned_long 4 - -static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(0); - if (no == 1) return(1); - if (no == 2) return(122); - return((unsigned long) -1); -} - -static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_double 4 - -static double gen_double(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(0); - if (no == 1) return(-1.1); -#if defined(LIBXML_XPATH_ENABLED) - if (no == 2) return(xmlXPathNAN); -#endif - return(-1); -} - -static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_unsigned_long_ptr 2 - -static unsigned long *gen_unsigned_long_ptr(int no, int nr) { - if (no == 0) return(&longtab[nr]); - return(NULL); -} - -static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_int_ptr 2 - -static int *gen_int_ptr(int no, int nr) { - if (no == 0) return(&inttab[nr]); - return(NULL); -} - -static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_const_char_ptr 4 - -static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return((char *) "foo"); - if (no == 1) return((char *) ""); - if (no == 2) return((char *) "test/ent2"); - return(NULL); -} -static void des_const_char_ptr(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_xmlChar_ptr 2 - -static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(&chartab[0]); - return(NULL); -} -static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_FILE_ptr 2 - -static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(fopen("test.out", "a+")); - return(NULL); -} -static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) { - if (val != NULL) fclose(val); -} - -#define gen_nb_debug_FILE_ptr 2 -static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(fopen("test.out", "a+")); -} -static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) { - if (val != NULL) fclose(val); -} - -#define gen_nb_const_xmlChar_ptr 5 - -static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return((xmlChar *) "foo"); - if (no == 1) return((xmlChar *) ""); - if (no == 2) return((xmlChar *) "n" "\xf8" "ne"); - if (no == 3) return((xmlChar *) " 2ab "); - return(NULL); -} -static void des_const_xmlChar_ptr(int no ATTRIBUTE_UNUSED, const xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_filepath 8 - -static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return("missing.xml"); - if (no == 1) return(""); - if (no == 2) return("test/ent2"); - if (no == 3) return("test/valid/REC-xml-19980210.xml"); - if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd"); - if (no == 5) return(REMOTE1GOOD); - if (no == 6) return(REMOTE1BAD); - return(NULL); -} -static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_eaten_name 2 - -static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlStrdup(BAD_CAST "eaten")); - return(NULL); -} -static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_fileoutput 6 - -static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return("/missing.xml"); - if (no == 1) return(""); - if (no == 2) return(REMOTE2GOOD); - if (no == 3) return(REMOTE1GOOD); - if (no == 4) return(REMOTE1BAD); - return(NULL); -} -static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_xmlParserCtxtPtr 3 -static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlNewParserCtxt()); - if (no == 1) return(xmlCreateMemoryParserCtxt("", 6)); - return(NULL); -} -static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) { - if (val != NULL) - xmlFreeParserCtxt(val); -} - -#define gen_nb_xmlSAXHandlerPtr 2 -static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) { -#ifdef LIBXML_SAX1_ENABLED - if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler); -#endif - return(NULL); -} -static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_xmlValidCtxtPtr 2 -static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { -#ifdef LIBXML_VALID_ENABLED - if (no == 0) return(xmlNewValidCtxt()); -#endif - return(NULL); -} -static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) { -#ifdef LIBXML_VALID_ENABLED - if (val != NULL) - xmlFreeValidCtxt(val); -#endif -} - -#define gen_nb_xmlParserInputBufferPtr 8 - -static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE)); - if (no == 1) return(xmlParserInputBufferCreateFilename("", XML_CHAR_ENCODING_NONE)); - if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE)); - if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE)); - if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE)); - if (no == 5) return(xmlParserInputBufferCreateFilename(REMOTE1GOOD, XML_CHAR_ENCODING_NONE)); - if (no == 6) return(xmlParserInputBufferCreateFilename(REMOTE1BAD, XML_CHAR_ENCODING_NONE)); - return(NULL); -} -static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) { - xmlFreeParserInputBuffer(val); -} - -#define gen_nb_xmlDocPtr 4 -static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlNewDoc(BAD_CAST "1.0")); - if (no == 1) return(xmlReadMemory("", 6, "test", NULL, 0)); - if (no == 2) return(xmlReadMemory(" ", 24, "test", NULL, 0)); - return(NULL); -} -static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) { - if ((val != NULL) && (val != api_doc) && (val->doc != api_doc)) - xmlFreeDoc(val); -} - -#define gen_nb_xmlAttrPtr 2 -static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(get_api_attr()); - return(NULL); -} -static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - if (no == 0) free_api_doc(); -} - -#define gen_nb_xmlDictPtr 2 -static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlDictCreate()); - return(NULL); -} -static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) { - if (val != NULL) - xmlDictFree(val); -} - -#define gen_nb_xmlNodePtr 3 -static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL)); - if (no == 1) return(get_api_root()); - return(NULL); -/* if (no == 2) return((xmlNodePtr) get_api_doc()); */ -} -static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) { - if (no == 1) { - free_api_doc(); - } else if (val != NULL) { - xmlUnlinkNode(val); - xmlFreeNode(val); - } -} - -#define gen_nb_xmlDtdPtr 3 -static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) - return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar")); - if (no == 1) return(get_api_dtd()); - return(NULL); -} -static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) { - if (no == 1) free_api_doc(); - else if (val != NULL) { - xmlUnlinkNode((xmlNodePtr) val); - xmlFreeNode((xmlNodePtr) val); - } -} - -#define gen_nb_xmlNsPtr 2 -static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(get_api_ns()); - return(NULL); -} -static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - if (no == 0) free_api_doc(); -} - -#define gen_nb_xmlNodePtr_in 3 -static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL)); - if (no == 0) return(xmlNewText(BAD_CAST "text")); - return(NULL); -} -static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#ifdef LIBXML_WRITER_ENABLED -#define gen_nb_xmlTextWriterPtr 2 -static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlNewTextWriterFilename("test.out", 0)); - return(NULL); -} -static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) { - if (val != NULL) xmlFreeTextWriter(val); -} -#endif - -#ifdef LIBXML_READER_ENABLED -#define gen_nb_xmlTextReaderPtr 4 -static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlNewTextReaderFilename("test/ent2")); - if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml")); - if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd")); - return(NULL); -} -static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) { - if (val != NULL) xmlFreeTextReader(val); -} -#endif - -#define gen_nb_xmlBufferPtr 3 -static const xmlChar *static_buf_content = (xmlChar *)"a static buffer"; -static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlBufferCreate()); - if (no == 1) return(xmlBufferCreateStatic((void *)static_buf_content, 13)); - return(NULL); -} -static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) { - if (val != NULL) { - xmlBufferFree(val); - } -} - -#define gen_nb_xmlListPtr 2 -static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlListCreate(NULL, NULL)); - return(NULL); -} -static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) { - if (val != NULL) { - xmlListDelete(val); - } -} - -#define gen_nb_xmlHashTablePtr 2 -static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlHashCreate(10)); - return(NULL); -} -static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) { - if (val != NULL) { - xmlHashFree(val, NULL); - } -} - -#include - -#ifdef LIBXML_XPATH_ENABLED -#define gen_nb_xmlXPathObjectPtr 5 -static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlXPathNewString(BAD_CAST "string object")); - if (no == 1) return(xmlXPathNewFloat(1.1)); - if (no == 2) return(xmlXPathNewBoolean(1)); - if (no == 3) return(xmlXPathNewNodeSet(NULL)); - return(NULL); -} -static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) { - if (val != NULL) { - xmlXPathFreeObject(val); - } -} -#endif - -#ifdef LIBXML_OUTPUT_ENABLED -#define gen_nb_xmlOutputBufferPtr 2 -static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0)); - return(NULL); -} -static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) { - if (val != NULL) { - xmlOutputBufferClose(val); - } -} -#endif - -#ifdef LIBXML_FTP_ENABLED -#define gen_nb_xmlNanoFTPCtxtPtr 4 -static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlNanoFTPNewCtxt(REMOTE2GOOD)); - if (no == 1) return(xmlNanoFTPNewCtxt(REMOTE1GOOD)); - if (no == 2) return(xmlNanoFTPNewCtxt("foo")); - return(NULL); -} -static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) { - if (val != NULL) { - xmlNanoFTPFreeCtxt(val); - } -} -#endif - -#ifdef LIBXML_HTTP_ENABLED -#define gen_nb_xmlNanoHTTPCtxtPtr 1 -static void *gen_xmlNanoHTTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlNanoHTTPOpen(REMOTE1GOOD, NULL)); - if (no == 1) return(xmlNanoHTTPOpen(REMOTE2GOOD, NULL)); - if (no == 2) return(xmlNanoHTTPOpen(REMOTE1BAD, NULL)); - return(NULL); -} -static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) { - if (val != NULL) { - xmlNanoHTTPClose(val); - } -} -#endif - -#define gen_nb_xmlCharEncoding 4 -static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(XML_CHAR_ENCODING_UTF8); - if (no == 1) return(XML_CHAR_ENCODING_NONE); - if (no == 2) return(XML_CHAR_ENCODING_8859_1); - return(XML_CHAR_ENCODING_ERROR); -} -static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) - -#define gen_nb_xmlExpCtxtPtr 1 -static xmlExpCtxtPtr gen_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED, xmlExpCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_xmlExpNodePtr 1 -static xmlExpNodePtr gen_xmlExpNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlExpNodePtr(int no ATTRIBUTE_UNUSED, xmlExpNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#endif - -#if defined(LIBXML_SCHEMAS_ENABLED) -#define gen_nb_xmlSchemaPtr 1 -static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_xmlSchemaValidCtxtPtr 1 -static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#endif /* LIBXML_SCHEMAS_ENABLED */ - -#define gen_nb_xmlHashDeallocator 2 -static void -test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) { -} - -static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(test_xmlHashDeallocator); - return(NULL); -} -static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - - -static void desret_int(int val ATTRIBUTE_UNUSED) { -} -static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) { -} -static void desret_long(long val ATTRIBUTE_UNUSED) { -} -static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED) { -} -static void desret_double(double val ATTRIBUTE_UNUSED) { -} -static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) { -} -#if 0 -static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) { -} -#endif -static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) { -} -static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) { -} -static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) { -} -static void desret_xmlChar_ptr(xmlChar *val) { - if (val != NULL) - xmlFree(val); -} -static void desret_xmlDocPtr(xmlDocPtr val) { - if (val != api_doc) - xmlFreeDoc(val); -} -static void desret_xmlDictPtr(xmlDictPtr val) { - xmlDictFree(val); -} -#ifdef LIBXML_OUTPUT_ENABLED -static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) { - xmlOutputBufferClose(val); -} -#endif -#ifdef LIBXML_READER_ENABLED -static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) { - xmlFreeTextReader(val); -} -#endif -static void desret_xmlNodePtr(xmlNodePtr val) { - if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) { - xmlUnlinkNode(val); - xmlFreeNode(val); - } -} -static void desret_xmlAttrPtr(xmlAttrPtr val) { - if (val != NULL) { - xmlUnlinkNode((xmlNodePtr) val); - xmlFreeNode((xmlNodePtr) val); - } -} -static void desret_xmlEntityPtr(xmlEntityPtr val) { - if (val != NULL) { - xmlUnlinkNode((xmlNodePtr) val); - xmlFreeNode((xmlNodePtr) val); - } -} -static void desret_xmlElementPtr(xmlElementPtr val) { - if (val != NULL) { - xmlUnlinkNode((xmlNodePtr) val); - } -} -static void desret_xmlAttributePtr(xmlAttributePtr val) { - if (val != NULL) { - xmlUnlinkNode((xmlNodePtr) val); - } -} -static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) { -} -static void desret_xmlDtdPtr(xmlDtdPtr val) { - desret_xmlNodePtr((xmlNodePtr)val); -} -#ifdef LIBXML_XPATH_ENABLED -static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) { - xmlXPathFreeObject(val); -} -static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) { - xmlXPathFreeNodeSet(val); -} -#endif -static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) { - xmlFreeParserCtxt(val); -} -static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) { - xmlFreeParserInputBuffer(val); -} -static void desret_xmlParserInputPtr(xmlParserInputPtr val) { - xmlFreeInputStream(val); -} -#ifdef LIBXML_WRITER_ENABLED -static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) { - xmlFreeTextWriter(val); -} -#endif -static void desret_xmlBufferPtr(xmlBufferPtr val) { - xmlBufferFree(val); -} -#ifdef LIBXML_SCHEMAS_ENABLED -static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) { - xmlSchemaFreeParserCtxt(val); -} -static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) { -} -static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) { - xmlRelaxNGFreeParserCtxt(val); -} -#endif -#ifdef LIBXML_HTML_ENABLED -static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED) { -} -#endif -#ifdef LIBXML_HTTP_ENABLED -static void desret_xmlNanoHTTPCtxtPtr(void *val) { - xmlNanoHTTPClose(val); -} -#endif -#ifdef LIBXML_FTP_ENABLED -static void desret_xmlNanoFTPCtxtPtr(void *val) { - xmlNanoFTPClose(val); -} -#endif -/* cut and pasted from autogenerated to avoid troubles */ -#define gen_nb_const_xmlChar_ptr_ptr 1 -static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_unsigned_char_ptr 1 -static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_const_unsigned_char_ptr 1 -static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#ifdef LIBXML_HTML_ENABLED -#define gen_nb_const_htmlNodePtr 1 -static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - -#ifdef LIBXML_HTML_ENABLED -#define gen_nb_htmlDocPtr 3 -static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(htmlNewDoc(NULL, NULL)); - if (no == 1) return(htmlReadMemory("", 7, "test", NULL, 0)); - return(NULL); -} -static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - if ((val != NULL) && (val != api_doc) && (val->doc != api_doc)) - xmlFreeDoc(val); -} -static void desret_htmlDocPtr(htmlDocPtr val) { - if ((val != NULL) && (val != api_doc) && (val->doc != api_doc)) - xmlFreeDoc(val); -} -#define gen_nb_htmlParserCtxtPtr 3 -static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlNewParserCtxt()); - if (no == 1) return(htmlCreateMemoryParserCtxt("", 7)); - return(NULL); -} -static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - if (val != NULL) - htmlFreeParserCtxt(val); -} -static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) { - if (val != NULL) - htmlFreeParserCtxt(val); -} -#endif - -#ifdef LIBXML_XPATH_ENABLED -#define gen_nb_xmlNodeSetPtr 1 -static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - -#ifdef LIBXML_DEBUG_ENABLED -#ifdef LIBXML_XPATH_ENABLED -#define gen_nb_xmlShellCtxtPtr 1 -static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif -#endif - -#ifdef LIBXML_PATTERN_ENABLED -#define gen_nb_xmlPatternPtr 1 -static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - -#define gen_nb_xmlElementContentPtr 1 -static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val, int nr ATTRIBUTE_UNUSED) { - if (val != NULL) - xmlFreeElementContent(val); -} -static void desret_xmlElementContentPtr(xmlElementContentPtr val) { - if (val != NULL) - xmlFreeElementContent(val); -} - -#define gen_nb_xmlParserNodeInfoSeqPtr 1 -static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) { -} - -#define gen_nb_void_ptr_ptr 1 -static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -/************************************************************************ - * * - * WARNING: end of the manually maintained part of the test code * - * do not remove or alter the CUT HERE line * - * * - ************************************************************************/ - -/* CUT HERE: everything below that line is generated */ -#ifdef LIBXML_HTML_ENABLED -static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) { -} - -#endif - -#define gen_nb_xmlAttributeDefault 4 -static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 1) return(XML_ATTRIBUTE_FIXED); - if (no == 2) return(XML_ATTRIBUTE_IMPLIED); - if (no == 3) return(XML_ATTRIBUTE_NONE); - if (no == 4) return(XML_ATTRIBUTE_REQUIRED); - return(0); -} - -static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_xmlAttributeType 4 -static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 1) return(XML_ATTRIBUTE_CDATA); - if (no == 2) return(XML_ATTRIBUTE_ENTITIES); - if (no == 3) return(XML_ATTRIBUTE_ENTITY); - if (no == 4) return(XML_ATTRIBUTE_ENUMERATION); - return(0); -} - -static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_xmlBufferAllocationScheme 4 -static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT); - if (no == 2) return(XML_BUFFER_ALLOC_EXACT); - if (no == 3) return(XML_BUFFER_ALLOC_HYBRID); - if (no == 4) return(XML_BUFFER_ALLOC_IMMUTABLE); - return(0); -} - -static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) { -} - -#ifdef LIBXML_CATALOG_ENABLED -#define gen_nb_xmlCatalogAllow 4 -static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 1) return(XML_CATA_ALLOW_ALL); - if (no == 2) return(XML_CATA_ALLOW_DOCUMENT); - if (no == 3) return(XML_CATA_ALLOW_GLOBAL); - if (no == 4) return(XML_CATA_ALLOW_NONE); - return(0); -} - -static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) { -} - -#endif - -#ifdef LIBXML_CATALOG_ENABLED -#define gen_nb_xmlCatalogPrefer 3 -static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 1) return(XML_CATA_PREFER_NONE); - if (no == 2) return(XML_CATA_PREFER_PUBLIC); - if (no == 3) return(XML_CATA_PREFER_SYSTEM); - return(0); -} - -static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) { -} - -#endif - -#define gen_nb_xmlElementContentType 4 -static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT); - if (no == 2) return(XML_ELEMENT_CONTENT_OR); - if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA); - if (no == 4) return(XML_ELEMENT_CONTENT_SEQ); - return(0); -} - -static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_xmlElementTypeVal 4 -static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 1) return(XML_ELEMENT_TYPE_ANY); - if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT); - if (no == 3) return(XML_ELEMENT_TYPE_EMPTY); - if (no == 4) return(XML_ELEMENT_TYPE_MIXED); - return(0); -} - -static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_xmlFeature 4 -static xmlFeature gen_xmlFeature(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 1) return(XML_WITH_AUTOMATA); - if (no == 2) return(XML_WITH_C14N); - if (no == 3) return(XML_WITH_CATALOG); - if (no == 4) return(XML_WITH_DEBUG); - return(0); -} - -static void des_xmlFeature(int no ATTRIBUTE_UNUSED, xmlFeature val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) { -} - -#ifdef LIBXML_SCHEMAS_ENABLED -#define gen_nb_xmlSchemaValType 4 -static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE); - if (no == 2) return(XML_SCHEMAS_ANYTYPE); - if (no == 3) return(XML_SCHEMAS_ANYURI); - if (no == 4) return(XML_SCHEMAS_BASE64BINARY); - return(0); -} - -static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static void desret_xmlSchemaValType(xmlSchemaValType val ATTRIBUTE_UNUSED) { -} - -#endif - -#ifdef LIBXML_SCHEMAS_ENABLED -#define gen_nb_xmlSchemaWhitespaceValueType 4 -static xmlSchemaWhitespaceValueType gen_xmlSchemaWhitespaceValueType(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 1) return(XML_SCHEMA_WHITESPACE_COLLAPSE); - if (no == 2) return(XML_SCHEMA_WHITESPACE_PRESERVE); - if (no == 3) return(XML_SCHEMA_WHITESPACE_REPLACE); - if (no == 4) return(XML_SCHEMA_WHITESPACE_UNKNOWN); - return(0); -} - -static void des_xmlSchemaWhitespaceValueType(int no ATTRIBUTE_UNUSED, xmlSchemaWhitespaceValueType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -static int test_HTMLparser(void); -static int test_HTMLtree(void); -static int test_SAX2(void); -static int test_c14n(void); -static int test_catalog(void); -static int test_chvalid(void); -static int test_debugXML(void); -static int test_dict(void); -static int test_encoding(void); -static int test_entities(void); -static int test_hash(void); -static int test_list(void); -static int test_nanoftp(void); -static int test_nanohttp(void); -static int test_parser(void); -static int test_parserInternals(void); -static int test_pattern(void); -static int test_relaxng(void); -static int test_schemasInternals(void); -static int test_schematron(void); -static int test_tree(void); -static int test_uri(void); -static int test_valid(void); -static int test_xinclude(void); -static int test_xmlIO(void); -static int test_xmlautomata(void); -static int test_xmlerror(void); -static int test_xmlmodule(void); -static int test_xmlreader(void); -static int test_xmlregexp(void); -static int test_xmlsave(void); -static int test_xmlschemas(void); -static int test_xmlschemastypes(void); -static int test_xmlstring(void); -static int test_xmlunicode(void); -static int test_xmlwriter(void); -static int test_xpath(void); -static int test_xpathInternals(void); -static int test_xpointer(void); - -/** - * testlibxml2: - * - * Main entry point of the tester for the full libxml2 module, - * it calls all the tester entry point for each module. - * - * Returns the number of error found - */ -static int -testlibxml2(void) -{ - int test_ret = 0; - - test_ret += test_HTMLparser(); - test_ret += test_HTMLtree(); - test_ret += test_SAX2(); - test_ret += test_c14n(); - test_ret += test_catalog(); - test_ret += test_chvalid(); - test_ret += test_debugXML(); - test_ret += test_dict(); - test_ret += test_encoding(); - test_ret += test_entities(); - test_ret += test_hash(); - test_ret += test_list(); - test_ret += test_nanoftp(); - test_ret += test_nanohttp(); - test_ret += test_parser(); - test_ret += test_parserInternals(); - test_ret += test_pattern(); - test_ret += test_relaxng(); - test_ret += test_schemasInternals(); - test_ret += test_schematron(); - test_ret += test_tree(); - test_ret += test_uri(); - test_ret += test_valid(); - test_ret += test_xinclude(); - test_ret += test_xmlIO(); - test_ret += test_xmlautomata(); - test_ret += test_xmlerror(); - test_ret += test_xmlmodule(); - test_ret += test_xmlreader(); - test_ret += test_xmlregexp(); - test_ret += test_xmlsave(); - test_ret += test_xmlschemas(); - test_ret += test_xmlschemastypes(); - test_ret += test_xmlstring(); - test_ret += test_xmlunicode(); - test_ret += test_xmlwriter(); - test_ret += test_xpath(); - test_ret += test_xpathInternals(); - test_ret += test_xpointer(); - - printf("Total: %d functions, %d tests, %d errors\n", - function_tests, call_tests, test_ret); - return(test_ret); -} - - -static int -test_UTF8ToHtml(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - int ret_val; - unsigned char * out; /* a pointer to an array of bytes to store the result */ - int n_out; - int * outlen; /* the length of @out */ - int n_outlen; - unsigned char * in; /* a pointer to an array of UTF-8 chars */ - int n_in; - int * inlen; /* the length of @in */ - int n_inlen; - - for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) { - for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) { - for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { - for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) { - mem_base = xmlMemBlocks(); - out = gen_unsigned_char_ptr(n_out, 0); - outlen = gen_int_ptr(n_outlen, 1); - in = gen_const_unsigned_char_ptr(n_in, 2); - inlen = gen_int_ptr(n_inlen, 3); - - ret_val = UTF8ToHtml(out, outlen, (const unsigned char *)in, inlen); - desret_int(ret_val); - call_tests++; - des_unsigned_char_ptr(n_out, out, 0); - des_int_ptr(n_outlen, outlen, 1); - des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2); - des_int_ptr(n_inlen, inlen, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in UTF8ToHtml", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_out); - printf(" %d", n_outlen); - printf(" %d", n_in); - printf(" %d", n_inlen); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -#ifdef LIBXML_HTML_ENABLED - -#define gen_nb_const_htmlElemDesc_ptr 1 -static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_htmlAttrAllowed(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - htmlStatus ret_val; - htmlElemDesc * elt; /* HTML element */ - int n_elt; - xmlChar * attr; /* HTML attribute */ - int n_attr; - int legacy; /* whether to allow deprecated attributes */ - int n_legacy; - - for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) { - for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) { - for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) { - mem_base = xmlMemBlocks(); - elt = gen_const_htmlElemDesc_ptr(n_elt, 0); - attr = gen_const_xmlChar_ptr(n_attr, 1); - legacy = gen_int(n_legacy, 2); - - ret_val = htmlAttrAllowed((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy); - desret_htmlStatus(ret_val); - call_tests++; - des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0); - des_const_xmlChar_ptr(n_attr, (const xmlChar *)attr, 1); - des_int(n_legacy, legacy, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlAttrAllowed", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_elt); - printf(" %d", n_attr); - printf(" %d", n_legacy); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -#ifdef LIBXML_HTML_ENABLED - -#define gen_nb_htmlNodePtr 1 -static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_htmlAutoCloseTag(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - int ret_val; - htmlDocPtr doc; /* the HTML document */ - int n_doc; - xmlChar * name; /* The tag name */ - int n_name; - htmlNodePtr elem; /* the HTML element */ - int n_elem; - - for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) { - mem_base = xmlMemBlocks(); - doc = gen_htmlDocPtr(n_doc, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - elem = gen_htmlNodePtr(n_elem, 2); - - ret_val = htmlAutoCloseTag(doc, (const xmlChar *)name, elem); - desret_int(ret_val); - call_tests++; - des_htmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_htmlNodePtr(n_elem, elem, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlAutoCloseTag", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_name); - printf(" %d", n_elem); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlCreateMemoryParserCtxt(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - htmlParserCtxtPtr ret_val; - char * buffer; /* a pointer to a char array */ - int n_buffer; - int size; /* the size of the array */ - int n_size; - - for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - mem_base = xmlMemBlocks(); - buffer = gen_const_char_ptr(n_buffer, 0); - size = gen_int(n_size, 1); - - ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size); - desret_htmlParserCtxtPtr(ret_val); - call_tests++; - des_const_char_ptr(n_buffer, (const char *)buffer, 0); - des_int(n_size, size, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buffer); - printf(" %d", n_size); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -#ifdef LIBXML_HTML_ENABLED - -#define gen_nb_htmlSAXHandlerPtr 1 -static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_htmlCreatePushParserCtxt(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED) - int mem_base; - htmlParserCtxtPtr ret_val; - htmlSAXHandlerPtr sax; /* a SAX handler */ - int n_sax; - void * user_data; /* The user data returned on SAX callbacks */ - int n_user_data; - char * chunk; /* a pointer to an array of chars */ - int n_chunk; - int size; /* number of chars in the array */ - int n_size; - const char * filename; /* an optional file name or URI */ - int n_filename; - xmlCharEncoding enc; /* an optional encoding */ - int n_enc; - - for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) { - for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { - for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { - for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { - mem_base = xmlMemBlocks(); - sax = gen_htmlSAXHandlerPtr(n_sax, 0); - user_data = gen_userdata(n_user_data, 1); - chunk = gen_const_char_ptr(n_chunk, 2); - size = gen_int(n_size, 3); - filename = gen_fileoutput(n_filename, 4); - enc = gen_xmlCharEncoding(n_enc, 5); - - ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc); - desret_htmlParserCtxtPtr(ret_val); - call_tests++; - des_htmlSAXHandlerPtr(n_sax, sax, 0); - des_userdata(n_user_data, user_data, 1); - des_const_char_ptr(n_chunk, (const char *)chunk, 2); - des_int(n_size, size, 3); - des_fileoutput(n_filename, filename, 4); - des_xmlCharEncoding(n_enc, enc, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlCreatePushParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_sax); - printf(" %d", n_user_data); - printf(" %d", n_chunk); - printf(" %d", n_size); - printf(" %d", n_filename); - printf(" %d", n_enc); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlCtxtReadDoc(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - htmlDocPtr ret_val; - htmlParserCtxtPtr ctxt; /* an HTML parser context */ - int n_ctxt; - xmlChar * cur; /* a pointer to a zero terminated string */ - int n_cur; - const char * URL; /* the base URL to use for the document */ - int n_URL; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of htmlParserOption(s) */ - int n_options; - - for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { - for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_int;n_options++) { - mem_base = xmlMemBlocks(); - ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); - cur = gen_const_xmlChar_ptr(n_cur, 1); - URL = gen_filepath(n_URL, 2); - encoding = gen_const_char_ptr(n_encoding, 3); - options = gen_int(n_options, 4); - - ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options); - desret_htmlDocPtr(ret_val); - call_tests++; - des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1); - des_filepath(n_URL, URL, 2); - des_const_char_ptr(n_encoding, (const char *)encoding, 3); - des_int(n_options, options, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlCtxtReadDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_cur); - printf(" %d", n_URL); - printf(" %d", n_encoding); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlCtxtReadFile(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - htmlDocPtr ret_val; - htmlParserCtxtPtr ctxt; /* an HTML parser context */ - int n_ctxt; - const char * filename; /* a file or URL */ - int n_filename; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of htmlParserOption(s) */ - int n_options; - - for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_int;n_options++) { - ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); - filename = gen_filepath(n_filename, 1); - encoding = gen_const_char_ptr(n_encoding, 2); - options = gen_int(n_options, 3); - - ret_val = htmlCtxtReadFile(ctxt, filename, (const char *)encoding, options); - desret_htmlDocPtr(ret_val); - call_tests++; - des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_filepath(n_filename, filename, 1); - des_const_char_ptr(n_encoding, (const char *)encoding, 2); - des_int(n_options, options, 3); - xmlResetLastError(); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlCtxtReadMemory(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - htmlDocPtr ret_val; - htmlParserCtxtPtr ctxt; /* an HTML parser context */ - int n_ctxt; - char * buffer; /* a pointer to a char array */ - int n_buffer; - int size; /* the size of the array */ - int n_size; - const char * URL; /* the base URL to use for the document */ - int n_URL; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of htmlParserOption(s) */ - int n_options; - - for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { - for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_int;n_options++) { - mem_base = xmlMemBlocks(); - ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); - buffer = gen_const_char_ptr(n_buffer, 1); - size = gen_int(n_size, 2); - URL = gen_filepath(n_URL, 3); - encoding = gen_const_char_ptr(n_encoding, 4); - options = gen_int(n_options, 5); - - ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options); - desret_htmlDocPtr(ret_val); - call_tests++; - des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_char_ptr(n_buffer, (const char *)buffer, 1); - des_int(n_size, size, 2); - des_filepath(n_URL, URL, 3); - des_const_char_ptr(n_encoding, (const char *)encoding, 4); - des_int(n_options, options, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlCtxtReadMemory", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_buffer); - printf(" %d", n_size); - printf(" %d", n_URL); - printf(" %d", n_encoding); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlCtxtReset(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - htmlParserCtxtPtr ctxt; /* an HTML parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); - - htmlCtxtReset(ctxt); - call_tests++; - des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlCtxtReset", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlCtxtUseOptions(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - int ret_val; - htmlParserCtxtPtr ctxt; /* an HTML parser context */ - int n_ctxt; - int options; /* a combination of htmlParserOption(s) */ - int n_options; - - for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { - for (n_options = 0;n_options < gen_nb_int;n_options++) { - mem_base = xmlMemBlocks(); - ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); - options = gen_int(n_options, 1); - - ret_val = htmlCtxtUseOptions(ctxt, options); - desret_int(ret_val); - call_tests++; - des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_int(n_options, options, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlCtxtUseOptions", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_options); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlElementAllowedHere(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - int ret_val; - htmlElemDesc * parent; /* HTML parent element */ - int n_parent; - xmlChar * elt; /* HTML element */ - int n_elt; - - for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) { - for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) { - mem_base = xmlMemBlocks(); - parent = gen_const_htmlElemDesc_ptr(n_parent, 0); - elt = gen_const_xmlChar_ptr(n_elt, 1); - - ret_val = htmlElementAllowedHere((const htmlElemDesc *)parent, (const xmlChar *)elt); - desret_int(ret_val); - call_tests++; - des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0); - des_const_xmlChar_ptr(n_elt, (const xmlChar *)elt, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlElementAllowedHere", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_parent); - printf(" %d", n_elt); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlElementStatusHere(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - htmlStatus ret_val; - htmlElemDesc * parent; /* HTML parent element */ - int n_parent; - htmlElemDesc * elt; /* HTML element */ - int n_elt; - - for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) { - for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) { - mem_base = xmlMemBlocks(); - parent = gen_const_htmlElemDesc_ptr(n_parent, 0); - elt = gen_const_htmlElemDesc_ptr(n_elt, 1); - - ret_val = htmlElementStatusHere((const htmlElemDesc *)parent, (const htmlElemDesc *)elt); - desret_htmlStatus(ret_val); - call_tests++; - des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0); - des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlElementStatusHere", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_parent); - printf(" %d", n_elt); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlEncodeEntities(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - int ret_val; - unsigned char * out; /* a pointer to an array of bytes to store the result */ - int n_out; - int * outlen; /* the length of @out */ - int n_outlen; - unsigned char * in; /* a pointer to an array of UTF-8 chars */ - int n_in; - int * inlen; /* the length of @in */ - int n_inlen; - int quoteChar; /* the quote character to escape (' or ") or zero. */ - int n_quoteChar; - - for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) { - for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) { - for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { - for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) { - for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) { - mem_base = xmlMemBlocks(); - out = gen_unsigned_char_ptr(n_out, 0); - outlen = gen_int_ptr(n_outlen, 1); - in = gen_const_unsigned_char_ptr(n_in, 2); - inlen = gen_int_ptr(n_inlen, 3); - quoteChar = gen_int(n_quoteChar, 4); - - ret_val = htmlEncodeEntities(out, outlen, (const unsigned char *)in, inlen, quoteChar); - desret_int(ret_val); - call_tests++; - des_unsigned_char_ptr(n_out, out, 0); - des_int_ptr(n_outlen, outlen, 1); - des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2); - des_int_ptr(n_inlen, inlen, 3); - des_int(n_quoteChar, quoteChar, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlEncodeEntities", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_out); - printf(" %d", n_outlen); - printf(" %d", n_in); - printf(" %d", n_inlen); - printf(" %d", n_quoteChar); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlEntityLookup(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - const htmlEntityDesc * ret_val; - xmlChar * name; /* the entity name */ - int n_name; - - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - name = gen_const_xmlChar_ptr(n_name, 0); - - ret_val = htmlEntityLookup((const xmlChar *)name); - desret_const_htmlEntityDesc_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlEntityLookup", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_name); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlEntityValueLookup(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - const htmlEntityDesc * ret_val; - unsigned int value; /* the entity's unicode value */ - int n_value; - - for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) { - mem_base = xmlMemBlocks(); - value = gen_unsigned_int(n_value, 0); - - ret_val = htmlEntityValueLookup(value); - desret_const_htmlEntityDesc_ptr(ret_val); - call_tests++; - des_unsigned_int(n_value, value, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlEntityValueLookup", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_value); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlHandleOmittedElem(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - int ret_val; - int val; /* int 0 or 1 */ - int n_val; - - for (n_val = 0;n_val < gen_nb_int;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_int(n_val, 0); - - ret_val = htmlHandleOmittedElem(val); - desret_int(ret_val); - call_tests++; - des_int(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlHandleOmittedElem", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlIsAutoClosed(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - int ret_val; - htmlDocPtr doc; /* the HTML document */ - int n_doc; - htmlNodePtr elem; /* the HTML element */ - int n_elem; - - for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { - for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) { - mem_base = xmlMemBlocks(); - doc = gen_htmlDocPtr(n_doc, 0); - elem = gen_htmlNodePtr(n_elem, 1); - - ret_val = htmlIsAutoClosed(doc, elem); - desret_int(ret_val); - call_tests++; - des_htmlDocPtr(n_doc, doc, 0); - des_htmlNodePtr(n_elem, elem, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlIsAutoClosed", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_elem); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlIsScriptAttribute(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - int ret_val; - xmlChar * name; /* an attribute name */ - int n_name; - - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - name = gen_const_xmlChar_ptr(n_name, 0); - - ret_val = htmlIsScriptAttribute((const xmlChar *)name); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlIsScriptAttribute", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_name); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlNewParserCtxt(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - htmlParserCtxtPtr ret_val; - - mem_base = xmlMemBlocks(); - - ret_val = htmlNewParserCtxt(); - desret_htmlParserCtxtPtr(ret_val); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlNewParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlNodeStatus(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - htmlStatus ret_val; - htmlNodePtr node; /* an htmlNodePtr in a tree */ - int n_node; - int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */ - int n_legacy; - - for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) { - for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) { - mem_base = xmlMemBlocks(); - node = gen_const_htmlNodePtr(n_node, 0); - legacy = gen_int(n_legacy, 1); - - ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy); - desret_htmlStatus(ret_val); - call_tests++; - des_const_htmlNodePtr(n_node, (const htmlNodePtr)node, 0); - des_int(n_legacy, legacy, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlNodeStatus", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_legacy); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlParseCharRef(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - int ret_val; - htmlParserCtxtPtr ctxt; /* an HTML parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); - - ret_val = htmlParseCharRef(ctxt); - desret_int(ret_val); - call_tests++; - des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlParseCharRef", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlParseChunk(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED) - int mem_base; - int ret_val; - htmlParserCtxtPtr ctxt; /* an HTML parser context */ - int n_ctxt; - char * chunk; /* an char array */ - int n_chunk; - int size; /* the size in byte of the chunk */ - int n_size; - int terminate; /* last chunk indicator */ - int n_terminate; - - for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { - for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) { - mem_base = xmlMemBlocks(); - ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); - chunk = gen_const_char_ptr(n_chunk, 1); - size = gen_int(n_size, 2); - terminate = gen_int(n_terminate, 3); - - ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate); - if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} - desret_int(ret_val); - call_tests++; - des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_char_ptr(n_chunk, (const char *)chunk, 1); - des_int(n_size, size, 2); - des_int(n_terminate, terminate, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlParseChunk", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_chunk); - printf(" %d", n_size); - printf(" %d", n_terminate); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlParseDoc(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - htmlDocPtr ret_val; - xmlChar * cur; /* a pointer to an array of xmlChar */ - int n_cur; - char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ - int n_encoding; - - for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlChar_ptr(n_cur, 0); - encoding = gen_const_char_ptr(n_encoding, 1); - - ret_val = htmlParseDoc(cur, (const char *)encoding); - desret_htmlDocPtr(ret_val); - call_tests++; - des_xmlChar_ptr(n_cur, cur, 0); - des_const_char_ptr(n_encoding, (const char *)encoding, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlParseDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_encoding); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlParseDocument(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - int ret_val; - htmlParserCtxtPtr ctxt; /* an HTML parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); - - ret_val = htmlParseDocument(ctxt); - if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} - desret_int(ret_val); - call_tests++; - des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlParseDocument", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlParseElement(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - htmlParserCtxtPtr ctxt; /* an HTML parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); - - htmlParseElement(ctxt); - call_tests++; - des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlParseElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlParseEntityRef(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - const htmlEntityDesc * ret_val; - htmlParserCtxtPtr ctxt; /* an HTML parser context */ - int n_ctxt; - xmlChar ** str; /* location to store the entity name */ - int n_str; - - for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) { - mem_base = xmlMemBlocks(); - ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); - str = gen_const_xmlChar_ptr_ptr(n_str, 1); - - ret_val = htmlParseEntityRef(ctxt, (const xmlChar **)str); - desret_const_htmlEntityDesc_ptr(ret_val); - call_tests++; - des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)str, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlParseEntityRef", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_str); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlParseFile(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - htmlDocPtr ret_val; - const char * filename; /* the filename */ - int n_filename; - char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ - int n_encoding; - - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - filename = gen_filepath(n_filename, 0); - encoding = gen_const_char_ptr(n_encoding, 1); - - ret_val = htmlParseFile(filename, (const char *)encoding); - desret_htmlDocPtr(ret_val); - call_tests++; - des_filepath(n_filename, filename, 0); - des_const_char_ptr(n_encoding, (const char *)encoding, 1); - xmlResetLastError(); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlReadDoc(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - htmlDocPtr ret_val; - xmlChar * cur; /* a pointer to a zero terminated string */ - int n_cur; - const char * URL; /* the base URL to use for the document */ - int n_URL; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of htmlParserOption(s) */ - int n_options; - - for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_int;n_options++) { - mem_base = xmlMemBlocks(); - cur = gen_const_xmlChar_ptr(n_cur, 0); - URL = gen_filepath(n_URL, 1); - encoding = gen_const_char_ptr(n_encoding, 2); - options = gen_int(n_options, 3); - - ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options); - desret_htmlDocPtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0); - des_filepath(n_URL, URL, 1); - des_const_char_ptr(n_encoding, (const char *)encoding, 2); - des_int(n_options, options, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlReadDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_URL); - printf(" %d", n_encoding); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlReadFile(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - htmlDocPtr ret_val; - const char * filename; /* a file or URL */ - int n_filename; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of htmlParserOption(s) */ - int n_options; - - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_int;n_options++) { - mem_base = xmlMemBlocks(); - filename = gen_filepath(n_filename, 0); - encoding = gen_const_char_ptr(n_encoding, 1); - options = gen_int(n_options, 2); - - ret_val = htmlReadFile(filename, (const char *)encoding, options); - desret_htmlDocPtr(ret_val); - call_tests++; - des_filepath(n_filename, filename, 0); - des_const_char_ptr(n_encoding, (const char *)encoding, 1); - des_int(n_options, options, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlReadFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf(" %d", n_encoding); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlReadMemory(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - htmlDocPtr ret_val; - char * buffer; /* a pointer to a char array */ - int n_buffer; - int size; /* the size of the array */ - int n_size; - const char * URL; /* the base URL to use for the document */ - int n_URL; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of htmlParserOption(s) */ - int n_options; - - for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_int;n_options++) { - mem_base = xmlMemBlocks(); - buffer = gen_const_char_ptr(n_buffer, 0); - size = gen_int(n_size, 1); - URL = gen_filepath(n_URL, 2); - encoding = gen_const_char_ptr(n_encoding, 3); - options = gen_int(n_options, 4); - - ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options); - desret_htmlDocPtr(ret_val); - call_tests++; - des_const_char_ptr(n_buffer, (const char *)buffer, 0); - des_int(n_size, size, 1); - des_filepath(n_URL, URL, 2); - des_const_char_ptr(n_encoding, (const char *)encoding, 3); - des_int(n_options, options, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlReadMemory", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buffer); - printf(" %d", n_size); - printf(" %d", n_URL); - printf(" %d", n_encoding); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlSAXParseDoc(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - htmlDocPtr ret_val; - xmlChar * cur; /* a pointer to an array of xmlChar */ - int n_cur; - char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ - int n_encoding; - htmlSAXHandlerPtr sax; /* the SAX handler block */ - int n_sax; - void * userData; /* if using SAX, this pointer will be provided on callbacks. */ - int n_userData; - - for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) { - for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlChar_ptr(n_cur, 0); - encoding = gen_const_char_ptr(n_encoding, 1); - sax = gen_htmlSAXHandlerPtr(n_sax, 2); - userData = gen_userdata(n_userData, 3); - - ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData); - desret_htmlDocPtr(ret_val); - call_tests++; - des_xmlChar_ptr(n_cur, cur, 0); - des_const_char_ptr(n_encoding, (const char *)encoding, 1); - des_htmlSAXHandlerPtr(n_sax, sax, 2); - des_userdata(n_userData, userData, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlSAXParseDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_encoding); - printf(" %d", n_sax); - printf(" %d", n_userData); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlSAXParseFile(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - htmlDocPtr ret_val; - const char * filename; /* the filename */ - int n_filename; - char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ - int n_encoding; - htmlSAXHandlerPtr sax; /* the SAX handler block */ - int n_sax; - void * userData; /* if using SAX, this pointer will be provided on callbacks. */ - int n_userData; - - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) { - for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) { - mem_base = xmlMemBlocks(); - filename = gen_filepath(n_filename, 0); - encoding = gen_const_char_ptr(n_encoding, 1); - sax = gen_htmlSAXHandlerPtr(n_sax, 2); - userData = gen_userdata(n_userData, 3); - - ret_val = htmlSAXParseFile(filename, (const char *)encoding, sax, userData); - desret_htmlDocPtr(ret_val); - call_tests++; - des_filepath(n_filename, filename, 0); - des_const_char_ptr(n_encoding, (const char *)encoding, 1); - des_htmlSAXHandlerPtr(n_sax, sax, 2); - des_userdata(n_userData, userData, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlSAXParseFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf(" %d", n_encoding); - printf(" %d", n_sax); - printf(" %d", n_userData); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlTagLookup(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - -static int -test_HTMLparser(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing HTMLparser : 32 of 38 functions ...\n"); - test_ret += test_UTF8ToHtml(); - test_ret += test_htmlAttrAllowed(); - test_ret += test_htmlAutoCloseTag(); - test_ret += test_htmlCreateMemoryParserCtxt(); - test_ret += test_htmlCreatePushParserCtxt(); - test_ret += test_htmlCtxtReadDoc(); - test_ret += test_htmlCtxtReadFile(); - test_ret += test_htmlCtxtReadMemory(); - test_ret += test_htmlCtxtReset(); - test_ret += test_htmlCtxtUseOptions(); - test_ret += test_htmlElementAllowedHere(); - test_ret += test_htmlElementStatusHere(); - test_ret += test_htmlEncodeEntities(); - test_ret += test_htmlEntityLookup(); - test_ret += test_htmlEntityValueLookup(); - test_ret += test_htmlHandleOmittedElem(); - test_ret += test_htmlIsAutoClosed(); - test_ret += test_htmlIsScriptAttribute(); - test_ret += test_htmlNewParserCtxt(); - test_ret += test_htmlNodeStatus(); - test_ret += test_htmlParseCharRef(); - test_ret += test_htmlParseChunk(); - test_ret += test_htmlParseDoc(); - test_ret += test_htmlParseDocument(); - test_ret += test_htmlParseElement(); - test_ret += test_htmlParseEntityRef(); - test_ret += test_htmlParseFile(); - test_ret += test_htmlReadDoc(); - test_ret += test_htmlReadFile(); - test_ret += test_htmlReadMemory(); - test_ret += test_htmlSAXParseDoc(); - test_ret += test_htmlSAXParseFile(); - test_ret += test_htmlTagLookup(); - - if (test_ret != 0) - printf("Module HTMLparser: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_htmlDocContentDumpFormatOutput(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlOutputBufferPtr buf; /* the HTML buffer output */ - int n_buf; - xmlDocPtr cur; /* the document */ - int n_cur; - char * encoding; /* the encoding string */ - int n_encoding; - int format; /* should formatting spaces been added */ - int n_format; - - for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { - for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_format = 0;n_format < gen_nb_int;n_format++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlOutputBufferPtr(n_buf, 0); - cur = gen_xmlDocPtr(n_cur, 1); - encoding = gen_const_char_ptr(n_encoding, 2); - format = gen_int(n_format, 3); - - htmlDocContentDumpFormatOutput(buf, cur, (const char *)encoding, format); - call_tests++; - des_xmlOutputBufferPtr(n_buf, buf, 0); - des_xmlDocPtr(n_cur, cur, 1); - des_const_char_ptr(n_encoding, (const char *)encoding, 2); - des_int(n_format, format, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_cur); - printf(" %d", n_encoding); - printf(" %d", n_format); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlDocContentDumpOutput(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlOutputBufferPtr buf; /* the HTML buffer output */ - int n_buf; - xmlDocPtr cur; /* the document */ - int n_cur; - char * encoding; /* the encoding string */ - int n_encoding; - - for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { - for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlOutputBufferPtr(n_buf, 0); - cur = gen_xmlDocPtr(n_cur, 1); - encoding = gen_const_char_ptr(n_encoding, 2); - - htmlDocContentDumpOutput(buf, cur, (const char *)encoding); - call_tests++; - des_xmlOutputBufferPtr(n_buf, buf, 0); - des_xmlDocPtr(n_cur, cur, 1); - des_const_char_ptr(n_encoding, (const char *)encoding, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlDocContentDumpOutput", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_cur); - printf(" %d", n_encoding); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlDocDump(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - FILE * f; /* the FILE* */ - int n_f; - xmlDocPtr cur; /* the document */ - int n_cur; - - for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) { - for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { - mem_base = xmlMemBlocks(); - f = gen_FILE_ptr(n_f, 0); - cur = gen_xmlDocPtr(n_cur, 1); - - ret_val = htmlDocDump(f, cur); - desret_int(ret_val); - call_tests++; - des_FILE_ptr(n_f, f, 0); - des_xmlDocPtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlDocDump", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_f); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -#define gen_nb_xmlChar_ptr_ptr 1 -static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_htmlDocDumpMemory(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlDocPtr cur; /* the document */ - int n_cur; - xmlChar ** mem; /* OUT: the memory pointer */ - int n_mem; - int * size; /* OUT: the memory length */ - int n_size; - - for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { - for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) { - for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlDocPtr(n_cur, 0); - mem = gen_xmlChar_ptr_ptr(n_mem, 1); - size = gen_int_ptr(n_size, 2); - - htmlDocDumpMemory(cur, mem, size); - call_tests++; - des_xmlDocPtr(n_cur, cur, 0); - des_xmlChar_ptr_ptr(n_mem, mem, 1); - des_int_ptr(n_size, size, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlDocDumpMemory", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_mem); - printf(" %d", n_size); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlDocDumpMemoryFormat(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlDocPtr cur; /* the document */ - int n_cur; - xmlChar ** mem; /* OUT: the memory pointer */ - int n_mem; - int * size; /* OUT: the memory length */ - int n_size; - int format; /* should formatting spaces been added */ - int n_format; - - for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { - for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) { - for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) { - for (n_format = 0;n_format < gen_nb_int;n_format++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlDocPtr(n_cur, 0); - mem = gen_xmlChar_ptr_ptr(n_mem, 1); - size = gen_int_ptr(n_size, 2); - format = gen_int(n_format, 3); - - htmlDocDumpMemoryFormat(cur, mem, size, format); - call_tests++; - des_xmlDocPtr(n_cur, cur, 0); - des_xmlChar_ptr_ptr(n_mem, mem, 1); - des_int_ptr(n_size, size, 2); - des_int(n_format, format, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlDocDumpMemoryFormat", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_mem); - printf(" %d", n_size); - printf(" %d", n_format); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlGetMetaEncoding(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - const xmlChar * ret_val; - htmlDocPtr doc; /* the document */ - int n_doc; - - for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - doc = gen_htmlDocPtr(n_doc, 0); - - ret_val = htmlGetMetaEncoding(doc); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_htmlDocPtr(n_doc, doc, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlGetMetaEncoding", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlIsBooleanAttr(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - int ret_val; - xmlChar * name; /* the name of the attribute to check */ - int n_name; - - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - name = gen_const_xmlChar_ptr(n_name, 0); - - ret_val = htmlIsBooleanAttr((const xmlChar *)name); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlIsBooleanAttr", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_name); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlNewDoc(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - htmlDocPtr ret_val; - xmlChar * URI; /* URI for the dtd, or NULL */ - int n_URI; - xmlChar * ExternalID; /* the external ID of the DTD, or NULL */ - int n_ExternalID; - - for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { - for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { - mem_base = xmlMemBlocks(); - URI = gen_const_xmlChar_ptr(n_URI, 0); - ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1); - - ret_val = htmlNewDoc((const xmlChar *)URI, (const xmlChar *)ExternalID); - desret_htmlDocPtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0); - des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlNewDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URI); - printf(" %d", n_ExternalID); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlNewDocNoDtD(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - htmlDocPtr ret_val; - xmlChar * URI; /* URI for the dtd, or NULL */ - int n_URI; - xmlChar * ExternalID; /* the external ID of the DTD, or NULL */ - int n_ExternalID; - - for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { - for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { - mem_base = xmlMemBlocks(); - URI = gen_const_xmlChar_ptr(n_URI, 0); - ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1); - - ret_val = htmlNewDocNoDtD((const xmlChar *)URI, (const xmlChar *)ExternalID); - desret_htmlDocPtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0); - des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlNewDocNoDtD", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URI); - printf(" %d", n_ExternalID); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlNodeDump(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - xmlBufferPtr buf; /* the HTML buffer output */ - int n_buf; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNodePtr cur; /* the current node */ - int n_cur; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - doc = gen_xmlDocPtr(n_doc, 1); - cur = gen_xmlNodePtr(n_cur, 2); - - ret_val = htmlNodeDump(buf, doc, cur); - desret_int(ret_val); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_cur, cur, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlNodeDump", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_doc); - printf(" %d", n_cur); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlNodeDumpFile(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - FILE * out; /* the FILE pointer */ - int n_out; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNodePtr cur; /* the current node */ - int n_cur; - - for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - out = gen_FILE_ptr(n_out, 0); - doc = gen_xmlDocPtr(n_doc, 1); - cur = gen_xmlNodePtr(n_cur, 2); - - htmlNodeDumpFile(out, doc, cur); - call_tests++; - des_FILE_ptr(n_out, out, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_cur, cur, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlNodeDumpFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_out); - printf(" %d", n_doc); - printf(" %d", n_cur); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlNodeDumpFileFormat(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - FILE * out; /* the FILE pointer */ - int n_out; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNodePtr cur; /* the current node */ - int n_cur; - char * encoding; /* the document encoding */ - int n_encoding; - int format; /* should formatting spaces been added */ - int n_format; - - for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_format = 0;n_format < gen_nb_int;n_format++) { - mem_base = xmlMemBlocks(); - out = gen_FILE_ptr(n_out, 0); - doc = gen_xmlDocPtr(n_doc, 1); - cur = gen_xmlNodePtr(n_cur, 2); - encoding = gen_const_char_ptr(n_encoding, 3); - format = gen_int(n_format, 4); - - ret_val = htmlNodeDumpFileFormat(out, doc, cur, (const char *)encoding, format); - desret_int(ret_val); - call_tests++; - des_FILE_ptr(n_out, out, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_cur, cur, 2); - des_const_char_ptr(n_encoding, (const char *)encoding, 3); - des_int(n_format, format, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlNodeDumpFileFormat", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_out); - printf(" %d", n_doc); - printf(" %d", n_cur); - printf(" %d", n_encoding); - printf(" %d", n_format); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlNodeDumpFormatOutput(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlOutputBufferPtr buf; /* the HTML buffer output */ - int n_buf; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNodePtr cur; /* the current node */ - int n_cur; - char * encoding; /* the encoding string */ - int n_encoding; - int format; /* should formatting spaces been added */ - int n_format; - - for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_format = 0;n_format < gen_nb_int;n_format++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlOutputBufferPtr(n_buf, 0); - doc = gen_xmlDocPtr(n_doc, 1); - cur = gen_xmlNodePtr(n_cur, 2); - encoding = gen_const_char_ptr(n_encoding, 3); - format = gen_int(n_format, 4); - - htmlNodeDumpFormatOutput(buf, doc, cur, (const char *)encoding, format); - call_tests++; - des_xmlOutputBufferPtr(n_buf, buf, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_cur, cur, 2); - des_const_char_ptr(n_encoding, (const char *)encoding, 3); - des_int(n_format, format, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlNodeDumpFormatOutput", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_doc); - printf(" %d", n_cur); - printf(" %d", n_encoding); - printf(" %d", n_format); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlNodeDumpOutput(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlOutputBufferPtr buf; /* the HTML buffer output */ - int n_buf; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNodePtr cur; /* the current node */ - int n_cur; - char * encoding; /* the encoding string */ - int n_encoding; - - for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlOutputBufferPtr(n_buf, 0); - doc = gen_xmlDocPtr(n_doc, 1); - cur = gen_xmlNodePtr(n_cur, 2); - encoding = gen_const_char_ptr(n_encoding, 3); - - htmlNodeDumpOutput(buf, doc, cur, (const char *)encoding); - call_tests++; - des_xmlOutputBufferPtr(n_buf, buf, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_cur, cur, 2); - des_const_char_ptr(n_encoding, (const char *)encoding, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlNodeDumpOutput", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_doc); - printf(" %d", n_cur); - printf(" %d", n_encoding); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlSaveFile(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - const char * filename; /* the filename (or URL) */ - int n_filename; - xmlDocPtr cur; /* the document */ - int n_cur; - - for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { - for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { - mem_base = xmlMemBlocks(); - filename = gen_fileoutput(n_filename, 0); - cur = gen_xmlDocPtr(n_cur, 1); - - ret_val = htmlSaveFile(filename, cur); - desret_int(ret_val); - call_tests++; - des_fileoutput(n_filename, filename, 0); - des_xmlDocPtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlSaveFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlSaveFileEnc(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - const char * filename; /* the filename */ - int n_filename; - xmlDocPtr cur; /* the document */ - int n_cur; - char * encoding; /* the document encoding */ - int n_encoding; - - for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { - for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - mem_base = xmlMemBlocks(); - filename = gen_fileoutput(n_filename, 0); - cur = gen_xmlDocPtr(n_cur, 1); - encoding = gen_const_char_ptr(n_encoding, 2); - - ret_val = htmlSaveFileEnc(filename, cur, (const char *)encoding); - desret_int(ret_val); - call_tests++; - des_fileoutput(n_filename, filename, 0); - des_xmlDocPtr(n_cur, cur, 1); - des_const_char_ptr(n_encoding, (const char *)encoding, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlSaveFileEnc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf(" %d", n_cur); - printf(" %d", n_encoding); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlSaveFileFormat(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - const char * filename; /* the filename */ - int n_filename; - xmlDocPtr cur; /* the document */ - int n_cur; - char * encoding; /* the document encoding */ - int n_encoding; - int format; /* should formatting spaces been added */ - int n_format; - - for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { - for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_format = 0;n_format < gen_nb_int;n_format++) { - mem_base = xmlMemBlocks(); - filename = gen_fileoutput(n_filename, 0); - cur = gen_xmlDocPtr(n_cur, 1); - encoding = gen_const_char_ptr(n_encoding, 2); - format = gen_int(n_format, 3); - - ret_val = htmlSaveFileFormat(filename, cur, (const char *)encoding, format); - desret_int(ret_val); - call_tests++; - des_fileoutput(n_filename, filename, 0); - des_xmlDocPtr(n_cur, cur, 1); - des_const_char_ptr(n_encoding, (const char *)encoding, 2); - des_int(n_format, format, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlSaveFileFormat", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf(" %d", n_cur); - printf(" %d", n_encoding); - printf(" %d", n_format); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlSetMetaEncoding(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - int ret_val; - htmlDocPtr doc; /* the document */ - int n_doc; - xmlChar * encoding; /* the encoding string */ - int n_encoding; - - for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { - for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) { - mem_base = xmlMemBlocks(); - doc = gen_htmlDocPtr(n_doc, 0); - encoding = gen_const_xmlChar_ptr(n_encoding, 1); - - ret_val = htmlSetMetaEncoding(doc, (const xmlChar *)encoding); - desret_int(ret_val); - call_tests++; - des_htmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_encoding, (const xmlChar *)encoding, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlSetMetaEncoding", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_encoding); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_HTMLtree(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing HTMLtree : 18 of 18 functions ...\n"); - test_ret += test_htmlDocContentDumpFormatOutput(); - test_ret += test_htmlDocContentDumpOutput(); - test_ret += test_htmlDocDump(); - test_ret += test_htmlDocDumpMemory(); - test_ret += test_htmlDocDumpMemoryFormat(); - test_ret += test_htmlGetMetaEncoding(); - test_ret += test_htmlIsBooleanAttr(); - test_ret += test_htmlNewDoc(); - test_ret += test_htmlNewDocNoDtD(); - test_ret += test_htmlNodeDump(); - test_ret += test_htmlNodeDumpFile(); - test_ret += test_htmlNodeDumpFileFormat(); - test_ret += test_htmlNodeDumpFormatOutput(); - test_ret += test_htmlNodeDumpOutput(); - test_ret += test_htmlSaveFile(); - test_ret += test_htmlSaveFileEnc(); - test_ret += test_htmlSaveFileFormat(); - test_ret += test_htmlSetMetaEncoding(); - - if (test_ret != 0) - printf("Module HTMLtree: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_docbDefaultSAXHandlerInit(void) { - int test_ret = 0; - -#if defined(LIBXML_DOCB_ENABLED) -#ifdef LIBXML_DOCB_ENABLED - int mem_base; - - mem_base = xmlMemBlocks(); - - docbDefaultSAXHandlerInit(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in docbDefaultSAXHandlerInit", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_htmlDefaultSAXHandlerInit(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) -#ifdef LIBXML_HTML_ENABLED - int mem_base; - - mem_base = xmlMemBlocks(); - - htmlDefaultSAXHandlerInit(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlDefaultSAXHandlerInit(void) { - int test_ret = 0; - - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlDefaultSAXHandlerInit(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; - - return(test_ret); -} - - -#define gen_nb_xmlEnumerationPtr 1 -static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlSAX2AttributeDecl(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * elem; /* the name of the element */ - int n_elem; - xmlChar * fullname; /* the attribute name */ - int n_fullname; - int type; /* the attribute type */ - int n_type; - int def; /* the type of default value */ - int n_def; - xmlChar * defaultValue; /* the attribute default value */ - int n_defaultValue; - xmlEnumerationPtr tree; /* the tree of enumerated value set */ - int n_tree; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) { - for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) { - for (n_type = 0;n_type < gen_nb_int;n_type++) { - for (n_def = 0;n_def < gen_nb_int;n_def++) { - for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) { - for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - elem = gen_const_xmlChar_ptr(n_elem, 1); - fullname = gen_const_xmlChar_ptr(n_fullname, 2); - type = gen_int(n_type, 3); - def = gen_int(n_def, 4); - defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5); - tree = gen_xmlEnumerationPtr(n_tree, 6); - - xmlSAX2AttributeDecl(ctx, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1); - des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2); - des_int(n_type, type, 3); - des_int(n_def, def, 4); - des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 5); - des_xmlEnumerationPtr(n_tree, tree, 6); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2AttributeDecl", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_elem); - printf(" %d", n_fullname); - printf(" %d", n_type); - printf(" %d", n_def); - printf(" %d", n_defaultValue); - printf(" %d", n_tree); - printf("\n"); - } - } - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2CDataBlock(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * value; /* The pcdata content */ - int n_value; - int len; /* the block length */ - int n_len; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - value = gen_const_xmlChar_ptr(n_value, 1); - len = gen_int(n_len, 2); - - xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2CDataBlock", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_value); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2Characters(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * ch; /* a xmlChar string */ - int n_ch; - int len; /* the number of xmlChar */ - int n_len; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - ch = gen_const_xmlChar_ptr(n_ch, 1); - len = gen_int(n_len, 2); - - xmlSAX2Characters(ctx, (const xmlChar *)ch, len); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2Characters", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_ch); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2Comment(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * value; /* the xmlSAX2Comment content */ - int n_value; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - value = gen_const_xmlChar_ptr(n_value, 1); - - xmlSAX2Comment(ctx, (const xmlChar *)value); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2Comment", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_value); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2ElementDecl(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * name; /* the element name */ - int n_name; - int type; /* the element type */ - int n_type; - xmlElementContentPtr content; /* the element value tree */ - int n_content; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_type = 0;n_type < gen_nb_int;n_type++) { - for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - type = gen_int(n_type, 2); - content = gen_xmlElementContentPtr(n_content, 3); - - xmlSAX2ElementDecl(ctx, (const xmlChar *)name, type, content); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_int(n_type, type, 2); - des_xmlElementContentPtr(n_content, content, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2ElementDecl", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_name); - printf(" %d", n_type); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2EndDocument(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - - xmlSAX2EndDocument(ctx); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2EndDocument", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2EndElement(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * name; /* The element name */ - int n_name; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - xmlSAX2EndElement(ctx, (const xmlChar *)name); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2EndElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlSAX2EndElementNs(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * localname; /* the local name of the element */ - int n_localname; - xmlChar * prefix; /* the element namespace prefix if available */ - int n_prefix; - xmlChar * URI; /* the element namespace name if available */ - int n_URI; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) { - for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { - for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - localname = gen_const_xmlChar_ptr(n_localname, 1); - prefix = gen_const_xmlChar_ptr(n_prefix, 2); - URI = gen_const_xmlChar_ptr(n_URI, 3); - - xmlSAX2EndElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1); - des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2); - des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2EndElementNs", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_localname); - printf(" %d", n_prefix); - printf(" %d", n_URI); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2EntityDecl(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * name; /* the entity name */ - int n_name; - int type; /* the entity type */ - int n_type; - xmlChar * publicId; /* The public ID of the entity */ - int n_publicId; - xmlChar * systemId; /* The system ID of the entity */ - int n_systemId; - xmlChar * content; /* the entity value (without processing). */ - int n_content; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_type = 0;n_type < gen_nb_int;n_type++) { - for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { - for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { - for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - type = gen_int(n_type, 2); - publicId = gen_const_xmlChar_ptr(n_publicId, 3); - systemId = gen_const_xmlChar_ptr(n_systemId, 4); - content = gen_xmlChar_ptr(n_content, 5); - - xmlSAX2EntityDecl(ctx, (const xmlChar *)name, type, (const xmlChar *)publicId, (const xmlChar *)systemId, content); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_int(n_type, type, 2); - des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 3); - des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 4); - des_xmlChar_ptr(n_content, content, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2EntityDecl", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_name); - printf(" %d", n_type); - printf(" %d", n_publicId); - printf(" %d", n_systemId); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2ExternalSubset(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * name; /* the root element name */ - int n_name; - xmlChar * ExternalID; /* the external ID */ - int n_ExternalID; - xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */ - int n_SystemID; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { - for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2); - SystemID = gen_const_xmlChar_ptr(n_SystemID, 3); - - xmlSAX2ExternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2); - des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2ExternalSubset", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_name); - printf(" %d", n_ExternalID); - printf(" %d", n_SystemID); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2GetColumnNumber(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - - ret_val = xmlSAX2GetColumnNumber(ctx); - desret_int(ret_val); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2GetColumnNumber", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2GetEntity(void) { - int test_ret = 0; - - int mem_base; - xmlEntityPtr ret_val; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * name; /* The entity name */ - int n_name; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlSAX2GetEntity(ctx, (const xmlChar *)name); - desret_xmlEntityPtr(ret_val); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2GetEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2GetLineNumber(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - - ret_val = xmlSAX2GetLineNumber(ctx); - desret_int(ret_val); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2GetLineNumber", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2GetParameterEntity(void) { - int test_ret = 0; - - int mem_base; - xmlEntityPtr ret_val; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * name; /* The entity name */ - int n_name; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlSAX2GetParameterEntity(ctx, (const xmlChar *)name); - desret_xmlEntityPtr(ret_val); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2GetParameterEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2GetPublicId(void) { - int test_ret = 0; - - int mem_base; - const xmlChar * ret_val; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - - ret_val = xmlSAX2GetPublicId(ctx); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2GetPublicId", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2GetSystemId(void) { - int test_ret = 0; - - int mem_base; - const xmlChar * ret_val; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - - ret_val = xmlSAX2GetSystemId(ctx); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2GetSystemId", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2HasExternalSubset(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - - ret_val = xmlSAX2HasExternalSubset(ctx); - desret_int(ret_val); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2HasExternalSubset", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2HasInternalSubset(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - - ret_val = xmlSAX2HasInternalSubset(ctx); - desret_int(ret_val); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2HasInternalSubset", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2IgnorableWhitespace(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * ch; /* a xmlChar string */ - int n_ch; - int len; /* the number of xmlChar */ - int n_len; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - ch = gen_const_xmlChar_ptr(n_ch, 1); - len = gen_int(n_len, 2); - - xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_ch); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -#define gen_nb_xmlSAXHandler_ptr 1 -static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlSAX2InitDefaultSAXHandler(void) { - int test_ret = 0; - - int mem_base; - xmlSAXHandler * hdlr; /* the SAX handler */ - int n_hdlr; - int warning; /* flag if non-zero sets the handler warning procedure */ - int n_warning; - - for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { - for (n_warning = 0;n_warning < gen_nb_int;n_warning++) { - mem_base = xmlMemBlocks(); - hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); - warning = gen_int(n_warning, 1); - - xmlSAX2InitDefaultSAXHandler(hdlr, warning); - call_tests++; - des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); - des_int(n_warning, warning, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_hdlr); - printf(" %d", n_warning); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2InitDocbDefaultSAXHandler(void) { - int test_ret = 0; - -#if defined(LIBXML_DOCB_ENABLED) - int mem_base; - xmlSAXHandler * hdlr; /* the SAX handler */ - int n_hdlr; - - for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { - mem_base = xmlMemBlocks(); - hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); - - xmlSAX2InitDocbDefaultSAXHandler(hdlr); - call_tests++; - des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_hdlr); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSAX2InitHtmlDefaultSAXHandler(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - xmlSAXHandler * hdlr; /* the SAX handler */ - int n_hdlr; - - for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { - mem_base = xmlMemBlocks(); - hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); - - xmlSAX2InitHtmlDefaultSAXHandler(hdlr); - call_tests++; - des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_hdlr); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSAX2InternalSubset(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * name; /* the root element name */ - int n_name; - xmlChar * ExternalID; /* the external ID */ - int n_ExternalID; - xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */ - int n_SystemID; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { - for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2); - SystemID = gen_const_xmlChar_ptr(n_SystemID, 3); - - xmlSAX2InternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2); - des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2InternalSubset", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_name); - printf(" %d", n_ExternalID); - printf(" %d", n_SystemID); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2IsStandalone(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - - ret_val = xmlSAX2IsStandalone(ctx); - desret_int(ret_val); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2IsStandalone", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2NotationDecl(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * name; /* The name of the notation */ - int n_name; - xmlChar * publicId; /* The public ID of the entity */ - int n_publicId; - xmlChar * systemId; /* The system ID of the entity */ - int n_systemId; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { - for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - publicId = gen_const_xmlChar_ptr(n_publicId, 2); - systemId = gen_const_xmlChar_ptr(n_systemId, 3); - - xmlSAX2NotationDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2); - des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2NotationDecl", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_name); - printf(" %d", n_publicId); - printf(" %d", n_systemId); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2ProcessingInstruction(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * target; /* the target name */ - int n_target; - xmlChar * data; /* the PI data's */ - int n_data; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) { - for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - target = gen_const_xmlChar_ptr(n_target, 1); - data = gen_const_xmlChar_ptr(n_data, 2); - - xmlSAX2ProcessingInstruction(ctx, (const xmlChar *)target, (const xmlChar *)data); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1); - des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_target); - printf(" %d", n_data); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2Reference(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * name; /* The entity name */ - int n_name; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - xmlSAX2Reference(ctx, (const xmlChar *)name); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2Reference", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2ResolveEntity(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputPtr ret_val; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * publicId; /* The public ID of the entity */ - int n_publicId; - xmlChar * systemId; /* The system ID of the entity */ - int n_systemId; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { - for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - publicId = gen_const_xmlChar_ptr(n_publicId, 1); - systemId = gen_const_xmlChar_ptr(n_systemId, 2); - - ret_val = xmlSAX2ResolveEntity(ctx, (const xmlChar *)publicId, (const xmlChar *)systemId); - desret_xmlParserInputPtr(ret_val); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 1); - des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2ResolveEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_publicId); - printf(" %d", n_systemId); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -#define gen_nb_xmlSAXLocatorPtr 1 -static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlSAX2SetDocumentLocator(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlSAXLocatorPtr loc; /* A SAX Locator */ - int n_loc; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - loc = gen_xmlSAXLocatorPtr(n_loc, 1); - - xmlSAX2SetDocumentLocator(ctx, loc); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_xmlSAXLocatorPtr(n_loc, loc, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_loc); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2StartDocument(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - - xmlSAX2StartDocument(ctx); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2StartDocument", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2StartElement(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * fullname; /* The element name, including namespace prefix */ - int n_fullname; - xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */ - int n_atts; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) { - for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - fullname = gen_const_xmlChar_ptr(n_fullname, 1); - atts = gen_const_xmlChar_ptr_ptr(n_atts, 2); - - xmlSAX2StartElement(ctx, (const xmlChar *)fullname, (const xmlChar **)atts); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 1); - des_const_xmlChar_ptr_ptr(n_atts, (const xmlChar **)atts, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2StartElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_fullname); - printf(" %d", n_atts); - printf("\n"); - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlSAX2StartElementNs(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * localname; /* the local name of the element */ - int n_localname; - xmlChar * prefix; /* the element namespace prefix if available */ - int n_prefix; - xmlChar * URI; /* the element namespace name if available */ - int n_URI; - int nb_namespaces; /* number of namespace definitions on that node */ - int n_nb_namespaces; - xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */ - int n_namespaces; - int nb_attributes; /* the number of attributes on that node */ - int n_nb_attributes; - int nb_defaulted; /* the number of defaulted attributes. */ - int n_nb_defaulted; - xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */ - int n_attributes; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) { - for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { - for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { - for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) { - for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) { - for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) { - for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) { - for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - localname = gen_const_xmlChar_ptr(n_localname, 1); - prefix = gen_const_xmlChar_ptr(n_prefix, 2); - URI = gen_const_xmlChar_ptr(n_URI, 3); - nb_namespaces = gen_int(n_nb_namespaces, 4); - namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5); - nb_attributes = gen_int(n_nb_attributes, 6); - nb_defaulted = gen_int(n_nb_defaulted, 7); - attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8); - - xmlSAX2StartElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI, nb_namespaces, (const xmlChar **)namespaces, nb_attributes, nb_defaulted, (const xmlChar **)attributes); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1); - des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2); - des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3); - des_int(n_nb_namespaces, nb_namespaces, 4); - des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 5); - des_int(n_nb_attributes, nb_attributes, 6); - des_int(n_nb_defaulted, nb_defaulted, 7); - des_const_xmlChar_ptr_ptr(n_attributes, (const xmlChar **)attributes, 8); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2StartElementNs", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_localname); - printf(" %d", n_prefix); - printf(" %d", n_URI); - printf(" %d", n_nb_namespaces); - printf(" %d", n_namespaces); - printf(" %d", n_nb_attributes); - printf(" %d", n_nb_defaulted); - printf(" %d", n_attributes); - printf("\n"); - } - } - } - } - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAX2UnparsedEntityDecl(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* the user data (XML parser context) */ - int n_ctx; - xmlChar * name; /* The name of the entity */ - int n_name; - xmlChar * publicId; /* The public ID of the entity */ - int n_publicId; - xmlChar * systemId; /* The system ID of the entity */ - int n_systemId; - xmlChar * notationName; /* the name of the notation */ - int n_notationName; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { - for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { - for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - publicId = gen_const_xmlChar_ptr(n_publicId, 2); - systemId = gen_const_xmlChar_ptr(n_systemId, 3); - notationName = gen_const_xmlChar_ptr(n_notationName, 4); - - xmlSAX2UnparsedEntityDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId, (const xmlChar *)notationName); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2); - des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3); - des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_name); - printf(" %d", n_publicId); - printf(" %d", n_systemId); - printf(" %d", n_notationName); - printf("\n"); - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSAXDefaultVersion(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - int ret_val; - int version; /* the version, 1 or 2 */ - int n_version; - - for (n_version = 0;n_version < gen_nb_int;n_version++) { - mem_base = xmlMemBlocks(); - version = gen_int(n_version, 0); - - ret_val = xmlSAXDefaultVersion(version); - desret_int(ret_val); - call_tests++; - des_int(n_version, version, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAXDefaultVersion", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_version); - printf("\n"); - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlSAXVersion(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlSAXHandler * hdlr; /* the SAX handler */ - int n_hdlr; - int version; /* the version, 1 or 2 */ - int n_version; - - for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { - for (n_version = 0;n_version < gen_nb_int;n_version++) { - mem_base = xmlMemBlocks(); - hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); - version = gen_int(n_version, 1); - - ret_val = xmlSAXVersion(hdlr, version); - desret_int(ret_val); - call_tests++; - des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); - des_int(n_version, version, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAXVersion", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_hdlr); - printf(" %d", n_version); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - -static int -test_SAX2(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n"); - test_ret += test_docbDefaultSAXHandlerInit(); - test_ret += test_htmlDefaultSAXHandlerInit(); - test_ret += test_xmlDefaultSAXHandlerInit(); - test_ret += test_xmlSAX2AttributeDecl(); - test_ret += test_xmlSAX2CDataBlock(); - test_ret += test_xmlSAX2Characters(); - test_ret += test_xmlSAX2Comment(); - test_ret += test_xmlSAX2ElementDecl(); - test_ret += test_xmlSAX2EndDocument(); - test_ret += test_xmlSAX2EndElement(); - test_ret += test_xmlSAX2EndElementNs(); - test_ret += test_xmlSAX2EntityDecl(); - test_ret += test_xmlSAX2ExternalSubset(); - test_ret += test_xmlSAX2GetColumnNumber(); - test_ret += test_xmlSAX2GetEntity(); - test_ret += test_xmlSAX2GetLineNumber(); - test_ret += test_xmlSAX2GetParameterEntity(); - test_ret += test_xmlSAX2GetPublicId(); - test_ret += test_xmlSAX2GetSystemId(); - test_ret += test_xmlSAX2HasExternalSubset(); - test_ret += test_xmlSAX2HasInternalSubset(); - test_ret += test_xmlSAX2IgnorableWhitespace(); - test_ret += test_xmlSAX2InitDefaultSAXHandler(); - test_ret += test_xmlSAX2InitDocbDefaultSAXHandler(); - test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler(); - test_ret += test_xmlSAX2InternalSubset(); - test_ret += test_xmlSAX2IsStandalone(); - test_ret += test_xmlSAX2NotationDecl(); - test_ret += test_xmlSAX2ProcessingInstruction(); - test_ret += test_xmlSAX2Reference(); - test_ret += test_xmlSAX2ResolveEntity(); - test_ret += test_xmlSAX2SetDocumentLocator(); - test_ret += test_xmlSAX2StartDocument(); - test_ret += test_xmlSAX2StartElement(); - test_ret += test_xmlSAX2StartElementNs(); - test_ret += test_xmlSAX2UnparsedEntityDecl(); - test_ret += test_xmlSAXDefaultVersion(); - test_ret += test_xmlSAXVersion(); - - if (test_ret != 0) - printf("Module SAX2: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlC14NDocDumpMemory(void) { - int test_ret = 0; - -#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - xmlDocPtr doc; /* the XML document for canonization */ - int n_doc; - xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */ - int n_nodes; - int mode; /* the c14n mode (see @xmlC14NMode) */ - int n_mode; - xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */ - int n_inclusive_ns_prefixes; - int with_comments; /* include comments in the result (!=0) or not (==0) */ - int n_with_comments; - xmlChar ** doc_txt_ptr; /* the memory pointer for allocated canonical XML text; the caller of this functions is responsible for calling xmlFree() to free allocated memory */ - int n_doc_txt_ptr; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { - for (n_mode = 0;n_mode < gen_nb_int;n_mode++) { - for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) { - for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) { - for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - nodes = gen_xmlNodeSetPtr(n_nodes, 1); - mode = gen_int(n_mode, 2); - inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3); - with_comments = gen_int(n_with_comments, 4); - doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5); - - ret_val = xmlC14NDocDumpMemory(doc, nodes, mode, inclusive_ns_prefixes, with_comments, doc_txt_ptr); - desret_int(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlNodeSetPtr(n_nodes, nodes, 1); - des_int(n_mode, mode, 2); - des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3); - des_int(n_with_comments, with_comments, 4); - des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlC14NDocDumpMemory", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_nodes); - printf(" %d", n_mode); - printf(" %d", n_inclusive_ns_prefixes); - printf(" %d", n_with_comments); - printf(" %d", n_doc_txt_ptr); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlC14NDocSave(void) { - int test_ret = 0; - -#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - xmlDocPtr doc; /* the XML document for canonization */ - int n_doc; - xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */ - int n_nodes; - int mode; /* the c14n mode (see @xmlC14NMode) */ - int n_mode; - xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */ - int n_inclusive_ns_prefixes; - int with_comments; /* include comments in the result (!=0) or not (==0) */ - int n_with_comments; - const char * filename; /* the filename to store canonical XML image */ - int n_filename; - int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */ - int n_compression; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { - for (n_mode = 0;n_mode < gen_nb_int;n_mode++) { - for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) { - for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) { - for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { - for (n_compression = 0;n_compression < gen_nb_int;n_compression++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - nodes = gen_xmlNodeSetPtr(n_nodes, 1); - mode = gen_int(n_mode, 2); - inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3); - with_comments = gen_int(n_with_comments, 4); - filename = gen_fileoutput(n_filename, 5); - compression = gen_int(n_compression, 6); - - ret_val = xmlC14NDocSave(doc, nodes, mode, inclusive_ns_prefixes, with_comments, filename, compression); - desret_int(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlNodeSetPtr(n_nodes, nodes, 1); - des_int(n_mode, mode, 2); - des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3); - des_int(n_with_comments, with_comments, 4); - des_fileoutput(n_filename, filename, 5); - des_int(n_compression, compression, 6); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlC14NDocSave", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_nodes); - printf(" %d", n_mode); - printf(" %d", n_inclusive_ns_prefixes); - printf(" %d", n_with_comments); - printf(" %d", n_filename); - printf(" %d", n_compression); - printf("\n"); - } - } - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlC14NDocSaveTo(void) { - int test_ret = 0; - -#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - xmlDocPtr doc; /* the XML document for canonization */ - int n_doc; - xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */ - int n_nodes; - int mode; /* the c14n mode (see @xmlC14NMode) */ - int n_mode; - xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */ - int n_inclusive_ns_prefixes; - int with_comments; /* include comments in the result (!=0) or not (==0) */ - int n_with_comments; - xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */ - int n_buf; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { - for (n_mode = 0;n_mode < gen_nb_int;n_mode++) { - for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) { - for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) { - for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - nodes = gen_xmlNodeSetPtr(n_nodes, 1); - mode = gen_int(n_mode, 2); - inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3); - with_comments = gen_int(n_with_comments, 4); - buf = gen_xmlOutputBufferPtr(n_buf, 5); - - ret_val = xmlC14NDocSaveTo(doc, nodes, mode, inclusive_ns_prefixes, with_comments, buf); - desret_int(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlNodeSetPtr(n_nodes, nodes, 1); - des_int(n_mode, mode, 2); - des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3); - des_int(n_with_comments, with_comments, 4); - des_xmlOutputBufferPtr(n_buf, buf, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlC14NDocSaveTo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_nodes); - printf(" %d", n_mode); - printf(" %d", n_inclusive_ns_prefixes); - printf(" %d", n_with_comments); - printf(" %d", n_buf); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlC14NExecute(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - -static int -test_c14n(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n"); - test_ret += test_xmlC14NDocDumpMemory(); - test_ret += test_xmlC14NDocSave(); - test_ret += test_xmlC14NDocSaveTo(); - test_ret += test_xmlC14NExecute(); - - if (test_ret != 0) - printf("Module c14n: %d errors\n", test_ret); - return(test_ret); -} -#ifdef LIBXML_CATALOG_ENABLED - -#define gen_nb_xmlCatalogPtr 1 -static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlACatalogAdd(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - int ret_val; - xmlCatalogPtr catal; /* a Catalog */ - int n_catal; - xmlChar * type; /* the type of record to add to the catalog */ - int n_type; - xmlChar * orig; /* the system, public or prefix to match */ - int n_orig; - xmlChar * replace; /* the replacement value for the match */ - int n_replace; - - for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { - for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) { - for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) { - for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) { - mem_base = xmlMemBlocks(); - catal = gen_xmlCatalogPtr(n_catal, 0); - type = gen_const_xmlChar_ptr(n_type, 1); - orig = gen_const_xmlChar_ptr(n_orig, 2); - replace = gen_const_xmlChar_ptr(n_replace, 3); - - ret_val = xmlACatalogAdd(catal, (const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace); - desret_int(ret_val); - call_tests++; - des_xmlCatalogPtr(n_catal, catal, 0); - des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 1); - des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 2); - des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlACatalogAdd", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_catal); - printf(" %d", n_type); - printf(" %d", n_orig); - printf(" %d", n_replace); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlACatalogDump(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlCatalogPtr catal; /* a Catalog */ - int n_catal; - FILE * out; /* the file. */ - int n_out; - - for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { - for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { - mem_base = xmlMemBlocks(); - catal = gen_xmlCatalogPtr(n_catal, 0); - out = gen_FILE_ptr(n_out, 1); - - xmlACatalogDump(catal, out); - call_tests++; - des_xmlCatalogPtr(n_catal, catal, 0); - des_FILE_ptr(n_out, out, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlACatalogDump", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_catal); - printf(" %d", n_out); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlACatalogRemove(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - int ret_val; - xmlCatalogPtr catal; /* a Catalog */ - int n_catal; - xmlChar * value; /* the value to remove */ - int n_value; - - for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - catal = gen_xmlCatalogPtr(n_catal, 0); - value = gen_const_xmlChar_ptr(n_value, 1); - - ret_val = xmlACatalogRemove(catal, (const xmlChar *)value); - desret_int(ret_val); - call_tests++; - des_xmlCatalogPtr(n_catal, catal, 0); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlACatalogRemove", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_catal); - printf(" %d", n_value); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlACatalogResolve(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlCatalogPtr catal; /* a Catalog */ - int n_catal; - xmlChar * pubID; /* the public ID string */ - int n_pubID; - xmlChar * sysID; /* the system ID string */ - int n_sysID; - - for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { - for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { - for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { - mem_base = xmlMemBlocks(); - catal = gen_xmlCatalogPtr(n_catal, 0); - pubID = gen_const_xmlChar_ptr(n_pubID, 1); - sysID = gen_const_xmlChar_ptr(n_sysID, 2); - - ret_val = xmlACatalogResolve(catal, (const xmlChar *)pubID, (const xmlChar *)sysID); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlCatalogPtr(n_catal, catal, 0); - des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1); - des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlACatalogResolve", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_catal); - printf(" %d", n_pubID); - printf(" %d", n_sysID); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlACatalogResolvePublic(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlCatalogPtr catal; /* a Catalog */ - int n_catal; - xmlChar * pubID; /* the public ID string */ - int n_pubID; - - for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { - for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { - mem_base = xmlMemBlocks(); - catal = gen_xmlCatalogPtr(n_catal, 0); - pubID = gen_const_xmlChar_ptr(n_pubID, 1); - - ret_val = xmlACatalogResolvePublic(catal, (const xmlChar *)pubID); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlCatalogPtr(n_catal, catal, 0); - des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlACatalogResolvePublic", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_catal); - printf(" %d", n_pubID); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlACatalogResolveSystem(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlCatalogPtr catal; /* a Catalog */ - int n_catal; - xmlChar * sysID; /* the system ID string */ - int n_sysID; - - for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { - for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { - mem_base = xmlMemBlocks(); - catal = gen_xmlCatalogPtr(n_catal, 0); - sysID = gen_const_xmlChar_ptr(n_sysID, 1); - - ret_val = xmlACatalogResolveSystem(catal, (const xmlChar *)sysID); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlCatalogPtr(n_catal, catal, 0); - des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlACatalogResolveSystem", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_catal); - printf(" %d", n_sysID); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlACatalogResolveURI(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlCatalogPtr catal; /* a Catalog */ - int n_catal; - xmlChar * URI; /* the URI */ - int n_URI; - - for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { - for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { - mem_base = xmlMemBlocks(); - catal = gen_xmlCatalogPtr(n_catal, 0); - URI = gen_const_xmlChar_ptr(n_URI, 1); - - ret_val = xmlACatalogResolveURI(catal, (const xmlChar *)URI); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlCatalogPtr(n_catal, catal, 0); - des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlACatalogResolveURI", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_catal); - printf(" %d", n_URI); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCatalogAdd(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - int ret_val; - xmlChar * type; /* the type of record to add to the catalog */ - int n_type; - xmlChar * orig; /* the system, public or prefix to match */ - int n_orig; - xmlChar * replace; /* the replacement value for the match */ - int n_replace; - - for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) { - for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) { - for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) { - mem_base = xmlMemBlocks(); - type = gen_const_xmlChar_ptr(n_type, 0); - orig = gen_const_xmlChar_ptr(n_orig, 1); - replace = gen_const_xmlChar_ptr(n_replace, 2); - - ret_val = xmlCatalogAdd((const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 0); - des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 1); - des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCatalogAdd", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_type); - printf(" %d", n_orig); - printf(" %d", n_replace); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCatalogCleanup(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - - - xmlCatalogCleanup(); - call_tests++; - xmlResetLastError(); - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCatalogConvert(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int ret_val; - - - ret_val = xmlCatalogConvert(); - desret_int(ret_val); - call_tests++; - xmlResetLastError(); - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCatalogDump(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - FILE * out; /* the file. */ - int n_out; - - for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { - mem_base = xmlMemBlocks(); - out = gen_FILE_ptr(n_out, 0); - - xmlCatalogDump(out); - call_tests++; - des_FILE_ptr(n_out, out, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCatalogDump", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_out); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCatalogGetDefaults(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - xmlCatalogAllow ret_val; - - mem_base = xmlMemBlocks(); - - ret_val = xmlCatalogGetDefaults(); - desret_xmlCatalogAllow(ret_val); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCatalogGetDefaults", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCatalogIsEmpty(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - int ret_val; - xmlCatalogPtr catal; /* should this create an SGML catalog */ - int n_catal; - - for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { - mem_base = xmlMemBlocks(); - catal = gen_xmlCatalogPtr(n_catal, 0); - - ret_val = xmlCatalogIsEmpty(catal); - desret_int(ret_val); - call_tests++; - des_xmlCatalogPtr(n_catal, catal, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCatalogIsEmpty", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_catal); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCatalogLocalResolve(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - xmlChar * ret_val; - void * catalogs; /* a document's list of catalogs */ - int n_catalogs; - xmlChar * pubID; /* the public ID string */ - int n_pubID; - xmlChar * sysID; /* the system ID string */ - int n_sysID; - - for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) { - for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { - for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { - mem_base = xmlMemBlocks(); - catalogs = gen_void_ptr(n_catalogs, 0); - pubID = gen_const_xmlChar_ptr(n_pubID, 1); - sysID = gen_const_xmlChar_ptr(n_sysID, 2); - - ret_val = xmlCatalogLocalResolve(catalogs, (const xmlChar *)pubID, (const xmlChar *)sysID); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_void_ptr(n_catalogs, catalogs, 0); - des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1); - des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCatalogLocalResolve", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_catalogs); - printf(" %d", n_pubID); - printf(" %d", n_sysID); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCatalogLocalResolveURI(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - xmlChar * ret_val; - void * catalogs; /* a document's list of catalogs */ - int n_catalogs; - xmlChar * URI; /* the URI */ - int n_URI; - - for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) { - for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { - mem_base = xmlMemBlocks(); - catalogs = gen_void_ptr(n_catalogs, 0); - URI = gen_const_xmlChar_ptr(n_URI, 1); - - ret_val = xmlCatalogLocalResolveURI(catalogs, (const xmlChar *)URI); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_void_ptr(n_catalogs, catalogs, 0); - des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCatalogLocalResolveURI", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_catalogs); - printf(" %d", n_URI); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCatalogRemove(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int ret_val; - xmlChar * value; /* the value to remove */ - int n_value; - - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - value = gen_const_xmlChar_ptr(n_value, 0); - - ret_val = xmlCatalogRemove((const xmlChar *)value); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0); - xmlResetLastError(); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCatalogResolve(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - xmlChar * ret_val; - xmlChar * pubID; /* the public ID string */ - int n_pubID; - xmlChar * sysID; /* the system ID string */ - int n_sysID; - - for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { - for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { - pubID = gen_const_xmlChar_ptr(n_pubID, 0); - sysID = gen_const_xmlChar_ptr(n_sysID, 1); - - ret_val = xmlCatalogResolve((const xmlChar *)pubID, (const xmlChar *)sysID); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0); - des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1); - xmlResetLastError(); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCatalogResolvePublic(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlChar * pubID; /* the public ID string */ - int n_pubID; - - for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { - mem_base = xmlMemBlocks(); - pubID = gen_const_xmlChar_ptr(n_pubID, 0); - - ret_val = xmlCatalogResolvePublic((const xmlChar *)pubID); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCatalogResolvePublic", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_pubID); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCatalogResolveSystem(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlChar * sysID; /* the system ID string */ - int n_sysID; - - for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { - mem_base = xmlMemBlocks(); - sysID = gen_const_xmlChar_ptr(n_sysID, 0); - - ret_val = xmlCatalogResolveSystem((const xmlChar *)sysID); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCatalogResolveSystem", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_sysID); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCatalogResolveURI(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlChar * URI; /* the URI */ - int n_URI; - - for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { - mem_base = xmlMemBlocks(); - URI = gen_const_xmlChar_ptr(n_URI, 0); - - ret_val = xmlCatalogResolveURI((const xmlChar *)URI); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCatalogResolveURI", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URI); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCatalogSetDefaultPrefer(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - xmlCatalogPrefer ret_val; - xmlCatalogPrefer prefer; /* the default preference for delegation */ - int n_prefer; - - for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) { - mem_base = xmlMemBlocks(); - prefer = gen_xmlCatalogPrefer(n_prefer, 0); - - ret_val = xmlCatalogSetDefaultPrefer(prefer); - desret_xmlCatalogPrefer(ret_val); - call_tests++; - des_xmlCatalogPrefer(n_prefer, prefer, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_prefer); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCatalogSetDefaults(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - xmlCatalogAllow allow; /* what catalogs should be accepted */ - int n_allow; - - for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) { - mem_base = xmlMemBlocks(); - allow = gen_xmlCatalogAllow(n_allow, 0); - - xmlCatalogSetDefaults(allow); - call_tests++; - des_xmlCatalogAllow(n_allow, allow, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCatalogSetDefaults", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_allow); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlConvertSGMLCatalog(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - int ret_val; - xmlCatalogPtr catal; /* the catalog */ - int n_catal; - - for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { - mem_base = xmlMemBlocks(); - catal = gen_xmlCatalogPtr(n_catal, 0); - - ret_val = xmlConvertSGMLCatalog(catal); - desret_int(ret_val); - call_tests++; - des_xmlCatalogPtr(n_catal, catal, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlConvertSGMLCatalog", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_catal); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlInitializeCatalog(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlInitializeCatalog(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlInitializeCatalog", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlLoadACatalog(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlLoadCatalog(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int ret_val; - const char * filename; /* a file path */ - int n_filename; - - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - filename = gen_filepath(n_filename, 0); - - ret_val = xmlLoadCatalog(filename); - desret_int(ret_val); - call_tests++; - des_filepath(n_filename, filename, 0); - xmlResetLastError(); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlLoadCatalogs(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - char * pathss; /* a list of directories separated by a colon or a space. */ - int n_pathss; - - for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) { - pathss = gen_const_char_ptr(n_pathss, 0); - - xmlLoadCatalogs((const char *)pathss); - call_tests++; - des_const_char_ptr(n_pathss, (const char *)pathss, 0); - xmlResetLastError(); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlLoadSGMLSuperCatalog(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlNewCatalog(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlParseCatalogFile(void) { - int test_ret = 0; - -#if defined(LIBXML_CATALOG_ENABLED) - int mem_base; - xmlDocPtr ret_val; - const char * filename; /* the filename */ - int n_filename; - - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - mem_base = xmlMemBlocks(); - filename = gen_filepath(n_filename, 0); - - ret_val = xmlParseCatalogFile(filename); - desret_xmlDocPtr(ret_val); - call_tests++; - des_filepath(n_filename, filename, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseCatalogFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_catalog(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n"); - test_ret += test_xmlACatalogAdd(); - test_ret += test_xmlACatalogDump(); - test_ret += test_xmlACatalogRemove(); - test_ret += test_xmlACatalogResolve(); - test_ret += test_xmlACatalogResolvePublic(); - test_ret += test_xmlACatalogResolveSystem(); - test_ret += test_xmlACatalogResolveURI(); - test_ret += test_xmlCatalogAdd(); - test_ret += test_xmlCatalogCleanup(); - test_ret += test_xmlCatalogConvert(); - test_ret += test_xmlCatalogDump(); - test_ret += test_xmlCatalogGetDefaults(); - test_ret += test_xmlCatalogIsEmpty(); - test_ret += test_xmlCatalogLocalResolve(); - test_ret += test_xmlCatalogLocalResolveURI(); - test_ret += test_xmlCatalogRemove(); - test_ret += test_xmlCatalogResolve(); - test_ret += test_xmlCatalogResolvePublic(); - test_ret += test_xmlCatalogResolveSystem(); - test_ret += test_xmlCatalogResolveURI(); - test_ret += test_xmlCatalogSetDefaultPrefer(); - test_ret += test_xmlCatalogSetDefaults(); - test_ret += test_xmlConvertSGMLCatalog(); - test_ret += test_xmlInitializeCatalog(); - test_ret += test_xmlLoadACatalog(); - test_ret += test_xmlLoadCatalog(); - test_ret += test_xmlLoadCatalogs(); - test_ret += test_xmlLoadSGMLSuperCatalog(); - test_ret += test_xmlNewCatalog(); - test_ret += test_xmlParseCatalogFile(); - - if (test_ret != 0) - printf("Module catalog: %d errors\n", test_ret); - return(test_ret); -} - -#define gen_nb_const_xmlChRangeGroup_ptr 1 -static xmlChRangeGroup * gen_const_xmlChRangeGroup_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlChRangeGroup_ptr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroup * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlCharInRange(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - unsigned int val; /* character to be validated */ - int n_val; - xmlChRangeGroup * rptr; /* pointer to range to be used to validate */ - int n_rptr; - - for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) { - for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroup_ptr;n_rptr++) { - mem_base = xmlMemBlocks(); - val = gen_unsigned_int(n_val, 0); - rptr = gen_const_xmlChRangeGroup_ptr(n_rptr, 1); - - ret_val = xmlCharInRange(val, (const xmlChRangeGroup *)rptr); - desret_int(ret_val); - call_tests++; - des_unsigned_int(n_val, val, 0); - des_const_xmlChRangeGroup_ptr(n_rptr, (const xmlChRangeGroup *)rptr, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCharInRange", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf(" %d", n_rptr); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlIsBaseChar(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - unsigned int ch; /* character to validate */ - int n_ch; - - for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { - mem_base = xmlMemBlocks(); - ch = gen_unsigned_int(n_ch, 0); - - ret_val = xmlIsBaseChar(ch); - desret_int(ret_val); - call_tests++; - des_unsigned_int(n_ch, ch, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIsBaseChar", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ch); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlIsBlank(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - unsigned int ch; /* character to validate */ - int n_ch; - - for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { - mem_base = xmlMemBlocks(); - ch = gen_unsigned_int(n_ch, 0); - - ret_val = xmlIsBlank(ch); - desret_int(ret_val); - call_tests++; - des_unsigned_int(n_ch, ch, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIsBlank", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ch); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlIsChar(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - unsigned int ch; /* character to validate */ - int n_ch; - - for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { - mem_base = xmlMemBlocks(); - ch = gen_unsigned_int(n_ch, 0); - - ret_val = xmlIsChar(ch); - desret_int(ret_val); - call_tests++; - des_unsigned_int(n_ch, ch, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIsChar", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ch); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlIsCombining(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - unsigned int ch; /* character to validate */ - int n_ch; - - for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { - mem_base = xmlMemBlocks(); - ch = gen_unsigned_int(n_ch, 0); - - ret_val = xmlIsCombining(ch); - desret_int(ret_val); - call_tests++; - des_unsigned_int(n_ch, ch, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIsCombining", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ch); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlIsDigit(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - unsigned int ch; /* character to validate */ - int n_ch; - - for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { - mem_base = xmlMemBlocks(); - ch = gen_unsigned_int(n_ch, 0); - - ret_val = xmlIsDigit(ch); - desret_int(ret_val); - call_tests++; - des_unsigned_int(n_ch, ch, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIsDigit", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ch); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlIsExtender(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - unsigned int ch; /* character to validate */ - int n_ch; - - for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { - mem_base = xmlMemBlocks(); - ch = gen_unsigned_int(n_ch, 0); - - ret_val = xmlIsExtender(ch); - desret_int(ret_val); - call_tests++; - des_unsigned_int(n_ch, ch, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIsExtender", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ch); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlIsIdeographic(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - unsigned int ch; /* character to validate */ - int n_ch; - - for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { - mem_base = xmlMemBlocks(); - ch = gen_unsigned_int(n_ch, 0); - - ret_val = xmlIsIdeographic(ch); - desret_int(ret_val); - call_tests++; - des_unsigned_int(n_ch, ch, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIsIdeographic", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ch); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlIsPubidChar(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - unsigned int ch; /* character to validate */ - int n_ch; - - for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { - mem_base = xmlMemBlocks(); - ch = gen_unsigned_int(n_ch, 0); - - ret_val = xmlIsPubidChar(ch); - desret_int(ret_val); - call_tests++; - des_unsigned_int(n_ch, ch, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIsPubidChar", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ch); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - -static int -test_chvalid(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n"); - test_ret += test_xmlCharInRange(); - test_ret += test_xmlIsBaseChar(); - test_ret += test_xmlIsBlank(); - test_ret += test_xmlIsChar(); - test_ret += test_xmlIsCombining(); - test_ret += test_xmlIsDigit(); - test_ret += test_xmlIsExtender(); - test_ret += test_xmlIsIdeographic(); - test_ret += test_xmlIsPubidChar(); - - if (test_ret != 0) - printf("Module chvalid: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlBoolToText(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) - int mem_base; - const char * ret_val; - int boolval; /* a bool to turn into text */ - int n_boolval; - - for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) { - mem_base = xmlMemBlocks(); - boolval = gen_int(n_boolval, 0); - - ret_val = xmlBoolToText(boolval); - desret_const_char_ptr(ret_val); - call_tests++; - des_int(n_boolval, boolval, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBoolToText", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_boolval); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDebugCheckDocument(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) - int mem_base; - int ret_val; - FILE * output; /* the FILE * for the output */ - int n_output; - xmlDocPtr doc; /* the document */ - int n_doc; - - for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - output = gen_debug_FILE_ptr(n_output, 0); - doc = gen_xmlDocPtr(n_doc, 1); - - ret_val = xmlDebugCheckDocument(output, doc); - desret_int(ret_val); - call_tests++; - des_debug_FILE_ptr(n_output, output, 0); - des_xmlDocPtr(n_doc, doc, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDebugCheckDocument", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_output); - printf(" %d", n_doc); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDebugDumpAttr(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) - int mem_base; - FILE * output; /* the FILE * for the output */ - int n_output; - xmlAttrPtr attr; /* the attribute */ - int n_attr; - int depth; /* the indentation level. */ - int n_depth; - - for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { - for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { - for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { - mem_base = xmlMemBlocks(); - output = gen_debug_FILE_ptr(n_output, 0); - attr = gen_xmlAttrPtr(n_attr, 1); - depth = gen_int(n_depth, 2); - - xmlDebugDumpAttr(output, attr, depth); - call_tests++; - des_debug_FILE_ptr(n_output, output, 0); - des_xmlAttrPtr(n_attr, attr, 1); - des_int(n_depth, depth, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDebugDumpAttr", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_output); - printf(" %d", n_attr); - printf(" %d", n_depth); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDebugDumpAttrList(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) - int mem_base; - FILE * output; /* the FILE * for the output */ - int n_output; - xmlAttrPtr attr; /* the attribute list */ - int n_attr; - int depth; /* the indentation level. */ - int n_depth; - - for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { - for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { - for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { - mem_base = xmlMemBlocks(); - output = gen_debug_FILE_ptr(n_output, 0); - attr = gen_xmlAttrPtr(n_attr, 1); - depth = gen_int(n_depth, 2); - - xmlDebugDumpAttrList(output, attr, depth); - call_tests++; - des_debug_FILE_ptr(n_output, output, 0); - des_xmlAttrPtr(n_attr, attr, 1); - des_int(n_depth, depth, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDebugDumpAttrList", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_output); - printf(" %d", n_attr); - printf(" %d", n_depth); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDebugDumpDTD(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) - int mem_base; - FILE * output; /* the FILE * for the output */ - int n_output; - xmlDtdPtr dtd; /* the DTD */ - int n_dtd; - - for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { - for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { - mem_base = xmlMemBlocks(); - output = gen_debug_FILE_ptr(n_output, 0); - dtd = gen_xmlDtdPtr(n_dtd, 1); - - xmlDebugDumpDTD(output, dtd); - call_tests++; - des_debug_FILE_ptr(n_output, output, 0); - des_xmlDtdPtr(n_dtd, dtd, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDebugDumpDTD", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_output); - printf(" %d", n_dtd); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDebugDumpDocument(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) - int mem_base; - FILE * output; /* the FILE * for the output */ - int n_output; - xmlDocPtr doc; /* the document */ - int n_doc; - - for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - output = gen_debug_FILE_ptr(n_output, 0); - doc = gen_xmlDocPtr(n_doc, 1); - - xmlDebugDumpDocument(output, doc); - call_tests++; - des_debug_FILE_ptr(n_output, output, 0); - des_xmlDocPtr(n_doc, doc, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDebugDumpDocument", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_output); - printf(" %d", n_doc); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDebugDumpDocumentHead(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) - int mem_base; - FILE * output; /* the FILE * for the output */ - int n_output; - xmlDocPtr doc; /* the document */ - int n_doc; - - for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - output = gen_debug_FILE_ptr(n_output, 0); - doc = gen_xmlDocPtr(n_doc, 1); - - xmlDebugDumpDocumentHead(output, doc); - call_tests++; - des_debug_FILE_ptr(n_output, output, 0); - des_xmlDocPtr(n_doc, doc, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDebugDumpDocumentHead", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_output); - printf(" %d", n_doc); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDebugDumpEntities(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) - int mem_base; - FILE * output; /* the FILE * for the output */ - int n_output; - xmlDocPtr doc; /* the document */ - int n_doc; - - for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - output = gen_debug_FILE_ptr(n_output, 0); - doc = gen_xmlDocPtr(n_doc, 1); - - xmlDebugDumpEntities(output, doc); - call_tests++; - des_debug_FILE_ptr(n_output, output, 0); - des_xmlDocPtr(n_doc, doc, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDebugDumpEntities", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_output); - printf(" %d", n_doc); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDebugDumpNode(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) - int mem_base; - FILE * output; /* the FILE * for the output */ - int n_output; - xmlNodePtr node; /* the node */ - int n_node; - int depth; /* the indentation level. */ - int n_depth; - - for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { - mem_base = xmlMemBlocks(); - output = gen_debug_FILE_ptr(n_output, 0); - node = gen_xmlNodePtr(n_node, 1); - depth = gen_int(n_depth, 2); - - xmlDebugDumpNode(output, node, depth); - call_tests++; - des_debug_FILE_ptr(n_output, output, 0); - des_xmlNodePtr(n_node, node, 1); - des_int(n_depth, depth, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDebugDumpNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_output); - printf(" %d", n_node); - printf(" %d", n_depth); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDebugDumpNodeList(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) - int mem_base; - FILE * output; /* the FILE * for the output */ - int n_output; - xmlNodePtr node; /* the node list */ - int n_node; - int depth; /* the indentation level. */ - int n_depth; - - for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { - mem_base = xmlMemBlocks(); - output = gen_debug_FILE_ptr(n_output, 0); - node = gen_xmlNodePtr(n_node, 1); - depth = gen_int(n_depth, 2); - - xmlDebugDumpNodeList(output, node, depth); - call_tests++; - des_debug_FILE_ptr(n_output, output, 0); - des_xmlNodePtr(n_node, node, 1); - des_int(n_depth, depth, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDebugDumpNodeList", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_output); - printf(" %d", n_node); - printf(" %d", n_depth); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDebugDumpOneNode(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) - int mem_base; - FILE * output; /* the FILE * for the output */ - int n_output; - xmlNodePtr node; /* the node */ - int n_node; - int depth; /* the indentation level. */ - int n_depth; - - for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { - mem_base = xmlMemBlocks(); - output = gen_debug_FILE_ptr(n_output, 0); - node = gen_xmlNodePtr(n_node, 1); - depth = gen_int(n_depth, 2); - - xmlDebugDumpOneNode(output, node, depth); - call_tests++; - des_debug_FILE_ptr(n_output, output, 0); - des_xmlNodePtr(n_node, node, 1); - des_int(n_depth, depth, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDebugDumpOneNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_output); - printf(" %d", n_node); - printf(" %d", n_depth); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDebugDumpString(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) - int mem_base; - FILE * output; /* the FILE * for the output */ - int n_output; - xmlChar * str; /* the string */ - int n_str; - - for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - mem_base = xmlMemBlocks(); - output = gen_debug_FILE_ptr(n_output, 0); - str = gen_const_xmlChar_ptr(n_str, 1); - - xmlDebugDumpString(output, (const xmlChar *)str); - call_tests++; - des_debug_FILE_ptr(n_output, output, 0); - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDebugDumpString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_output); - printf(" %d", n_str); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlLsCountNode(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) - int mem_base; - int ret_val; - xmlNodePtr node; /* the node to count */ - int n_node; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - - ret_val = xmlLsCountNode(node); - desret_int(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlLsCountNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlLsOneNode(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) - int mem_base; - FILE * output; /* the FILE * for the output */ - int n_output; - xmlNodePtr node; /* the node to dump */ - int n_node; - - for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - output = gen_debug_FILE_ptr(n_output, 0); - node = gen_xmlNodePtr(n_node, 1); - - xmlLsOneNode(output, node); - call_tests++; - des_debug_FILE_ptr(n_output, output, 0); - des_xmlNodePtr(n_node, node, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlLsOneNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_output); - printf(" %d", n_node); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -#define gen_nb_char_ptr 1 -static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlShell(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlShellBase(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlShellCtxtPtr ctxt; /* the shell context */ - int n_ctxt; - char * arg; /* unused */ - int n_arg; - xmlNodePtr node; /* a node */ - int n_node; - xmlNodePtr node2; /* unused */ - int n_node2; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { - for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); - arg = gen_char_ptr(n_arg, 1); - node = gen_xmlNodePtr(n_node, 2); - node2 = gen_xmlNodePtr(n_node2, 3); - - ret_val = xmlShellBase(ctxt, arg, node, node2); - desret_int(ret_val); - call_tests++; - des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); - des_char_ptr(n_arg, arg, 1); - des_xmlNodePtr(n_node, node, 2); - des_xmlNodePtr(n_node2, node2, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlShellBase", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_arg); - printf(" %d", n_node); - printf(" %d", n_node2); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlShellCat(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - xmlShellCtxtPtr ctxt; /* the shell context */ - int n_ctxt; - char * arg; /* unused */ - int n_arg; - xmlNodePtr node; /* a node */ - int n_node; - xmlNodePtr node2; /* unused */ - int n_node2; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { - for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); - arg = gen_char_ptr(n_arg, 1); - node = gen_xmlNodePtr(n_node, 2); - node2 = gen_xmlNodePtr(n_node2, 3); - - ret_val = xmlShellCat(ctxt, arg, node, node2); - desret_int(ret_val); - call_tests++; - des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); - des_char_ptr(n_arg, arg, 1); - des_xmlNodePtr(n_node, node, 2); - des_xmlNodePtr(n_node2, node2, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlShellCat", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_arg); - printf(" %d", n_node); - printf(" %d", n_node2); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlShellDir(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlShellCtxtPtr ctxt; /* the shell context */ - int n_ctxt; - char * arg; /* unused */ - int n_arg; - xmlNodePtr node; /* a node */ - int n_node; - xmlNodePtr node2; /* unused */ - int n_node2; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { - for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); - arg = gen_char_ptr(n_arg, 1); - node = gen_xmlNodePtr(n_node, 2); - node2 = gen_xmlNodePtr(n_node2, 3); - - ret_val = xmlShellDir(ctxt, arg, node, node2); - desret_int(ret_val); - call_tests++; - des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); - des_char_ptr(n_arg, arg, 1); - des_xmlNodePtr(n_node, node, 2); - des_xmlNodePtr(n_node2, node2, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlShellDir", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_arg); - printf(" %d", n_node); - printf(" %d", n_node2); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlShellDu(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlShellCtxtPtr ctxt; /* the shell context */ - int n_ctxt; - char * arg; /* unused */ - int n_arg; - xmlNodePtr tree; /* a node defining a subtree */ - int n_tree; - xmlNodePtr node2; /* unused */ - int n_node2; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { - for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) { - for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) { - for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); - arg = gen_char_ptr(n_arg, 1); - tree = gen_xmlNodePtr(n_tree, 2); - node2 = gen_xmlNodePtr(n_node2, 3); - - ret_val = xmlShellDu(ctxt, arg, tree, node2); - desret_int(ret_val); - call_tests++; - des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); - des_char_ptr(n_arg, arg, 1); - des_xmlNodePtr(n_tree, tree, 2); - des_xmlNodePtr(n_node2, node2, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlShellDu", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_arg); - printf(" %d", n_tree); - printf(" %d", n_node2); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlShellList(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlShellCtxtPtr ctxt; /* the shell context */ - int n_ctxt; - char * arg; /* unused */ - int n_arg; - xmlNodePtr node; /* a node */ - int n_node; - xmlNodePtr node2; /* unused */ - int n_node2; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { - for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); - arg = gen_char_ptr(n_arg, 1); - node = gen_xmlNodePtr(n_node, 2); - node2 = gen_xmlNodePtr(n_node2, 3); - - ret_val = xmlShellList(ctxt, arg, node, node2); - desret_int(ret_val); - call_tests++; - des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); - des_char_ptr(n_arg, arg, 1); - des_xmlNodePtr(n_node, node, 2); - des_xmlNodePtr(n_node2, node2, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlShellList", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_arg); - printf(" %d", n_node); - printf(" %d", n_node2); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlShellLoad(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlShellCtxtPtr ctxt; /* the shell context */ - int n_ctxt; - char * filename; /* the file name */ - int n_filename; - xmlNodePtr node; /* unused */ - int n_node; - xmlNodePtr node2; /* unused */ - int n_node2; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { - for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); - filename = gen_char_ptr(n_filename, 1); - node = gen_xmlNodePtr(n_node, 2); - node2 = gen_xmlNodePtr(n_node2, 3); - - ret_val = xmlShellLoad(ctxt, filename, node, node2); - desret_int(ret_val); - call_tests++; - des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); - des_char_ptr(n_filename, filename, 1); - des_xmlNodePtr(n_node, node, 2); - des_xmlNodePtr(n_node2, node2, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlShellLoad", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_filename); - printf(" %d", n_node); - printf(" %d", n_node2); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlShellPrintXPathResult(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */ - int n_list; - - for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) { - mem_base = xmlMemBlocks(); - list = gen_xmlXPathObjectPtr(n_list, 0); - - xmlShellPrintXPathResult(list); - call_tests++; - des_xmlXPathObjectPtr(n_list, list, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlShellPrintXPathResult", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_list); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlShellPwd(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlShellCtxtPtr ctxt; /* the shell context */ - int n_ctxt; - char * buffer; /* the output buffer */ - int n_buffer; - xmlNodePtr node; /* a node */ - int n_node; - xmlNodePtr node2; /* unused */ - int n_node2; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { - for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); - buffer = gen_char_ptr(n_buffer, 1); - node = gen_xmlNodePtr(n_node, 2); - node2 = gen_xmlNodePtr(n_node2, 3); - - ret_val = xmlShellPwd(ctxt, buffer, node, node2); - desret_int(ret_val); - call_tests++; - des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); - des_char_ptr(n_buffer, buffer, 1); - des_xmlNodePtr(n_node, node, 2); - des_xmlNodePtr(n_node2, node2, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlShellPwd", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_buffer); - printf(" %d", n_node); - printf(" %d", n_node2); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlShellSave(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - xmlShellCtxtPtr ctxt; /* the shell context */ - int n_ctxt; - char * filename; /* the file name (optional) */ - int n_filename; - xmlNodePtr node; /* unused */ - int n_node; - xmlNodePtr node2; /* unused */ - int n_node2; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { - for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); - filename = gen_char_ptr(n_filename, 1); - node = gen_xmlNodePtr(n_node, 2); - node2 = gen_xmlNodePtr(n_node2, 3); - - ret_val = xmlShellSave(ctxt, filename, node, node2); - desret_int(ret_val); - call_tests++; - des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); - des_char_ptr(n_filename, filename, 1); - des_xmlNodePtr(n_node, node, 2); - des_xmlNodePtr(n_node2, node2, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlShellSave", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_filename); - printf(" %d", n_node); - printf(" %d", n_node2); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlShellValidate(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_VALID_ENABLED) - int mem_base; - int ret_val; - xmlShellCtxtPtr ctxt; /* the shell context */ - int n_ctxt; - char * dtd; /* the DTD URI (optional) */ - int n_dtd; - xmlNodePtr node; /* unused */ - int n_node; - xmlNodePtr node2; /* unused */ - int n_node2; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { - for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); - dtd = gen_char_ptr(n_dtd, 1); - node = gen_xmlNodePtr(n_node, 2); - node2 = gen_xmlNodePtr(n_node2, 3); - - ret_val = xmlShellValidate(ctxt, dtd, node, node2); - desret_int(ret_val); - call_tests++; - des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); - des_char_ptr(n_dtd, dtd, 1); - des_xmlNodePtr(n_node, node, 2); - des_xmlNodePtr(n_node2, node2, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlShellValidate", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_dtd); - printf(" %d", n_node); - printf(" %d", n_node2); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlShellWrite(void) { - int test_ret = 0; - -#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - xmlShellCtxtPtr ctxt; /* the shell context */ - int n_ctxt; - char * filename; /* the file name */ - int n_filename; - xmlNodePtr node; /* a node in the tree */ - int n_node; - xmlNodePtr node2; /* unused */ - int n_node2; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { - for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); - filename = gen_char_ptr(n_filename, 1); - node = gen_xmlNodePtr(n_node, 2); - node2 = gen_xmlNodePtr(n_node2, 3); - - ret_val = xmlShellWrite(ctxt, filename, node, node2); - desret_int(ret_val); - call_tests++; - des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); - des_char_ptr(n_filename, filename, 1); - des_xmlNodePtr(n_node, node, 2); - des_xmlNodePtr(n_node2, node2, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlShellWrite", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_filename); - printf(" %d", n_node); - printf(" %d", n_node2); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_debugXML(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing debugXML : 25 of 28 functions ...\n"); - test_ret += test_xmlBoolToText(); - test_ret += test_xmlDebugCheckDocument(); - test_ret += test_xmlDebugDumpAttr(); - test_ret += test_xmlDebugDumpAttrList(); - test_ret += test_xmlDebugDumpDTD(); - test_ret += test_xmlDebugDumpDocument(); - test_ret += test_xmlDebugDumpDocumentHead(); - test_ret += test_xmlDebugDumpEntities(); - test_ret += test_xmlDebugDumpNode(); - test_ret += test_xmlDebugDumpNodeList(); - test_ret += test_xmlDebugDumpOneNode(); - test_ret += test_xmlDebugDumpString(); - test_ret += test_xmlLsCountNode(); - test_ret += test_xmlLsOneNode(); - test_ret += test_xmlShell(); - test_ret += test_xmlShellBase(); - test_ret += test_xmlShellCat(); - test_ret += test_xmlShellDir(); - test_ret += test_xmlShellDu(); - test_ret += test_xmlShellList(); - test_ret += test_xmlShellLoad(); - test_ret += test_xmlShellPrintXPathResult(); - test_ret += test_xmlShellPwd(); - test_ret += test_xmlShellSave(); - test_ret += test_xmlShellValidate(); - test_ret += test_xmlShellWrite(); - - if (test_ret != 0) - printf("Module debugXML: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlDictCleanup(void) { - int test_ret = 0; - - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlDictCleanup(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDictCleanup", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlDictCreate(void) { - int test_ret = 0; - - int mem_base; - xmlDictPtr ret_val; - - mem_base = xmlMemBlocks(); - - ret_val = xmlDictCreate(); - desret_xmlDictPtr(ret_val); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDictCreate", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlDictCreateSub(void) { - int test_ret = 0; - - int mem_base; - xmlDictPtr ret_val; - xmlDictPtr sub; /* an existing dictionnary */ - int n_sub; - - for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) { - mem_base = xmlMemBlocks(); - sub = gen_xmlDictPtr(n_sub, 0); - - ret_val = xmlDictCreateSub(sub); - desret_xmlDictPtr(ret_val); - call_tests++; - des_xmlDictPtr(n_sub, sub, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDictCreateSub", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_sub); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlDictExists(void) { - int test_ret = 0; - - int mem_base; - const xmlChar * ret_val; - xmlDictPtr dict; /* the dictionnary */ - int n_dict; - xmlChar * name; /* the name of the userdata */ - int n_name; - int len; /* the length of the name, if -1 it is recomputed */ - int n_len; - - for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - dict = gen_xmlDictPtr(n_dict, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - len = gen_int(n_len, 2); - - ret_val = xmlDictExists(dict, (const xmlChar *)name, len); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_xmlDictPtr(n_dict, dict, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDictExists", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_dict); - printf(" %d", n_name); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlDictGetUsage(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlDictLookup(void) { - int test_ret = 0; - - int mem_base; - const xmlChar * ret_val; - xmlDictPtr dict; /* the dictionnary */ - int n_dict; - xmlChar * name; /* the name of the userdata */ - int n_name; - int len; /* the length of the name, if -1 it is recomputed */ - int n_len; - - for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - dict = gen_xmlDictPtr(n_dict, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - len = gen_int(n_len, 2); - - ret_val = xmlDictLookup(dict, (const xmlChar *)name, len); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_xmlDictPtr(n_dict, dict, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDictLookup", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_dict); - printf(" %d", n_name); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlDictOwns(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlDictPtr dict; /* the dictionnary */ - int n_dict; - xmlChar * str; /* the string */ - int n_str; - - for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - mem_base = xmlMemBlocks(); - dict = gen_xmlDictPtr(n_dict, 0); - str = gen_const_xmlChar_ptr(n_str, 1); - - ret_val = xmlDictOwns(dict, (const xmlChar *)str); - desret_int(ret_val); - call_tests++; - des_xmlDictPtr(n_dict, dict, 0); - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDictOwns", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_dict); - printf(" %d", n_str); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlDictQLookup(void) { - int test_ret = 0; - - int mem_base; - const xmlChar * ret_val; - xmlDictPtr dict; /* the dictionnary */ - int n_dict; - xmlChar * prefix; /* the prefix */ - int n_prefix; - xmlChar * name; /* the name */ - int n_name; - - for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { - for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - dict = gen_xmlDictPtr(n_dict, 0); - prefix = gen_const_xmlChar_ptr(n_prefix, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - - ret_val = xmlDictQLookup(dict, (const xmlChar *)prefix, (const xmlChar *)name); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_xmlDictPtr(n_dict, dict, 0); - des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDictQLookup", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_dict); - printf(" %d", n_prefix); - printf(" %d", n_name); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlDictReference(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlDictPtr dict; /* the dictionnary */ - int n_dict; - - for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { - mem_base = xmlMemBlocks(); - dict = gen_xmlDictPtr(n_dict, 0); - - ret_val = xmlDictReference(dict); - xmlDictFree(dict); - desret_int(ret_val); - call_tests++; - des_xmlDictPtr(n_dict, dict, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDictReference", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_dict); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlDictSetLimit(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlDictSize(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlDictPtr dict; /* the dictionnary */ - int n_dict; - - for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { - mem_base = xmlMemBlocks(); - dict = gen_xmlDictPtr(n_dict, 0); - - ret_val = xmlDictSize(dict); - desret_int(ret_val); - call_tests++; - des_xmlDictPtr(n_dict, dict, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDictSize", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_dict); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlInitializeDict(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - - mem_base = xmlMemBlocks(); - - ret_val = xmlInitializeDict(); - desret_int(ret_val); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlInitializeDict", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; - - return(test_ret); -} - -static int -test_dict(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing dict : 10 of 13 functions ...\n"); - test_ret += test_xmlDictCleanup(); - test_ret += test_xmlDictCreate(); - test_ret += test_xmlDictCreateSub(); - test_ret += test_xmlDictExists(); - test_ret += test_xmlDictGetUsage(); - test_ret += test_xmlDictLookup(); - test_ret += test_xmlDictOwns(); - test_ret += test_xmlDictQLookup(); - test_ret += test_xmlDictReference(); - test_ret += test_xmlDictSetLimit(); - test_ret += test_xmlDictSize(); - test_ret += test_xmlInitializeDict(); - - if (test_ret != 0) - printf("Module dict: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_UTF8Toisolat1(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) -#ifdef LIBXML_OUTPUT_ENABLED - int mem_base; - int ret_val; - unsigned char * out; /* a pointer to an array of bytes to store the result */ - int n_out; - int * outlen; /* the length of @out */ - int n_outlen; - unsigned char * in; /* a pointer to an array of UTF-8 chars */ - int n_in; - int * inlen; /* the length of @in */ - int n_inlen; - - for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) { - for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) { - for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { - for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) { - mem_base = xmlMemBlocks(); - out = gen_unsigned_char_ptr(n_out, 0); - outlen = gen_int_ptr(n_outlen, 1); - in = gen_const_unsigned_char_ptr(n_in, 2); - inlen = gen_int_ptr(n_inlen, 3); - - ret_val = UTF8Toisolat1(out, outlen, (const unsigned char *)in, inlen); - desret_int(ret_val); - call_tests++; - des_unsigned_char_ptr(n_out, out, 0); - des_int_ptr(n_outlen, outlen, 1); - des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2); - des_int_ptr(n_inlen, inlen, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in UTF8Toisolat1", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_out); - printf(" %d", n_outlen); - printf(" %d", n_in); - printf(" %d", n_inlen); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_isolat1ToUTF8(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - unsigned char * out; /* a pointer to an array of bytes to store the result */ - int n_out; - int * outlen; /* the length of @out */ - int n_outlen; - unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */ - int n_in; - int * inlen; /* the length of @in */ - int n_inlen; - - for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) { - for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) { - for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { - for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) { - mem_base = xmlMemBlocks(); - out = gen_unsigned_char_ptr(n_out, 0); - outlen = gen_int_ptr(n_outlen, 1); - in = gen_const_unsigned_char_ptr(n_in, 2); - inlen = gen_int_ptr(n_inlen, 3); - - ret_val = isolat1ToUTF8(out, outlen, (const unsigned char *)in, inlen); - desret_int(ret_val); - call_tests++; - des_unsigned_char_ptr(n_out, out, 0); - des_int_ptr(n_outlen, outlen, 1); - des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2); - des_int_ptr(n_inlen, inlen, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in isolat1ToUTF8", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_out); - printf(" %d", n_outlen); - printf(" %d", n_in); - printf(" %d", n_inlen); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlAddEncodingAlias(void) { - int test_ret = 0; - - int ret_val; - char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */ - int n_name; - char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */ - int n_alias; - - for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) { - for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) { - name = gen_const_char_ptr(n_name, 0); - alias = gen_const_char_ptr(n_alias, 1); - - ret_val = xmlAddEncodingAlias((const char *)name, (const char *)alias); - desret_int(ret_val); - call_tests++; - des_const_char_ptr(n_name, (const char *)name, 0); - des_const_char_ptr(n_alias, (const char *)alias, 1); - xmlResetLastError(); - } - } - function_tests++; - - return(test_ret); -} - - -#define gen_nb_xmlCharEncodingHandler_ptr 1 -static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlCharEncCloseFunc(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlCharEncodingHandler * handler; /* char enconding transformation data structure */ - int n_handler; - - for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) { - mem_base = xmlMemBlocks(); - handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0); - - ret_val = xmlCharEncCloseFunc(handler); - desret_int(ret_val); - call_tests++; - des_xmlCharEncodingHandler_ptr(n_handler, handler, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCharEncCloseFunc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_handler); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCharEncFirstLine(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlCharEncodingHandler * handler; /* char enconding transformation data structure */ - int n_handler; - xmlBufferPtr out; /* an xmlBuffer for the output. */ - int n_out; - xmlBufferPtr in; /* an xmlBuffer for the input */ - int n_in; - - for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) { - for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) { - for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) { - mem_base = xmlMemBlocks(); - handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0); - out = gen_xmlBufferPtr(n_out, 1); - in = gen_xmlBufferPtr(n_in, 2); - - ret_val = xmlCharEncFirstLine(handler, out, in); - desret_int(ret_val); - call_tests++; - des_xmlCharEncodingHandler_ptr(n_handler, handler, 0); - des_xmlBufferPtr(n_out, out, 1); - des_xmlBufferPtr(n_in, in, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCharEncFirstLine", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_handler); - printf(" %d", n_out); - printf(" %d", n_in); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCharEncInFunc(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlCharEncodingHandler * handler; /* char encoding transformation data structure */ - int n_handler; - xmlBufferPtr out; /* an xmlBuffer for the output. */ - int n_out; - xmlBufferPtr in; /* an xmlBuffer for the input */ - int n_in; - - for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) { - for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) { - for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) { - mem_base = xmlMemBlocks(); - handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0); - out = gen_xmlBufferPtr(n_out, 1); - in = gen_xmlBufferPtr(n_in, 2); - - ret_val = xmlCharEncInFunc(handler, out, in); - desret_int(ret_val); - call_tests++; - des_xmlCharEncodingHandler_ptr(n_handler, handler, 0); - des_xmlBufferPtr(n_out, out, 1); - des_xmlBufferPtr(n_in, in, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCharEncInFunc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_handler); - printf(" %d", n_out); - printf(" %d", n_in); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCharEncOutFunc(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlCharEncodingHandler * handler; /* char enconding transformation data structure */ - int n_handler; - xmlBufferPtr out; /* an xmlBuffer for the output. */ - int n_out; - xmlBufferPtr in; /* an xmlBuffer for the input */ - int n_in; - - for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) { - for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) { - for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) { - mem_base = xmlMemBlocks(); - handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0); - out = gen_xmlBufferPtr(n_out, 1); - in = gen_xmlBufferPtr(n_in, 2); - - ret_val = xmlCharEncOutFunc(handler, out, in); - desret_int(ret_val); - call_tests++; - des_xmlCharEncodingHandler_ptr(n_handler, handler, 0); - des_xmlBufferPtr(n_out, out, 1); - des_xmlBufferPtr(n_in, in, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCharEncOutFunc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_handler); - printf(" %d", n_out); - printf(" %d", n_in); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCleanupCharEncodingHandlers(void) { - int test_ret = 0; - - - - xmlCleanupCharEncodingHandlers(); - call_tests++; - xmlResetLastError(); - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCleanupEncodingAliases(void) { - int test_ret = 0; - - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlCleanupEncodingAliases(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCleanupEncodingAliases", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlDelEncodingAlias(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */ - int n_alias; - - for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) { - mem_base = xmlMemBlocks(); - alias = gen_const_char_ptr(n_alias, 0); - - ret_val = xmlDelEncodingAlias((const char *)alias); - desret_int(ret_val); - call_tests++; - des_const_char_ptr(n_alias, (const char *)alias, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDelEncodingAlias", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_alias); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlDetectCharEncoding(void) { - int test_ret = 0; - - int mem_base; - xmlCharEncoding ret_val; - unsigned char * in; /* a pointer to the first bytes of the XML entity, must be at least 2 bytes long (at least 4 if encoding is UTF4 variant). */ - int n_in; - int len; /* pointer to the length of the buffer */ - int n_len; - - for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - in = gen_const_unsigned_char_ptr(n_in, 0); - len = gen_int(n_len, 1); - - ret_val = xmlDetectCharEncoding((const unsigned char *)in, len); - desret_xmlCharEncoding(ret_val); - call_tests++; - des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 0); - des_int(n_len, len, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDetectCharEncoding", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_in); - printf(" %d", n_len); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlFindCharEncodingHandler(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlGetCharEncodingHandler(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlGetCharEncodingName(void) { - int test_ret = 0; - - int mem_base; - const char * ret_val; - xmlCharEncoding enc; /* the encoding */ - int n_enc; - - for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { - mem_base = xmlMemBlocks(); - enc = gen_xmlCharEncoding(n_enc, 0); - - ret_val = xmlGetCharEncodingName(enc); - desret_const_char_ptr(ret_val); - call_tests++; - des_xmlCharEncoding(n_enc, enc, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetCharEncodingName", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_enc); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetEncodingAlias(void) { - int test_ret = 0; - - int mem_base; - const char * ret_val; - char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */ - int n_alias; - - for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) { - mem_base = xmlMemBlocks(); - alias = gen_const_char_ptr(n_alias, 0); - - ret_val = xmlGetEncodingAlias((const char *)alias); - desret_const_char_ptr(ret_val); - call_tests++; - des_const_char_ptr(n_alias, (const char *)alias, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetEncodingAlias", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_alias); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlInitCharEncodingHandlers(void) { - int test_ret = 0; - - - - xmlInitCharEncodingHandlers(); - call_tests++; - xmlResetLastError(); - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewCharEncodingHandler(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlParseCharEncoding(void) { - int test_ret = 0; - - int mem_base; - xmlCharEncoding ret_val; - char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */ - int n_name; - - for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) { - mem_base = xmlMemBlocks(); - name = gen_const_char_ptr(n_name, 0); - - ret_val = xmlParseCharEncoding((const char *)name); - desret_xmlCharEncoding(ret_val); - call_tests++; - des_const_char_ptr(n_name, (const char *)name, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseCharEncoding", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_name); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -#define gen_nb_xmlCharEncodingHandlerPtr 1 -static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlRegisterCharEncodingHandler(void) { - int test_ret = 0; - - int mem_base; - xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */ - int n_handler; - - for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) { - mem_base = xmlMemBlocks(); - handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0); - - xmlRegisterCharEncodingHandler(handler); - call_tests++; - des_xmlCharEncodingHandlerPtr(n_handler, handler, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_handler); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - -static int -test_encoding(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n"); - test_ret += test_UTF8Toisolat1(); - test_ret += test_isolat1ToUTF8(); - test_ret += test_xmlAddEncodingAlias(); - test_ret += test_xmlCharEncCloseFunc(); - test_ret += test_xmlCharEncFirstLine(); - test_ret += test_xmlCharEncInFunc(); - test_ret += test_xmlCharEncOutFunc(); - test_ret += test_xmlCleanupCharEncodingHandlers(); - test_ret += test_xmlCleanupEncodingAliases(); - test_ret += test_xmlDelEncodingAlias(); - test_ret += test_xmlDetectCharEncoding(); - test_ret += test_xmlFindCharEncodingHandler(); - test_ret += test_xmlGetCharEncodingHandler(); - test_ret += test_xmlGetCharEncodingName(); - test_ret += test_xmlGetEncodingAlias(); - test_ret += test_xmlInitCharEncodingHandlers(); - test_ret += test_xmlNewCharEncodingHandler(); - test_ret += test_xmlParseCharEncoding(); - test_ret += test_xmlRegisterCharEncodingHandler(); - - if (test_ret != 0) - printf("Module encoding: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlAddDocEntity(void) { - int test_ret = 0; - - int mem_base; - xmlEntityPtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlChar * name; /* the entity name */ - int n_name; - int type; /* the entity type XML_xxx_yyy_ENTITY */ - int n_type; - xmlChar * ExternalID; /* the entity external ID if available */ - int n_ExternalID; - xmlChar * SystemID; /* the entity system ID if available */ - int n_SystemID; - xmlChar * content; /* the entity content */ - int n_content; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_type = 0;n_type < gen_nb_int;n_type++) { - for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { - for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - type = gen_int(n_type, 2); - ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3); - SystemID = gen_const_xmlChar_ptr(n_SystemID, 4); - content = gen_const_xmlChar_ptr(n_content, 5); - - ret_val = xmlAddDocEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content); - desret_xmlEntityPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_int(n_type, type, 2); - des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3); - des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAddDocEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_name); - printf(" %d", n_type); - printf(" %d", n_ExternalID); - printf(" %d", n_SystemID); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlAddDtdEntity(void) { - int test_ret = 0; - - int mem_base; - xmlEntityPtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlChar * name; /* the entity name */ - int n_name; - int type; /* the entity type XML_xxx_yyy_ENTITY */ - int n_type; - xmlChar * ExternalID; /* the entity external ID if available */ - int n_ExternalID; - xmlChar * SystemID; /* the entity system ID if available */ - int n_SystemID; - xmlChar * content; /* the entity content */ - int n_content; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_type = 0;n_type < gen_nb_int;n_type++) { - for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { - for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - type = gen_int(n_type, 2); - ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3); - SystemID = gen_const_xmlChar_ptr(n_SystemID, 4); - content = gen_const_xmlChar_ptr(n_content, 5); - - ret_val = xmlAddDtdEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content); - desret_xmlEntityPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_int(n_type, type, 2); - des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3); - des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAddDtdEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_name); - printf(" %d", n_type); - printf(" %d", n_ExternalID); - printf(" %d", n_SystemID); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCleanupPredefinedEntities(void) { - int test_ret = 0; - -#if defined(LIBXML_LEGACY_ENABLED) -#ifdef LIBXML_LEGACY_ENABLED - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlCleanupPredefinedEntities(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCleanupPredefinedEntities", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -#define gen_nb_xmlEntitiesTablePtr 1 -static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlCopyEntitiesTable(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlCreateEntitiesTable(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlDumpEntitiesTable(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlBufferPtr buf; /* An XML buffer. */ - int n_buf; - xmlEntitiesTablePtr table; /* An entity table */ - int n_table; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - table = gen_xmlEntitiesTablePtr(n_table, 1); - - xmlDumpEntitiesTable(buf, table); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_xmlEntitiesTablePtr(n_table, table, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDumpEntitiesTable", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_table); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -#define gen_nb_xmlEntityPtr 1 -static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlDumpEntityDecl(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlBufferPtr buf; /* An XML buffer. */ - int n_buf; - xmlEntityPtr ent; /* An entity table */ - int n_ent; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - ent = gen_xmlEntityPtr(n_ent, 1); - - xmlDumpEntityDecl(buf, ent); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_xmlEntityPtr(n_ent, ent, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDumpEntityDecl", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_ent); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlEncodeEntitiesReentrant(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlDocPtr doc; /* the document containing the string */ - int n_doc; - xmlChar * input; /* A string to convert to XML. */ - int n_input; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - input = gen_const_xmlChar_ptr(n_input, 1); - - ret_val = xmlEncodeEntitiesReentrant(doc, (const xmlChar *)input); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_input); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlEncodeSpecialChars(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlDocPtr doc; /* the document containing the string */ - int n_doc; - xmlChar * input; /* A string to convert to XML. */ - int n_input; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - input = gen_const_xmlChar_ptr(n_input, 1); - - ret_val = xmlEncodeSpecialChars(doc, (const xmlChar *)input); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlEncodeSpecialChars", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_input); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetDocEntity(void) { - int test_ret = 0; - - int mem_base; - xmlEntityPtr ret_val; - xmlDocPtr doc; /* the document referencing the entity */ - int n_doc; - xmlChar * name; /* the entity name */ - int n_name; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlGetDocEntity(doc, (const xmlChar *)name); - desret_xmlEntityPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetDocEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetDtdEntity(void) { - int test_ret = 0; - - int mem_base; - xmlEntityPtr ret_val; - xmlDocPtr doc; /* the document referencing the entity */ - int n_doc; - xmlChar * name; /* the entity name */ - int n_name; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlGetDtdEntity(doc, (const xmlChar *)name); - desret_xmlEntityPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetDtdEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetParameterEntity(void) { - int test_ret = 0; - - int mem_base; - xmlEntityPtr ret_val; - xmlDocPtr doc; /* the document referencing the entity */ - int n_doc; - xmlChar * name; /* the entity name */ - int n_name; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlGetParameterEntity(doc, (const xmlChar *)name); - desret_xmlEntityPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetParameterEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetPredefinedEntity(void) { - int test_ret = 0; - - int mem_base; - xmlEntityPtr ret_val; - xmlChar * name; /* the entity name */ - int n_name; - - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - name = gen_const_xmlChar_ptr(n_name, 0); - - ret_val = xmlGetPredefinedEntity((const xmlChar *)name); - desret_xmlEntityPtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetPredefinedEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_name); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlInitializePredefinedEntities(void) { - int test_ret = 0; - -#if defined(LIBXML_LEGACY_ENABLED) -#ifdef LIBXML_LEGACY_ENABLED - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlInitializePredefinedEntities(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlInitializePredefinedEntities", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlNewEntity(void) { - int test_ret = 0; - - int mem_base; - xmlEntityPtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlChar * name; /* the entity name */ - int n_name; - int type; /* the entity type XML_xxx_yyy_ENTITY */ - int n_type; - xmlChar * ExternalID; /* the entity external ID if available */ - int n_ExternalID; - xmlChar * SystemID; /* the entity system ID if available */ - int n_SystemID; - xmlChar * content; /* the entity content */ - int n_content; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_type = 0;n_type < gen_nb_int;n_type++) { - for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { - for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - type = gen_int(n_type, 2); - ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3); - SystemID = gen_const_xmlChar_ptr(n_SystemID, 4); - content = gen_const_xmlChar_ptr(n_content, 5); - - ret_val = xmlNewEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content); - desret_xmlEntityPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_int(n_type, type, 2); - des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3); - des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_name); - printf(" %d", n_type); - printf(" %d", n_ExternalID); - printf(" %d", n_SystemID); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - -static int -test_entities(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing entities : 13 of 17 functions ...\n"); - test_ret += test_xmlAddDocEntity(); - test_ret += test_xmlAddDtdEntity(); - test_ret += test_xmlCleanupPredefinedEntities(); - test_ret += test_xmlCopyEntitiesTable(); - test_ret += test_xmlCreateEntitiesTable(); - test_ret += test_xmlDumpEntitiesTable(); - test_ret += test_xmlDumpEntityDecl(); - test_ret += test_xmlEncodeEntitiesReentrant(); - test_ret += test_xmlEncodeSpecialChars(); - test_ret += test_xmlGetDocEntity(); - test_ret += test_xmlGetDtdEntity(); - test_ret += test_xmlGetParameterEntity(); - test_ret += test_xmlGetPredefinedEntity(); - test_ret += test_xmlInitializePredefinedEntities(); - test_ret += test_xmlNewEntity(); - - if (test_ret != 0) - printf("Module entities: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlHashAddEntry(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlHashTablePtr table; /* the hash table */ - int n_table; - xmlChar * name; /* the name of the userdata */ - int n_name; - void * userdata; /* a pointer to the userdata */ - int n_userdata; - - for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) { - mem_base = xmlMemBlocks(); - table = gen_xmlHashTablePtr(n_table, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - userdata = gen_userdata(n_userdata, 2); - - ret_val = xmlHashAddEntry(table, (const xmlChar *)name, userdata); - desret_int(ret_val); - call_tests++; - des_xmlHashTablePtr(n_table, table, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_userdata(n_userdata, userdata, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHashAddEntry", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_table); - printf(" %d", n_name); - printf(" %d", n_userdata); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlHashAddEntry2(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlHashTablePtr table; /* the hash table */ - int n_table; - xmlChar * name; /* the name of the userdata */ - int n_name; - xmlChar * name2; /* a second name of the userdata */ - int n_name2; - void * userdata; /* a pointer to the userdata */ - int n_userdata; - - for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { - for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) { - mem_base = xmlMemBlocks(); - table = gen_xmlHashTablePtr(n_table, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - name2 = gen_const_xmlChar_ptr(n_name2, 2); - userdata = gen_userdata(n_userdata, 3); - - ret_val = xmlHashAddEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata); - desret_int(ret_val); - call_tests++; - des_xmlHashTablePtr(n_table, table, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2); - des_userdata(n_userdata, userdata, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHashAddEntry2", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_table); - printf(" %d", n_name); - printf(" %d", n_name2); - printf(" %d", n_userdata); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlHashAddEntry3(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlHashTablePtr table; /* the hash table */ - int n_table; - xmlChar * name; /* the name of the userdata */ - int n_name; - xmlChar * name2; /* a second name of the userdata */ - int n_name2; - xmlChar * name3; /* a third name of the userdata */ - int n_name3; - void * userdata; /* a pointer to the userdata */ - int n_userdata; - - for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { - for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) { - for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) { - mem_base = xmlMemBlocks(); - table = gen_xmlHashTablePtr(n_table, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - name2 = gen_const_xmlChar_ptr(n_name2, 2); - name3 = gen_const_xmlChar_ptr(n_name3, 3); - userdata = gen_userdata(n_userdata, 4); - - ret_val = xmlHashAddEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata); - desret_int(ret_val); - call_tests++; - des_xmlHashTablePtr(n_table, table, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2); - des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3); - des_userdata(n_userdata, userdata, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHashAddEntry3", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_table); - printf(" %d", n_name); - printf(" %d", n_name2); - printf(" %d", n_name3); - printf(" %d", n_userdata); - printf("\n"); - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlHashCopy(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlHashCreate(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlHashCreateDict(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlHashLookup(void) { - int test_ret = 0; - - int mem_base; - void * ret_val; - xmlHashTablePtr table; /* the hash table */ - int n_table; - xmlChar * name; /* the name of the userdata */ - int n_name; - - for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - table = gen_xmlHashTablePtr(n_table, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlHashLookup(table, (const xmlChar *)name); - desret_void_ptr(ret_val); - call_tests++; - des_xmlHashTablePtr(n_table, table, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHashLookup", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_table); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlHashLookup2(void) { - int test_ret = 0; - - int mem_base; - void * ret_val; - xmlHashTablePtr table; /* the hash table */ - int n_table; - xmlChar * name; /* the name of the userdata */ - int n_name; - xmlChar * name2; /* a second name of the userdata */ - int n_name2; - - for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { - mem_base = xmlMemBlocks(); - table = gen_xmlHashTablePtr(n_table, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - name2 = gen_const_xmlChar_ptr(n_name2, 2); - - ret_val = xmlHashLookup2(table, (const xmlChar *)name, (const xmlChar *)name2); - desret_void_ptr(ret_val); - call_tests++; - des_xmlHashTablePtr(n_table, table, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHashLookup2", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_table); - printf(" %d", n_name); - printf(" %d", n_name2); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlHashLookup3(void) { - int test_ret = 0; - - int mem_base; - void * ret_val; - xmlHashTablePtr table; /* the hash table */ - int n_table; - xmlChar * name; /* the name of the userdata */ - int n_name; - xmlChar * name2; /* a second name of the userdata */ - int n_name2; - xmlChar * name3; /* a third name of the userdata */ - int n_name3; - - for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { - for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) { - mem_base = xmlMemBlocks(); - table = gen_xmlHashTablePtr(n_table, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - name2 = gen_const_xmlChar_ptr(n_name2, 2); - name3 = gen_const_xmlChar_ptr(n_name3, 3); - - ret_val = xmlHashLookup3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3); - desret_void_ptr(ret_val); - call_tests++; - des_xmlHashTablePtr(n_table, table, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2); - des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHashLookup3", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_table); - printf(" %d", n_name); - printf(" %d", n_name2); - printf(" %d", n_name3); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlHashQLookup(void) { - int test_ret = 0; - - int mem_base; - void * ret_val; - xmlHashTablePtr table; /* the hash table */ - int n_table; - xmlChar * prefix; /* the prefix of the userdata */ - int n_prefix; - xmlChar * name; /* the name of the userdata */ - int n_name; - - for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { - for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - table = gen_xmlHashTablePtr(n_table, 0); - prefix = gen_const_xmlChar_ptr(n_prefix, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - - ret_val = xmlHashQLookup(table, (const xmlChar *)prefix, (const xmlChar *)name); - desret_void_ptr(ret_val); - call_tests++; - des_xmlHashTablePtr(n_table, table, 0); - des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHashQLookup", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_table); - printf(" %d", n_prefix); - printf(" %d", n_name); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlHashQLookup2(void) { - int test_ret = 0; - - int mem_base; - void * ret_val; - xmlHashTablePtr table; /* the hash table */ - int n_table; - xmlChar * prefix; /* the prefix of the userdata */ - int n_prefix; - xmlChar * name; /* the name of the userdata */ - int n_name; - xmlChar * prefix2; /* the second prefix of the userdata */ - int n_prefix2; - xmlChar * name2; /* a second name of the userdata */ - int n_name2; - - for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { - for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) { - for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { - mem_base = xmlMemBlocks(); - table = gen_xmlHashTablePtr(n_table, 0); - prefix = gen_const_xmlChar_ptr(n_prefix, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3); - name2 = gen_const_xmlChar_ptr(n_name2, 4); - - ret_val = xmlHashQLookup2(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2); - desret_void_ptr(ret_val); - call_tests++; - des_xmlHashTablePtr(n_table, table, 0); - des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3); - des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHashQLookup2", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_table); - printf(" %d", n_prefix); - printf(" %d", n_name); - printf(" %d", n_prefix2); - printf(" %d", n_name2); - printf("\n"); - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlHashQLookup3(void) { - int test_ret = 0; - - int mem_base; - void * ret_val; - xmlHashTablePtr table; /* the hash table */ - int n_table; - xmlChar * prefix; /* the prefix of the userdata */ - int n_prefix; - xmlChar * name; /* the name of the userdata */ - int n_name; - xmlChar * prefix2; /* the second prefix of the userdata */ - int n_prefix2; - xmlChar * name2; /* a second name of the userdata */ - int n_name2; - xmlChar * prefix3; /* the third prefix of the userdata */ - int n_prefix3; - xmlChar * name3; /* a third name of the userdata */ - int n_name3; - - for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { - for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) { - for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { - for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) { - for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) { - mem_base = xmlMemBlocks(); - table = gen_xmlHashTablePtr(n_table, 0); - prefix = gen_const_xmlChar_ptr(n_prefix, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3); - name2 = gen_const_xmlChar_ptr(n_name2, 4); - prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5); - name3 = gen_const_xmlChar_ptr(n_name3, 6); - - ret_val = xmlHashQLookup3(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2, (const xmlChar *)prefix3, (const xmlChar *)name3); - desret_void_ptr(ret_val); - call_tests++; - des_xmlHashTablePtr(n_table, table, 0); - des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3); - des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4); - des_const_xmlChar_ptr(n_prefix3, (const xmlChar *)prefix3, 5); - des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 6); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHashQLookup3", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_table); - printf(" %d", n_prefix); - printf(" %d", n_name); - printf(" %d", n_prefix2); - printf(" %d", n_name2); - printf(" %d", n_prefix3); - printf(" %d", n_name3); - printf("\n"); - } - } - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlHashRemoveEntry(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlHashTablePtr table; /* the hash table */ - int n_table; - xmlChar * name; /* the name of the userdata */ - int n_name; - xmlHashDeallocator f; /* the deallocator function for removed item (if any) */ - int n_f; - - for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) { - mem_base = xmlMemBlocks(); - table = gen_xmlHashTablePtr(n_table, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - f = gen_xmlHashDeallocator(n_f, 2); - - ret_val = xmlHashRemoveEntry(table, (const xmlChar *)name, f); - desret_int(ret_val); - call_tests++; - des_xmlHashTablePtr(n_table, table, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_xmlHashDeallocator(n_f, f, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHashRemoveEntry", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_table); - printf(" %d", n_name); - printf(" %d", n_f); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlHashRemoveEntry2(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlHashTablePtr table; /* the hash table */ - int n_table; - xmlChar * name; /* the name of the userdata */ - int n_name; - xmlChar * name2; /* a second name of the userdata */ - int n_name2; - xmlHashDeallocator f; /* the deallocator function for removed item (if any) */ - int n_f; - - for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { - for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) { - mem_base = xmlMemBlocks(); - table = gen_xmlHashTablePtr(n_table, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - name2 = gen_const_xmlChar_ptr(n_name2, 2); - f = gen_xmlHashDeallocator(n_f, 3); - - ret_val = xmlHashRemoveEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, f); - desret_int(ret_val); - call_tests++; - des_xmlHashTablePtr(n_table, table, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2); - des_xmlHashDeallocator(n_f, f, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHashRemoveEntry2", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_table); - printf(" %d", n_name); - printf(" %d", n_name2); - printf(" %d", n_f); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlHashRemoveEntry3(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlHashTablePtr table; /* the hash table */ - int n_table; - xmlChar * name; /* the name of the userdata */ - int n_name; - xmlChar * name2; /* a second name of the userdata */ - int n_name2; - xmlChar * name3; /* a third name of the userdata */ - int n_name3; - xmlHashDeallocator f; /* the deallocator function for removed item (if any) */ - int n_f; - - for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { - for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) { - for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) { - mem_base = xmlMemBlocks(); - table = gen_xmlHashTablePtr(n_table, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - name2 = gen_const_xmlChar_ptr(n_name2, 2); - name3 = gen_const_xmlChar_ptr(n_name3, 3); - f = gen_xmlHashDeallocator(n_f, 4); - - ret_val = xmlHashRemoveEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, f); - desret_int(ret_val); - call_tests++; - des_xmlHashTablePtr(n_table, table, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2); - des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3); - des_xmlHashDeallocator(n_f, f, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHashRemoveEntry3", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_table); - printf(" %d", n_name); - printf(" %d", n_name2); - printf(" %d", n_name3); - printf(" %d", n_f); - printf("\n"); - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlHashScan(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlHashScan3(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlHashScanFull(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlHashScanFull3(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlHashSize(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlHashTablePtr table; /* the hash table */ - int n_table; - - for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { - mem_base = xmlMemBlocks(); - table = gen_xmlHashTablePtr(n_table, 0); - - ret_val = xmlHashSize(table); - desret_int(ret_val); - call_tests++; - des_xmlHashTablePtr(n_table, table, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHashSize", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_table); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlHashUpdateEntry(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlHashTablePtr table; /* the hash table */ - int n_table; - xmlChar * name; /* the name of the userdata */ - int n_name; - void * userdata; /* a pointer to the userdata */ - int n_userdata; - xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */ - int n_f; - - for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) { - for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) { - mem_base = xmlMemBlocks(); - table = gen_xmlHashTablePtr(n_table, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - userdata = gen_userdata(n_userdata, 2); - f = gen_xmlHashDeallocator(n_f, 3); - - ret_val = xmlHashUpdateEntry(table, (const xmlChar *)name, userdata, f); - desret_int(ret_val); - call_tests++; - des_xmlHashTablePtr(n_table, table, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_userdata(n_userdata, userdata, 2); - des_xmlHashDeallocator(n_f, f, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHashUpdateEntry", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_table); - printf(" %d", n_name); - printf(" %d", n_userdata); - printf(" %d", n_f); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlHashUpdateEntry2(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlHashTablePtr table; /* the hash table */ - int n_table; - xmlChar * name; /* the name of the userdata */ - int n_name; - xmlChar * name2; /* a second name of the userdata */ - int n_name2; - void * userdata; /* a pointer to the userdata */ - int n_userdata; - xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */ - int n_f; - - for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { - for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) { - for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) { - mem_base = xmlMemBlocks(); - table = gen_xmlHashTablePtr(n_table, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - name2 = gen_const_xmlChar_ptr(n_name2, 2); - userdata = gen_userdata(n_userdata, 3); - f = gen_xmlHashDeallocator(n_f, 4); - - ret_val = xmlHashUpdateEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata, f); - desret_int(ret_val); - call_tests++; - des_xmlHashTablePtr(n_table, table, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2); - des_userdata(n_userdata, userdata, 3); - des_xmlHashDeallocator(n_f, f, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHashUpdateEntry2", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_table); - printf(" %d", n_name); - printf(" %d", n_name2); - printf(" %d", n_userdata); - printf(" %d", n_f); - printf("\n"); - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlHashUpdateEntry3(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlHashTablePtr table; /* the hash table */ - int n_table; - xmlChar * name; /* the name of the userdata */ - int n_name; - xmlChar * name2; /* a second name of the userdata */ - int n_name2; - xmlChar * name3; /* a third name of the userdata */ - int n_name3; - void * userdata; /* a pointer to the userdata */ - int n_userdata; - xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */ - int n_f; - - for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { - for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) { - for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) { - for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) { - mem_base = xmlMemBlocks(); - table = gen_xmlHashTablePtr(n_table, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - name2 = gen_const_xmlChar_ptr(n_name2, 2); - name3 = gen_const_xmlChar_ptr(n_name3, 3); - userdata = gen_userdata(n_userdata, 4); - f = gen_xmlHashDeallocator(n_f, 5); - - ret_val = xmlHashUpdateEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata, f); - desret_int(ret_val); - call_tests++; - des_xmlHashTablePtr(n_table, table, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2); - des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3); - des_userdata(n_userdata, userdata, 4); - des_xmlHashDeallocator(n_f, f, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHashUpdateEntry3", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_table); - printf(" %d", n_name); - printf(" %d", n_name2); - printf(" %d", n_name3); - printf(" %d", n_userdata); - printf(" %d", n_f); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - -static int -test_hash(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing hash : 16 of 24 functions ...\n"); - test_ret += test_xmlHashAddEntry(); - test_ret += test_xmlHashAddEntry2(); - test_ret += test_xmlHashAddEntry3(); - test_ret += test_xmlHashCopy(); - test_ret += test_xmlHashCreate(); - test_ret += test_xmlHashCreateDict(); - test_ret += test_xmlHashLookup(); - test_ret += test_xmlHashLookup2(); - test_ret += test_xmlHashLookup3(); - test_ret += test_xmlHashQLookup(); - test_ret += test_xmlHashQLookup2(); - test_ret += test_xmlHashQLookup3(); - test_ret += test_xmlHashRemoveEntry(); - test_ret += test_xmlHashRemoveEntry2(); - test_ret += test_xmlHashRemoveEntry3(); - test_ret += test_xmlHashScan(); - test_ret += test_xmlHashScan3(); - test_ret += test_xmlHashScanFull(); - test_ret += test_xmlHashScanFull3(); - test_ret += test_xmlHashSize(); - test_ret += test_xmlHashUpdateEntry(); - test_ret += test_xmlHashUpdateEntry2(); - test_ret += test_xmlHashUpdateEntry3(); - - if (test_ret != 0) - printf("Module hash: %d errors\n", test_ret); - return(test_ret); -} - -#define gen_nb_xmlLinkPtr 1 -static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlLinkGetData(void) { - int test_ret = 0; - - int mem_base; - void * ret_val; - xmlLinkPtr lk; /* a link */ - int n_lk; - - for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) { - mem_base = xmlMemBlocks(); - lk = gen_xmlLinkPtr(n_lk, 0); - - ret_val = xmlLinkGetData(lk); - desret_void_ptr(ret_val); - call_tests++; - des_xmlLinkPtr(n_lk, lk, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlLinkGetData", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_lk); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlListAppend(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlListPtr l; /* a list */ - int n_l; - void * data; /* the data */ - int n_data; - - for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { - for (n_data = 0;n_data < gen_nb_userdata;n_data++) { - mem_base = xmlMemBlocks(); - l = gen_xmlListPtr(n_l, 0); - data = gen_userdata(n_data, 1); - - ret_val = xmlListAppend(l, data); - desret_int(ret_val); - call_tests++; - des_xmlListPtr(n_l, l, 0); - des_userdata(n_data, data, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlListAppend", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_l); - printf(" %d", n_data); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlListClear(void) { - int test_ret = 0; - - int mem_base; - xmlListPtr l; /* a list */ - int n_l; - - for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { - mem_base = xmlMemBlocks(); - l = gen_xmlListPtr(n_l, 0); - - xmlListClear(l); - call_tests++; - des_xmlListPtr(n_l, l, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlListClear", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_l); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -#define gen_nb_const_xmlListPtr 1 -static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlListCopy(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlListPtr cur; /* the new list */ - int n_cur; - xmlListPtr old; /* the old list */ - int n_old; - - for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) { - for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlListPtr(n_cur, 0); - old = gen_const_xmlListPtr(n_old, 1); - - ret_val = xmlListCopy(cur, (const xmlListPtr)old); - desret_int(ret_val); - call_tests++; - des_xmlListPtr(n_cur, cur, 0); - des_const_xmlListPtr(n_old, (const xmlListPtr)old, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlListCopy", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_old); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlListCreate(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlListDup(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlListEmpty(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlListPtr l; /* a list */ - int n_l; - - for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { - mem_base = xmlMemBlocks(); - l = gen_xmlListPtr(n_l, 0); - - ret_val = xmlListEmpty(l); - desret_int(ret_val); - call_tests++; - des_xmlListPtr(n_l, l, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlListEmpty", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_l); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlListEnd(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlListFront(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlListInsert(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlListPtr l; /* a list */ - int n_l; - void * data; /* the data */ - int n_data; - - for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { - for (n_data = 0;n_data < gen_nb_userdata;n_data++) { - mem_base = xmlMemBlocks(); - l = gen_xmlListPtr(n_l, 0); - data = gen_userdata(n_data, 1); - - ret_val = xmlListInsert(l, data); - desret_int(ret_val); - call_tests++; - des_xmlListPtr(n_l, l, 0); - des_userdata(n_data, data, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlListInsert", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_l); - printf(" %d", n_data); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlListMerge(void) { - int test_ret = 0; - - int mem_base; - xmlListPtr l1; /* the original list */ - int n_l1; - xmlListPtr l2; /* the new list */ - int n_l2; - - for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) { - for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) { - mem_base = xmlMemBlocks(); - l1 = gen_xmlListPtr(n_l1, 0); - l2 = gen_xmlListPtr(n_l2, 1); - - xmlListMerge(l1, l2); - call_tests++; - des_xmlListPtr(n_l1, l1, 0); - des_xmlListPtr(n_l2, l2, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlListMerge", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_l1); - printf(" %d", n_l2); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlListPopBack(void) { - int test_ret = 0; - - int mem_base; - xmlListPtr l; /* a list */ - int n_l; - - for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { - mem_base = xmlMemBlocks(); - l = gen_xmlListPtr(n_l, 0); - - xmlListPopBack(l); - call_tests++; - des_xmlListPtr(n_l, l, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlListPopBack", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_l); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlListPopFront(void) { - int test_ret = 0; - - int mem_base; - xmlListPtr l; /* a list */ - int n_l; - - for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { - mem_base = xmlMemBlocks(); - l = gen_xmlListPtr(n_l, 0); - - xmlListPopFront(l); - call_tests++; - des_xmlListPtr(n_l, l, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlListPopFront", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_l); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlListPushBack(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlListPtr l; /* a list */ - int n_l; - void * data; /* new data */ - int n_data; - - for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { - for (n_data = 0;n_data < gen_nb_userdata;n_data++) { - mem_base = xmlMemBlocks(); - l = gen_xmlListPtr(n_l, 0); - data = gen_userdata(n_data, 1); - - ret_val = xmlListPushBack(l, data); - desret_int(ret_val); - call_tests++; - des_xmlListPtr(n_l, l, 0); - des_userdata(n_data, data, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlListPushBack", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_l); - printf(" %d", n_data); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlListPushFront(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlListPtr l; /* a list */ - int n_l; - void * data; /* new data */ - int n_data; - - for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { - for (n_data = 0;n_data < gen_nb_userdata;n_data++) { - mem_base = xmlMemBlocks(); - l = gen_xmlListPtr(n_l, 0); - data = gen_userdata(n_data, 1); - - ret_val = xmlListPushFront(l, data); - desret_int(ret_val); - call_tests++; - des_xmlListPtr(n_l, l, 0); - des_userdata(n_data, data, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlListPushFront", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_l); - printf(" %d", n_data); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlListRemoveAll(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlListPtr l; /* a list */ - int n_l; - void * data; /* list data */ - int n_data; - - for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { - for (n_data = 0;n_data < gen_nb_userdata;n_data++) { - mem_base = xmlMemBlocks(); - l = gen_xmlListPtr(n_l, 0); - data = gen_userdata(n_data, 1); - - ret_val = xmlListRemoveAll(l, data); - desret_int(ret_val); - call_tests++; - des_xmlListPtr(n_l, l, 0); - des_userdata(n_data, data, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlListRemoveAll", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_l); - printf(" %d", n_data); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlListRemoveFirst(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlListPtr l; /* a list */ - int n_l; - void * data; /* list data */ - int n_data; - - for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { - for (n_data = 0;n_data < gen_nb_userdata;n_data++) { - mem_base = xmlMemBlocks(); - l = gen_xmlListPtr(n_l, 0); - data = gen_userdata(n_data, 1); - - ret_val = xmlListRemoveFirst(l, data); - desret_int(ret_val); - call_tests++; - des_xmlListPtr(n_l, l, 0); - des_userdata(n_data, data, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlListRemoveFirst", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_l); - printf(" %d", n_data); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlListRemoveLast(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlListPtr l; /* a list */ - int n_l; - void * data; /* list data */ - int n_data; - - for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { - for (n_data = 0;n_data < gen_nb_userdata;n_data++) { - mem_base = xmlMemBlocks(); - l = gen_xmlListPtr(n_l, 0); - data = gen_userdata(n_data, 1); - - ret_val = xmlListRemoveLast(l, data); - desret_int(ret_val); - call_tests++; - des_xmlListPtr(n_l, l, 0); - des_userdata(n_data, data, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlListRemoveLast", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_l); - printf(" %d", n_data); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlListReverse(void) { - int test_ret = 0; - - int mem_base; - xmlListPtr l; /* a list */ - int n_l; - - for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { - mem_base = xmlMemBlocks(); - l = gen_xmlListPtr(n_l, 0); - - xmlListReverse(l); - call_tests++; - des_xmlListPtr(n_l, l, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlListReverse", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_l); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlListReverseSearch(void) { - int test_ret = 0; - - int mem_base; - void * ret_val; - xmlListPtr l; /* a list */ - int n_l; - void * data; /* a search value */ - int n_data; - - for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { - for (n_data = 0;n_data < gen_nb_userdata;n_data++) { - mem_base = xmlMemBlocks(); - l = gen_xmlListPtr(n_l, 0); - data = gen_userdata(n_data, 1); - - ret_val = xmlListReverseSearch(l, data); - desret_void_ptr(ret_val); - call_tests++; - des_xmlListPtr(n_l, l, 0); - des_userdata(n_data, data, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlListReverseSearch", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_l); - printf(" %d", n_data); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlListReverseWalk(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlListSearch(void) { - int test_ret = 0; - - int mem_base; - void * ret_val; - xmlListPtr l; /* a list */ - int n_l; - void * data; /* a search value */ - int n_data; - - for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { - for (n_data = 0;n_data < gen_nb_userdata;n_data++) { - mem_base = xmlMemBlocks(); - l = gen_xmlListPtr(n_l, 0); - data = gen_userdata(n_data, 1); - - ret_val = xmlListSearch(l, data); - desret_void_ptr(ret_val); - call_tests++; - des_xmlListPtr(n_l, l, 0); - des_userdata(n_data, data, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlListSearch", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_l); - printf(" %d", n_data); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlListSize(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlListPtr l; /* a list */ - int n_l; - - for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { - mem_base = xmlMemBlocks(); - l = gen_xmlListPtr(n_l, 0); - - ret_val = xmlListSize(l); - desret_int(ret_val); - call_tests++; - des_xmlListPtr(n_l, l, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlListSize", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_l); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlListSort(void) { - int test_ret = 0; - - int mem_base; - xmlListPtr l; /* a list */ - int n_l; - - for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { - mem_base = xmlMemBlocks(); - l = gen_xmlListPtr(n_l, 0); - - xmlListSort(l); - call_tests++; - des_xmlListPtr(n_l, l, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlListSort", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_l); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlListWalk(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - -static int -test_list(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n"); - test_ret += test_xmlLinkGetData(); - test_ret += test_xmlListAppend(); - test_ret += test_xmlListClear(); - test_ret += test_xmlListCopy(); - test_ret += test_xmlListCreate(); - test_ret += test_xmlListDup(); - test_ret += test_xmlListEmpty(); - test_ret += test_xmlListEnd(); - test_ret += test_xmlListFront(); - test_ret += test_xmlListInsert(); - test_ret += test_xmlListMerge(); - test_ret += test_xmlListPopBack(); - test_ret += test_xmlListPopFront(); - test_ret += test_xmlListPushBack(); - test_ret += test_xmlListPushFront(); - test_ret += test_xmlListRemoveAll(); - test_ret += test_xmlListRemoveFirst(); - test_ret += test_xmlListRemoveLast(); - test_ret += test_xmlListReverse(); - test_ret += test_xmlListReverseSearch(); - test_ret += test_xmlListReverseWalk(); - test_ret += test_xmlListSearch(); - test_ret += test_xmlListSize(); - test_ret += test_xmlListSort(); - test_ret += test_xmlListWalk(); - - if (test_ret != 0) - printf("Module list: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlNanoFTPCheckResponse(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* an FTP context */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); - - ret_val = xmlNanoFTPCheckResponse(ctx); - desret_int(ret_val); - call_tests++; - des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPCheckResponse", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPCleanup(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlNanoFTPCleanup(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPCleanup", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPCloseConnection(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* an FTP context */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); - - ret_val = xmlNanoFTPCloseConnection(ctx); - desret_int(ret_val); - call_tests++; - des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPCloseConnection", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPCwd(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* an FTP context */ - int n_ctx; - char * directory; /* a directory on the server */ - int n_directory; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { - for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); - directory = gen_const_char_ptr(n_directory, 1); - - ret_val = xmlNanoFTPCwd(ctx, (const char *)directory); - desret_int(ret_val); - call_tests++; - des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); - des_const_char_ptr(n_directory, (const char *)directory, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPCwd", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_directory); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPDele(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* an FTP context */ - int n_ctx; - const char * file; /* a file or directory on the server */ - int n_file; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { - for (n_file = 0;n_file < gen_nb_filepath;n_file++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); - file = gen_filepath(n_file, 1); - - ret_val = xmlNanoFTPDele(ctx, file); - desret_int(ret_val); - call_tests++; - des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); - des_filepath(n_file, file, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPDele", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_file); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPGet(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlNanoFTPGetConnection(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlNanoFTPGetResponse(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* an FTP context */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); - - ret_val = xmlNanoFTPGetResponse(ctx); - desret_int(ret_val); - call_tests++; - des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPGetResponse", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPGetSocket(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlNanoFTPInit(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlNanoFTPInit(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPInit", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPList(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlNanoFTPNewCtxt(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - void * ret_val; - const char * URL; /* The URL used to initialize the context */ - int n_URL; - - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - mem_base = xmlMemBlocks(); - URL = gen_filepath(n_URL, 0); - - ret_val = xmlNanoFTPNewCtxt(URL); - desret_xmlNanoFTPCtxtPtr(ret_val); - call_tests++; - des_filepath(n_URL, URL, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPNewCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URL); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPOpen(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - void * ret_val; - const char * URL; /* the URL to the resource */ - int n_URL; - - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - mem_base = xmlMemBlocks(); - URL = gen_filepath(n_URL, 0); - - ret_val = xmlNanoFTPOpen(URL); - desret_xmlNanoFTPCtxtPtr(ret_val); - call_tests++; - des_filepath(n_URL, URL, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPOpen", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URL); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPProxy(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - char * host; /* the proxy host name */ - int n_host; - int port; /* the proxy port */ - int n_port; - char * user; /* the proxy user name */ - int n_user; - char * passwd; /* the proxy password */ - int n_passwd; - int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */ - int n_type; - - for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) { - for (n_port = 0;n_port < gen_nb_int;n_port++) { - for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) { - for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) { - for (n_type = 0;n_type < gen_nb_int;n_type++) { - host = gen_const_char_ptr(n_host, 0); - port = gen_int(n_port, 1); - user = gen_const_char_ptr(n_user, 2); - passwd = gen_const_char_ptr(n_passwd, 3); - type = gen_int(n_type, 4); - - xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type); - call_tests++; - des_const_char_ptr(n_host, (const char *)host, 0); - des_int(n_port, port, 1); - des_const_char_ptr(n_user, (const char *)user, 2); - des_const_char_ptr(n_passwd, (const char *)passwd, 3); - des_int(n_type, type, 4); - xmlResetLastError(); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPQuit(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* an FTP context */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); - - ret_val = xmlNanoFTPQuit(ctx); - desret_int(ret_val); - call_tests++; - des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPQuit", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPRead(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* the FTP context */ - int n_ctx; - void * dest; /* a buffer */ - int n_dest; - int len; /* the buffer length */ - int n_len; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { - for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); - dest = gen_void_ptr(n_dest, 1); - len = gen_int(n_len, 2); - - ret_val = xmlNanoFTPRead(ctx, dest, len); - desret_int(ret_val); - call_tests++; - des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); - des_void_ptr(n_dest, dest, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPRead", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_dest); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPScanProxy(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - const char * URL; /* The proxy URL used to initialize the proxy context */ - int n_URL; - - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - URL = gen_filepath(n_URL, 0); - - xmlNanoFTPScanProxy(URL); - call_tests++; - des_filepath(n_URL, URL, 0); - xmlResetLastError(); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoFTPUpdateURL(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* an FTP context */ - int n_ctx; - const char * URL; /* The URL used to update the context */ - int n_URL; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); - URL = gen_filepath(n_URL, 1); - - ret_val = xmlNanoFTPUpdateURL(ctx, URL); - desret_int(ret_val); - call_tests++; - des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); - des_filepath(n_URL, URL, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoFTPUpdateURL", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_URL); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_nanoftp(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing nanoftp : 14 of 22 functions ...\n"); - test_ret += test_xmlNanoFTPCheckResponse(); - test_ret += test_xmlNanoFTPCleanup(); - test_ret += test_xmlNanoFTPCloseConnection(); - test_ret += test_xmlNanoFTPCwd(); - test_ret += test_xmlNanoFTPDele(); - test_ret += test_xmlNanoFTPGet(); - test_ret += test_xmlNanoFTPGetConnection(); - test_ret += test_xmlNanoFTPGetResponse(); - test_ret += test_xmlNanoFTPGetSocket(); - test_ret += test_xmlNanoFTPInit(); - test_ret += test_xmlNanoFTPList(); - test_ret += test_xmlNanoFTPNewCtxt(); - test_ret += test_xmlNanoFTPOpen(); - test_ret += test_xmlNanoFTPProxy(); - test_ret += test_xmlNanoFTPQuit(); - test_ret += test_xmlNanoFTPRead(); - test_ret += test_xmlNanoFTPScanProxy(); - test_ret += test_xmlNanoFTPUpdateURL(); - - if (test_ret != 0) - printf("Module nanoftp: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlNanoHTTPAuthHeader(void) { - int test_ret = 0; - -#if defined(LIBXML_HTTP_ENABLED) - int mem_base; - const char * ret_val; - void * ctx; /* the HTTP context */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); - - ret_val = xmlNanoHTTPAuthHeader(ctx); - desret_const_char_ptr(ret_val); - call_tests++; - des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoHTTPCleanup(void) { - int test_ret = 0; - -#if defined(LIBXML_HTTP_ENABLED) - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlNanoHTTPCleanup(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoHTTPCleanup", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoHTTPContentLength(void) { - int test_ret = 0; - -#if defined(LIBXML_HTTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* the HTTP context */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); - - ret_val = xmlNanoHTTPContentLength(ctx); - desret_int(ret_val); - call_tests++; - des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoHTTPContentLength", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoHTTPEncoding(void) { - int test_ret = 0; - -#if defined(LIBXML_HTTP_ENABLED) - int mem_base; - const char * ret_val; - void * ctx; /* the HTTP context */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); - - ret_val = xmlNanoHTTPEncoding(ctx); - desret_const_char_ptr(ret_val); - call_tests++; - des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoHTTPEncoding", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -#define gen_nb_char_ptr_ptr 1 -static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlNanoHTTPFetch(void) { - int test_ret = 0; - -#if defined(LIBXML_HTTP_ENABLED) - int mem_base; - int ret_val; - const char * URL; /* The URL to load */ - int n_URL; - const char * filename; /* the filename where the content should be saved */ - int n_filename; - char ** contentType; /* if available the Content-Type information will be returned at that location */ - int n_contentType; - - for (n_URL = 0;n_URL < gen_nb_fileoutput;n_URL++) { - for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { - for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) { - mem_base = xmlMemBlocks(); - URL = gen_fileoutput(n_URL, 0); - filename = gen_fileoutput(n_filename, 1); - contentType = gen_char_ptr_ptr(n_contentType, 2); - - ret_val = xmlNanoHTTPFetch(URL, filename, contentType); - desret_int(ret_val); - call_tests++; - des_fileoutput(n_URL, URL, 0); - des_fileoutput(n_filename, filename, 1); - des_char_ptr_ptr(n_contentType, contentType, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoHTTPFetch", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URL); - printf(" %d", n_filename); - printf(" %d", n_contentType); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoHTTPInit(void) { - int test_ret = 0; - -#if defined(LIBXML_HTTP_ENABLED) - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlNanoHTTPInit(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoHTTPInit", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoHTTPMimeType(void) { - int test_ret = 0; - -#if defined(LIBXML_HTTP_ENABLED) - int mem_base; - const char * ret_val; - void * ctx; /* the HTTP context */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); - - ret_val = xmlNanoHTTPMimeType(ctx); - desret_const_char_ptr(ret_val); - call_tests++; - des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoHTTPMimeType", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoHTTPOpen(void) { - int test_ret = 0; - -#if defined(LIBXML_HTTP_ENABLED) - int mem_base; - void * ret_val; - const char * URL; /* The URL to load */ - int n_URL; - char ** contentType; /* if available the Content-Type information will be returned at that location */ - int n_contentType; - - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) { - mem_base = xmlMemBlocks(); - URL = gen_filepath(n_URL, 0); - contentType = gen_char_ptr_ptr(n_contentType, 1); - - ret_val = xmlNanoHTTPOpen(URL, contentType); - desret_xmlNanoHTTPCtxtPtr(ret_val); - call_tests++; - des_filepath(n_URL, URL, 0); - des_char_ptr_ptr(n_contentType, contentType, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoHTTPOpen", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URL); - printf(" %d", n_contentType); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoHTTPOpenRedir(void) { - int test_ret = 0; - -#if defined(LIBXML_HTTP_ENABLED) - int mem_base; - void * ret_val; - const char * URL; /* The URL to load */ - int n_URL; - char ** contentType; /* if available the Content-Type information will be returned at that location */ - int n_contentType; - char ** redir; /* if available the redirected URL will be returned */ - int n_redir; - - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) { - for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) { - mem_base = xmlMemBlocks(); - URL = gen_filepath(n_URL, 0); - contentType = gen_char_ptr_ptr(n_contentType, 1); - redir = gen_char_ptr_ptr(n_redir, 2); - - ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir); - desret_xmlNanoHTTPCtxtPtr(ret_val); - call_tests++; - des_filepath(n_URL, URL, 0); - des_char_ptr_ptr(n_contentType, contentType, 1); - des_char_ptr_ptr(n_redir, redir, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URL); - printf(" %d", n_contentType); - printf(" %d", n_redir); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoHTTPRead(void) { - int test_ret = 0; - -#if defined(LIBXML_HTTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* the HTTP context */ - int n_ctx; - void * dest; /* a buffer */ - int n_dest; - int len; /* the buffer length */ - int n_len; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { - for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); - dest = gen_void_ptr(n_dest, 1); - len = gen_int(n_len, 2); - - ret_val = xmlNanoHTTPRead(ctx, dest, len); - desret_int(ret_val); - call_tests++; - des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); - des_void_ptr(n_dest, dest, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoHTTPRead", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_dest); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoHTTPRedir(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlNanoHTTPReturnCode(void) { - int test_ret = 0; - -#if defined(LIBXML_HTTP_ENABLED) - int mem_base; - int ret_val; - void * ctx; /* the HTTP context */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); - - ret_val = xmlNanoHTTPReturnCode(ctx); - desret_int(ret_val); - call_tests++; - des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoHTTPReturnCode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoHTTPSave(void) { - int test_ret = 0; - -#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - void * ctxt; /* the HTTP context */ - int n_ctxt; - const char * filename; /* the filename where the content should be saved */ - int n_filename; - - for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) { - for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { - mem_base = xmlMemBlocks(); - ctxt = gen_void_ptr(n_ctxt, 0); - filename = gen_fileoutput(n_filename, 1); - - ret_val = xmlNanoHTTPSave(ctxt, filename); - desret_int(ret_val); - call_tests++; - des_void_ptr(n_ctxt, ctxt, 0); - des_fileoutput(n_filename, filename, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoHTTPSave", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_filename); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoHTTPScanProxy(void) { - int test_ret = 0; - -#if defined(LIBXML_HTTP_ENABLED) - const char * URL; /* The proxy URL used to initialize the proxy context */ - int n_URL; - - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - URL = gen_filepath(n_URL, 0); - - xmlNanoHTTPScanProxy(URL); - call_tests++; - des_filepath(n_URL, URL, 0); - xmlResetLastError(); - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_nanohttp(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing nanohttp : 13 of 17 functions ...\n"); - test_ret += test_xmlNanoHTTPAuthHeader(); - test_ret += test_xmlNanoHTTPCleanup(); - test_ret += test_xmlNanoHTTPContentLength(); - test_ret += test_xmlNanoHTTPEncoding(); - test_ret += test_xmlNanoHTTPFetch(); - test_ret += test_xmlNanoHTTPInit(); - test_ret += test_xmlNanoHTTPMimeType(); - test_ret += test_xmlNanoHTTPOpen(); - test_ret += test_xmlNanoHTTPOpenRedir(); - test_ret += test_xmlNanoHTTPRead(); - test_ret += test_xmlNanoHTTPRedir(); - test_ret += test_xmlNanoHTTPReturnCode(); - test_ret += test_xmlNanoHTTPSave(); - test_ret += test_xmlNanoHTTPScanProxy(); - - if (test_ret != 0) - printf("Module nanohttp: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlByteConsumed(void) { - int test_ret = 0; - - int mem_base; - long ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - - ret_val = xmlByteConsumed(ctxt); - desret_long(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlByteConsumed", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlClearNodeInfoSeq(void) { - int test_ret = 0; - - int mem_base; - xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */ - int n_seq; - - for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) { - mem_base = xmlMemBlocks(); - seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0); - - xmlClearNodeInfoSeq(seq); - call_tests++; - des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlClearNodeInfoSeq", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_seq); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlClearParserCtxt(void) { - int test_ret = 0; - - int mem_base; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - - xmlClearParserCtxt(ctxt); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlClearParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCreateDocParserCtxt(void) { - int test_ret = 0; - - int mem_base; - xmlParserCtxtPtr ret_val; - xmlChar * cur; /* a pointer to an array of xmlChar */ - int n_cur; - - for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { - mem_base = xmlMemBlocks(); - cur = gen_const_xmlChar_ptr(n_cur, 0); - - ret_val = xmlCreateDocParserCtxt((const xmlChar *)cur); - desret_xmlParserCtxtPtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCreateDocParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCreatePushParserCtxt(void) { - int test_ret = 0; - -#if defined(LIBXML_PUSH_ENABLED) - int mem_base; - xmlParserCtxtPtr ret_val; - xmlSAXHandlerPtr sax; /* a SAX handler */ - int n_sax; - void * user_data; /* The user data returned on SAX callbacks */ - int n_user_data; - char * chunk; /* a pointer to an array of chars */ - int n_chunk; - int size; /* number of chars in the array */ - int n_size; - const char * filename; /* an optional file name or URI */ - int n_filename; - - for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { - for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { - for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { - mem_base = xmlMemBlocks(); - sax = gen_xmlSAXHandlerPtr(n_sax, 0); - user_data = gen_userdata(n_user_data, 1); - chunk = gen_const_char_ptr(n_chunk, 2); - size = gen_int(n_size, 3); - filename = gen_fileoutput(n_filename, 4); - - ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename); - desret_xmlParserCtxtPtr(ret_val); - call_tests++; - des_xmlSAXHandlerPtr(n_sax, sax, 0); - des_userdata(n_user_data, user_data, 1); - des_const_char_ptr(n_chunk, (const char *)chunk, 2); - des_int(n_size, size, 3); - des_fileoutput(n_filename, filename, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCreatePushParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_sax); - printf(" %d", n_user_data); - printf(" %d", n_chunk); - printf(" %d", n_size); - printf(" %d", n_filename); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCtxtReadDoc(void) { - int test_ret = 0; - - int mem_base; - xmlDocPtr ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - xmlChar * cur; /* a pointer to a zero terminated string */ - int n_cur; - const char * URL; /* the base URL to use for the document */ - int n_URL; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of xmlParserOption */ - int n_options; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - cur = gen_const_xmlChar_ptr(n_cur, 1); - URL = gen_filepath(n_URL, 2); - encoding = gen_const_char_ptr(n_encoding, 3); - options = gen_parseroptions(n_options, 4); - - ret_val = xmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options); - desret_xmlDocPtr(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1); - des_filepath(n_URL, URL, 2); - des_const_char_ptr(n_encoding, (const char *)encoding, 3); - des_parseroptions(n_options, options, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCtxtReadDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_cur); - printf(" %d", n_URL); - printf(" %d", n_encoding); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCtxtReadFile(void) { - int test_ret = 0; - - int mem_base; - xmlDocPtr ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - const char * filename; /* a file or URL */ - int n_filename; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of xmlParserOption */ - int n_options; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - filename = gen_filepath(n_filename, 1); - encoding = gen_const_char_ptr(n_encoding, 2); - options = gen_parseroptions(n_options, 3); - - ret_val = xmlCtxtReadFile(ctxt, filename, (const char *)encoding, options); - desret_xmlDocPtr(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_filepath(n_filename, filename, 1); - des_const_char_ptr(n_encoding, (const char *)encoding, 2); - des_parseroptions(n_options, options, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCtxtReadFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_filename); - printf(" %d", n_encoding); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCtxtReadMemory(void) { - int test_ret = 0; - - int mem_base; - xmlDocPtr ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - char * buffer; /* a pointer to a char array */ - int n_buffer; - int size; /* the size of the array */ - int n_size; - const char * URL; /* the base URL to use for the document */ - int n_URL; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of xmlParserOption */ - int n_options; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - buffer = gen_const_char_ptr(n_buffer, 1); - size = gen_int(n_size, 2); - URL = gen_filepath(n_URL, 3); - encoding = gen_const_char_ptr(n_encoding, 4); - options = gen_parseroptions(n_options, 5); - - ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options); - desret_xmlDocPtr(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_char_ptr(n_buffer, (const char *)buffer, 1); - des_int(n_size, size, 2); - des_filepath(n_URL, URL, 3); - des_const_char_ptr(n_encoding, (const char *)encoding, 4); - des_parseroptions(n_options, options, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCtxtReadMemory", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_buffer); - printf(" %d", n_size); - printf(" %d", n_URL); - printf(" %d", n_encoding); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCtxtReset(void) { - int test_ret = 0; - - int mem_base; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - - xmlCtxtReset(ctxt); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCtxtReset", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCtxtResetPush(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - char * chunk; /* a pointer to an array of chars */ - int n_chunk; - int size; /* number of chars in the array */ - int n_size; - const char * filename; /* an optional file name or URI */ - int n_filename; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - chunk = gen_const_char_ptr(n_chunk, 1); - size = gen_int(n_size, 2); - filename = gen_filepath(n_filename, 3); - encoding = gen_const_char_ptr(n_encoding, 4); - - ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding); - desret_int(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_char_ptr(n_chunk, (const char *)chunk, 1); - des_int(n_size, size, 2); - des_filepath(n_filename, filename, 3); - des_const_char_ptr(n_encoding, (const char *)encoding, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCtxtResetPush", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_chunk); - printf(" %d", n_size); - printf(" %d", n_filename); - printf(" %d", n_encoding); - printf("\n"); - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCtxtUseOptions(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - int options; /* a combination of xmlParserOption */ - int n_options; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - options = gen_parseroptions(n_options, 1); - - ret_val = xmlCtxtUseOptions(ctxt, options); - desret_int(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_parseroptions(n_options, options, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCtxtUseOptions", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_options); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetExternalEntityLoader(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlGetFeature(void) { - int test_ret = 0; - -#if defined(LIBXML_LEGACY_ENABLED) -#ifdef LIBXML_LEGACY_ENABLED - int mem_base; - int ret_val; - xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */ - int n_ctxt; - char * name; /* the feature name */ - int n_name; - void * result; /* location to store the result */ - int n_result; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) { - for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - name = gen_const_char_ptr(n_name, 1); - result = gen_void_ptr(n_result, 2); - - ret_val = xmlGetFeature(ctxt, (const char *)name, result); - desret_int(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_char_ptr(n_name, (const char *)name, 1); - des_void_ptr(n_result, result, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetFeature", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_name); - printf(" %d", n_result); - printf("\n"); - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -#define gen_nb_const_char_ptr_ptr 1 -static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlGetFeaturesList(void) { - int test_ret = 0; - -#if defined(LIBXML_LEGACY_ENABLED) -#ifdef LIBXML_LEGACY_ENABLED - int mem_base; - int ret_val; - int * len; /* the length of the features name array (input/output) */ - int n_len; - char ** result; /* an array of string to be filled with the features name. */ - int n_result; - - for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) { - for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) { - mem_base = xmlMemBlocks(); - len = gen_int_ptr(n_len, 0); - result = gen_const_char_ptr_ptr(n_result, 1); - - ret_val = xmlGetFeaturesList(len, (const char **)result); - desret_int(ret_val); - call_tests++; - des_int_ptr(n_len, len, 0); - des_const_char_ptr_ptr(n_result, (const char **)result, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetFeaturesList", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_len); - printf(" %d", n_result); - printf("\n"); - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlHasFeature(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlFeature feature; /* the feature to be examined */ - int n_feature; - - for (n_feature = 0;n_feature < gen_nb_xmlFeature;n_feature++) { - mem_base = xmlMemBlocks(); - feature = gen_xmlFeature(n_feature, 0); - - ret_val = xmlHasFeature(feature); - desret_int(ret_val); - call_tests++; - des_xmlFeature(n_feature, feature, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHasFeature", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_feature); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlIOParseDTD(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) -#ifdef LIBXML_VALID_ENABLED - xmlDtdPtr ret_val; - xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */ - int n_sax; - xmlParserInputBufferPtr input; /* an Input Buffer */ - int n_input; - xmlCharEncoding enc; /* the charset encoding if known */ - int n_enc; - - for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { - for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) { - for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { - sax = gen_xmlSAXHandlerPtr(n_sax, 0); - input = gen_xmlParserInputBufferPtr(n_input, 1); - enc = gen_xmlCharEncoding(n_enc, 2); - - ret_val = xmlIOParseDTD(sax, input, enc); - input = NULL; - desret_xmlDtdPtr(ret_val); - call_tests++; - des_xmlSAXHandlerPtr(n_sax, sax, 0); - des_xmlParserInputBufferPtr(n_input, input, 1); - des_xmlCharEncoding(n_enc, enc, 2); - xmlResetLastError(); - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlInitNodeInfoSeq(void) { - int test_ret = 0; - - int mem_base; - xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */ - int n_seq; - - for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) { - mem_base = xmlMemBlocks(); - seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0); - - xmlInitNodeInfoSeq(seq); - call_tests++; - des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlInitNodeInfoSeq", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_seq); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlInitParser(void) { - int test_ret = 0; - - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlInitParser(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlInitParser", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlInitParserCtxt(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - - ret_val = xmlInitParserCtxt(ctxt); - desret_int(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlInitParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlKeepBlanksDefault(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - int val; /* int 0 or 1 */ - int n_val; - - for (n_val = 0;n_val < gen_nb_int;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_int(n_val, 0); - - ret_val = xmlKeepBlanksDefault(val); - desret_int(ret_val); - call_tests++; - des_int(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlKeepBlanksDefault", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlLineNumbersDefault(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - int val; /* int 0 or 1 */ - int n_val; - - for (n_val = 0;n_val < gen_nb_int;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_int(n_val, 0); - - ret_val = xmlLineNumbersDefault(val); - desret_int(ret_val); - call_tests++; - des_int(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlLineNumbersDefault", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlLoadExternalEntity(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputPtr ret_val; - const char * URL; /* the URL for the entity to load */ - int n_URL; - char * ID; /* the Public ID for the entity to load */ - int n_ID; - xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */ - int n_ctxt; - - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) { - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - URL = gen_filepath(n_URL, 0); - ID = gen_const_char_ptr(n_ID, 1); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2); - - ret_val = xmlLoadExternalEntity(URL, (const char *)ID, ctxt); - desret_xmlParserInputPtr(ret_val); - call_tests++; - des_filepath(n_URL, URL, 0); - des_const_char_ptr(n_ID, (const char *)ID, 1); - des_xmlParserCtxtPtr(n_ctxt, ctxt, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlLoadExternalEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URL); - printf(" %d", n_ID); - printf(" %d", n_ctxt); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewIOInputStream(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputPtr ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - xmlParserInputBufferPtr input; /* an I/O Input */ - int n_input; - xmlCharEncoding enc; /* the charset encoding if known */ - int n_enc; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) { - for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - input = gen_xmlParserInputBufferPtr(n_input, 1); - enc = gen_xmlCharEncoding(n_enc, 2); - - ret_val = xmlNewIOInputStream(ctxt, input, enc); - if (ret_val != NULL) input = NULL; - desret_xmlParserInputPtr(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_xmlParserInputBufferPtr(n_input, input, 1); - des_xmlCharEncoding(n_enc, enc, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewIOInputStream", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_input); - printf(" %d", n_enc); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewParserCtxt(void) { - int test_ret = 0; - - int mem_base; - xmlParserCtxtPtr ret_val; - - mem_base = xmlMemBlocks(); - - ret_val = xmlNewParserCtxt(); - desret_xmlParserCtxtPtr(ret_val); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; - - return(test_ret); -} - - -#define gen_nb_xmlNodePtr_ptr 1 -static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlParseBalancedChunkMemory(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - int ret_val; - xmlDocPtr doc; /* the document the chunk pertains to */ - int n_doc; - xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */ - int n_sax; - void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */ - int n_user_data; - int depth; /* Used for loop detection, use 0 */ - int n_depth; - xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */ - int n_string; - xmlNodePtr * lst; /* the return value for the set of parsed nodes */ - int n_lst; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { - for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { - for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { - for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) { - for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - sax = gen_xmlSAXHandlerPtr(n_sax, 1); - user_data = gen_userdata(n_user_data, 2); - depth = gen_int(n_depth, 3); - string = gen_const_xmlChar_ptr(n_string, 4); - lst = gen_xmlNodePtr_ptr(n_lst, 5); - -#ifdef LIBXML_SAX1_ENABLED - if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; -#endif - - - ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, (const xmlChar *)string, lst); - desret_int(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlSAXHandlerPtr(n_sax, sax, 1); - des_userdata(n_user_data, user_data, 2); - des_int(n_depth, depth, 3); - des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4); - des_xmlNodePtr_ptr(n_lst, lst, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseBalancedChunkMemory", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_sax); - printf(" %d", n_user_data); - printf(" %d", n_depth); - printf(" %d", n_string); - printf(" %d", n_lst); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlParseBalancedChunkMemoryRecover(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - int ret_val; - xmlDocPtr doc; /* the document the chunk pertains to */ - int n_doc; - xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */ - int n_sax; - void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */ - int n_user_data; - int depth; /* Used for loop detection, use 0 */ - int n_depth; - xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */ - int n_string; - xmlNodePtr * lst; /* the return value for the set of parsed nodes */ - int n_lst; - int recover; /* return nodes even if the data is broken (use 0) */ - int n_recover; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { - for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { - for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { - for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) { - for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) { - for (n_recover = 0;n_recover < gen_nb_int;n_recover++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - sax = gen_xmlSAXHandlerPtr(n_sax, 1); - user_data = gen_userdata(n_user_data, 2); - depth = gen_int(n_depth, 3); - string = gen_const_xmlChar_ptr(n_string, 4); - lst = gen_xmlNodePtr_ptr(n_lst, 5); - recover = gen_int(n_recover, 6); - -#ifdef LIBXML_SAX1_ENABLED - if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; -#endif - - - ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, (const xmlChar *)string, lst, recover); - desret_int(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlSAXHandlerPtr(n_sax, sax, 1); - des_userdata(n_user_data, user_data, 2); - des_int(n_depth, depth, 3); - des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4); - des_xmlNodePtr_ptr(n_lst, lst, 5); - des_int(n_recover, recover, 6); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_sax); - printf(" %d", n_user_data); - printf(" %d", n_depth); - printf(" %d", n_string); - printf(" %d", n_lst); - printf(" %d", n_recover); - printf("\n"); - } - } - } - } - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlParseChunk(void) { - int test_ret = 0; - -#if defined(LIBXML_PUSH_ENABLED) - int mem_base; - int ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - char * chunk; /* an char array */ - int n_chunk; - int size; /* the size in byte of the chunk */ - int n_size; - int terminate; /* last chunk indicator */ - int n_terminate; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - chunk = gen_const_char_ptr(n_chunk, 1); - size = gen_int(n_size, 2); - terminate = gen_int(n_terminate, 3); - - ret_val = xmlParseChunk(ctxt, (const char *)chunk, size, terminate); - if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} - desret_int(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_char_ptr(n_chunk, (const char *)chunk, 1); - des_int(n_size, size, 2); - des_int(n_terminate, terminate, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseChunk", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_chunk); - printf(" %d", n_size); - printf(" %d", n_terminate); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlParseCtxtExternalEntity(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserCtxtPtr ctx; /* the existing parsing context */ - int n_ctx; - xmlChar * URL; /* the URL for the entity to load */ - int n_URL; - xmlChar * ID; /* the System ID for the entity to load */ - int n_ID; - xmlNodePtr * lst; /* the return value for the set of parsed nodes */ - int n_lst; - - for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) { - for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) { - for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) { - for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) { - mem_base = xmlMemBlocks(); - ctx = gen_xmlParserCtxtPtr(n_ctx, 0); - URL = gen_const_xmlChar_ptr(n_URL, 1); - ID = gen_const_xmlChar_ptr(n_ID, 2); - lst = gen_xmlNodePtr_ptr(n_lst, 3); - - ret_val = xmlParseCtxtExternalEntity(ctx, (const xmlChar *)URL, (const xmlChar *)ID, lst); - desret_int(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctx, ctx, 0); - des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 1); - des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 2); - des_xmlNodePtr_ptr(n_lst, lst, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseCtxtExternalEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_URL); - printf(" %d", n_ID); - printf(" %d", n_lst); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlParseDTD(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) -#ifdef LIBXML_VALID_ENABLED - int mem_base; - xmlDtdPtr ret_val; - xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */ - int n_ExternalID; - xmlChar * SystemID; /* a NAME* containing the URL to the DTD */ - int n_SystemID; - - for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { - for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { - mem_base = xmlMemBlocks(); - ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0); - SystemID = gen_const_xmlChar_ptr(n_SystemID, 1); - - ret_val = xmlParseDTD((const xmlChar *)ExternalID, (const xmlChar *)SystemID); - desret_xmlDtdPtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 0); - des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseDTD", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ExternalID); - printf(" %d", n_SystemID); - printf("\n"); - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlParseDoc(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - xmlDocPtr ret_val; - xmlChar * cur; /* a pointer to an array of xmlChar */ - int n_cur; - - for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { - mem_base = xmlMemBlocks(); - cur = gen_const_xmlChar_ptr(n_cur, 0); - - ret_val = xmlParseDoc((const xmlChar *)cur); - desret_xmlDocPtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf("\n"); - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlParseDocument(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - - ret_val = xmlParseDocument(ctxt); - if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} - desret_int(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseDocument", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlParseEntity(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - xmlDocPtr ret_val; - const char * filename; /* the filename */ - int n_filename; - - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - mem_base = xmlMemBlocks(); - filename = gen_filepath(n_filename, 0); - - ret_val = xmlParseEntity(filename); - desret_xmlDocPtr(ret_val); - call_tests++; - des_filepath(n_filename, filename, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf("\n"); - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlParseExtParsedEnt(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - - ret_val = xmlParseExtParsedEnt(ctxt); - if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} - desret_int(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseExtParsedEnt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlParseExternalEntity(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - int ret_val; - xmlDocPtr doc; /* the document the chunk pertains to */ - int n_doc; - xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */ - int n_sax; - void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */ - int n_user_data; - int depth; /* Used for loop detection, use 0 */ - int n_depth; - xmlChar * URL; /* the URL for the entity to load */ - int n_URL; - xmlChar * ID; /* the System ID for the entity to load */ - int n_ID; - xmlNodePtr * lst; /* the return value for the set of parsed nodes */ - int n_lst; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { - for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { - for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { - for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) { - for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) { - for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - sax = gen_xmlSAXHandlerPtr(n_sax, 1); - user_data = gen_userdata(n_user_data, 2); - depth = gen_int(n_depth, 3); - URL = gen_const_xmlChar_ptr(n_URL, 4); - ID = gen_const_xmlChar_ptr(n_ID, 5); - lst = gen_xmlNodePtr_ptr(n_lst, 6); - - ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, (const xmlChar *)URL, (const xmlChar *)ID, lst); - desret_int(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlSAXHandlerPtr(n_sax, sax, 1); - des_userdata(n_user_data, user_data, 2); - des_int(n_depth, depth, 3); - des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 4); - des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 5); - des_xmlNodePtr_ptr(n_lst, lst, 6); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseExternalEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_sax); - printf(" %d", n_user_data); - printf(" %d", n_depth); - printf(" %d", n_URL); - printf(" %d", n_ID); - printf(" %d", n_lst); - printf("\n"); - } - } - } - } - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlParseFile(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - xmlDocPtr ret_val; - const char * filename; /* the filename */ - int n_filename; - - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - mem_base = xmlMemBlocks(); - filename = gen_filepath(n_filename, 0); - - ret_val = xmlParseFile(filename); - desret_xmlDocPtr(ret_val); - call_tests++; - des_filepath(n_filename, filename, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf("\n"); - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlParseInNodeContext(void) { - int test_ret = 0; - - int mem_base; - xmlParserErrors ret_val; - xmlNodePtr node; /* the context node */ - int n_node; - char * data; /* the input string */ - int n_data; - int datalen; /* the input string length in bytes */ - int n_datalen; - int options; /* a combination of xmlParserOption */ - int n_options; - xmlNodePtr * lst; /* the return value for the set of parsed nodes */ - int n_lst; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) { - for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) { - for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { - for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - data = gen_const_char_ptr(n_data, 1); - datalen = gen_int(n_datalen, 2); - options = gen_parseroptions(n_options, 3); - lst = gen_xmlNodePtr_ptr(n_lst, 4); - - ret_val = xmlParseInNodeContext(node, (const char *)data, datalen, options, lst); - desret_xmlParserErrors(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - des_const_char_ptr(n_data, (const char *)data, 1); - des_int(n_datalen, datalen, 2); - des_parseroptions(n_options, options, 3); - des_xmlNodePtr_ptr(n_lst, lst, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseInNodeContext", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_data); - printf(" %d", n_datalen); - printf(" %d", n_options); - printf(" %d", n_lst); - printf("\n"); - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlParseMemory(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - xmlDocPtr ret_val; - char * buffer; /* an pointer to a char array */ - int n_buffer; - int size; /* the size of the array */ - int n_size; - - for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - mem_base = xmlMemBlocks(); - buffer = gen_const_char_ptr(n_buffer, 0); - size = gen_int(n_size, 1); - - ret_val = xmlParseMemory((const char *)buffer, size); - desret_xmlDocPtr(ret_val); - call_tests++; - des_const_char_ptr(n_buffer, (const char *)buffer, 0); - des_int(n_size, size, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseMemory", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buffer); - printf(" %d", n_size); - printf("\n"); - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -#define gen_nb_const_xmlParserNodeInfoPtr 1 -static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlParserAddNodeInfo(void) { - int test_ret = 0; - - int mem_base; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - xmlParserNodeInfoPtr info; /* a node info sequence pointer */ - int n_info; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - info = gen_const_xmlParserNodeInfoPtr(n_info, 1); - - xmlParserAddNodeInfo(ctxt, (const xmlParserNodeInfoPtr)info); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_xmlParserNodeInfoPtr(n_info, (const xmlParserNodeInfoPtr)info, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParserAddNodeInfo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_info); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -#define gen_nb_const_xmlParserCtxtPtr 1 -static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -#define gen_nb_const_xmlNodePtr 1 -static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlParserFindNodeInfo(void) { - int test_ret = 0; - - int mem_base; - const xmlParserNodeInfo * ret_val; - xmlParserCtxtPtr ctx; /* an XML parser context */ - int n_ctx; - xmlNodePtr node; /* an XML node within the tree */ - int n_node; - - for (n_ctx = 0;n_ctx < gen_nb_const_xmlParserCtxtPtr;n_ctx++) { - for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - ctx = gen_const_xmlParserCtxtPtr(n_ctx, 0); - node = gen_const_xmlNodePtr(n_node, 1); - - ret_val = xmlParserFindNodeInfo((const xmlParserCtxtPtr)ctx, (const xmlNodePtr)node); - desret_const_xmlParserNodeInfo_ptr(ret_val); - call_tests++; - des_const_xmlParserCtxtPtr(n_ctx, (const xmlParserCtxtPtr)ctx, 0); - des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParserFindNodeInfo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf(" %d", n_node); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -#define gen_nb_const_xmlParserNodeInfoSeqPtr 1 -static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlParserFindNodeInfoIndex(void) { - int test_ret = 0; - - int mem_base; - unsigned long ret_val; - xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */ - int n_seq; - xmlNodePtr node; /* an XML node pointer */ - int n_node; - - for (n_seq = 0;n_seq < gen_nb_const_xmlParserNodeInfoSeqPtr;n_seq++) { - for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - seq = gen_const_xmlParserNodeInfoSeqPtr(n_seq, 0); - node = gen_const_xmlNodePtr(n_node, 1); - - ret_val = xmlParserFindNodeInfoIndex((const xmlParserNodeInfoSeqPtr)seq, (const xmlNodePtr)node); - desret_unsigned_long(ret_val); - call_tests++; - des_const_xmlParserNodeInfoSeqPtr(n_seq, (const xmlParserNodeInfoSeqPtr)seq, 0); - des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParserFindNodeInfoIndex", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_seq); - printf(" %d", n_node); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -#define gen_nb_xmlParserInputPtr 1 -static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlParserInputGrow(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserInputPtr in; /* an XML parser input */ - int n_in; - int len; /* an indicative size for the lookahead */ - int n_len; - - for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - in = gen_xmlParserInputPtr(n_in, 0); - len = gen_int(n_len, 1); - - ret_val = xmlParserInputGrow(in, len); - desret_int(ret_val); - call_tests++; - des_xmlParserInputPtr(n_in, in, 0); - des_int(n_len, len, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParserInputGrow", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_in); - printf(" %d", n_len); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlParserInputRead(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserInputPtr in; /* an XML parser input */ - int n_in; - int len; /* an indicative size for the lookahead */ - int n_len; - - for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - in = gen_xmlParserInputPtr(n_in, 0); - len = gen_int(n_len, 1); - - ret_val = xmlParserInputRead(in, len); - desret_int(ret_val); - call_tests++; - des_xmlParserInputPtr(n_in, in, 0); - des_int(n_len, len, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParserInputRead", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_in); - printf(" %d", n_len); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlPedanticParserDefault(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - int val; /* int 0 or 1 */ - int n_val; - - for (n_val = 0;n_val < gen_nb_int;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_int(n_val, 0); - - ret_val = xmlPedanticParserDefault(val); - desret_int(ret_val); - call_tests++; - des_int(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlPedanticParserDefault", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlReadDoc(void) { - int test_ret = 0; - - int mem_base; - xmlDocPtr ret_val; - xmlChar * cur; /* a pointer to a zero terminated string */ - int n_cur; - const char * URL; /* the base URL to use for the document */ - int n_URL; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of xmlParserOption */ - int n_options; - - for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { - mem_base = xmlMemBlocks(); - cur = gen_const_xmlChar_ptr(n_cur, 0); - URL = gen_filepath(n_URL, 1); - encoding = gen_const_char_ptr(n_encoding, 2); - options = gen_parseroptions(n_options, 3); - - ret_val = xmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options); - desret_xmlDocPtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0); - des_filepath(n_URL, URL, 1); - des_const_char_ptr(n_encoding, (const char *)encoding, 2); - des_parseroptions(n_options, options, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlReadDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_URL); - printf(" %d", n_encoding); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlReadFile(void) { - int test_ret = 0; - - int mem_base; - xmlDocPtr ret_val; - const char * filename; /* a file or URL */ - int n_filename; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of xmlParserOption */ - int n_options; - - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { - mem_base = xmlMemBlocks(); - filename = gen_filepath(n_filename, 0); - encoding = gen_const_char_ptr(n_encoding, 1); - options = gen_parseroptions(n_options, 2); - - ret_val = xmlReadFile(filename, (const char *)encoding, options); - desret_xmlDocPtr(ret_val); - call_tests++; - des_filepath(n_filename, filename, 0); - des_const_char_ptr(n_encoding, (const char *)encoding, 1); - des_parseroptions(n_options, options, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlReadFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf(" %d", n_encoding); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlReadMemory(void) { - int test_ret = 0; - - int mem_base; - xmlDocPtr ret_val; - char * buffer; /* a pointer to a char array */ - int n_buffer; - int size; /* the size of the array */ - int n_size; - const char * URL; /* the base URL to use for the document */ - int n_URL; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of xmlParserOption */ - int n_options; - - for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { - mem_base = xmlMemBlocks(); - buffer = gen_const_char_ptr(n_buffer, 0); - size = gen_int(n_size, 1); - URL = gen_filepath(n_URL, 2); - encoding = gen_const_char_ptr(n_encoding, 3); - options = gen_parseroptions(n_options, 4); - - ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options); - desret_xmlDocPtr(ret_val); - call_tests++; - des_const_char_ptr(n_buffer, (const char *)buffer, 0); - des_int(n_size, size, 1); - des_filepath(n_URL, URL, 2); - des_const_char_ptr(n_encoding, (const char *)encoding, 3); - des_parseroptions(n_options, options, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlReadMemory", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buffer); - printf(" %d", n_size); - printf(" %d", n_URL); - printf(" %d", n_encoding); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlRecoverDoc(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - xmlDocPtr ret_val; - xmlChar * cur; /* a pointer to an array of xmlChar */ - int n_cur; - - for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { - mem_base = xmlMemBlocks(); - cur = gen_const_xmlChar_ptr(n_cur, 0); - - ret_val = xmlRecoverDoc((const xmlChar *)cur); - desret_xmlDocPtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRecoverDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf("\n"); - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlRecoverFile(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - xmlDocPtr ret_val; - const char * filename; /* the filename */ - int n_filename; - - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - mem_base = xmlMemBlocks(); - filename = gen_filepath(n_filename, 0); - - ret_val = xmlRecoverFile(filename); - desret_xmlDocPtr(ret_val); - call_tests++; - des_filepath(n_filename, filename, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRecoverFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf("\n"); - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlRecoverMemory(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - xmlDocPtr ret_val; - char * buffer; /* an pointer to a char array */ - int n_buffer; - int size; /* the size of the array */ - int n_size; - - for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - mem_base = xmlMemBlocks(); - buffer = gen_const_char_ptr(n_buffer, 0); - size = gen_int(n_size, 1); - - ret_val = xmlRecoverMemory((const char *)buffer, size); - desret_xmlDocPtr(ret_val); - call_tests++; - des_const_char_ptr(n_buffer, (const char *)buffer, 0); - des_int(n_size, size, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRecoverMemory", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buffer); - printf(" %d", n_size); - printf("\n"); - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlSAXParseDTD(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - xmlDtdPtr ret_val; - xmlSAXHandlerPtr sax; /* the SAX handler block */ - int n_sax; - xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */ - int n_ExternalID; - xmlChar * SystemID; /* a NAME* containing the URL to the DTD */ - int n_SystemID; - - for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { - for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { - for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { - mem_base = xmlMemBlocks(); - sax = gen_xmlSAXHandlerPtr(n_sax, 0); - ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1); - SystemID = gen_const_xmlChar_ptr(n_SystemID, 2); - - ret_val = xmlSAXParseDTD(sax, (const xmlChar *)ExternalID, (const xmlChar *)SystemID); - desret_xmlDtdPtr(ret_val); - call_tests++; - des_xmlSAXHandlerPtr(n_sax, sax, 0); - des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1); - des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAXParseDTD", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_sax); - printf(" %d", n_ExternalID); - printf(" %d", n_SystemID); - printf("\n"); - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlSAXParseDoc(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - xmlDocPtr ret_val; - xmlSAXHandlerPtr sax; /* the SAX handler block */ - int n_sax; - xmlChar * cur; /* a pointer to an array of xmlChar */ - int n_cur; - int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */ - int n_recovery; - - for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { - for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { - for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { - mem_base = xmlMemBlocks(); - sax = gen_xmlSAXHandlerPtr(n_sax, 0); - cur = gen_const_xmlChar_ptr(n_cur, 1); - recovery = gen_int(n_recovery, 2); - - ret_val = xmlSAXParseDoc(sax, (const xmlChar *)cur, recovery); - desret_xmlDocPtr(ret_val); - call_tests++; - des_xmlSAXHandlerPtr(n_sax, sax, 0); - des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1); - des_int(n_recovery, recovery, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAXParseDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_sax); - printf(" %d", n_cur); - printf(" %d", n_recovery); - printf("\n"); - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlSAXParseEntity(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - xmlDocPtr ret_val; - xmlSAXHandlerPtr sax; /* the SAX handler block */ - int n_sax; - const char * filename; /* the filename */ - int n_filename; - - for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - mem_base = xmlMemBlocks(); - sax = gen_xmlSAXHandlerPtr(n_sax, 0); - filename = gen_filepath(n_filename, 1); - - ret_val = xmlSAXParseEntity(sax, filename); - desret_xmlDocPtr(ret_val); - call_tests++; - des_xmlSAXHandlerPtr(n_sax, sax, 0); - des_filepath(n_filename, filename, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAXParseEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_sax); - printf(" %d", n_filename); - printf("\n"); - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlSAXParseFile(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - xmlDocPtr ret_val; - xmlSAXHandlerPtr sax; /* the SAX handler block */ - int n_sax; - const char * filename; /* the filename */ - int n_filename; - int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */ - int n_recovery; - - for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { - mem_base = xmlMemBlocks(); - sax = gen_xmlSAXHandlerPtr(n_sax, 0); - filename = gen_filepath(n_filename, 1); - recovery = gen_int(n_recovery, 2); - - ret_val = xmlSAXParseFile(sax, filename, recovery); - desret_xmlDocPtr(ret_val); - call_tests++; - des_xmlSAXHandlerPtr(n_sax, sax, 0); - des_filepath(n_filename, filename, 1); - des_int(n_recovery, recovery, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAXParseFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_sax); - printf(" %d", n_filename); - printf(" %d", n_recovery); - printf("\n"); - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlSAXParseFileWithData(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - xmlDocPtr ret_val; - xmlSAXHandlerPtr sax; /* the SAX handler block */ - int n_sax; - const char * filename; /* the filename */ - int n_filename; - int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */ - int n_recovery; - void * data; /* the userdata */ - int n_data; - - for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { - for (n_data = 0;n_data < gen_nb_userdata;n_data++) { - mem_base = xmlMemBlocks(); - sax = gen_xmlSAXHandlerPtr(n_sax, 0); - filename = gen_filepath(n_filename, 1); - recovery = gen_int(n_recovery, 2); - data = gen_userdata(n_data, 3); - - ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data); - desret_xmlDocPtr(ret_val); - call_tests++; - des_xmlSAXHandlerPtr(n_sax, sax, 0); - des_filepath(n_filename, filename, 1); - des_int(n_recovery, recovery, 2); - des_userdata(n_data, data, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAXParseFileWithData", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_sax); - printf(" %d", n_filename); - printf(" %d", n_recovery); - printf(" %d", n_data); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlSAXParseMemory(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - xmlDocPtr ret_val; - xmlSAXHandlerPtr sax; /* the SAX handler block */ - int n_sax; - char * buffer; /* an pointer to a char array */ - int n_buffer; - int size; /* the size of the array */ - int n_size; - int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */ - int n_recovery; - - for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { - for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { - mem_base = xmlMemBlocks(); - sax = gen_xmlSAXHandlerPtr(n_sax, 0); - buffer = gen_const_char_ptr(n_buffer, 1); - size = gen_int(n_size, 2); - recovery = gen_int(n_recovery, 3); - - ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery); - desret_xmlDocPtr(ret_val); - call_tests++; - des_xmlSAXHandlerPtr(n_sax, sax, 0); - des_const_char_ptr(n_buffer, (const char *)buffer, 1); - des_int(n_size, size, 2); - des_int(n_recovery, recovery, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAXParseMemory", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_sax); - printf(" %d", n_buffer); - printf(" %d", n_size); - printf(" %d", n_recovery); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlSAXParseMemoryWithData(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - xmlDocPtr ret_val; - xmlSAXHandlerPtr sax; /* the SAX handler block */ - int n_sax; - char * buffer; /* an pointer to a char array */ - int n_buffer; - int size; /* the size of the array */ - int n_size; - int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */ - int n_recovery; - void * data; /* the userdata */ - int n_data; - - for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { - for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { - for (n_data = 0;n_data < gen_nb_userdata;n_data++) { - mem_base = xmlMemBlocks(); - sax = gen_xmlSAXHandlerPtr(n_sax, 0); - buffer = gen_const_char_ptr(n_buffer, 1); - size = gen_int(n_size, 2); - recovery = gen_int(n_recovery, 3); - data = gen_userdata(n_data, 4); - - ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data); - desret_xmlDocPtr(ret_val); - call_tests++; - des_xmlSAXHandlerPtr(n_sax, sax, 0); - des_const_char_ptr(n_buffer, (const char *)buffer, 1); - des_int(n_size, size, 2); - des_int(n_recovery, recovery, 3); - des_userdata(n_data, data, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAXParseMemoryWithData", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_sax); - printf(" %d", n_buffer); - printf(" %d", n_size); - printf(" %d", n_recovery); - printf(" %d", n_data); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlSAXUserParseFile(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - int ret_val; - xmlSAXHandlerPtr sax; /* a SAX handler */ - int n_sax; - void * user_data; /* The user data returned on SAX callbacks */ - int n_user_data; - const char * filename; /* a file name */ - int n_filename; - - for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { - for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - mem_base = xmlMemBlocks(); - sax = gen_xmlSAXHandlerPtr(n_sax, 0); - user_data = gen_userdata(n_user_data, 1); - filename = gen_filepath(n_filename, 2); - -#ifdef LIBXML_SAX1_ENABLED - if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; -#endif - - - ret_val = xmlSAXUserParseFile(sax, user_data, filename); - desret_int(ret_val); - call_tests++; - des_xmlSAXHandlerPtr(n_sax, sax, 0); - des_userdata(n_user_data, user_data, 1); - des_filepath(n_filename, filename, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAXUserParseFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_sax); - printf(" %d", n_user_data); - printf(" %d", n_filename); - printf("\n"); - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlSAXUserParseMemory(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - int ret_val; - xmlSAXHandlerPtr sax; /* a SAX handler */ - int n_sax; - void * user_data; /* The user data returned on SAX callbacks */ - int n_user_data; - char * buffer; /* an in-memory XML document input */ - int n_buffer; - int size; /* the length of the XML document in bytes */ - int n_size; - - for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { - for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { - for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - mem_base = xmlMemBlocks(); - sax = gen_xmlSAXHandlerPtr(n_sax, 0); - user_data = gen_userdata(n_user_data, 1); - buffer = gen_const_char_ptr(n_buffer, 2); - size = gen_int(n_size, 3); - -#ifdef LIBXML_SAX1_ENABLED - if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; -#endif - - - ret_val = xmlSAXUserParseMemory(sax, user_data, (const char *)buffer, size); - desret_int(ret_val); - call_tests++; - des_xmlSAXHandlerPtr(n_sax, sax, 0); - des_userdata(n_user_data, user_data, 1); - des_const_char_ptr(n_buffer, (const char *)buffer, 2); - des_int(n_size, size, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSAXUserParseMemory", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_sax); - printf(" %d", n_user_data); - printf(" %d", n_buffer); - printf(" %d", n_size); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlSetExternalEntityLoader(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSetFeature(void) { - int test_ret = 0; - -#if defined(LIBXML_LEGACY_ENABLED) -#ifdef LIBXML_LEGACY_ENABLED - int mem_base; - int ret_val; - xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */ - int n_ctxt; - char * name; /* the feature name */ - int n_name; - void * value; /* pointer to the location of the new value */ - int n_value; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) { - for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - name = gen_const_char_ptr(n_name, 1); - value = gen_void_ptr(n_value, 2); - - ret_val = xmlSetFeature(ctxt, (const char *)name, value); - desret_int(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_char_ptr(n_name, (const char *)name, 1); - des_void_ptr(n_value, value, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSetFeature", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_name); - printf(" %d", n_value); - printf("\n"); - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlSetupParserForBuffer(void) { - int test_ret = 0; - -#if defined(LIBXML_SAX1_ENABLED) -#ifdef LIBXML_SAX1_ENABLED - int mem_base; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - xmlChar * buffer; /* a xmlChar * buffer */ - int n_buffer; - const char * filename; /* a file name */ - int n_filename; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) { - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - buffer = gen_const_xmlChar_ptr(n_buffer, 1); - filename = gen_filepath(n_filename, 2); - - xmlSetupParserForBuffer(ctxt, (const xmlChar *)buffer, filename); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1); - des_filepath(n_filename, filename, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSetupParserForBuffer", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_buffer); - printf(" %d", n_filename); - printf("\n"); - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlStopParser(void) { - int test_ret = 0; - -#ifdef LIBXML_PUSH_ENABLED - int mem_base; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - - xmlStopParser(ctxt); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStopParser", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSubstituteEntitiesDefault(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - int val; /* int 0 or 1 */ - int n_val; - - for (n_val = 0;n_val < gen_nb_int;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_int(n_val, 0); - - ret_val = xmlSubstituteEntitiesDefault(val); - desret_int(ret_val); - call_tests++; - des_int(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - -static int -test_parser(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing parser : 61 of 70 functions ...\n"); - test_ret += test_xmlByteConsumed(); - test_ret += test_xmlClearNodeInfoSeq(); - test_ret += test_xmlClearParserCtxt(); - test_ret += test_xmlCreateDocParserCtxt(); - test_ret += test_xmlCreatePushParserCtxt(); - test_ret += test_xmlCtxtReadDoc(); - test_ret += test_xmlCtxtReadFile(); - test_ret += test_xmlCtxtReadMemory(); - test_ret += test_xmlCtxtReset(); - test_ret += test_xmlCtxtResetPush(); - test_ret += test_xmlCtxtUseOptions(); - test_ret += test_xmlGetExternalEntityLoader(); - test_ret += test_xmlGetFeature(); - test_ret += test_xmlGetFeaturesList(); - test_ret += test_xmlHasFeature(); - test_ret += test_xmlIOParseDTD(); - test_ret += test_xmlInitNodeInfoSeq(); - test_ret += test_xmlInitParser(); - test_ret += test_xmlInitParserCtxt(); - test_ret += test_xmlKeepBlanksDefault(); - test_ret += test_xmlLineNumbersDefault(); - test_ret += test_xmlLoadExternalEntity(); - test_ret += test_xmlNewIOInputStream(); - test_ret += test_xmlNewParserCtxt(); - test_ret += test_xmlParseBalancedChunkMemory(); - test_ret += test_xmlParseBalancedChunkMemoryRecover(); - test_ret += test_xmlParseChunk(); - test_ret += test_xmlParseCtxtExternalEntity(); - test_ret += test_xmlParseDTD(); - test_ret += test_xmlParseDoc(); - test_ret += test_xmlParseDocument(); - test_ret += test_xmlParseEntity(); - test_ret += test_xmlParseExtParsedEnt(); - test_ret += test_xmlParseExternalEntity(); - test_ret += test_xmlParseFile(); - test_ret += test_xmlParseInNodeContext(); - test_ret += test_xmlParseMemory(); - test_ret += test_xmlParserAddNodeInfo(); - test_ret += test_xmlParserFindNodeInfo(); - test_ret += test_xmlParserFindNodeInfoIndex(); - test_ret += test_xmlParserInputGrow(); - test_ret += test_xmlParserInputRead(); - test_ret += test_xmlPedanticParserDefault(); - test_ret += test_xmlReadDoc(); - test_ret += test_xmlReadFile(); - test_ret += test_xmlReadMemory(); - test_ret += test_xmlRecoverDoc(); - test_ret += test_xmlRecoverFile(); - test_ret += test_xmlRecoverMemory(); - test_ret += test_xmlSAXParseDTD(); - test_ret += test_xmlSAXParseDoc(); - test_ret += test_xmlSAXParseEntity(); - test_ret += test_xmlSAXParseFile(); - test_ret += test_xmlSAXParseFileWithData(); - test_ret += test_xmlSAXParseMemory(); - test_ret += test_xmlSAXParseMemoryWithData(); - test_ret += test_xmlSAXUserParseFile(); - test_ret += test_xmlSAXUserParseMemory(); - test_ret += test_xmlSetExternalEntityLoader(); - test_ret += test_xmlSetFeature(); - test_ret += test_xmlSetupParserForBuffer(); - test_ret += test_xmlStopParser(); - test_ret += test_xmlSubstituteEntitiesDefault(); - - if (test_ret != 0) - printf("Module parser: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_htmlCreateFileParserCtxt(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - htmlParserCtxtPtr ret_val; - const char * filename; /* the filename */ - int n_filename; - char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ - int n_encoding; - - for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - mem_base = xmlMemBlocks(); - filename = gen_fileoutput(n_filename, 0); - encoding = gen_const_char_ptr(n_encoding, 1); - - ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding); - desret_htmlParserCtxtPtr(ret_val); - call_tests++; - des_fileoutput(n_filename, filename, 0); - des_const_char_ptr(n_encoding, (const char *)encoding, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlCreateFileParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf(" %d", n_encoding); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_htmlInitAutoClose(void) { - int test_ret = 0; - -#if defined(LIBXML_HTML_ENABLED) - int mem_base; - - mem_base = xmlMemBlocks(); - - htmlInitAutoClose(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in htmlInitAutoClose", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_inputPop(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputPtr ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - - ret_val = inputPop(ctxt); - desret_xmlParserInputPtr(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in inputPop", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_inputPush(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - xmlParserInputPtr value; /* the parser input */ - int n_value; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - value = gen_xmlParserInputPtr(n_value, 1); - - ret_val = inputPush(ctxt, value); - desret_int(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_xmlParserInputPtr(n_value, value, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in inputPush", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_value); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_namePop(void) { - int test_ret = 0; - - int mem_base; - const xmlChar * ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - - ret_val = namePop(ctxt); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in namePop", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_namePush(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - xmlChar * value; /* the element name */ - int n_value; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - value = gen_const_xmlChar_ptr(n_value, 1); - - ret_val = namePush(ctxt, (const xmlChar *)value); - desret_int(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in namePush", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_value); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_nodePop(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - - ret_val = nodePop(ctxt); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in nodePop", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_nodePush(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - xmlNodePtr value; /* the element node */ - int n_value; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - value = gen_xmlNodePtr(n_value, 1); - - ret_val = nodePush(ctxt, value); - desret_int(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_xmlNodePtr(n_value, value, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in nodePush", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_value); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCheckLanguageID(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlChar * lang; /* pointer to the string value */ - int n_lang; - - for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) { - mem_base = xmlMemBlocks(); - lang = gen_const_xmlChar_ptr(n_lang, 0); - - ret_val = xmlCheckLanguageID((const xmlChar *)lang); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCheckLanguageID", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_lang); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCopyChar(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - int len; /* Ignored, compatibility */ - int n_len; - xmlChar * out; /* pointer to an array of xmlChar */ - int n_out; - int val; /* the char value */ - int n_val; - - for (n_len = 0;n_len < gen_nb_int;n_len++) { - for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) { - for (n_val = 0;n_val < gen_nb_int;n_val++) { - mem_base = xmlMemBlocks(); - len = gen_int(n_len, 0); - out = gen_xmlChar_ptr(n_out, 1); - val = gen_int(n_val, 2); - - ret_val = xmlCopyChar(len, out, val); - desret_int(ret_val); - call_tests++; - des_int(n_len, len, 0); - des_xmlChar_ptr(n_out, out, 1); - des_int(n_val, val, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCopyChar", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_len); - printf(" %d", n_out); - printf(" %d", n_val); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCopyCharMultiByte(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlChar * out; /* pointer to an array of xmlChar */ - int n_out; - int val; /* the char value */ - int n_val; - - for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) { - for (n_val = 0;n_val < gen_nb_int;n_val++) { - mem_base = xmlMemBlocks(); - out = gen_xmlChar_ptr(n_out, 0); - val = gen_int(n_val, 1); - - ret_val = xmlCopyCharMultiByte(out, val); - desret_int(ret_val); - call_tests++; - des_xmlChar_ptr(n_out, out, 0); - des_int(n_val, val, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCopyCharMultiByte", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_out); - printf(" %d", n_val); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCreateEntityParserCtxt(void) { - int test_ret = 0; - - int mem_base; - xmlParserCtxtPtr ret_val; - xmlChar * URL; /* the entity URL */ - int n_URL; - xmlChar * ID; /* the entity PUBLIC ID */ - int n_ID; - xmlChar * base; /* a possible base for the target URI */ - int n_base; - - for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) { - for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) { - for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) { - mem_base = xmlMemBlocks(); - URL = gen_const_xmlChar_ptr(n_URL, 0); - ID = gen_const_xmlChar_ptr(n_ID, 1); - base = gen_const_xmlChar_ptr(n_base, 2); - - ret_val = xmlCreateEntityParserCtxt((const xmlChar *)URL, (const xmlChar *)ID, (const xmlChar *)base); - desret_xmlParserCtxtPtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 0); - des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1); - des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCreateEntityParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URL); - printf(" %d", n_ID); - printf(" %d", n_base); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCreateFileParserCtxt(void) { - int test_ret = 0; - - int mem_base; - xmlParserCtxtPtr ret_val; - const char * filename; /* the filename */ - int n_filename; - - for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { - mem_base = xmlMemBlocks(); - filename = gen_fileoutput(n_filename, 0); - - ret_val = xmlCreateFileParserCtxt(filename); - desret_xmlParserCtxtPtr(ret_val); - call_tests++; - des_fileoutput(n_filename, filename, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCreateFileParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCreateMemoryParserCtxt(void) { - int test_ret = 0; - - int mem_base; - xmlParserCtxtPtr ret_val; - char * buffer; /* a pointer to a char array */ - int n_buffer; - int size; /* the size of the array */ - int n_size; - - for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - mem_base = xmlMemBlocks(); - buffer = gen_const_char_ptr(n_buffer, 0); - size = gen_int(n_size, 1); - - ret_val = xmlCreateMemoryParserCtxt((const char *)buffer, size); - desret_xmlParserCtxtPtr(ret_val); - call_tests++; - des_const_char_ptr(n_buffer, (const char *)buffer, 0); - des_int(n_size, size, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buffer); - printf(" %d", n_size); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCreateURLParserCtxt(void) { - int test_ret = 0; - - int mem_base; - xmlParserCtxtPtr ret_val; - const char * filename; /* the filename or URL */ - int n_filename; - int options; /* a combination of xmlParserOption */ - int n_options; - - for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { - for (n_options = 0;n_options < gen_nb_int;n_options++) { - mem_base = xmlMemBlocks(); - filename = gen_fileoutput(n_filename, 0); - options = gen_int(n_options, 1); - - ret_val = xmlCreateURLParserCtxt(filename, options); - desret_xmlParserCtxtPtr(ret_val); - call_tests++; - des_fileoutput(n_filename, filename, 0); - des_int(n_options, options, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCreateURLParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf(" %d", n_options); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCurrentChar(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserCtxtPtr ctxt; /* the XML parser context */ - int n_ctxt; - int * len; /* pointer to the length of the char read */ - int n_len; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - len = gen_int_ptr(n_len, 1); - - ret_val = xmlCurrentChar(ctxt, len); - desret_int(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_int_ptr(n_len, len, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCurrentChar", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_len); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlErrMemory(void) { - int test_ret = 0; - - int mem_base; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - char * extra; /* extra informations */ - int n_extra; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - extra = gen_const_char_ptr(n_extra, 1); - - xmlErrMemory(ctxt, (const char *)extra); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_char_ptr(n_extra, (const char *)extra, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlErrMemory", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_extra); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlIsLetter(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - int c; /* an unicode character (int) */ - int n_c; - - for (n_c = 0;n_c < gen_nb_int;n_c++) { - mem_base = xmlMemBlocks(); - c = gen_int(n_c, 0); - - ret_val = xmlIsLetter(c); - desret_int(ret_val); - call_tests++; - des_int(n_c, c, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIsLetter", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_c); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewEntityInputStream(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputPtr ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - xmlEntityPtr entity; /* an Entity pointer */ - int n_entity; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - entity = gen_xmlEntityPtr(n_entity, 1); - - ret_val = xmlNewEntityInputStream(ctxt, entity); - desret_xmlParserInputPtr(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_xmlEntityPtr(n_entity, entity, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewEntityInputStream", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_entity); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewInputFromFile(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputPtr ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - const char * filename; /* the filename to use as entity */ - int n_filename; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - filename = gen_filepath(n_filename, 1); - - ret_val = xmlNewInputFromFile(ctxt, filename); - desret_xmlParserInputPtr(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_filepath(n_filename, filename, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewInputFromFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_filename); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewInputStream(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputPtr ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - - ret_val = xmlNewInputStream(ctxt); - desret_xmlParserInputPtr(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewInputStream", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewStringInputStream(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputPtr ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - xmlChar * buffer; /* an memory buffer */ - int n_buffer; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - buffer = gen_const_xmlChar_ptr(n_buffer, 1); - - ret_val = xmlNewStringInputStream(ctxt, (const xmlChar *)buffer); - desret_xmlParserInputPtr(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewStringInputStream", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_buffer); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNextChar(void) { - int test_ret = 0; - - int mem_base; - xmlParserCtxtPtr ctxt; /* the XML parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - - xmlNextChar(ctxt); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNextChar", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlParserInputShrink(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputPtr in; /* an XML parser input */ - int n_in; - - for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) { - mem_base = xmlMemBlocks(); - in = gen_xmlParserInputPtr(n_in, 0); - - xmlParserInputShrink(in); - call_tests++; - des_xmlParserInputPtr(n_in, in, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParserInputShrink", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_in); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlPopInput(void) { - int test_ret = 0; - - int mem_base; - xmlChar ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - - ret_val = xmlPopInput(ctxt); - desret_xmlChar(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlPopInput", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlPushInput(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */ - int n_input; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - input = gen_xmlParserInputPtr(n_input, 1); - - ret_val = xmlPushInput(ctxt, input); - desret_int(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_xmlParserInputPtr(n_input, input, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlPushInput", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_input); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSetEntityReferenceFunc(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSplitQName(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - xmlChar * name; /* an XML parser context */ - int n_name; - xmlChar ** prefix; /* a xmlChar ** */ - int n_prefix; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - prefix = gen_xmlChar_ptr_ptr(n_prefix, 2); - - ret_val = xmlSplitQName(ctxt, (const xmlChar *)name, prefix); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_xmlChar_ptr_ptr(n_prefix, prefix, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSplitQName", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_name); - printf(" %d", n_prefix); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStringCurrentChar(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserCtxtPtr ctxt; /* the XML parser context */ - int n_ctxt; - xmlChar * cur; /* pointer to the beginning of the char */ - int n_cur; - int * len; /* pointer to the length of the char read */ - int n_len; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { - for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - cur = gen_const_xmlChar_ptr(n_cur, 1); - len = gen_int_ptr(n_len, 2); - - ret_val = xmlStringCurrentChar(ctxt, (const xmlChar *)cur, len); - desret_int(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1); - des_int_ptr(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStringCurrentChar", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_cur); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStringDecodeEntities(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlParserCtxtPtr ctxt; /* the parser context */ - int n_ctxt; - xmlChar * str; /* the input string */ - int n_str; - int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */ - int n_what; - xmlChar end; /* an end marker xmlChar, 0 if none */ - int n_end; - xmlChar end2; /* an end marker xmlChar, 0 if none */ - int n_end2; - xmlChar end3; /* an end marker xmlChar, 0 if none */ - int n_end3; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - for (n_what = 0;n_what < gen_nb_int;n_what++) { - for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) { - for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) { - for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - str = gen_const_xmlChar_ptr(n_str, 1); - what = gen_int(n_what, 2); - end = gen_xmlChar(n_end, 3); - end2 = gen_xmlChar(n_end2, 4); - end3 = gen_xmlChar(n_end3, 5); - - ret_val = xmlStringDecodeEntities(ctxt, (const xmlChar *)str, what, end, end2, end3); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1); - des_int(n_what, what, 2); - des_xmlChar(n_end, end, 3); - des_xmlChar(n_end2, end2, 4); - des_xmlChar(n_end3, end3, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStringDecodeEntities", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_str); - printf(" %d", n_what); - printf(" %d", n_end); - printf(" %d", n_end2); - printf(" %d", n_end3); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStringLenDecodeEntities(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlParserCtxtPtr ctxt; /* the parser context */ - int n_ctxt; - xmlChar * str; /* the input string */ - int n_str; - int len; /* the string length */ - int n_len; - int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */ - int n_what; - xmlChar end; /* an end marker xmlChar, 0 if none */ - int n_end; - xmlChar end2; /* an end marker xmlChar, 0 if none */ - int n_end2; - xmlChar end3; /* an end marker xmlChar, 0 if none */ - int n_end3; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - for (n_what = 0;n_what < gen_nb_int;n_what++) { - for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) { - for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) { - for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - str = gen_const_xmlChar_ptr(n_str, 1); - len = gen_int(n_len, 2); - what = gen_int(n_what, 3); - end = gen_xmlChar(n_end, 4); - end2 = gen_xmlChar(n_end2, 5); - end3 = gen_xmlChar(n_end3, 6); - - ret_val = xmlStringLenDecodeEntities(ctxt, (const xmlChar *)str, len, what, end, end2, end3); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1); - des_int(n_len, len, 2); - des_int(n_what, what, 3); - des_xmlChar(n_end, end, 4); - des_xmlChar(n_end2, end2, 5); - des_xmlChar(n_end3, end3, 6); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStringLenDecodeEntities", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_str); - printf(" %d", n_len); - printf(" %d", n_what); - printf(" %d", n_end); - printf(" %d", n_end2); - printf(" %d", n_end3); - printf("\n"); - } - } - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSwitchEncoding(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserCtxtPtr ctxt; /* the parser context */ - int n_ctxt; - xmlCharEncoding enc; /* the encoding value (number) */ - int n_enc; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - enc = gen_xmlCharEncoding(n_enc, 1); - - ret_val = xmlSwitchEncoding(ctxt, enc); - desret_int(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_xmlCharEncoding(n_enc, enc, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSwitchEncoding", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_enc); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSwitchInputEncoding(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserCtxtPtr ctxt; /* the parser context */ - int n_ctxt; - xmlParserInputPtr input; /* the input stream */ - int n_input; - xmlCharEncodingHandlerPtr handler; /* the encoding handler */ - int n_handler; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) { - for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - input = gen_xmlParserInputPtr(n_input, 1); - handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2); - - ret_val = xmlSwitchInputEncoding(ctxt, input, handler); - desret_int(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_xmlParserInputPtr(n_input, input, 1); - des_xmlCharEncodingHandlerPtr(n_handler, handler, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSwitchInputEncoding", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_input); - printf(" %d", n_handler); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSwitchToEncoding(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserCtxtPtr ctxt; /* the parser context */ - int n_ctxt; - xmlCharEncodingHandlerPtr handler; /* the encoding handler */ - int n_handler; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1); - - ret_val = xmlSwitchToEncoding(ctxt, handler); - desret_int(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_xmlCharEncodingHandlerPtr(n_handler, handler, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSwitchToEncoding", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_handler); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - -static int -test_parserInternals(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n"); - test_ret += test_htmlCreateFileParserCtxt(); - test_ret += test_htmlInitAutoClose(); - test_ret += test_inputPop(); - test_ret += test_inputPush(); - test_ret += test_namePop(); - test_ret += test_namePush(); - test_ret += test_nodePop(); - test_ret += test_nodePush(); - test_ret += test_xmlCheckLanguageID(); - test_ret += test_xmlCopyChar(); - test_ret += test_xmlCopyCharMultiByte(); - test_ret += test_xmlCreateEntityParserCtxt(); - test_ret += test_xmlCreateFileParserCtxt(); - test_ret += test_xmlCreateMemoryParserCtxt(); - test_ret += test_xmlCreateURLParserCtxt(); - test_ret += test_xmlCurrentChar(); - test_ret += test_xmlErrMemory(); - test_ret += test_xmlIsLetter(); - test_ret += test_xmlNewEntityInputStream(); - test_ret += test_xmlNewInputFromFile(); - test_ret += test_xmlNewInputStream(); - test_ret += test_xmlNewStringInputStream(); - test_ret += test_xmlNextChar(); - test_ret += test_xmlParserInputShrink(); - test_ret += test_xmlPopInput(); - test_ret += test_xmlPushInput(); - test_ret += test_xmlSetEntityReferenceFunc(); - test_ret += test_xmlSplitQName(); - test_ret += test_xmlStringCurrentChar(); - test_ret += test_xmlStringDecodeEntities(); - test_ret += test_xmlStringLenDecodeEntities(); - test_ret += test_xmlSwitchEncoding(); - test_ret += test_xmlSwitchInputEncoding(); - test_ret += test_xmlSwitchToEncoding(); - - if (test_ret != 0) - printf("Module parserInternals: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlPatternFromRoot(void) { - int test_ret = 0; - -#if defined(LIBXML_PATTERN_ENABLED) - int mem_base; - int ret_val; - xmlPatternPtr comp; /* the precompiled pattern */ - int n_comp; - - for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) { - mem_base = xmlMemBlocks(); - comp = gen_xmlPatternPtr(n_comp, 0); - - ret_val = xmlPatternFromRoot(comp); - desret_int(ret_val); - call_tests++; - des_xmlPatternPtr(n_comp, comp, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlPatternFromRoot", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_comp); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlPatternGetStreamCtxt(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlPatternMatch(void) { - int test_ret = 0; - -#if defined(LIBXML_PATTERN_ENABLED) - int mem_base; - int ret_val; - xmlPatternPtr comp; /* the precompiled pattern */ - int n_comp; - xmlNodePtr node; /* a node */ - int n_node; - - for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - comp = gen_xmlPatternPtr(n_comp, 0); - node = gen_xmlNodePtr(n_node, 1); - - ret_val = xmlPatternMatch(comp, node); - desret_int(ret_val); - call_tests++; - des_xmlPatternPtr(n_comp, comp, 0); - des_xmlNodePtr(n_node, node, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlPatternMatch", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_comp); - printf(" %d", n_node); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlPatternMaxDepth(void) { - int test_ret = 0; - -#if defined(LIBXML_PATTERN_ENABLED) - int mem_base; - int ret_val; - xmlPatternPtr comp; /* the precompiled pattern */ - int n_comp; - - for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) { - mem_base = xmlMemBlocks(); - comp = gen_xmlPatternPtr(n_comp, 0); - - ret_val = xmlPatternMaxDepth(comp); - desret_int(ret_val); - call_tests++; - des_xmlPatternPtr(n_comp, comp, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlPatternMaxDepth", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_comp); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlPatternMinDepth(void) { - int test_ret = 0; - -#if defined(LIBXML_PATTERN_ENABLED) - int mem_base; - int ret_val; - xmlPatternPtr comp; /* the precompiled pattern */ - int n_comp; - - for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) { - mem_base = xmlMemBlocks(); - comp = gen_xmlPatternPtr(n_comp, 0); - - ret_val = xmlPatternMinDepth(comp); - desret_int(ret_val); - call_tests++; - des_xmlPatternPtr(n_comp, comp, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlPatternMinDepth", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_comp); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlPatternStreamable(void) { - int test_ret = 0; - -#if defined(LIBXML_PATTERN_ENABLED) - int mem_base; - int ret_val; - xmlPatternPtr comp; /* the precompiled pattern */ - int n_comp; - - for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) { - mem_base = xmlMemBlocks(); - comp = gen_xmlPatternPtr(n_comp, 0); - - ret_val = xmlPatternStreamable(comp); - desret_int(ret_val); - call_tests++; - des_xmlPatternPtr(n_comp, comp, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlPatternStreamable", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_comp); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlPatterncompile(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - -#ifdef LIBXML_PATTERN_ENABLED - -#define gen_nb_xmlStreamCtxtPtr 1 -static xmlStreamCtxtPtr gen_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, xmlStreamCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlStreamPop(void) { - int test_ret = 0; - -#if defined(LIBXML_PATTERN_ENABLED) - int mem_base; - int ret_val; - xmlStreamCtxtPtr stream; /* the stream context */ - int n_stream; - - for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) { - mem_base = xmlMemBlocks(); - stream = gen_xmlStreamCtxtPtr(n_stream, 0); - - ret_val = xmlStreamPop(stream); - desret_int(ret_val); - call_tests++; - des_xmlStreamCtxtPtr(n_stream, stream, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStreamPop", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_stream); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlStreamPush(void) { - int test_ret = 0; - -#if defined(LIBXML_PATTERN_ENABLED) - int mem_base; - int ret_val; - xmlStreamCtxtPtr stream; /* the stream context */ - int n_stream; - xmlChar * name; /* the current name */ - int n_name; - xmlChar * ns; /* the namespace name */ - int n_ns; - - for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) { - mem_base = xmlMemBlocks(); - stream = gen_xmlStreamCtxtPtr(n_stream, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - ns = gen_const_xmlChar_ptr(n_ns, 2); - - ret_val = xmlStreamPush(stream, (const xmlChar *)name, (const xmlChar *)ns); - desret_int(ret_val); - call_tests++; - des_xmlStreamCtxtPtr(n_stream, stream, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStreamPush", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_stream); - printf(" %d", n_name); - printf(" %d", n_ns); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlStreamPushAttr(void) { - int test_ret = 0; - -#if defined(LIBXML_PATTERN_ENABLED) - int mem_base; - int ret_val; - xmlStreamCtxtPtr stream; /* the stream context */ - int n_stream; - xmlChar * name; /* the current name */ - int n_name; - xmlChar * ns; /* the namespace name */ - int n_ns; - - for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) { - mem_base = xmlMemBlocks(); - stream = gen_xmlStreamCtxtPtr(n_stream, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - ns = gen_const_xmlChar_ptr(n_ns, 2); - - ret_val = xmlStreamPushAttr(stream, (const xmlChar *)name, (const xmlChar *)ns); - desret_int(ret_val); - call_tests++; - des_xmlStreamCtxtPtr(n_stream, stream, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStreamPushAttr", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_stream); - printf(" %d", n_name); - printf(" %d", n_ns); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlStreamPushNode(void) { - int test_ret = 0; - -#if defined(LIBXML_PATTERN_ENABLED) - int mem_base; - int ret_val; - xmlStreamCtxtPtr stream; /* the stream context */ - int n_stream; - xmlChar * name; /* the current name */ - int n_name; - xmlChar * ns; /* the namespace name */ - int n_ns; - int nodeType; /* the type of the node being pushed */ - int n_nodeType; - - for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) { - for (n_nodeType = 0;n_nodeType < gen_nb_int;n_nodeType++) { - mem_base = xmlMemBlocks(); - stream = gen_xmlStreamCtxtPtr(n_stream, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - ns = gen_const_xmlChar_ptr(n_ns, 2); - nodeType = gen_int(n_nodeType, 3); - - ret_val = xmlStreamPushNode(stream, (const xmlChar *)name, (const xmlChar *)ns, nodeType); - desret_int(ret_val); - call_tests++; - des_xmlStreamCtxtPtr(n_stream, stream, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2); - des_int(n_nodeType, nodeType, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStreamPushNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_stream); - printf(" %d", n_name); - printf(" %d", n_ns); - printf(" %d", n_nodeType); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlStreamWantsAnyNode(void) { - int test_ret = 0; - -#if defined(LIBXML_PATTERN_ENABLED) - int mem_base; - int ret_val; - xmlStreamCtxtPtr streamCtxt; /* the stream context */ - int n_streamCtxt; - - for (n_streamCtxt = 0;n_streamCtxt < gen_nb_xmlStreamCtxtPtr;n_streamCtxt++) { - mem_base = xmlMemBlocks(); - streamCtxt = gen_xmlStreamCtxtPtr(n_streamCtxt, 0); - - ret_val = xmlStreamWantsAnyNode(streamCtxt); - desret_int(ret_val); - call_tests++; - des_xmlStreamCtxtPtr(n_streamCtxt, streamCtxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStreamWantsAnyNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_streamCtxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_pattern(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing pattern : 10 of 15 functions ...\n"); - test_ret += test_xmlPatternFromRoot(); - test_ret += test_xmlPatternGetStreamCtxt(); - test_ret += test_xmlPatternMatch(); - test_ret += test_xmlPatternMaxDepth(); - test_ret += test_xmlPatternMinDepth(); - test_ret += test_xmlPatternStreamable(); - test_ret += test_xmlPatterncompile(); - test_ret += test_xmlStreamPop(); - test_ret += test_xmlStreamPush(); - test_ret += test_xmlStreamPushAttr(); - test_ret += test_xmlStreamPushNode(); - test_ret += test_xmlStreamWantsAnyNode(); - - if (test_ret != 0) - printf("Module pattern: %d errors\n", test_ret); - return(test_ret); -} -#ifdef LIBXML_SCHEMAS_ENABLED - -#define gen_nb_xmlRelaxNGPtr 1 -static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlRelaxNGDump(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - FILE * output; /* the file output */ - int n_output; - xmlRelaxNGPtr schema; /* a schema structure */ - int n_schema; - - for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) { - for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) { - mem_base = xmlMemBlocks(); - output = gen_FILE_ptr(n_output, 0); - schema = gen_xmlRelaxNGPtr(n_schema, 1); - - xmlRelaxNGDump(output, schema); - call_tests++; - des_FILE_ptr(n_output, output, 0); - des_xmlRelaxNGPtr(n_schema, schema, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRelaxNGDump", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_output); - printf(" %d", n_schema); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlRelaxNGDumpTree(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - FILE * output; /* the file output */ - int n_output; - xmlRelaxNGPtr schema; /* a schema structure */ - int n_schema; - - for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) { - for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) { - mem_base = xmlMemBlocks(); - output = gen_FILE_ptr(n_output, 0); - schema = gen_xmlRelaxNGPtr(n_schema, 1); - - xmlRelaxNGDumpTree(output, schema); - call_tests++; - des_FILE_ptr(n_output, output, 0); - des_xmlRelaxNGPtr(n_schema, schema, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRelaxNGDumpTree", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_output); - printf(" %d", n_schema); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -#ifdef LIBXML_SCHEMAS_ENABLED - -#define gen_nb_xmlRelaxNGParserCtxtPtr 1 -static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - -#ifdef LIBXML_SCHEMAS_ENABLED - -#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1 -static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - -#ifdef LIBXML_SCHEMAS_ENABLED - -#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1 -static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlRelaxNGGetParserErrors(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */ - int n_ctxt; - xmlRelaxNGValidityErrorFunc * err; /* the error callback result */ - int n_err; - xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */ - int n_warn; - void ** ctx; /* contextual data for the callbacks result */ - int n_ctx; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) { - for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) { - for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) { - for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0); - err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1); - warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2); - ctx = gen_void_ptr_ptr(n_ctx, 3); - - ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx); - desret_int(ret_val); - call_tests++; - des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0); - des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1); - des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2); - des_void_ptr_ptr(n_ctx, ctx, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_err); - printf(" %d", n_warn); - printf(" %d", n_ctx); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -#ifdef LIBXML_SCHEMAS_ENABLED - -#define gen_nb_xmlRelaxNGValidCtxtPtr 1 -static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlRelaxNGGetValidErrors(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */ - int n_ctxt; - xmlRelaxNGValidityErrorFunc * err; /* the error function result */ - int n_err; - xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */ - int n_warn; - void ** ctx; /* the functions context result */ - int n_ctx; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) { - for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) { - for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) { - for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0); - err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1); - warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2); - ctx = gen_void_ptr_ptr(n_ctx, 3); - - ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx); - desret_int(ret_val); - call_tests++; - des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1); - des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2); - des_void_ptr_ptr(n_ctx, ctx, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_err); - printf(" %d", n_warn); - printf(" %d", n_ctx); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlRelaxNGInitTypes(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - - mem_base = xmlMemBlocks(); - - ret_val = xmlRelaxNGInitTypes(); - desret_int(ret_val); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRelaxNGInitTypes", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlRelaxNGNewDocParserCtxt(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - xmlRelaxNGParserCtxtPtr ret_val; - xmlDocPtr doc; /* a preparsed document tree */ - int n_doc; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - - ret_val = xmlRelaxNGNewDocParserCtxt(doc); - desret_xmlRelaxNGParserCtxtPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlRelaxNGNewMemParserCtxt(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - xmlRelaxNGParserCtxtPtr ret_val; - char * buffer; /* a pointer to a char array containing the schemas */ - int n_buffer; - int size; /* the size of the array */ - int n_size; - - for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - mem_base = xmlMemBlocks(); - buffer = gen_const_char_ptr(n_buffer, 0); - size = gen_int(n_size, 1); - - ret_val = xmlRelaxNGNewMemParserCtxt((const char *)buffer, size); - desret_xmlRelaxNGParserCtxtPtr(ret_val); - call_tests++; - des_const_char_ptr(n_buffer, (const char *)buffer, 0); - des_int(n_size, size, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buffer); - printf(" %d", n_size); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlRelaxNGNewParserCtxt(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - xmlRelaxNGParserCtxtPtr ret_val; - char * URL; /* the location of the schema */ - int n_URL; - - for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) { - mem_base = xmlMemBlocks(); - URL = gen_const_char_ptr(n_URL, 0); - - ret_val = xmlRelaxNGNewParserCtxt((const char *)URL); - desret_xmlRelaxNGParserCtxtPtr(ret_val); - call_tests++; - des_const_char_ptr(n_URL, (const char *)URL, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URL); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlRelaxNGNewValidCtxt(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlRelaxNGParse(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlRelaxNGSetParserErrors(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlRelaxNGSetParserStructuredErrors(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlRelaxNGSetValidErrors(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlRelaxNGSetValidStructuredErrors(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlRelaxNGValidateDoc(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */ - int n_ctxt; - xmlDocPtr doc; /* a parsed document tree */ - int n_doc; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - - ret_val = xmlRelaxNGValidateDoc(ctxt, doc); - desret_int(ret_val); - call_tests++; - des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRelaxNGValidateDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlRelaxNGValidateFullElement(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDocPtr doc; /* a document instance */ - int n_doc; - xmlNodePtr elem; /* an element instance */ - int n_elem; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - elem = gen_xmlNodePtr(n_elem, 2); - - ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem); - desret_int(ret_val); - call_tests++; - des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_elem, elem, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf(" %d", n_elem); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlRelaxNGValidatePopElement(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */ - int n_ctxt; - xmlDocPtr doc; /* a document instance */ - int n_doc; - xmlNodePtr elem; /* an element instance */ - int n_elem; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - elem = gen_xmlNodePtr(n_elem, 2); - - ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem); - desret_int(ret_val); - call_tests++; - des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_elem, elem, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf(" %d", n_elem); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlRelaxNGValidatePushCData(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */ - int n_ctxt; - xmlChar * data; /* some character data read */ - int n_data; - int len; /* the lenght of the data */ - int n_len; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) { - for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0); - data = gen_const_xmlChar_ptr(n_data, 1); - len = gen_int(n_len, 2); - - ret_val = xmlRelaxNGValidatePushCData(ctxt, (const xmlChar *)data, len); - desret_int(ret_val); - call_tests++; - des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0); - des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_data); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlRelaxNGValidatePushElement(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDocPtr doc; /* a document instance */ - int n_doc; - xmlNodePtr elem; /* an element instance */ - int n_elem; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - elem = gen_xmlNodePtr(n_elem, 2); - - ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem); - desret_int(ret_val); - call_tests++; - des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_elem, elem, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf(" %d", n_elem); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlRelaxParserSetFlag(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */ - int n_ctxt; - int flags; /* a set of flags values */ - int n_flags; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) { - for (n_flags = 0;n_flags < gen_nb_int;n_flags++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0); - flags = gen_int(n_flags, 1); - - ret_val = xmlRelaxParserSetFlag(ctxt, flags); - desret_int(ret_val); - call_tests++; - des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0); - des_int(n_flags, flags, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRelaxParserSetFlag", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_flags); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_relaxng(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing relaxng : 14 of 24 functions ...\n"); - test_ret += test_xmlRelaxNGDump(); - test_ret += test_xmlRelaxNGDumpTree(); - test_ret += test_xmlRelaxNGGetParserErrors(); - test_ret += test_xmlRelaxNGGetValidErrors(); - test_ret += test_xmlRelaxNGInitTypes(); - test_ret += test_xmlRelaxNGNewDocParserCtxt(); - test_ret += test_xmlRelaxNGNewMemParserCtxt(); - test_ret += test_xmlRelaxNGNewParserCtxt(); - test_ret += test_xmlRelaxNGNewValidCtxt(); - test_ret += test_xmlRelaxNGParse(); - test_ret += test_xmlRelaxNGSetParserErrors(); - test_ret += test_xmlRelaxNGSetParserStructuredErrors(); - test_ret += test_xmlRelaxNGSetValidErrors(); - test_ret += test_xmlRelaxNGSetValidStructuredErrors(); - test_ret += test_xmlRelaxNGValidateDoc(); - test_ret += test_xmlRelaxNGValidateFullElement(); - test_ret += test_xmlRelaxNGValidatePopElement(); - test_ret += test_xmlRelaxNGValidatePushCData(); - test_ret += test_xmlRelaxNGValidatePushElement(); - test_ret += test_xmlRelaxParserSetFlag(); - - if (test_ret != 0) - printf("Module relaxng: %d errors\n", test_ret); - return(test_ret); -} -static int -test_schemasInternals(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n"); - - if (test_ret != 0) - printf("Module schemasInternals: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlSchematronNewDocParserCtxt(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSchematronNewMemParserCtxt(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSchematronNewParserCtxt(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - -#ifdef LIBXML_SCHEMATRON_ENABLED - -#define gen_nb_xmlSchematronPtr 1 -static xmlSchematronPtr gen_xmlSchematronPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchematronPtr(int no ATTRIBUTE_UNUSED, xmlSchematronPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlSchematronNewValidCtxt(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - -#ifdef LIBXML_SCHEMATRON_ENABLED - -#define gen_nb_xmlSchematronParserCtxtPtr 1 -static xmlSchematronParserCtxtPtr gen_xmlSchematronParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchematronParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchematronParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlSchematronParse(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - -#ifdef LIBXML_SCHEMATRON_ENABLED - -#define gen_nb_xmlSchematronValidCtxtPtr 1 -static xmlSchematronValidCtxtPtr gen_xmlSchematronValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchematronValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchematronValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlSchematronSetValidStructuredErrors(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSchematronValidateDoc(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMATRON_ENABLED) - int mem_base; - int ret_val; - xmlSchematronValidCtxtPtr ctxt; /* the schema validation context */ - int n_ctxt; - xmlDocPtr instance; /* the document instace tree */ - int n_instance; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchematronValidCtxtPtr;n_ctxt++) { - for (n_instance = 0;n_instance < gen_nb_xmlDocPtr;n_instance++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlSchematronValidCtxtPtr(n_ctxt, 0); - instance = gen_xmlDocPtr(n_instance, 1); - - ret_val = xmlSchematronValidateDoc(ctxt, instance); - desret_int(ret_val); - call_tests++; - des_xmlSchematronValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_instance, instance, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchematronValidateDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_instance); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_schematron(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing schematron : 1 of 10 functions ...\n"); - test_ret += test_xmlSchematronNewDocParserCtxt(); - test_ret += test_xmlSchematronNewMemParserCtxt(); - test_ret += test_xmlSchematronNewParserCtxt(); - test_ret += test_xmlSchematronNewValidCtxt(); - test_ret += test_xmlSchematronParse(); - test_ret += test_xmlSchematronSetValidStructuredErrors(); - test_ret += test_xmlSchematronValidateDoc(); - - if (test_ret != 0) - printf("Module schematron: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlAddChild(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlNodePtr parent; /* the parent node */ - int n_parent; - xmlNodePtr cur; /* the child node */ - int n_cur; - - for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) { - mem_base = xmlMemBlocks(); - parent = gen_xmlNodePtr(n_parent, 0); - cur = gen_xmlNodePtr_in(n_cur, 1); - - ret_val = xmlAddChild(parent, cur); - if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; } - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlNodePtr(n_parent, parent, 0); - des_xmlNodePtr_in(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAddChild", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_parent); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlAddChildList(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlNodePtr parent; /* the parent node */ - int n_parent; - xmlNodePtr cur; /* the first node in the list */ - int n_cur; - - for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) { - mem_base = xmlMemBlocks(); - parent = gen_xmlNodePtr(n_parent, 0); - cur = gen_xmlNodePtr_in(n_cur, 1); - - ret_val = xmlAddChildList(parent, cur); - if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; } - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlNodePtr(n_parent, parent, 0); - des_xmlNodePtr_in(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAddChildList", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_parent); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlAddNextSibling(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlNodePtr cur; /* the child node */ - int n_cur; - xmlNodePtr elem; /* the new node */ - int n_elem; - - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodePtr(n_cur, 0); - elem = gen_xmlNodePtr_in(n_elem, 1); - - ret_val = xmlAddNextSibling(cur, elem); - if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; } - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlNodePtr(n_cur, cur, 0); - des_xmlNodePtr_in(n_elem, elem, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAddNextSibling", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_elem); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlAddPrevSibling(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlNodePtr cur; /* the child node */ - int n_cur; - xmlNodePtr elem; /* the new node */ - int n_elem; - - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodePtr(n_cur, 0); - elem = gen_xmlNodePtr_in(n_elem, 1); - - ret_val = xmlAddPrevSibling(cur, elem); - if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; } - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlNodePtr(n_cur, cur, 0); - des_xmlNodePtr_in(n_elem, elem, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAddPrevSibling", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_elem); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlAddSibling(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlNodePtr cur; /* the child node */ - int n_cur; - xmlNodePtr elem; /* the new node */ - int n_elem; - - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodePtr(n_cur, 0); - elem = gen_xmlNodePtr_in(n_elem, 1); - - ret_val = xmlAddSibling(cur, elem); - if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; } - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlNodePtr(n_cur, cur, 0); - des_xmlNodePtr_in(n_elem, elem, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAddSibling", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_elem); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlAttrSerializeTxtContent(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) -#ifdef LIBXML_OUTPUT_ENABLED - int mem_base; - xmlBufferPtr buf; /* the XML buffer output */ - int n_buf; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlAttrPtr attr; /* the attribute node */ - int n_attr; - xmlChar * string; /* the text content */ - int n_string; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { - for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - doc = gen_xmlDocPtr(n_doc, 1); - attr = gen_xmlAttrPtr(n_attr, 2); - string = gen_const_xmlChar_ptr(n_string, 3); - - xmlAttrSerializeTxtContent(buf, doc, attr, (const xmlChar *)string); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlAttrPtr(n_attr, attr, 2); - des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAttrSerializeTxtContent", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_doc); - printf(" %d", n_attr); - printf(" %d", n_string); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -#define gen_nb_const_xmlBufPtr 1 -static xmlBufPtr gen_const_xmlBufPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlBufPtr(int no ATTRIBUTE_UNUSED, const xmlBufPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlBufContent(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlBufPtr buf; /* the buffer */ - int n_buf; - - for (n_buf = 0;n_buf < gen_nb_const_xmlBufPtr;n_buf++) { - mem_base = xmlMemBlocks(); - buf = gen_const_xmlBufPtr(n_buf, 0); - - ret_val = xmlBufContent((const xmlBufPtr)buf); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlBufPtr(n_buf, (const xmlBufPtr)buf, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufContent", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlBufEnd(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlBufPtr buf; /* the buffer */ - int n_buf; - - for (n_buf = 0;n_buf < gen_nb_const_xmlBufPtr;n_buf++) { - mem_base = xmlMemBlocks(); - buf = gen_const_xmlBufPtr(n_buf, 0); - - ret_val = xmlBufEnd((const xmlBufPtr)buf); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlBufPtr(n_buf, (const xmlBufPtr)buf, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufEnd", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -#define gen_nb_xmlBufPtr 1 -static xmlBufPtr gen_xmlBufPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlBufPtr(int no ATTRIBUTE_UNUSED, xmlBufPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlBufGetNodeContent(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlBufPtr buf; /* a buffer xmlBufPtr */ - int n_buf; - xmlNodePtr cur; /* the node being read */ - int n_cur; - - for (n_buf = 0;n_buf < gen_nb_xmlBufPtr;n_buf++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufPtr(n_buf, 0); - cur = gen_xmlNodePtr(n_cur, 1); - - ret_val = xmlBufGetNodeContent(buf, cur); - desret_int(ret_val); - call_tests++; - des_xmlBufPtr(n_buf, buf, 0); - des_xmlNodePtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufGetNodeContent", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlBufNodeDump(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlBufShrink(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlBufUse(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlBufferAdd(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlBufferPtr buf; /* the buffer to dump */ - int n_buf; - xmlChar * str; /* the #xmlChar string */ - int n_str; - int len; /* the number of #xmlChar to add */ - int n_len; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - str = gen_const_xmlChar_ptr(n_str, 1); - len = gen_int(n_len, 2); - - ret_val = xmlBufferAdd(buf, (const xmlChar *)str, len); - desret_int(ret_val); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufferAdd", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_str); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlBufferAddHead(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlBufferPtr buf; /* the buffer */ - int n_buf; - xmlChar * str; /* the #xmlChar string */ - int n_str; - int len; /* the number of #xmlChar to add */ - int n_len; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - str = gen_const_xmlChar_ptr(n_str, 1); - len = gen_int(n_len, 2); - - ret_val = xmlBufferAddHead(buf, (const xmlChar *)str, len); - desret_int(ret_val); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufferAddHead", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_str); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlBufferCCat(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlBufferPtr buf; /* the buffer to dump */ - int n_buf; - char * str; /* the C char string */ - int n_str; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - str = gen_const_char_ptr(n_str, 1); - - ret_val = xmlBufferCCat(buf, (const char *)str); - desret_int(ret_val); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_const_char_ptr(n_str, (const char *)str, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufferCCat", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_str); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlBufferCat(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlBufferPtr buf; /* the buffer to add to */ - int n_buf; - xmlChar * str; /* the #xmlChar string */ - int n_str; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - str = gen_const_xmlChar_ptr(n_str, 1); - - ret_val = xmlBufferCat(buf, (const xmlChar *)str); - desret_int(ret_val); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufferCat", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_str); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -#define gen_nb_const_xmlBufferPtr 1 -static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlBufferContent(void) { - int test_ret = 0; - - int mem_base; - const xmlChar * ret_val; - xmlBufferPtr buf; /* the buffer */ - int n_buf; - - for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) { - mem_base = xmlMemBlocks(); - buf = gen_const_xmlBufferPtr(n_buf, 0); - - ret_val = xmlBufferContent((const xmlBufferPtr)buf); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufferContent", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlBufferCreate(void) { - int test_ret = 0; - - int mem_base; - xmlBufferPtr ret_val; - - mem_base = xmlMemBlocks(); - - ret_val = xmlBufferCreate(); - desret_xmlBufferPtr(ret_val); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufferCreate", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlBufferCreateSize(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlBufferCreateStatic(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlBufferDetach(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlBufferPtr buf; /* the buffer */ - int n_buf; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - - ret_val = xmlBufferDetach(buf); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufferDetach", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlBufferEmpty(void) { - int test_ret = 0; - - int mem_base; - xmlBufferPtr buf; /* the buffer */ - int n_buf; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - - xmlBufferEmpty(buf); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufferEmpty", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlBufferGrow(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlBufferPtr buf; /* the buffer */ - int n_buf; - unsigned int len; /* the minimum free size to allocate */ - int n_len; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - len = gen_unsigned_int(n_len, 1); - - ret_val = xmlBufferGrow(buf, len); - desret_int(ret_val); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_unsigned_int(n_len, len, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufferGrow", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_len); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlBufferLength(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlBufferPtr buf; /* the buffer */ - int n_buf; - - for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) { - mem_base = xmlMemBlocks(); - buf = gen_const_xmlBufferPtr(n_buf, 0); - - ret_val = xmlBufferLength((const xmlBufferPtr)buf); - desret_int(ret_val); - call_tests++; - des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufferLength", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlBufferResize(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlBufferPtr buf; /* the buffer to resize */ - int n_buf; - unsigned int size; /* the desired size */ - int n_size; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - size = gen_unsigned_int(n_size, 1); - - ret_val = xmlBufferResize(buf, size); - desret_int(ret_val); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_unsigned_int(n_size, size, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufferResize", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_size); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlBufferSetAllocationScheme(void) { - int test_ret = 0; - - int mem_base; - xmlBufferPtr buf; /* the buffer to tune */ - int n_buf; - xmlBufferAllocationScheme scheme; /* allocation scheme to use */ - int n_scheme; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - scheme = gen_xmlBufferAllocationScheme(n_scheme, 1); - - xmlBufferSetAllocationScheme(buf, scheme); - if ((buf != NULL) && (scheme == XML_BUFFER_ALLOC_IMMUTABLE) && (buf->content != NULL) && (buf->content != static_buf_content)) { xmlFree(buf->content); buf->content = NULL;} - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_xmlBufferAllocationScheme(n_scheme, scheme, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufferSetAllocationScheme", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_scheme); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlBufferShrink(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlBufferPtr buf; /* the buffer to dump */ - int n_buf; - unsigned int len; /* the number of xmlChar to remove */ - int n_len; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - len = gen_unsigned_int(n_len, 1); - - ret_val = xmlBufferShrink(buf, len); - desret_int(ret_val); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_unsigned_int(n_len, len, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufferShrink", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_len); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlBufferWriteCHAR(void) { - int test_ret = 0; - - int mem_base; - xmlBufferPtr buf; /* the XML buffer */ - int n_buf; - xmlChar * string; /* the string to add */ - int n_string; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - string = gen_const_xmlChar_ptr(n_string, 1); - - xmlBufferWriteCHAR(buf, (const xmlChar *)string); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufferWriteCHAR", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_string); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlBufferWriteChar(void) { - int test_ret = 0; - - int mem_base; - xmlBufferPtr buf; /* the XML buffer output */ - int n_buf; - char * string; /* the string to add */ - int n_string; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - string = gen_const_char_ptr(n_string, 1); - - xmlBufferWriteChar(buf, (const char *)string); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_const_char_ptr(n_string, (const char *)string, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufferWriteChar", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_string); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlBufferWriteQuotedString(void) { - int test_ret = 0; - - int mem_base; - xmlBufferPtr buf; /* the XML buffer output */ - int n_buf; - xmlChar * string; /* the string to add */ - int n_string; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - string = gen_const_xmlChar_ptr(n_string, 1); - - xmlBufferWriteQuotedString(buf, (const xmlChar *)string); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBufferWriteQuotedString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_string); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlBuildQName(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlChar * ncname; /* the Name */ - int n_ncname; - xmlChar * prefix; /* the prefix */ - int n_prefix; - xmlChar * memory; /* preallocated memory */ - int n_memory; - int len; /* preallocated memory length */ - int n_len; - - for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) { - for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { - for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - ncname = gen_const_xmlChar_ptr(n_ncname, 0); - prefix = gen_const_xmlChar_ptr(n_prefix, 1); - memory = gen_xmlChar_ptr(n_memory, 2); - len = gen_int(n_len, 3); - - ret_val = xmlBuildQName((const xmlChar *)ncname, (const xmlChar *)prefix, memory, len); - if ((ret_val != NULL) && (ret_val != ncname) && - (ret_val != prefix) && (ret_val != memory)) - xmlFree(ret_val); - ret_val = NULL; - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_ncname, (const xmlChar *)ncname, 0); - des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1); - des_xmlChar_ptr(n_memory, memory, 2); - des_int(n_len, len, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBuildQName", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ncname); - printf(" %d", n_prefix); - printf(" %d", n_memory); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlChildElementCount(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) - int mem_base; - unsigned long ret_val; - xmlNodePtr parent; /* the parent node */ - int n_parent; - - for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) { - mem_base = xmlMemBlocks(); - parent = gen_xmlNodePtr(n_parent, 0); - - ret_val = xmlChildElementCount(parent); - desret_unsigned_long(ret_val); - call_tests++; - des_xmlNodePtr(n_parent, parent, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlChildElementCount", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_parent); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCopyDoc(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - xmlDocPtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - int recursive; /* if not zero do a recursive copy. */ - int n_recursive; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - recursive = gen_int(n_recursive, 1); - - ret_val = xmlCopyDoc(doc, recursive); - desret_xmlDocPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_int(n_recursive, recursive, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCopyDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_recursive); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCopyDtd(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) - int mem_base; - xmlDtdPtr ret_val; - xmlDtdPtr dtd; /* the dtd */ - int n_dtd; - - for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { - mem_base = xmlMemBlocks(); - dtd = gen_xmlDtdPtr(n_dtd, 0); - - ret_val = xmlCopyDtd(dtd); - desret_xmlDtdPtr(ret_val); - call_tests++; - des_xmlDtdPtr(n_dtd, dtd, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCopyDtd", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_dtd); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlCopyNamespace(void) { - int test_ret = 0; - - int mem_base; - xmlNsPtr ret_val; - xmlNsPtr cur; /* the namespace */ - int n_cur; - - for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNsPtr(n_cur, 0); - - ret_val = xmlCopyNamespace(cur); - if (ret_val != NULL) xmlFreeNs(ret_val); - desret_xmlNsPtr(ret_val); - call_tests++; - des_xmlNsPtr(n_cur, cur, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCopyNamespace", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCopyNamespaceList(void) { - int test_ret = 0; - - int mem_base; - xmlNsPtr ret_val; - xmlNsPtr cur; /* the first namespace */ - int n_cur; - - for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNsPtr(n_cur, 0); - - ret_val = xmlCopyNamespaceList(cur); - if (ret_val != NULL) xmlFreeNsList(ret_val); - desret_xmlNsPtr(ret_val); - call_tests++; - des_xmlNsPtr(n_cur, cur, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCopyNamespaceList", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCopyNode(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlNodePtr node; /* the node */ - int n_node; - int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */ - int n_extended; - - for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) { - for (n_extended = 0;n_extended < gen_nb_int;n_extended++) { - mem_base = xmlMemBlocks(); - node = gen_const_xmlNodePtr(n_node, 0); - extended = gen_int(n_extended, 1); - - ret_val = xmlCopyNode((const xmlNodePtr)node, extended); - desret_xmlNodePtr(ret_val); - call_tests++; - des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0); - des_int(n_extended, extended, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCopyNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_extended); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCopyNodeList(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlNodePtr node; /* the first node in the list. */ - int n_node; - - for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - node = gen_const_xmlNodePtr(n_node, 0); - - ret_val = xmlCopyNodeList((const xmlNodePtr)node); - desret_xmlNodePtr(ret_val); - call_tests++; - des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCopyNodeList", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCopyProp(void) { - int test_ret = 0; - - int mem_base; - xmlAttrPtr ret_val; - xmlNodePtr target; /* the element where the attribute will be grafted */ - int n_target; - xmlAttrPtr cur; /* the attribute */ - int n_cur; - - for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) { - for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) { - mem_base = xmlMemBlocks(); - target = gen_xmlNodePtr(n_target, 0); - cur = gen_xmlAttrPtr(n_cur, 1); - - ret_val = xmlCopyProp(target, cur); - desret_xmlAttrPtr(ret_val); - call_tests++; - des_xmlNodePtr(n_target, target, 0); - des_xmlAttrPtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCopyProp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_target); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCopyPropList(void) { - int test_ret = 0; - - int mem_base; - xmlAttrPtr ret_val; - xmlNodePtr target; /* the element where the attributes will be grafted */ - int n_target; - xmlAttrPtr cur; /* the first attribute */ - int n_cur; - - for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) { - for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) { - mem_base = xmlMemBlocks(); - target = gen_xmlNodePtr(n_target, 0); - cur = gen_xmlAttrPtr(n_cur, 1); - - ret_val = xmlCopyPropList(target, cur); - desret_xmlAttrPtr(ret_val); - call_tests++; - des_xmlNodePtr(n_target, target, 0); - des_xmlAttrPtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCopyPropList", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_target); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCreateIntSubset(void) { - int test_ret = 0; - - int mem_base; - xmlDtdPtr ret_val; - xmlDocPtr doc; /* the document pointer */ - int n_doc; - xmlChar * name; /* the DTD name */ - int n_name; - xmlChar * ExternalID; /* the external (PUBLIC) ID */ - int n_ExternalID; - xmlChar * SystemID; /* the system ID */ - int n_SystemID; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { - for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2); - SystemID = gen_const_xmlChar_ptr(n_SystemID, 3); - - ret_val = xmlCreateIntSubset(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID); - desret_xmlDtdPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2); - des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCreateIntSubset", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_name); - printf(" %d", n_ExternalID); - printf(" %d", n_SystemID); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -#define gen_nb_xmlDOMWrapCtxtPtr 1 -static xmlDOMWrapCtxtPtr gen_xmlDOMWrapCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlDOMWrapCtxtPtr(int no ATTRIBUTE_UNUSED, xmlDOMWrapCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlDOMWrapAdoptNode(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlDOMWrapCtxtPtr ctxt; /* the optional context for custom processing */ - int n_ctxt; - xmlDocPtr sourceDoc; /* the optional sourceDoc */ - int n_sourceDoc; - xmlNodePtr node; /* the node to start with */ - int n_node; - xmlDocPtr destDoc; /* the destination doc */ - int n_destDoc; - xmlNodePtr destParent; /* the optional new parent of @node in @destDoc */ - int n_destParent; - int options; /* option flags */ - int n_options; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlDOMWrapCtxtPtr;n_ctxt++) { - for (n_sourceDoc = 0;n_sourceDoc < gen_nb_xmlDocPtr;n_sourceDoc++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_destDoc = 0;n_destDoc < gen_nb_xmlDocPtr;n_destDoc++) { - for (n_destParent = 0;n_destParent < gen_nb_xmlNodePtr;n_destParent++) { - for (n_options = 0;n_options < gen_nb_int;n_options++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlDOMWrapCtxtPtr(n_ctxt, 0); - sourceDoc = gen_xmlDocPtr(n_sourceDoc, 1); - node = gen_xmlNodePtr(n_node, 2); - destDoc = gen_xmlDocPtr(n_destDoc, 3); - destParent = gen_xmlNodePtr(n_destParent, 4); - options = gen_int(n_options, 5); - - ret_val = xmlDOMWrapAdoptNode(ctxt, sourceDoc, node, destDoc, destParent, options); - if ((node != NULL) && (node->parent == NULL)) {xmlUnlinkNode(node);xmlFreeNode(node);node = NULL;} - desret_int(ret_val); - call_tests++; - des_xmlDOMWrapCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_sourceDoc, sourceDoc, 1); - des_xmlNodePtr(n_node, node, 2); - des_xmlDocPtr(n_destDoc, destDoc, 3); - des_xmlNodePtr(n_destParent, destParent, 4); - des_int(n_options, options, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDOMWrapAdoptNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_sourceDoc); - printf(" %d", n_node); - printf(" %d", n_destDoc); - printf(" %d", n_destParent); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlDOMWrapCloneNode(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlDOMWrapCtxtPtr ctxt; /* the optional context for custom processing */ - int n_ctxt; - xmlDocPtr sourceDoc; /* the optional sourceDoc */ - int n_sourceDoc; - xmlNodePtr node; /* the node to start with */ - int n_node; - xmlNodePtr * resNode; /* the clone of the given @node */ - int n_resNode; - xmlDocPtr destDoc; /* the destination doc */ - int n_destDoc; - xmlNodePtr destParent; /* the optional new parent of @node in @destDoc */ - int n_destParent; - int deep; /* descend into child if set */ - int n_deep; - int options; /* option flags */ - int n_options; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlDOMWrapCtxtPtr;n_ctxt++) { - for (n_sourceDoc = 0;n_sourceDoc < gen_nb_xmlDocPtr;n_sourceDoc++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_resNode = 0;n_resNode < gen_nb_xmlNodePtr_ptr;n_resNode++) { - for (n_destDoc = 0;n_destDoc < gen_nb_xmlDocPtr;n_destDoc++) { - for (n_destParent = 0;n_destParent < gen_nb_xmlNodePtr;n_destParent++) { - for (n_deep = 0;n_deep < gen_nb_int;n_deep++) { - for (n_options = 0;n_options < gen_nb_int;n_options++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlDOMWrapCtxtPtr(n_ctxt, 0); - sourceDoc = gen_xmlDocPtr(n_sourceDoc, 1); - node = gen_xmlNodePtr(n_node, 2); - resNode = gen_xmlNodePtr_ptr(n_resNode, 3); - destDoc = gen_xmlDocPtr(n_destDoc, 4); - destParent = gen_xmlNodePtr(n_destParent, 5); - deep = gen_int(n_deep, 6); - options = gen_int(n_options, 7); - - ret_val = xmlDOMWrapCloneNode(ctxt, sourceDoc, node, resNode, destDoc, destParent, deep, options); - desret_int(ret_val); - call_tests++; - des_xmlDOMWrapCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_sourceDoc, sourceDoc, 1); - des_xmlNodePtr(n_node, node, 2); - des_xmlNodePtr_ptr(n_resNode, resNode, 3); - des_xmlDocPtr(n_destDoc, destDoc, 4); - des_xmlNodePtr(n_destParent, destParent, 5); - des_int(n_deep, deep, 6); - des_int(n_options, options, 7); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDOMWrapCloneNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_sourceDoc); - printf(" %d", n_node); - printf(" %d", n_resNode); - printf(" %d", n_destDoc); - printf(" %d", n_destParent); - printf(" %d", n_deep); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlDOMWrapNewCtxt(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlDOMWrapReconcileNamespaces(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlDOMWrapCtxtPtr ctxt; /* DOM wrapper context, unused at the moment */ - int n_ctxt; - xmlNodePtr elem; /* the element-node */ - int n_elem; - int options; /* option flags */ - int n_options; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlDOMWrapCtxtPtr;n_ctxt++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { - for (n_options = 0;n_options < gen_nb_int;n_options++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlDOMWrapCtxtPtr(n_ctxt, 0); - elem = gen_xmlNodePtr(n_elem, 1); - options = gen_int(n_options, 2); - - ret_val = xmlDOMWrapReconcileNamespaces(ctxt, elem, options); - desret_int(ret_val); - call_tests++; - des_xmlDOMWrapCtxtPtr(n_ctxt, ctxt, 0); - des_xmlNodePtr(n_elem, elem, 1); - des_int(n_options, options, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDOMWrapReconcileNamespaces", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_elem); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlDOMWrapRemoveNode(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlDOMWrapCtxtPtr ctxt; /* a DOM wrapper context */ - int n_ctxt; - xmlDocPtr doc; /* the doc */ - int n_doc; - xmlNodePtr node; /* the node to be removed. */ - int n_node; - int options; /* set of options, unused at the moment */ - int n_options; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlDOMWrapCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_options = 0;n_options < gen_nb_int;n_options++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlDOMWrapCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - node = gen_xmlNodePtr(n_node, 2); - options = gen_int(n_options, 3); - - ret_val = xmlDOMWrapRemoveNode(ctxt, doc, node, options); - desret_int(ret_val); - call_tests++; - des_xmlDOMWrapCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_node, node, 2); - des_int(n_options, options, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDOMWrapRemoveNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf(" %d", n_node); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlDocCopyNode(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlNodePtr node; /* the node */ - int n_node; - xmlDocPtr doc; /* the document */ - int n_doc; - int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */ - int n_extended; - - for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_extended = 0;n_extended < gen_nb_int;n_extended++) { - mem_base = xmlMemBlocks(); - node = gen_const_xmlNodePtr(n_node, 0); - doc = gen_xmlDocPtr(n_doc, 1); - extended = gen_int(n_extended, 2); - - ret_val = xmlDocCopyNode((const xmlNodePtr)node, doc, extended); - desret_xmlNodePtr(ret_val); - call_tests++; - des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_int(n_extended, extended, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDocCopyNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_doc); - printf(" %d", n_extended); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlDocCopyNodeList(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlDocPtr doc; /* the target document */ - int n_doc; - xmlNodePtr node; /* the first node in the list. */ - int n_node; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - node = gen_const_xmlNodePtr(n_node, 1); - - ret_val = xmlDocCopyNodeList(doc, (const xmlNodePtr)node); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDocCopyNodeList", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_node); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlDocDump(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - FILE * f; /* the FILE* */ - int n_f; - xmlDocPtr cur; /* the document */ - int n_cur; - - for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) { - for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { - mem_base = xmlMemBlocks(); - f = gen_FILE_ptr(n_f, 0); - cur = gen_xmlDocPtr(n_cur, 1); - - ret_val = xmlDocDump(f, cur); - desret_int(ret_val); - call_tests++; - des_FILE_ptr(n_f, f, 0); - des_xmlDocPtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDocDump", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_f); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDocDumpFormatMemory(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlDocPtr cur; /* the document */ - int n_cur; - xmlChar ** mem; /* OUT: the memory pointer */ - int n_mem; - int * size; /* OUT: the memory length */ - int n_size; - int format; /* should formatting spaces been added */ - int n_format; - - for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { - for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) { - for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) { - for (n_format = 0;n_format < gen_nb_int;n_format++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlDocPtr(n_cur, 0); - mem = gen_xmlChar_ptr_ptr(n_mem, 1); - size = gen_int_ptr(n_size, 2); - format = gen_int(n_format, 3); - - xmlDocDumpFormatMemory(cur, mem, size, format); - call_tests++; - des_xmlDocPtr(n_cur, cur, 0); - des_xmlChar_ptr_ptr(n_mem, mem, 1); - des_int_ptr(n_size, size, 2); - des_int(n_format, format, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDocDumpFormatMemory", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_mem); - printf(" %d", n_size); - printf(" %d", n_format); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDocDumpFormatMemoryEnc(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlDocPtr out_doc; /* Document to generate XML text from */ - int n_out_doc; - xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */ - int n_doc_txt_ptr; - int * doc_txt_len; /* Length of the generated XML text */ - int n_doc_txt_len; - char * txt_encoding; /* Character encoding to use when generating XML text */ - int n_txt_encoding; - int format; /* should formatting spaces been added */ - int n_format; - - for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) { - for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) { - for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) { - for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) { - for (n_format = 0;n_format < gen_nb_int;n_format++) { - mem_base = xmlMemBlocks(); - out_doc = gen_xmlDocPtr(n_out_doc, 0); - doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1); - doc_txt_len = gen_int_ptr(n_doc_txt_len, 2); - txt_encoding = gen_const_char_ptr(n_txt_encoding, 3); - format = gen_int(n_format, 4); - - xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding, format); - call_tests++; - des_xmlDocPtr(n_out_doc, out_doc, 0); - des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1); - des_int_ptr(n_doc_txt_len, doc_txt_len, 2); - des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3); - des_int(n_format, format, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_out_doc); - printf(" %d", n_doc_txt_ptr); - printf(" %d", n_doc_txt_len); - printf(" %d", n_txt_encoding); - printf(" %d", n_format); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDocDumpMemory(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlDocPtr cur; /* the document */ - int n_cur; - xmlChar ** mem; /* OUT: the memory pointer */ - int n_mem; - int * size; /* OUT: the memory length */ - int n_size; - - for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { - for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) { - for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlDocPtr(n_cur, 0); - mem = gen_xmlChar_ptr_ptr(n_mem, 1); - size = gen_int_ptr(n_size, 2); - - xmlDocDumpMemory(cur, mem, size); - call_tests++; - des_xmlDocPtr(n_cur, cur, 0); - des_xmlChar_ptr_ptr(n_mem, mem, 1); - des_int_ptr(n_size, size, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDocDumpMemory", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_mem); - printf(" %d", n_size); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDocDumpMemoryEnc(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlDocPtr out_doc; /* Document to generate XML text from */ - int n_out_doc; - xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */ - int n_doc_txt_ptr; - int * doc_txt_len; /* Length of the generated XML text */ - int n_doc_txt_len; - char * txt_encoding; /* Character encoding to use when generating XML text */ - int n_txt_encoding; - - for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) { - for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) { - for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) { - for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) { - mem_base = xmlMemBlocks(); - out_doc = gen_xmlDocPtr(n_out_doc, 0); - doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1); - doc_txt_len = gen_int_ptr(n_doc_txt_len, 2); - txt_encoding = gen_const_char_ptr(n_txt_encoding, 3); - - xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding); - call_tests++; - des_xmlDocPtr(n_out_doc, out_doc, 0); - des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1); - des_int_ptr(n_doc_txt_len, doc_txt_len, 2); - des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDocDumpMemoryEnc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_out_doc); - printf(" %d", n_doc_txt_ptr); - printf(" %d", n_doc_txt_len); - printf(" %d", n_txt_encoding); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDocFormatDump(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - FILE * f; /* the FILE* */ - int n_f; - xmlDocPtr cur; /* the document */ - int n_cur; - int format; /* should formatting spaces been added */ - int n_format; - - for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) { - for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { - for (n_format = 0;n_format < gen_nb_int;n_format++) { - mem_base = xmlMemBlocks(); - f = gen_FILE_ptr(n_f, 0); - cur = gen_xmlDocPtr(n_cur, 1); - format = gen_int(n_format, 2); - - ret_val = xmlDocFormatDump(f, cur, format); - desret_int(ret_val); - call_tests++; - des_FILE_ptr(n_f, f, 0); - des_xmlDocPtr(n_cur, cur, 1); - des_int(n_format, format, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDocFormatDump", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_f); - printf(" %d", n_cur); - printf(" %d", n_format); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDocGetRootElement(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - - ret_val = xmlDocGetRootElement(doc); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDocGetRootElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlDocSetRootElement(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNodePtr root; /* the new document root element, if root is NULL no action is taken, to remove a node from a document use xmlUnlinkNode(root) instead. */ - int n_root; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - root = gen_xmlNodePtr_in(n_root, 1); - - ret_val = xmlDocSetRootElement(doc, root); - if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; } - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlNodePtr_in(n_root, root, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDocSetRootElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_root); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlElemDump(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - FILE * f; /* the FILE * for the output */ - int n_f; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNodePtr cur; /* the current node */ - int n_cur; - - for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - f = gen_FILE_ptr(n_f, 0); - doc = gen_xmlDocPtr(n_doc, 1); - cur = gen_xmlNodePtr(n_cur, 2); - - xmlElemDump(f, doc, cur); - call_tests++; - des_FILE_ptr(n_f, f, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_cur, cur, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlElemDump", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_f); - printf(" %d", n_doc); - printf(" %d", n_cur); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlFirstElementChild(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlNodePtr parent; /* the parent node */ - int n_parent; - - for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) { - mem_base = xmlMemBlocks(); - parent = gen_xmlNodePtr(n_parent, 0); - - ret_val = xmlFirstElementChild(parent); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlNodePtr(n_parent, parent, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlFirstElementChild", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_parent); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlGetBufferAllocationScheme(void) { - int test_ret = 0; - - int mem_base; - xmlBufferAllocationScheme ret_val; - - mem_base = xmlMemBlocks(); - - ret_val = xmlGetBufferAllocationScheme(); - desret_xmlBufferAllocationScheme(ret_val); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetBufferAllocationScheme", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetCompressMode(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - - mem_base = xmlMemBlocks(); - - ret_val = xmlGetCompressMode(); - desret_int(ret_val); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetCompressMode", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetDocCompressMode(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - - ret_val = xmlGetDocCompressMode(doc); - desret_int(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetDocCompressMode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetIntSubset(void) { - int test_ret = 0; - - int mem_base; - xmlDtdPtr ret_val; - xmlDocPtr doc; /* the document pointer */ - int n_doc; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - - ret_val = xmlGetIntSubset(doc); - desret_xmlDtdPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetIntSubset", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetLastChild(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlNodePtr parent; /* the parent node */ - int n_parent; - - for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) { - mem_base = xmlMemBlocks(); - parent = gen_xmlNodePtr(n_parent, 0); - - ret_val = xmlGetLastChild(parent); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlNodePtr(n_parent, parent, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetLastChild", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_parent); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetLineNo(void) { - int test_ret = 0; - - int mem_base; - long ret_val; - xmlNodePtr node; /* valid node */ - int n_node; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - - ret_val = xmlGetLineNo(node); - desret_long(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetLineNo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetNoNsProp(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlNodePtr node; /* the node */ - int n_node; - xmlChar * name; /* the attribute name */ - int n_name; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlGetNoNsProp(node, (const xmlChar *)name); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetNoNsProp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetNodePath(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlNodePtr node; /* a node */ - int n_node; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - - ret_val = xmlGetNodePath(node); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetNodePath", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlGetNsList(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlGetNsProp(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlNodePtr node; /* the node */ - int n_node; - xmlChar * name; /* the attribute name */ - int n_name; - xmlChar * nameSpace; /* the URI of the namespace */ - int n_nameSpace; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2); - - ret_val = xmlGetNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetNsProp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_name); - printf(" %d", n_nameSpace); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetProp(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlNodePtr node; /* the node */ - int n_node; - xmlChar * name; /* the attribute name */ - int n_name; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlGetProp(node, (const xmlChar *)name); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetProp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlHasNsProp(void) { - int test_ret = 0; - - int mem_base; - xmlAttrPtr ret_val; - xmlNodePtr node; /* the node */ - int n_node; - xmlChar * name; /* the attribute name */ - int n_name; - xmlChar * nameSpace; /* the URI of the namespace */ - int n_nameSpace; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2); - - ret_val = xmlHasNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace); - desret_xmlAttrPtr(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHasNsProp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_name); - printf(" %d", n_nameSpace); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlHasProp(void) { - int test_ret = 0; - - int mem_base; - xmlAttrPtr ret_val; - xmlNodePtr node; /* the node */ - int n_node; - xmlChar * name; /* the attribute name */ - int n_name; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlHasProp(node, (const xmlChar *)name); - desret_xmlAttrPtr(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlHasProp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlIsBlankNode(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlNodePtr node; /* the node */ - int n_node; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - - ret_val = xmlIsBlankNode(node); - desret_int(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIsBlankNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlIsXHTML(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlChar * systemID; /* the system identifier */ - int n_systemID; - xmlChar * publicID; /* the public identifier */ - int n_publicID; - - for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) { - for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) { - mem_base = xmlMemBlocks(); - systemID = gen_const_xmlChar_ptr(n_systemID, 0); - publicID = gen_const_xmlChar_ptr(n_publicID, 1); - - ret_val = xmlIsXHTML((const xmlChar *)systemID, (const xmlChar *)publicID); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_systemID, (const xmlChar *)systemID, 0); - des_const_xmlChar_ptr(n_publicID, (const xmlChar *)publicID, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIsXHTML", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_systemID); - printf(" %d", n_publicID); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlLastElementChild(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlNodePtr parent; /* the parent node */ - int n_parent; - - for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) { - mem_base = xmlMemBlocks(); - parent = gen_xmlNodePtr(n_parent, 0); - - ret_val = xmlLastElementChild(parent); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlNodePtr(n_parent, parent, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlLastElementChild", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_parent); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNewCDataBlock(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlChar * content; /* the CDATA block content content */ - int n_content; - int len; /* the length of the block */ - int n_len; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - content = gen_const_xmlChar_ptr(n_content, 1); - len = gen_int(n_len, 2); - - ret_val = xmlNewCDataBlock(doc, (const xmlChar *)content, len); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewCDataBlock", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_content); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewCharRef(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */ - int n_name; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlNewCharRef(doc, (const xmlChar *)name); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewCharRef", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewChild(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -#ifdef LIBXML_TREE_ENABLED - int mem_base; - xmlNodePtr ret_val; - xmlNodePtr parent; /* the parent node */ - int n_parent; - xmlNsPtr ns; /* a namespace if any */ - int n_ns; - xmlChar * name; /* the name of the child */ - int n_name; - xmlChar * content; /* the XML content of the child if any. */ - int n_content; - - for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) { - for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - parent = gen_xmlNodePtr(n_parent, 0); - ns = gen_xmlNsPtr(n_ns, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - content = gen_const_xmlChar_ptr(n_content, 3); - - ret_val = xmlNewChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlNodePtr(n_parent, parent, 0); - des_xmlNsPtr(n_ns, ns, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewChild", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_parent); - printf(" %d", n_ns); - printf(" %d", n_name); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlNewComment(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlChar * content; /* the comment content */ - int n_content; - - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - content = gen_const_xmlChar_ptr(n_content, 0); - - ret_val = xmlNewComment((const xmlChar *)content); - desret_xmlNodePtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewComment", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_content); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewDoc(void) { - int test_ret = 0; - - int mem_base; - xmlDocPtr ret_val; - xmlChar * version; /* xmlChar string giving the version of XML "1.0" */ - int n_version; - - for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) { - mem_base = xmlMemBlocks(); - version = gen_const_xmlChar_ptr(n_version, 0); - - ret_val = xmlNewDoc((const xmlChar *)version); - desret_xmlDocPtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_version, (const xmlChar *)version, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_version); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewDocComment(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlChar * content; /* the comment content */ - int n_content; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - content = gen_const_xmlChar_ptr(n_content, 1); - - ret_val = xmlNewDocComment(doc, (const xmlChar *)content); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewDocComment", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_content); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewDocFragment(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlDocPtr doc; /* the document owning the fragment */ - int n_doc; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - - ret_val = xmlNewDocFragment(doc); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewDocFragment", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNewDocNode(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNsPtr ns; /* namespace if any */ - int n_ns; - xmlChar * name; /* the node name */ - int n_name; - xmlChar * content; /* the XML text content if any */ - int n_content; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - ns = gen_xmlNsPtr(n_ns, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - content = gen_const_xmlChar_ptr(n_content, 3); - - ret_val = xmlNewDocNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlNsPtr(n_ns, ns, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewDocNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_ns); - printf(" %d", n_name); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewDocNodeEatName(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNsPtr ns; /* namespace if any */ - int n_ns; - xmlChar * name; /* the node name */ - int n_name; - xmlChar * content; /* the XML text content if any */ - int n_content; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { - for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - ns = gen_xmlNsPtr(n_ns, 1); - name = gen_eaten_name(n_name, 2); - content = gen_const_xmlChar_ptr(n_content, 3); - - ret_val = xmlNewDocNodeEatName(doc, ns, name, (const xmlChar *)content); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlNsPtr(n_ns, ns, 1); - des_eaten_name(n_name, name, 2); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewDocNodeEatName", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_ns); - printf(" %d", n_name); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewDocPI(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlDocPtr doc; /* the target document */ - int n_doc; - xmlChar * name; /* the processing instruction name */ - int n_name; - xmlChar * content; /* the PI content */ - int n_content; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - content = gen_const_xmlChar_ptr(n_content, 2); - - ret_val = xmlNewDocPI(doc, (const xmlChar *)name, (const xmlChar *)content); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewDocPI", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_name); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewDocProp(void) { - int test_ret = 0; - - int mem_base; - xmlAttrPtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlChar * name; /* the name of the attribute */ - int n_name; - xmlChar * value; /* the value of the attribute */ - int n_value; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - value = gen_const_xmlChar_ptr(n_value, 2); - - ret_val = xmlNewDocProp(doc, (const xmlChar *)name, (const xmlChar *)value); - desret_xmlAttrPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewDocProp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_name); - printf(" %d", n_value); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewDocRawNode(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) -#ifdef LIBXML_TREE_ENABLED - int mem_base; - xmlNodePtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNsPtr ns; /* namespace if any */ - int n_ns; - xmlChar * name; /* the node name */ - int n_name; - xmlChar * content; /* the text content if any */ - int n_content; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - ns = gen_xmlNsPtr(n_ns, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - content = gen_const_xmlChar_ptr(n_content, 3); - - ret_val = xmlNewDocRawNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlNsPtr(n_ns, ns, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewDocRawNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_ns); - printf(" %d", n_name); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlNewDocText(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlChar * content; /* the text content */ - int n_content; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - content = gen_const_xmlChar_ptr(n_content, 1); - - ret_val = xmlNewDocText(doc, (const xmlChar *)content); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewDocText", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_content); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewDocTextLen(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlChar * content; /* the text content */ - int n_content; - int len; /* the text len. */ - int n_len; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - content = gen_const_xmlChar_ptr(n_content, 1); - len = gen_int(n_len, 2); - - ret_val = xmlNewDocTextLen(doc, (const xmlChar *)content, len); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewDocTextLen", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_content); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewDtd(void) { - int test_ret = 0; - - int mem_base; - xmlDtdPtr ret_val; - xmlDocPtr doc; /* the document pointer */ - int n_doc; - xmlChar * name; /* the DTD name */ - int n_name; - xmlChar * ExternalID; /* the external ID */ - int n_ExternalID; - xmlChar * SystemID; /* the system ID */ - int n_SystemID; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { - for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2); - SystemID = gen_const_xmlChar_ptr(n_SystemID, 3); - - ret_val = xmlNewDtd(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID); - desret_xmlDtdPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2); - des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewDtd", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_name); - printf(" %d", n_ExternalID); - printf(" %d", n_SystemID); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewNode(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlNsPtr ns; /* namespace if any */ - int n_ns; - xmlChar * name; /* the node name */ - int n_name; - - for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - ns = gen_xmlNsPtr(n_ns, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlNewNode(ns, (const xmlChar *)name); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlNsPtr(n_ns, ns, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ns); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewNodeEatName(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlNsPtr ns; /* namespace if any */ - int n_ns; - xmlChar * name; /* the node name */ - int n_name; - - for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { - for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) { - mem_base = xmlMemBlocks(); - ns = gen_xmlNsPtr(n_ns, 0); - name = gen_eaten_name(n_name, 1); - - ret_val = xmlNewNodeEatName(ns, name); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlNsPtr(n_ns, ns, 0); - des_eaten_name(n_name, name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewNodeEatName", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ns); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewNs(void) { - int test_ret = 0; - - int mem_base; - xmlNsPtr ret_val; - xmlNodePtr node; /* the element carrying the namespace */ - int n_node; - xmlChar * href; /* the URI associated */ - int n_href; - xmlChar * prefix; /* the prefix for the namespace */ - int n_prefix; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) { - for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - href = gen_const_xmlChar_ptr(n_href, 1); - prefix = gen_const_xmlChar_ptr(n_prefix, 2); - - ret_val = xmlNewNs(node, (const xmlChar *)href, (const xmlChar *)prefix); - if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val); - desret_xmlNsPtr(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 1); - des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewNs", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_href); - printf(" %d", n_prefix); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewNsProp(void) { - int test_ret = 0; - - int mem_base; - xmlAttrPtr ret_val; - xmlNodePtr node; /* the holding node */ - int n_node; - xmlNsPtr ns; /* the namespace */ - int n_ns; - xmlChar * name; /* the name of the attribute */ - int n_name; - xmlChar * value; /* the value of the attribute */ - int n_value; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - ns = gen_xmlNsPtr(n_ns, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - value = gen_const_xmlChar_ptr(n_value, 3); - - ret_val = xmlNewNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value); - desret_xmlAttrPtr(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - des_xmlNsPtr(n_ns, ns, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewNsProp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_ns); - printf(" %d", n_name); - printf(" %d", n_value); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewNsPropEatName(void) { - int test_ret = 0; - - int mem_base; - xmlAttrPtr ret_val; - xmlNodePtr node; /* the holding node */ - int n_node; - xmlNsPtr ns; /* the namespace */ - int n_ns; - xmlChar * name; /* the name of the attribute */ - int n_name; - xmlChar * value; /* the value of the attribute */ - int n_value; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { - for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - ns = gen_xmlNsPtr(n_ns, 1); - name = gen_eaten_name(n_name, 2); - value = gen_const_xmlChar_ptr(n_value, 3); - - ret_val = xmlNewNsPropEatName(node, ns, name, (const xmlChar *)value); - desret_xmlAttrPtr(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - des_xmlNsPtr(n_ns, ns, 1); - des_eaten_name(n_name, name, 2); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewNsPropEatName", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_ns); - printf(" %d", n_name); - printf(" %d", n_value); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewPI(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlChar * name; /* the processing instruction name */ - int n_name; - xmlChar * content; /* the PI content */ - int n_content; - - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - name = gen_const_xmlChar_ptr(n_name, 0); - content = gen_const_xmlChar_ptr(n_content, 1); - - ret_val = xmlNewPI((const xmlChar *)name, (const xmlChar *)content); - desret_xmlNodePtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewPI", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_name); - printf(" %d", n_content); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewProp(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -#ifdef LIBXML_TREE_ENABLED - int mem_base; - xmlAttrPtr ret_val; - xmlNodePtr node; /* the holding node */ - int n_node; - xmlChar * name; /* the name of the attribute */ - int n_name; - xmlChar * value; /* the value of the attribute */ - int n_value; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - value = gen_const_xmlChar_ptr(n_value, 2); - - ret_val = xmlNewProp(node, (const xmlChar *)name, (const xmlChar *)value); - desret_xmlAttrPtr(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewProp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_name); - printf(" %d", n_value); - printf("\n"); - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlNewReference(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlChar * name; /* the reference name, or the reference string with & and ; */ - int n_name; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlNewReference(doc, (const xmlChar *)name); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewReference", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewText(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlChar * content; /* the text content */ - int n_content; - - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - content = gen_const_xmlChar_ptr(n_content, 0); - - ret_val = xmlNewText((const xmlChar *)content); - desret_xmlNodePtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewText", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_content); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewTextChild(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) -#ifdef LIBXML_TREE_ENABLED - int mem_base; - xmlNodePtr ret_val; - xmlNodePtr parent; /* the parent node */ - int n_parent; - xmlNsPtr ns; /* a namespace if any */ - int n_ns; - xmlChar * name; /* the name of the child */ - int n_name; - xmlChar * content; /* the text content of the child if any. */ - int n_content; - - for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) { - for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - parent = gen_xmlNodePtr(n_parent, 0); - ns = gen_xmlNsPtr(n_ns, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - content = gen_const_xmlChar_ptr(n_content, 3); - - ret_val = xmlNewTextChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlNodePtr(n_parent, parent, 0); - des_xmlNsPtr(n_ns, ns, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewTextChild", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_parent); - printf(" %d", n_ns); - printf(" %d", n_name); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlNewTextLen(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlChar * content; /* the text content */ - int n_content; - int len; /* the text len. */ - int n_len; - - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - content = gen_const_xmlChar_ptr(n_content, 0); - len = gen_int(n_len, 1); - - ret_val = xmlNewTextLen((const xmlChar *)content, len); - desret_xmlNodePtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0); - des_int(n_len, len, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewTextLen", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_content); - printf(" %d", n_len); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNextElementSibling(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlNodePtr node; /* the current node */ - int n_node; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - - ret_val = xmlNextElementSibling(node); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNextElementSibling", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNodeAddContent(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr cur; /* the node being modified */ - int n_cur; - xmlChar * content; /* extra content */ - int n_content; - - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodePtr(n_cur, 0); - content = gen_const_xmlChar_ptr(n_content, 1); - - xmlNodeAddContent(cur, (const xmlChar *)content); - call_tests++; - des_xmlNodePtr(n_cur, cur, 0); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeAddContent", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_content); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNodeAddContentLen(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr cur; /* the node being modified */ - int n_cur; - xmlChar * content; /* extra content */ - int n_content; - int len; /* the size of @content */ - int n_len; - - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodePtr(n_cur, 0); - content = gen_const_xmlChar_ptr(n_content, 1); - len = gen_int(n_len, 2); - - xmlNodeAddContentLen(cur, (const xmlChar *)content, len); - call_tests++; - des_xmlNodePtr(n_cur, cur, 0); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeAddContentLen", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_content); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNodeBufGetContent(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlBufferPtr buffer; /* a buffer */ - int n_buffer; - xmlNodePtr cur; /* the node being read */ - int n_cur; - - for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - buffer = gen_xmlBufferPtr(n_buffer, 0); - cur = gen_xmlNodePtr(n_cur, 1); - - ret_val = xmlNodeBufGetContent(buffer, cur); - desret_int(ret_val); - call_tests++; - des_xmlBufferPtr(n_buffer, buffer, 0); - des_xmlNodePtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeBufGetContent", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buffer); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNodeDump(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - xmlBufferPtr buf; /* the XML buffer output */ - int n_buf; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNodePtr cur; /* the current node */ - int n_cur; - int level; /* the imbrication level for indenting */ - int n_level; - int format; /* is formatting allowed */ - int n_format; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_level = 0;n_level < gen_nb_int;n_level++) { - for (n_format = 0;n_format < gen_nb_int;n_format++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - doc = gen_xmlDocPtr(n_doc, 1); - cur = gen_xmlNodePtr(n_cur, 2); - level = gen_int(n_level, 3); - format = gen_int(n_format, 4); - - ret_val = xmlNodeDump(buf, doc, cur, level, format); - desret_int(ret_val); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_cur, cur, 2); - des_int(n_level, level, 3); - des_int(n_format, format, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeDump", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_doc); - printf(" %d", n_cur); - printf(" %d", n_level); - printf(" %d", n_format); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNodeDumpOutput(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlOutputBufferPtr buf; /* the XML buffer output */ - int n_buf; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNodePtr cur; /* the current node */ - int n_cur; - int level; /* the imbrication level for indenting */ - int n_level; - int format; /* is formatting allowed */ - int n_format; - char * encoding; /* an optional encoding string */ - int n_encoding; - - for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_level = 0;n_level < gen_nb_int;n_level++) { - for (n_format = 0;n_format < gen_nb_int;n_format++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlOutputBufferPtr(n_buf, 0); - doc = gen_xmlDocPtr(n_doc, 1); - cur = gen_xmlNodePtr(n_cur, 2); - level = gen_int(n_level, 3); - format = gen_int(n_format, 4); - encoding = gen_const_char_ptr(n_encoding, 5); - - xmlNodeDumpOutput(buf, doc, cur, level, format, (const char *)encoding); - call_tests++; - des_xmlOutputBufferPtr(n_buf, buf, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_cur, cur, 2); - des_int(n_level, level, 3); - des_int(n_format, format, 4); - des_const_char_ptr(n_encoding, (const char *)encoding, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeDumpOutput", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_doc); - printf(" %d", n_cur); - printf(" %d", n_level); - printf(" %d", n_format); - printf(" %d", n_encoding); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNodeGetBase(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlDocPtr doc; /* the document the node pertains to */ - int n_doc; - xmlNodePtr cur; /* the node being checked */ - int n_cur; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - cur = gen_xmlNodePtr(n_cur, 1); - - ret_val = xmlNodeGetBase(doc, cur); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlNodePtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeGetBase", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNodeGetContent(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlNodePtr cur; /* the node being read */ - int n_cur; - - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodePtr(n_cur, 0); - - ret_val = xmlNodeGetContent(cur); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlNodePtr(n_cur, cur, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeGetContent", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNodeGetLang(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlNodePtr cur; /* the node being checked */ - int n_cur; - - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodePtr(n_cur, 0); - - ret_val = xmlNodeGetLang(cur); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlNodePtr(n_cur, cur, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeGetLang", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNodeGetSpacePreserve(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlNodePtr cur; /* the node being checked */ - int n_cur; - - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodePtr(n_cur, 0); - - ret_val = xmlNodeGetSpacePreserve(cur); - desret_int(ret_val); - call_tests++; - des_xmlNodePtr(n_cur, cur, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeGetSpacePreserve", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNodeIsText(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlNodePtr node; /* the node */ - int n_node; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - - ret_val = xmlNodeIsText(node); - desret_int(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeIsText", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNodeListGetRawString(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNodePtr list; /* a Node list */ - int n_list; - int inLine; /* should we replace entity contents or show their external form */ - int n_inLine; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) { - for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - list = gen_xmlNodePtr(n_list, 1); - inLine = gen_int(n_inLine, 2); - - ret_val = xmlNodeListGetRawString(doc, list, inLine); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlNodePtr(n_list, list, 1); - des_int(n_inLine, inLine, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeListGetRawString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_list); - printf(" %d", n_inLine); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNodeListGetString(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNodePtr list; /* a Node list */ - int n_list; - int inLine; /* should we replace entity contents or show their external form */ - int n_inLine; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) { - for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - list = gen_xmlNodePtr(n_list, 1); - inLine = gen_int(n_inLine, 2); - - ret_val = xmlNodeListGetString(doc, list, inLine); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlNodePtr(n_list, list, 1); - des_int(n_inLine, inLine, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeListGetString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_list); - printf(" %d", n_inLine); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNodeSetBase(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) - int mem_base; - xmlNodePtr cur; /* the node being changed */ - int n_cur; - xmlChar * uri; /* the new base URI */ - int n_uri; - - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodePtr(n_cur, 0); - uri = gen_const_xmlChar_ptr(n_uri, 1); - - xmlNodeSetBase(cur, (const xmlChar *)uri); - call_tests++; - des_xmlNodePtr(n_cur, cur, 0); - des_const_xmlChar_ptr(n_uri, (const xmlChar *)uri, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeSetBase", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_uri); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNodeSetContent(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr cur; /* the node being modified */ - int n_cur; - xmlChar * content; /* the new value of the content */ - int n_content; - - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodePtr(n_cur, 0); - content = gen_const_xmlChar_ptr(n_content, 1); - - xmlNodeSetContent(cur, (const xmlChar *)content); - call_tests++; - des_xmlNodePtr(n_cur, cur, 0); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeSetContent", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_content); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNodeSetContentLen(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) - int mem_base; - xmlNodePtr cur; /* the node being modified */ - int n_cur; - xmlChar * content; /* the new value of the content */ - int n_content; - int len; /* the size of @content */ - int n_len; - - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodePtr(n_cur, 0); - content = gen_const_xmlChar_ptr(n_content, 1); - len = gen_int(n_len, 2); - - xmlNodeSetContentLen(cur, (const xmlChar *)content, len); - call_tests++; - des_xmlNodePtr(n_cur, cur, 0); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeSetContentLen", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_content); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNodeSetLang(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) - int mem_base; - xmlNodePtr cur; /* the node being changed */ - int n_cur; - xmlChar * lang; /* the language description */ - int n_lang; - - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodePtr(n_cur, 0); - lang = gen_const_xmlChar_ptr(n_lang, 1); - - xmlNodeSetLang(cur, (const xmlChar *)lang); - call_tests++; - des_xmlNodePtr(n_cur, cur, 0); - des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeSetLang", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_lang); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNodeSetName(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) - int mem_base; - xmlNodePtr cur; /* the node being changed */ - int n_cur; - xmlChar * name; /* the new tag name */ - int n_name; - - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodePtr(n_cur, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - xmlNodeSetName(cur, (const xmlChar *)name); - call_tests++; - des_xmlNodePtr(n_cur, cur, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeSetName", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNodeSetSpacePreserve(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) - int mem_base; - xmlNodePtr cur; /* the node being changed */ - int n_cur; - int val; /* the xml:space value ("0": default, 1: "preserve") */ - int n_val; - - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - for (n_val = 0;n_val < gen_nb_int;n_val++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodePtr(n_cur, 0); - val = gen_int(n_val, 1); - - xmlNodeSetSpacePreserve(cur, val); - call_tests++; - des_xmlNodePtr(n_cur, cur, 0); - des_int(n_val, val, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNodeSetSpacePreserve", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_val); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlPreviousElementSibling(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlNodePtr node; /* the current node */ - int n_node; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - - ret_val = xmlPreviousElementSibling(node); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlPreviousElementSibling", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlReconciliateNs(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) -#ifdef LIBXML_TREE_ENABLED - int mem_base; - int ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNodePtr tree; /* a node defining the subtree to reconciliate */ - int n_tree; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - tree = gen_xmlNodePtr(n_tree, 1); - - ret_val = xmlReconciliateNs(doc, tree); - desret_int(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlNodePtr(n_tree, tree, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlReconciliateNs", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_tree); - printf("\n"); - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlRemoveProp(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlAttrPtr cur; /* an attribute */ - int n_cur; - - for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlAttrPtr(n_cur, 0); - - ret_val = xmlRemoveProp(cur); - cur = NULL; - desret_int(ret_val); - call_tests++; - des_xmlAttrPtr(n_cur, cur, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRemoveProp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlReplaceNode(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlNodePtr old; /* the old node */ - int n_old; - xmlNodePtr cur; /* the node */ - int n_cur; - - for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) { - mem_base = xmlMemBlocks(); - old = gen_xmlNodePtr(n_old, 0); - cur = gen_xmlNodePtr_in(n_cur, 1); - - ret_val = xmlReplaceNode(old, cur); - if (cur != NULL) { - xmlUnlinkNode(cur); - xmlFreeNode(cur) ; cur = NULL ; } - if (old != NULL) { - xmlUnlinkNode(old); - xmlFreeNode(old) ; old = NULL ; } - ret_val = NULL; - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlNodePtr(n_old, old, 0); - des_xmlNodePtr_in(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlReplaceNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_old); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSaveFile(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - const char * filename; /* the filename (or URL) */ - int n_filename; - xmlDocPtr cur; /* the document */ - int n_cur; - - for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { - for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { - mem_base = xmlMemBlocks(); - filename = gen_fileoutput(n_filename, 0); - cur = gen_xmlDocPtr(n_cur, 1); - - ret_val = xmlSaveFile(filename, cur); - desret_int(ret_val); - call_tests++; - des_fileoutput(n_filename, filename, 0); - des_xmlDocPtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSaveFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSaveFileEnc(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - const char * filename; /* the filename (or URL) */ - int n_filename; - xmlDocPtr cur; /* the document */ - int n_cur; - char * encoding; /* the name of an encoding (or NULL) */ - int n_encoding; - - for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { - for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - mem_base = xmlMemBlocks(); - filename = gen_fileoutput(n_filename, 0); - cur = gen_xmlDocPtr(n_cur, 1); - encoding = gen_const_char_ptr(n_encoding, 2); - - ret_val = xmlSaveFileEnc(filename, cur, (const char *)encoding); - desret_int(ret_val); - call_tests++; - des_fileoutput(n_filename, filename, 0); - des_xmlDocPtr(n_cur, cur, 1); - des_const_char_ptr(n_encoding, (const char *)encoding, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSaveFileEnc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf(" %d", n_cur); - printf(" %d", n_encoding); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSaveFileTo(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - xmlOutputBufferPtr buf; /* an output I/O buffer */ - int n_buf; - xmlDocPtr cur; /* the document */ - int n_cur; - char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */ - int n_encoding; - - for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { - for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlOutputBufferPtr(n_buf, 0); - cur = gen_xmlDocPtr(n_cur, 1); - encoding = gen_const_char_ptr(n_encoding, 2); - - ret_val = xmlSaveFileTo(buf, cur, (const char *)encoding); - buf = NULL; - desret_int(ret_val); - call_tests++; - des_xmlOutputBufferPtr(n_buf, buf, 0); - des_xmlDocPtr(n_cur, cur, 1); - des_const_char_ptr(n_encoding, (const char *)encoding, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSaveFileTo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_cur); - printf(" %d", n_encoding); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSaveFormatFile(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - const char * filename; /* the filename (or URL) */ - int n_filename; - xmlDocPtr cur; /* the document */ - int n_cur; - int format; /* should formatting spaces been added */ - int n_format; - - for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { - for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { - for (n_format = 0;n_format < gen_nb_int;n_format++) { - mem_base = xmlMemBlocks(); - filename = gen_fileoutput(n_filename, 0); - cur = gen_xmlDocPtr(n_cur, 1); - format = gen_int(n_format, 2); - - ret_val = xmlSaveFormatFile(filename, cur, format); - desret_int(ret_val); - call_tests++; - des_fileoutput(n_filename, filename, 0); - des_xmlDocPtr(n_cur, cur, 1); - des_int(n_format, format, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSaveFormatFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf(" %d", n_cur); - printf(" %d", n_format); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSaveFormatFileEnc(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - const char * filename; /* the filename or URL to output */ - int n_filename; - xmlDocPtr cur; /* the document being saved */ - int n_cur; - char * encoding; /* the name of the encoding to use or NULL. */ - int n_encoding; - int format; /* should formatting spaces be added. */ - int n_format; - - for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { - for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_format = 0;n_format < gen_nb_int;n_format++) { - mem_base = xmlMemBlocks(); - filename = gen_fileoutput(n_filename, 0); - cur = gen_xmlDocPtr(n_cur, 1); - encoding = gen_const_char_ptr(n_encoding, 2); - format = gen_int(n_format, 3); - - ret_val = xmlSaveFormatFileEnc(filename, cur, (const char *)encoding, format); - desret_int(ret_val); - call_tests++; - des_fileoutput(n_filename, filename, 0); - des_xmlDocPtr(n_cur, cur, 1); - des_const_char_ptr(n_encoding, (const char *)encoding, 2); - des_int(n_format, format, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSaveFormatFileEnc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf(" %d", n_cur); - printf(" %d", n_encoding); - printf(" %d", n_format); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSaveFormatFileTo(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - xmlOutputBufferPtr buf; /* an output I/O buffer */ - int n_buf; - xmlDocPtr cur; /* the document */ - int n_cur; - char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */ - int n_encoding; - int format; /* should formatting spaces been added */ - int n_format; - - for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { - for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_format = 0;n_format < gen_nb_int;n_format++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlOutputBufferPtr(n_buf, 0); - cur = gen_xmlDocPtr(n_cur, 1); - encoding = gen_const_char_ptr(n_encoding, 2); - format = gen_int(n_format, 3); - - ret_val = xmlSaveFormatFileTo(buf, cur, (const char *)encoding, format); - buf = NULL; - desret_int(ret_val); - call_tests++; - des_xmlOutputBufferPtr(n_buf, buf, 0); - des_xmlDocPtr(n_cur, cur, 1); - des_const_char_ptr(n_encoding, (const char *)encoding, 2); - des_int(n_format, format, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSaveFormatFileTo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_cur); - printf(" %d", n_encoding); - printf(" %d", n_format); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSearchNs(void) { - int test_ret = 0; - - int mem_base; - xmlNsPtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNodePtr node; /* the current node */ - int n_node; - xmlChar * nameSpace; /* the namespace prefix */ - int n_nameSpace; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - node = gen_xmlNodePtr(n_node, 1); - nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2); - - ret_val = xmlSearchNs(doc, node, (const xmlChar *)nameSpace); - desret_xmlNsPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlNodePtr(n_node, node, 1); - des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSearchNs", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_node); - printf(" %d", n_nameSpace); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSearchNsByHref(void) { - int test_ret = 0; - - int mem_base; - xmlNsPtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNodePtr node; /* the current node */ - int n_node; - xmlChar * href; /* the namespace value */ - int n_href; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - node = gen_xmlNodePtr(n_node, 1); - href = gen_const_xmlChar_ptr(n_href, 2); - - ret_val = xmlSearchNsByHref(doc, node, (const xmlChar *)href); - desret_xmlNsPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlNodePtr(n_node, node, 1); - des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSearchNsByHref", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_node); - printf(" %d", n_href); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSetBufferAllocationScheme(void) { - int test_ret = 0; - - int mem_base; - xmlBufferAllocationScheme scheme; /* allocation method to use */ - int n_scheme; - - for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) { - mem_base = xmlMemBlocks(); - scheme = gen_xmlBufferAllocationScheme(n_scheme, 0); - - xmlSetBufferAllocationScheme(scheme); - call_tests++; - des_xmlBufferAllocationScheme(n_scheme, scheme, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSetBufferAllocationScheme", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_scheme); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSetCompressMode(void) { - int test_ret = 0; - - int mem_base; - int mode; /* the compression ratio */ - int n_mode; - - for (n_mode = 0;n_mode < gen_nb_int;n_mode++) { - mem_base = xmlMemBlocks(); - mode = gen_int(n_mode, 0); - - xmlSetCompressMode(mode); - call_tests++; - des_int(n_mode, mode, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSetCompressMode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_mode); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSetDocCompressMode(void) { - int test_ret = 0; - - int mem_base; - xmlDocPtr doc; /* the document */ - int n_doc; - int mode; /* the compression ratio */ - int n_mode; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_mode = 0;n_mode < gen_nb_int;n_mode++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - mode = gen_int(n_mode, 1); - - xmlSetDocCompressMode(doc, mode); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_int(n_mode, mode, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSetDocCompressMode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_mode); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSetNs(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr node; /* a node in the document */ - int n_node; - xmlNsPtr ns; /* a namespace pointer */ - int n_ns; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - ns = gen_xmlNsPtr(n_ns, 1); - - xmlSetNs(node, ns); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - des_xmlNsPtr(n_ns, ns, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSetNs", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_ns); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSetNsProp(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) - int mem_base; - xmlAttrPtr ret_val; - xmlNodePtr node; /* the node */ - int n_node; - xmlNsPtr ns; /* the namespace definition */ - int n_ns; - xmlChar * name; /* the attribute name */ - int n_name; - xmlChar * value; /* the attribute value */ - int n_value; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - ns = gen_xmlNsPtr(n_ns, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - value = gen_const_xmlChar_ptr(n_value, 3); - - ret_val = xmlSetNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value); - desret_xmlAttrPtr(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - des_xmlNsPtr(n_ns, ns, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSetNsProp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_ns); - printf(" %d", n_name); - printf(" %d", n_value); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSetProp(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) - int mem_base; - xmlAttrPtr ret_val; - xmlNodePtr node; /* the node */ - int n_node; - xmlChar * name; /* the attribute name (a QName) */ - int n_name; - xmlChar * value; /* the attribute value */ - int n_value; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - value = gen_const_xmlChar_ptr(n_value, 2); - - ret_val = xmlSetProp(node, (const xmlChar *)name, (const xmlChar *)value); - desret_xmlAttrPtr(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSetProp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_name); - printf(" %d", n_value); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSplitQName2(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlChar * name; /* the full QName */ - int n_name; - xmlChar ** prefix; /* a xmlChar ** */ - int n_prefix; - - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) { - mem_base = xmlMemBlocks(); - name = gen_const_xmlChar_ptr(n_name, 0); - prefix = gen_xmlChar_ptr_ptr(n_prefix, 1); - - ret_val = xmlSplitQName2((const xmlChar *)name, prefix); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0); - des_xmlChar_ptr_ptr(n_prefix, prefix, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSplitQName2", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_name); - printf(" %d", n_prefix); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSplitQName3(void) { - int test_ret = 0; - - int mem_base; - const xmlChar * ret_val; - xmlChar * name; /* the full QName */ - int n_name; - int * len; /* an int * */ - int n_len; - - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) { - mem_base = xmlMemBlocks(); - name = gen_const_xmlChar_ptr(n_name, 0); - len = gen_int_ptr(n_len, 1); - - ret_val = xmlSplitQName3((const xmlChar *)name, len); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0); - des_int_ptr(n_len, len, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSplitQName3", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_name); - printf(" %d", n_len); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStringGetNodeList(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlChar * value; /* the value of the attribute */ - int n_value; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - value = gen_const_xmlChar_ptr(n_value, 1); - - ret_val = xmlStringGetNodeList(doc, (const xmlChar *)value); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStringGetNodeList", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_value); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStringLenGetNodeList(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlChar * value; /* the value of the text */ - int n_value; - int len; /* the length of the string value */ - int n_len; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - value = gen_const_xmlChar_ptr(n_value, 1); - len = gen_int(n_len, 2); - - ret_val = xmlStringLenGetNodeList(doc, (const xmlChar *)value, len); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStringLenGetNodeList", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_value); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlTextConcat(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlNodePtr node; /* the node */ - int n_node; - xmlChar * content; /* the content */ - int n_content; - int len; /* @content length */ - int n_len; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - content = gen_const_xmlChar_ptr(n_content, 1); - len = gen_int(n_len, 2); - - ret_val = xmlTextConcat(node, (const xmlChar *)content, len); - desret_int(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextConcat", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_content); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlTextMerge(void) { - int test_ret = 0; - - int mem_base; - xmlNodePtr ret_val; - xmlNodePtr first; /* the first text node */ - int n_first; - xmlNodePtr second; /* the second text node being merged */ - int n_second; - - for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) { - for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) { - mem_base = xmlMemBlocks(); - first = gen_xmlNodePtr_in(n_first, 0); - second = gen_xmlNodePtr_in(n_second, 1); - - ret_val = xmlTextMerge(first, second); - if ((first != NULL) && (first->type != XML_TEXT_NODE)) { - xmlUnlinkNode(second); - xmlFreeNode(second) ; second = NULL ; } - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlNodePtr_in(n_first, first, 0); - des_xmlNodePtr_in(n_second, second, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextMerge", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_first); - printf(" %d", n_second); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlUnsetNsProp(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlNodePtr node; /* the node */ - int n_node; - xmlNsPtr ns; /* the namespace definition */ - int n_ns; - xmlChar * name; /* the attribute name */ - int n_name; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - ns = gen_xmlNsPtr(n_ns, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - - ret_val = xmlUnsetNsProp(node, ns, (const xmlChar *)name); - desret_int(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - des_xmlNsPtr(n_ns, ns, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUnsetNsProp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_ns); - printf(" %d", n_name); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUnsetProp(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlNodePtr node; /* the node */ - int n_node; - xmlChar * name; /* the attribute name */ - int n_name; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlUnsetProp(node, (const xmlChar *)name); - desret_int(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUnsetProp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateNCName(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) -#ifdef LIBXML_TREE_ENABLED - int mem_base; - int ret_val; - xmlChar * value; /* the value to check */ - int n_value; - int space; /* allow spaces in front and end of the string */ - int n_space; - - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - for (n_space = 0;n_space < gen_nb_int;n_space++) { - mem_base = xmlMemBlocks(); - value = gen_const_xmlChar_ptr(n_value, 0); - space = gen_int(n_space, 1); - - ret_val = xmlValidateNCName((const xmlChar *)value, space); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0); - des_int(n_space, space, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateNCName", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_value); - printf(" %d", n_space); - printf("\n"); - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlValidateNMToken(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -#ifdef LIBXML_TREE_ENABLED - int mem_base; - int ret_val; - xmlChar * value; /* the value to check */ - int n_value; - int space; /* allow spaces in front and end of the string */ - int n_space; - - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - for (n_space = 0;n_space < gen_nb_int;n_space++) { - mem_base = xmlMemBlocks(); - value = gen_const_xmlChar_ptr(n_value, 0); - space = gen_int(n_space, 1); - - ret_val = xmlValidateNMToken((const xmlChar *)value, space); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0); - des_int(n_space, space, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateNMToken", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_value); - printf(" %d", n_space); - printf("\n"); - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlValidateName(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -#ifdef LIBXML_TREE_ENABLED - int mem_base; - int ret_val; - xmlChar * value; /* the value to check */ - int n_value; - int space; /* allow spaces in front and end of the string */ - int n_space; - - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - for (n_space = 0;n_space < gen_nb_int;n_space++) { - mem_base = xmlMemBlocks(); - value = gen_const_xmlChar_ptr(n_value, 0); - space = gen_int(n_space, 1); - - ret_val = xmlValidateName((const xmlChar *)value, space); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0); - des_int(n_space, space, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateName", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_value); - printf(" %d", n_space); - printf("\n"); - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlValidateQName(void) { - int test_ret = 0; - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -#ifdef LIBXML_TREE_ENABLED - int mem_base; - int ret_val; - xmlChar * value; /* the value to check */ - int n_value; - int space; /* allow spaces in front and end of the string */ - int n_space; - - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - for (n_space = 0;n_space < gen_nb_int;n_space++) { - mem_base = xmlMemBlocks(); - value = gen_const_xmlChar_ptr(n_value, 0); - space = gen_int(n_space, 1); - - ret_val = xmlValidateQName((const xmlChar *)value, space); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0); - des_int(n_space, space, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateQName", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_value); - printf(" %d", n_space); - printf("\n"); - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - -static int -test_tree(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing tree : 142 of 164 functions ...\n"); - test_ret += test_xmlAddChild(); - test_ret += test_xmlAddChildList(); - test_ret += test_xmlAddNextSibling(); - test_ret += test_xmlAddPrevSibling(); - test_ret += test_xmlAddSibling(); - test_ret += test_xmlAttrSerializeTxtContent(); - test_ret += test_xmlBufContent(); - test_ret += test_xmlBufEnd(); - test_ret += test_xmlBufGetNodeContent(); - test_ret += test_xmlBufNodeDump(); - test_ret += test_xmlBufShrink(); - test_ret += test_xmlBufUse(); - test_ret += test_xmlBufferAdd(); - test_ret += test_xmlBufferAddHead(); - test_ret += test_xmlBufferCCat(); - test_ret += test_xmlBufferCat(); - test_ret += test_xmlBufferContent(); - test_ret += test_xmlBufferCreate(); - test_ret += test_xmlBufferCreateSize(); - test_ret += test_xmlBufferCreateStatic(); - test_ret += test_xmlBufferDetach(); - test_ret += test_xmlBufferEmpty(); - test_ret += test_xmlBufferGrow(); - test_ret += test_xmlBufferLength(); - test_ret += test_xmlBufferResize(); - test_ret += test_xmlBufferSetAllocationScheme(); - test_ret += test_xmlBufferShrink(); - test_ret += test_xmlBufferWriteCHAR(); - test_ret += test_xmlBufferWriteChar(); - test_ret += test_xmlBufferWriteQuotedString(); - test_ret += test_xmlBuildQName(); - test_ret += test_xmlChildElementCount(); - test_ret += test_xmlCopyDoc(); - test_ret += test_xmlCopyDtd(); - test_ret += test_xmlCopyNamespace(); - test_ret += test_xmlCopyNamespaceList(); - test_ret += test_xmlCopyNode(); - test_ret += test_xmlCopyNodeList(); - test_ret += test_xmlCopyProp(); - test_ret += test_xmlCopyPropList(); - test_ret += test_xmlCreateIntSubset(); - test_ret += test_xmlDOMWrapAdoptNode(); - test_ret += test_xmlDOMWrapCloneNode(); - test_ret += test_xmlDOMWrapNewCtxt(); - test_ret += test_xmlDOMWrapReconcileNamespaces(); - test_ret += test_xmlDOMWrapRemoveNode(); - test_ret += test_xmlDocCopyNode(); - test_ret += test_xmlDocCopyNodeList(); - test_ret += test_xmlDocDump(); - test_ret += test_xmlDocDumpFormatMemory(); - test_ret += test_xmlDocDumpFormatMemoryEnc(); - test_ret += test_xmlDocDumpMemory(); - test_ret += test_xmlDocDumpMemoryEnc(); - test_ret += test_xmlDocFormatDump(); - test_ret += test_xmlDocGetRootElement(); - test_ret += test_xmlDocSetRootElement(); - test_ret += test_xmlElemDump(); - test_ret += test_xmlFirstElementChild(); - test_ret += test_xmlGetBufferAllocationScheme(); - test_ret += test_xmlGetCompressMode(); - test_ret += test_xmlGetDocCompressMode(); - test_ret += test_xmlGetIntSubset(); - test_ret += test_xmlGetLastChild(); - test_ret += test_xmlGetLineNo(); - test_ret += test_xmlGetNoNsProp(); - test_ret += test_xmlGetNodePath(); - test_ret += test_xmlGetNsList(); - test_ret += test_xmlGetNsProp(); - test_ret += test_xmlGetProp(); - test_ret += test_xmlHasNsProp(); - test_ret += test_xmlHasProp(); - test_ret += test_xmlIsBlankNode(); - test_ret += test_xmlIsXHTML(); - test_ret += test_xmlLastElementChild(); - test_ret += test_xmlNewCDataBlock(); - test_ret += test_xmlNewCharRef(); - test_ret += test_xmlNewChild(); - test_ret += test_xmlNewComment(); - test_ret += test_xmlNewDoc(); - test_ret += test_xmlNewDocComment(); - test_ret += test_xmlNewDocFragment(); - test_ret += test_xmlNewDocNode(); - test_ret += test_xmlNewDocNodeEatName(); - test_ret += test_xmlNewDocPI(); - test_ret += test_xmlNewDocProp(); - test_ret += test_xmlNewDocRawNode(); - test_ret += test_xmlNewDocText(); - test_ret += test_xmlNewDocTextLen(); - test_ret += test_xmlNewDtd(); - test_ret += test_xmlNewNode(); - test_ret += test_xmlNewNodeEatName(); - test_ret += test_xmlNewNs(); - test_ret += test_xmlNewNsProp(); - test_ret += test_xmlNewNsPropEatName(); - test_ret += test_xmlNewPI(); - test_ret += test_xmlNewProp(); - test_ret += test_xmlNewReference(); - test_ret += test_xmlNewText(); - test_ret += test_xmlNewTextChild(); - test_ret += test_xmlNewTextLen(); - test_ret += test_xmlNextElementSibling(); - test_ret += test_xmlNodeAddContent(); - test_ret += test_xmlNodeAddContentLen(); - test_ret += test_xmlNodeBufGetContent(); - test_ret += test_xmlNodeDump(); - test_ret += test_xmlNodeDumpOutput(); - test_ret += test_xmlNodeGetBase(); - test_ret += test_xmlNodeGetContent(); - test_ret += test_xmlNodeGetLang(); - test_ret += test_xmlNodeGetSpacePreserve(); - test_ret += test_xmlNodeIsText(); - test_ret += test_xmlNodeListGetRawString(); - test_ret += test_xmlNodeListGetString(); - test_ret += test_xmlNodeSetBase(); - test_ret += test_xmlNodeSetContent(); - test_ret += test_xmlNodeSetContentLen(); - test_ret += test_xmlNodeSetLang(); - test_ret += test_xmlNodeSetName(); - test_ret += test_xmlNodeSetSpacePreserve(); - test_ret += test_xmlPreviousElementSibling(); - test_ret += test_xmlReconciliateNs(); - test_ret += test_xmlRemoveProp(); - test_ret += test_xmlReplaceNode(); - test_ret += test_xmlSaveFile(); - test_ret += test_xmlSaveFileEnc(); - test_ret += test_xmlSaveFileTo(); - test_ret += test_xmlSaveFormatFile(); - test_ret += test_xmlSaveFormatFileEnc(); - test_ret += test_xmlSaveFormatFileTo(); - test_ret += test_xmlSearchNs(); - test_ret += test_xmlSearchNsByHref(); - test_ret += test_xmlSetBufferAllocationScheme(); - test_ret += test_xmlSetCompressMode(); - test_ret += test_xmlSetDocCompressMode(); - test_ret += test_xmlSetNs(); - test_ret += test_xmlSetNsProp(); - test_ret += test_xmlSetProp(); - test_ret += test_xmlSplitQName2(); - test_ret += test_xmlSplitQName3(); - test_ret += test_xmlStringGetNodeList(); - test_ret += test_xmlStringLenGetNodeList(); - test_ret += test_xmlTextConcat(); - test_ret += test_xmlTextMerge(); - test_ret += test_xmlUnsetNsProp(); - test_ret += test_xmlUnsetProp(); - test_ret += test_xmlValidateNCName(); - test_ret += test_xmlValidateNMToken(); - test_ret += test_xmlValidateName(); - test_ret += test_xmlValidateQName(); - - if (test_ret != 0) - printf("Module tree: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlBuildRelativeURI(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlChar * URI; /* the URI reference under consideration */ - int n_URI; - xmlChar * base; /* the base value */ - int n_base; - - for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { - for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) { - mem_base = xmlMemBlocks(); - URI = gen_const_xmlChar_ptr(n_URI, 0); - base = gen_const_xmlChar_ptr(n_base, 1); - - ret_val = xmlBuildRelativeURI((const xmlChar *)URI, (const xmlChar *)base); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0); - des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBuildRelativeURI", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URI); - printf(" %d", n_base); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlBuildURI(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlChar * URI; /* the URI instance found in the document */ - int n_URI; - xmlChar * base; /* the base value */ - int n_base; - - for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { - for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) { - mem_base = xmlMemBlocks(); - URI = gen_const_xmlChar_ptr(n_URI, 0); - base = gen_const_xmlChar_ptr(n_base, 1); - - ret_val = xmlBuildURI((const xmlChar *)URI, (const xmlChar *)base); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0); - des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlBuildURI", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URI); - printf(" %d", n_base); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCanonicPath(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlChar * path; /* the resource locator in a filesystem notation */ - int n_path; - - for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) { - mem_base = xmlMemBlocks(); - path = gen_const_xmlChar_ptr(n_path, 0); - - ret_val = xmlCanonicPath((const xmlChar *)path); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCanonicPath", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_path); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCreateURI(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlNormalizeURIPath(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - char * path; /* pointer to the path string */ - int n_path; - - for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) { - mem_base = xmlMemBlocks(); - path = gen_char_ptr(n_path, 0); - - ret_val = xmlNormalizeURIPath(path); - desret_int(ret_val); - call_tests++; - des_char_ptr(n_path, path, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNormalizeURIPath", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_path); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlParseURI(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlParseURIRaw(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -#define gen_nb_xmlURIPtr 1 -static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlParseURIReference(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlURIPtr uri; /* pointer to an URI structure */ - int n_uri; - char * str; /* the string to analyze */ - int n_str; - - for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) { - for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) { - mem_base = xmlMemBlocks(); - uri = gen_xmlURIPtr(n_uri, 0); - str = gen_const_char_ptr(n_str, 1); - - ret_val = xmlParseURIReference(uri, (const char *)str); - desret_int(ret_val); - call_tests++; - des_xmlURIPtr(n_uri, uri, 0); - des_const_char_ptr(n_str, (const char *)str, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParseURIReference", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_uri); - printf(" %d", n_str); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlPathToURI(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlChar * path; /* the resource locator in a filesystem notation */ - int n_path; - - for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) { - mem_base = xmlMemBlocks(); - path = gen_const_xmlChar_ptr(n_path, 0); - - ret_val = xmlPathToURI((const xmlChar *)path); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlPathToURI", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_path); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlPrintURI(void) { - int test_ret = 0; - - int mem_base; - FILE * stream; /* a FILE* for the output */ - int n_stream; - xmlURIPtr uri; /* pointer to an xmlURI */ - int n_uri; - - for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) { - for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) { - mem_base = xmlMemBlocks(); - stream = gen_FILE_ptr(n_stream, 0); - uri = gen_xmlURIPtr(n_uri, 1); - - xmlPrintURI(stream, uri); - call_tests++; - des_FILE_ptr(n_stream, stream, 0); - des_xmlURIPtr(n_uri, uri, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlPrintURI", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_stream); - printf(" %d", n_uri); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSaveUri(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlURIPtr uri; /* pointer to an xmlURI */ - int n_uri; - - for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) { - mem_base = xmlMemBlocks(); - uri = gen_xmlURIPtr(n_uri, 0); - - ret_val = xmlSaveUri(uri); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlURIPtr(n_uri, uri, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSaveUri", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_uri); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlURIEscape(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlChar * str; /* the string of the URI to escape */ - int n_str; - - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - mem_base = xmlMemBlocks(); - str = gen_const_xmlChar_ptr(n_str, 0); - - ret_val = xmlURIEscape((const xmlChar *)str); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlURIEscape", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_str); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlURIEscapeStr(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlChar * str; /* string to escape */ - int n_str; - xmlChar * list; /* exception list string of chars not to escape */ - int n_list; - - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) { - mem_base = xmlMemBlocks(); - str = gen_const_xmlChar_ptr(n_str, 0); - list = gen_const_xmlChar_ptr(n_list, 1); - - ret_val = xmlURIEscapeStr((const xmlChar *)str, (const xmlChar *)list); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0); - des_const_xmlChar_ptr(n_list, (const xmlChar *)list, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlURIEscapeStr", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_str); - printf(" %d", n_list); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlURIUnescapeString(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - -static int -test_uri(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing uri : 10 of 15 functions ...\n"); - test_ret += test_xmlBuildRelativeURI(); - test_ret += test_xmlBuildURI(); - test_ret += test_xmlCanonicPath(); - test_ret += test_xmlCreateURI(); - test_ret += test_xmlNormalizeURIPath(); - test_ret += test_xmlParseURI(); - test_ret += test_xmlParseURIRaw(); - test_ret += test_xmlParseURIReference(); - test_ret += test_xmlPathToURI(); - test_ret += test_xmlPrintURI(); - test_ret += test_xmlSaveUri(); - test_ret += test_xmlURIEscape(); - test_ret += test_xmlURIEscapeStr(); - test_ret += test_xmlURIUnescapeString(); - - if (test_ret != 0) - printf("Module uri: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlAddAttributeDecl(void) { - int test_ret = 0; - - int mem_base; - xmlAttributePtr ret_val; - xmlValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDtdPtr dtd; /* pointer to the DTD */ - int n_dtd; - xmlChar * elem; /* the element name */ - int n_elem; - xmlChar * name; /* the attribute name */ - int n_name; - xmlChar * ns; /* the attribute namespace prefix */ - int n_ns; - xmlAttributeType type; /* the attribute type */ - int n_type; - xmlAttributeDefault def; /* the attribute default type */ - int n_def; - xmlChar * defaultValue; /* the attribute default value */ - int n_defaultValue; - xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */ - int n_tree; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { - for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) { - for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) { - for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) { - for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) { - for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - dtd = gen_xmlDtdPtr(n_dtd, 1); - elem = gen_const_xmlChar_ptr(n_elem, 2); - name = gen_const_xmlChar_ptr(n_name, 3); - ns = gen_const_xmlChar_ptr(n_ns, 4); - type = gen_xmlAttributeType(n_type, 5); - def = gen_xmlAttributeDefault(n_def, 6); - defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7); - tree = gen_xmlEnumerationPtr(n_tree, 8); - - ret_val = xmlAddAttributeDecl(ctxt, dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)ns, type, def, (const xmlChar *)defaultValue, tree); - desret_xmlAttributePtr(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDtdPtr(n_dtd, dtd, 1); - des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 2); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3); - des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 4); - des_xmlAttributeType(n_type, type, 5); - des_xmlAttributeDefault(n_def, def, 6); - des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 7); - des_xmlEnumerationPtr(n_tree, tree, 8); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAddAttributeDecl", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_dtd); - printf(" %d", n_elem); - printf(" %d", n_name); - printf(" %d", n_ns); - printf(" %d", n_type); - printf(" %d", n_def); - printf(" %d", n_defaultValue); - printf(" %d", n_tree); - printf("\n"); - } - } - } - } - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlAddElementDecl(void) { - int test_ret = 0; - - int mem_base; - xmlElementPtr ret_val; - xmlValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDtdPtr dtd; /* pointer to the DTD */ - int n_dtd; - xmlChar * name; /* the entity name */ - int n_name; - xmlElementTypeVal type; /* the element type */ - int n_type; - xmlElementContentPtr content; /* the element content tree or NULL */ - int n_content; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) { - for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - dtd = gen_xmlDtdPtr(n_dtd, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - type = gen_xmlElementTypeVal(n_type, 3); - content = gen_xmlElementContentPtr(n_content, 4); - - ret_val = xmlAddElementDecl(ctxt, dtd, (const xmlChar *)name, type, content); - desret_xmlElementPtr(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDtdPtr(n_dtd, dtd, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - des_xmlElementTypeVal(n_type, type, 3); - des_xmlElementContentPtr(n_content, content, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAddElementDecl", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_dtd); - printf(" %d", n_name); - printf(" %d", n_type); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlAddID(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlAddNotationDecl(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlAddRef(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -#define gen_nb_xmlAttributeTablePtr 1 -static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlCopyAttributeTable(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlCopyDocElementContent(void) { - int test_ret = 0; - - int mem_base; - xmlElementContentPtr ret_val; - xmlDocPtr doc; /* the document owning the element declaration */ - int n_doc; - xmlElementContentPtr cur; /* An element content pointer. */ - int n_cur; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - cur = gen_xmlElementContentPtr(n_cur, 1); - - ret_val = xmlCopyDocElementContent(doc, cur); - desret_xmlElementContentPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlElementContentPtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCopyDocElementContent", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCopyElementContent(void) { - int test_ret = 0; - - int mem_base; - xmlElementContentPtr ret_val; - xmlElementContentPtr cur; /* An element content pointer. */ - int n_cur; - - for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlElementContentPtr(n_cur, 0); - - ret_val = xmlCopyElementContent(cur); - desret_xmlElementContentPtr(ret_val); - call_tests++; - des_xmlElementContentPtr(n_cur, cur, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCopyElementContent", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -#define gen_nb_xmlElementTablePtr 1 -static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlCopyElementTable(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlCopyEnumeration(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -#define gen_nb_xmlNotationTablePtr 1 -static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlCopyNotationTable(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlCreateEnumeration(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -#define gen_nb_xmlAttributePtr 1 -static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlDumpAttributeDecl(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlBufferPtr buf; /* the XML buffer output */ - int n_buf; - xmlAttributePtr attr; /* An attribute declaration */ - int n_attr; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - attr = gen_xmlAttributePtr(n_attr, 1); - - xmlDumpAttributeDecl(buf, attr); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_xmlAttributePtr(n_attr, attr, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDumpAttributeDecl", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_attr); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDumpAttributeTable(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlBufferPtr buf; /* the XML buffer output */ - int n_buf; - xmlAttributeTablePtr table; /* An attribute table */ - int n_table; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - table = gen_xmlAttributeTablePtr(n_table, 1); - - xmlDumpAttributeTable(buf, table); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_xmlAttributeTablePtr(n_table, table, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDumpAttributeTable", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_table); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -#define gen_nb_xmlElementPtr 1 -static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlDumpElementDecl(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlBufferPtr buf; /* the XML buffer output */ - int n_buf; - xmlElementPtr elem; /* An element table */ - int n_elem; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - elem = gen_xmlElementPtr(n_elem, 1); - - xmlDumpElementDecl(buf, elem); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_xmlElementPtr(n_elem, elem, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDumpElementDecl", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_elem); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDumpElementTable(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlBufferPtr buf; /* the XML buffer output */ - int n_buf; - xmlElementTablePtr table; /* An element table */ - int n_table; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - table = gen_xmlElementTablePtr(n_table, 1); - - xmlDumpElementTable(buf, table); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_xmlElementTablePtr(n_table, table, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDumpElementTable", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_table); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -#define gen_nb_xmlNotationPtr 1 -static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlDumpNotationDecl(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlBufferPtr buf; /* the XML buffer output */ - int n_buf; - xmlNotationPtr nota; /* A notation declaration */ - int n_nota; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - nota = gen_xmlNotationPtr(n_nota, 1); - - xmlDumpNotationDecl(buf, nota); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_xmlNotationPtr(n_nota, nota, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDumpNotationDecl", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_nota); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlDumpNotationTable(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlBufferPtr buf; /* the XML buffer output */ - int n_buf; - xmlNotationTablePtr table; /* A notation table */ - int n_table; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - table = gen_xmlNotationTablePtr(n_table, 1); - - xmlDumpNotationTable(buf, table); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_xmlNotationTablePtr(n_table, table, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlDumpNotationTable", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_table); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlGetDtdAttrDesc(void) { - int test_ret = 0; - - int mem_base; - xmlAttributePtr ret_val; - xmlDtdPtr dtd; /* a pointer to the DtD to search */ - int n_dtd; - xmlChar * elem; /* the element name */ - int n_elem; - xmlChar * name; /* the attribute name */ - int n_name; - - for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { - for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - dtd = gen_xmlDtdPtr(n_dtd, 0); - elem = gen_const_xmlChar_ptr(n_elem, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - - ret_val = xmlGetDtdAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name); - desret_xmlAttributePtr(ret_val); - call_tests++; - des_xmlDtdPtr(n_dtd, dtd, 0); - des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetDtdAttrDesc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_dtd); - printf(" %d", n_elem); - printf(" %d", n_name); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetDtdElementDesc(void) { - int test_ret = 0; - - int mem_base; - xmlElementPtr ret_val; - xmlDtdPtr dtd; /* a pointer to the DtD to search */ - int n_dtd; - xmlChar * name; /* the element name */ - int n_name; - - for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - dtd = gen_xmlDtdPtr(n_dtd, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlGetDtdElementDesc(dtd, (const xmlChar *)name); - desret_xmlElementPtr(ret_val); - call_tests++; - des_xmlDtdPtr(n_dtd, dtd, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetDtdElementDesc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_dtd); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetDtdNotationDesc(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlGetDtdQAttrDesc(void) { - int test_ret = 0; - - int mem_base; - xmlAttributePtr ret_val; - xmlDtdPtr dtd; /* a pointer to the DtD to search */ - int n_dtd; - xmlChar * elem; /* the element name */ - int n_elem; - xmlChar * name; /* the attribute name */ - int n_name; - xmlChar * prefix; /* the attribute namespace prefix */ - int n_prefix; - - for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { - for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { - mem_base = xmlMemBlocks(); - dtd = gen_xmlDtdPtr(n_dtd, 0); - elem = gen_const_xmlChar_ptr(n_elem, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - prefix = gen_const_xmlChar_ptr(n_prefix, 3); - - ret_val = xmlGetDtdQAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)prefix); - desret_xmlAttributePtr(ret_val); - call_tests++; - des_xmlDtdPtr(n_dtd, dtd, 0); - des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetDtdQAttrDesc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_dtd); - printf(" %d", n_elem); - printf(" %d", n_name); - printf(" %d", n_prefix); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetDtdQElementDesc(void) { - int test_ret = 0; - - int mem_base; - xmlElementPtr ret_val; - xmlDtdPtr dtd; /* a pointer to the DtD to search */ - int n_dtd; - xmlChar * name; /* the element name */ - int n_name; - xmlChar * prefix; /* the element namespace prefix */ - int n_prefix; - - for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { - mem_base = xmlMemBlocks(); - dtd = gen_xmlDtdPtr(n_dtd, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - prefix = gen_const_xmlChar_ptr(n_prefix, 2); - - ret_val = xmlGetDtdQElementDesc(dtd, (const xmlChar *)name, (const xmlChar *)prefix); - desret_xmlElementPtr(ret_val); - call_tests++; - des_xmlDtdPtr(n_dtd, dtd, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetDtdQElementDesc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_dtd); - printf(" %d", n_name); - printf(" %d", n_prefix); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetID(void) { - int test_ret = 0; - - int mem_base; - xmlAttrPtr ret_val; - xmlDocPtr doc; /* pointer to the document */ - int n_doc; - xmlChar * ID; /* the ID value */ - int n_ID; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - ID = gen_const_xmlChar_ptr(n_ID, 1); - - ret_val = xmlGetID(doc, (const xmlChar *)ID); - desret_xmlAttrPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetID", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_ID); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetRefs(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlIsID(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNodePtr elem; /* the element carrying the attribute */ - int n_elem; - xmlAttrPtr attr; /* the attribute */ - int n_attr; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { - for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - elem = gen_xmlNodePtr(n_elem, 1); - attr = gen_xmlAttrPtr(n_attr, 2); - - ret_val = xmlIsID(doc, elem, attr); - desret_int(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlNodePtr(n_elem, elem, 1); - des_xmlAttrPtr(n_attr, attr, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIsID", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_elem); - printf(" %d", n_attr); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlIsMixedElement(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlChar * name; /* the element name */ - int n_name; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlIsMixedElement(doc, (const xmlChar *)name); - desret_int(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIsMixedElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlIsRef(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNodePtr elem; /* the element carrying the attribute */ - int n_elem; - xmlAttrPtr attr; /* the attribute */ - int n_attr; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { - for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - elem = gen_xmlNodePtr(n_elem, 1); - attr = gen_xmlAttrPtr(n_attr, 2); - - ret_val = xmlIsRef(doc, elem, attr); - desret_int(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlNodePtr(n_elem, elem, 1); - des_xmlAttrPtr(n_attr, attr, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIsRef", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_elem); - printf(" %d", n_attr); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewDocElementContent(void) { - int test_ret = 0; - - int mem_base; - xmlElementContentPtr ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlChar * name; /* the subelement name or NULL */ - int n_name; - xmlElementContentType type; /* the type of element content decl */ - int n_type; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - type = gen_xmlElementContentType(n_type, 2); - - ret_val = xmlNewDocElementContent(doc, (const xmlChar *)name, type); - xmlFreeDocElementContent(doc, ret_val); ret_val = NULL; - desret_xmlElementContentPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_xmlElementContentType(n_type, type, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewDocElementContent", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_name); - printf(" %d", n_type); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewElementContent(void) { - int test_ret = 0; - - int mem_base; - xmlElementContentPtr ret_val; - xmlChar * name; /* the subelement name or NULL */ - int n_name; - xmlElementContentType type; /* the type of element content decl */ - int n_type; - - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) { - mem_base = xmlMemBlocks(); - name = gen_const_xmlChar_ptr(n_name, 0); - type = gen_xmlElementContentType(n_type, 1); - - ret_val = xmlNewElementContent((const xmlChar *)name, type); - desret_xmlElementContentPtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0); - des_xmlElementContentType(n_type, type, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewElementContent", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_name); - printf(" %d", n_type); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNewValidCtxt(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlRemoveID(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlAttrPtr attr; /* the attribute */ - int n_attr; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - attr = gen_xmlAttrPtr(n_attr, 1); - - ret_val = xmlRemoveID(doc, attr); - desret_int(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlAttrPtr(n_attr, attr, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRemoveID", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_attr); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlRemoveRef(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlAttrPtr attr; /* the attribute */ - int n_attr; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - attr = gen_xmlAttrPtr(n_attr, 1); - - ret_val = xmlRemoveRef(doc, attr); - desret_int(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlAttrPtr(n_attr, attr, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRemoveRef", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_attr); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSnprintfElementContent(void) { - int test_ret = 0; - - int mem_base; - char * buf; /* an output buffer */ - int n_buf; - int size; /* the buffer size */ - int n_size; - xmlElementContentPtr content; /* An element table */ - int n_content; - int englob; /* 1 if one must print the englobing parenthesis, 0 otherwise */ - int n_englob; - - for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) { - for (n_englob = 0;n_englob < gen_nb_int;n_englob++) { - mem_base = xmlMemBlocks(); - buf = gen_char_ptr(n_buf, 0); - size = gen_int(n_size, 1); - content = gen_xmlElementContentPtr(n_content, 2); - englob = gen_int(n_englob, 3); - - xmlSnprintfElementContent(buf, size, content, englob); - call_tests++; - des_char_ptr(n_buf, buf, 0); - des_int(n_size, size, 1); - des_xmlElementContentPtr(n_content, content, 2); - des_int(n_englob, englob, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSnprintfElementContent", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_size); - printf(" %d", n_content); - printf(" %d", n_englob); - printf("\n"); - } - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSprintfElementContent(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) -#ifdef LIBXML_OUTPUT_ENABLED - int mem_base; - char * buf; /* an output buffer */ - int n_buf; - xmlElementContentPtr content; /* An element table */ - int n_content; - int englob; /* 1 if one must print the englobing parenthesis, 0 otherwise */ - int n_englob; - - for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) { - for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) { - for (n_englob = 0;n_englob < gen_nb_int;n_englob++) { - mem_base = xmlMemBlocks(); - buf = gen_char_ptr(n_buf, 0); - content = gen_xmlElementContentPtr(n_content, 1); - englob = gen_int(n_englob, 2); - - xmlSprintfElementContent(buf, content, englob); - call_tests++; - des_char_ptr(n_buf, buf, 0); - des_xmlElementContentPtr(n_content, content, 1); - des_int(n_englob, englob, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSprintfElementContent", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_content); - printf(" %d", n_englob); - printf("\n"); - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlValidBuildContentModel(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED) - int mem_base; - int ret_val; - xmlValidCtxtPtr ctxt; /* a validation context */ - int n_ctxt; - xmlElementPtr elem; /* an element declaration node */ - int n_elem; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - elem = gen_xmlElementPtr(n_elem, 1); - - ret_val = xmlValidBuildContentModel(ctxt, elem); - desret_int(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlElementPtr(n_elem, elem, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidBuildContentModel", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_elem); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidCtxtNormalizeAttributeValue(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlValidCtxtPtr ctxt; /* the validation context or NULL */ - int n_ctxt; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNodePtr elem; /* the parent */ - int n_elem; - xmlChar * name; /* the attribute name */ - int n_name; - xmlChar * value; /* the attribute value */ - int n_value; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - elem = gen_xmlNodePtr(n_elem, 2); - name = gen_const_xmlChar_ptr(n_name, 3); - value = gen_const_xmlChar_ptr(n_value, 4); - - ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, (const xmlChar *)name, (const xmlChar *)value); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_elem, elem, 2); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf(" %d", n_elem); - printf(" %d", n_name); - printf(" %d", n_value); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -#define gen_nb_xmlElementContent_ptr 1 -static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlValidGetPotentialChildren(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) -#ifdef LIBXML_VALID_ENABLED - int mem_base; - int ret_val; - xmlElementContent * ctree; /* an element content tree */ - int n_ctree; - xmlChar ** names; /* an array to store the list of child names */ - int n_names; - int * len; /* a pointer to the number of element in the list */ - int n_len; - int max; /* the size of the array */ - int n_max; - - for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) { - for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) { - for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) { - for (n_max = 0;n_max < gen_nb_int;n_max++) { - mem_base = xmlMemBlocks(); - ctree = gen_xmlElementContent_ptr(n_ctree, 0); - names = gen_const_xmlChar_ptr_ptr(n_names, 1); - len = gen_int_ptr(n_len, 2); - max = gen_int(n_max, 3); - - ret_val = xmlValidGetPotentialChildren(ctree, (const xmlChar **)names, len, max); - desret_int(ret_val); - call_tests++; - des_xmlElementContent_ptr(n_ctree, ctree, 0); - des_const_xmlChar_ptr_ptr(n_names, (const xmlChar **)names, 1); - des_int_ptr(n_len, len, 2); - des_int(n_max, max, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidGetPotentialChildren", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctree); - printf(" %d", n_names); - printf(" %d", n_len); - printf(" %d", n_max); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlValidGetValidElements(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) -#ifdef LIBXML_VALID_ENABLED - int mem_base; - int ret_val; - xmlNode * prev; /* an element to insert after */ - int n_prev; - xmlNode * next; /* an element to insert next */ - int n_next; - xmlChar ** names; /* an array to store the list of child names */ - int n_names; - int max; /* the size of the array */ - int n_max; - - for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) { - for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) { - for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) { - for (n_max = 0;n_max < gen_nb_int;n_max++) { - mem_base = xmlMemBlocks(); - prev = gen_xmlNodePtr(n_prev, 0); - next = gen_xmlNodePtr(n_next, 1); - names = gen_const_xmlChar_ptr_ptr(n_names, 2); - max = gen_int(n_max, 3); - - ret_val = xmlValidGetValidElements(prev, next, (const xmlChar **)names, max); - desret_int(ret_val); - call_tests++; - des_xmlNodePtr(n_prev, prev, 0); - des_xmlNodePtr(n_next, next, 1); - des_const_xmlChar_ptr_ptr(n_names, (const xmlChar **)names, 2); - des_int(n_max, max, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidGetValidElements", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_prev); - printf(" %d", n_next); - printf(" %d", n_names); - printf(" %d", n_max); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlValidNormalizeAttributeValue(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlNodePtr elem; /* the parent */ - int n_elem; - xmlChar * name; /* the attribute name */ - int n_name; - xmlChar * value; /* the attribute value */ - int n_value; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - elem = gen_xmlNodePtr(n_elem, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - value = gen_const_xmlChar_ptr(n_value, 3); - - ret_val = xmlValidNormalizeAttributeValue(doc, elem, (const xmlChar *)name, (const xmlChar *)value); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlNodePtr(n_elem, elem, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_elem); - printf(" %d", n_name); - printf(" %d", n_value); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateAttributeDecl(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - int ret_val; - xmlValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDocPtr doc; /* a document instance */ - int n_doc; - xmlAttributePtr attr; /* an attribute definition */ - int n_attr; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - attr = gen_xmlAttributePtr(n_attr, 2); - - ret_val = xmlValidateAttributeDecl(ctxt, doc, attr); - desret_int(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlAttributePtr(n_attr, attr, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateAttributeDecl", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf(" %d", n_attr); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateAttributeValue(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - int ret_val; - xmlAttributeType type; /* an attribute type */ - int n_type; - xmlChar * value; /* an attribute value */ - int n_value; - - for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - type = gen_xmlAttributeType(n_type, 0); - value = gen_const_xmlChar_ptr(n_value, 1); - - ret_val = xmlValidateAttributeValue(type, (const xmlChar *)value); - desret_int(ret_val); - call_tests++; - des_xmlAttributeType(n_type, type, 0); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateAttributeValue", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_type); - printf(" %d", n_value); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateDocument(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - int ret_val; - xmlValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDocPtr doc; /* a document instance */ - int n_doc; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - - ret_val = xmlValidateDocument(ctxt, doc); - desret_int(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateDocument", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateDocumentFinal(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - int ret_val; - xmlValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDocPtr doc; /* a document instance */ - int n_doc; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - - ret_val = xmlValidateDocumentFinal(ctxt, doc); - desret_int(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateDocumentFinal", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateDtd(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - int ret_val; - xmlValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDocPtr doc; /* a document instance */ - int n_doc; - xmlDtdPtr dtd; /* a dtd instance */ - int n_dtd; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - dtd = gen_xmlDtdPtr(n_dtd, 2); - - ret_val = xmlValidateDtd(ctxt, doc, dtd); - desret_int(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlDtdPtr(n_dtd, dtd, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateDtd", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf(" %d", n_dtd); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateDtdFinal(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - int ret_val; - xmlValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDocPtr doc; /* a document instance */ - int n_doc; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - - ret_val = xmlValidateDtdFinal(ctxt, doc); - desret_int(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateDtdFinal", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateElement(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - int ret_val; - xmlValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDocPtr doc; /* a document instance */ - int n_doc; - xmlNodePtr elem; /* an element instance */ - int n_elem; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - elem = gen_xmlNodePtr(n_elem, 2); - - ret_val = xmlValidateElement(ctxt, doc, elem); - desret_int(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_elem, elem, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf(" %d", n_elem); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateElementDecl(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - int ret_val; - xmlValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDocPtr doc; /* a document instance */ - int n_doc; - xmlElementPtr elem; /* an element definition */ - int n_elem; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - elem = gen_xmlElementPtr(n_elem, 2); - - ret_val = xmlValidateElementDecl(ctxt, doc, elem); - desret_int(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlElementPtr(n_elem, elem, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateElementDecl", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf(" %d", n_elem); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateNameValue(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - int ret_val; - xmlChar * value; /* an Name value */ - int n_value; - - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - value = gen_const_xmlChar_ptr(n_value, 0); - - ret_val = xmlValidateNameValue((const xmlChar *)value); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateNameValue", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_value); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateNamesValue(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - int ret_val; - xmlChar * value; /* an Names value */ - int n_value; - - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - value = gen_const_xmlChar_ptr(n_value, 0); - - ret_val = xmlValidateNamesValue((const xmlChar *)value); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateNamesValue", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_value); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateNmtokenValue(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - int ret_val; - xmlChar * value; /* an Nmtoken value */ - int n_value; - - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - value = gen_const_xmlChar_ptr(n_value, 0); - - ret_val = xmlValidateNmtokenValue((const xmlChar *)value); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateNmtokenValue", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_value); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateNmtokensValue(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - int ret_val; - xmlChar * value; /* an Nmtokens value */ - int n_value; - - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - value = gen_const_xmlChar_ptr(n_value, 0); - - ret_val = xmlValidateNmtokensValue((const xmlChar *)value); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateNmtokensValue", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_value); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateNotationDecl(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - int ret_val; - xmlValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDocPtr doc; /* a document instance */ - int n_doc; - xmlNotationPtr nota; /* a notation definition */ - int n_nota; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - nota = gen_xmlNotationPtr(n_nota, 2); - - ret_val = xmlValidateNotationDecl(ctxt, doc, nota); - desret_int(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNotationPtr(n_nota, nota, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateNotationDecl", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf(" %d", n_nota); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateNotationUse(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDocPtr doc; /* the document */ - int n_doc; - xmlChar * notationName; /* the notation name to check */ - int n_notationName; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - notationName = gen_const_xmlChar_ptr(n_notationName, 2); - - ret_val = xmlValidateNotationUse(ctxt, doc, (const xmlChar *)notationName); - desret_int(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateNotationUse", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf(" %d", n_notationName); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateOneAttribute(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - int ret_val; - xmlValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDocPtr doc; /* a document instance */ - int n_doc; - xmlNodePtr elem; /* an element instance */ - int n_elem; - xmlAttrPtr attr; /* an attribute instance */ - int n_attr; - xmlChar * value; /* the attribute value (without entities processing) */ - int n_value; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { - for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - elem = gen_xmlNodePtr(n_elem, 2); - attr = gen_xmlAttrPtr(n_attr, 3); - value = gen_const_xmlChar_ptr(n_value, 4); - - ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, (const xmlChar *)value); - desret_int(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_elem, elem, 2); - des_xmlAttrPtr(n_attr, attr, 3); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateOneAttribute", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf(" %d", n_elem); - printf(" %d", n_attr); - printf(" %d", n_value); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateOneElement(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - int ret_val; - xmlValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDocPtr doc; /* a document instance */ - int n_doc; - xmlNodePtr elem; /* an element instance */ - int n_elem; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - elem = gen_xmlNodePtr(n_elem, 2); - - ret_val = xmlValidateOneElement(ctxt, doc, elem); - desret_int(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_elem, elem, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateOneElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf(" %d", n_elem); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateOneNamespace(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - int ret_val; - xmlValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDocPtr doc; /* a document instance */ - int n_doc; - xmlNodePtr elem; /* an element instance */ - int n_elem; - xmlChar * prefix; /* the namespace prefix */ - int n_prefix; - xmlNsPtr ns; /* an namespace declaration instance */ - int n_ns; - xmlChar * value; /* the attribute value (without entities processing) */ - int n_value; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { - for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { - for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - elem = gen_xmlNodePtr(n_elem, 2); - prefix = gen_const_xmlChar_ptr(n_prefix, 3); - ns = gen_xmlNsPtr(n_ns, 4); - value = gen_const_xmlChar_ptr(n_value, 5); - - ret_val = xmlValidateOneNamespace(ctxt, doc, elem, (const xmlChar *)prefix, ns, (const xmlChar *)value); - desret_int(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_elem, elem, 2); - des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3); - des_xmlNsPtr(n_ns, ns, 4); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateOneNamespace", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf(" %d", n_elem); - printf(" %d", n_prefix); - printf(" %d", n_ns); - printf(" %d", n_value); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidatePopElement(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED) - int mem_base; - int ret_val; - xmlValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDocPtr doc; /* a document instance */ - int n_doc; - xmlNodePtr elem; /* an element instance */ - int n_elem; - xmlChar * qname; /* the qualified name as appearing in the serialization */ - int n_qname; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { - for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - elem = gen_xmlNodePtr(n_elem, 2); - qname = gen_const_xmlChar_ptr(n_qname, 3); - - ret_val = xmlValidatePopElement(ctxt, doc, elem, (const xmlChar *)qname); - desret_int(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_elem, elem, 2); - des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidatePopElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf(" %d", n_elem); - printf(" %d", n_qname); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidatePushCData(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED) - int mem_base; - int ret_val; - xmlValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlChar * data; /* some character data read */ - int n_data; - int len; /* the lenght of the data */ - int n_len; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - data = gen_const_xmlChar_ptr(n_data, 1); - len = gen_int(n_len, 2); - - ret_val = xmlValidatePushCData(ctxt, (const xmlChar *)data, len); - desret_int(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidatePushCData", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_data); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidatePushElement(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED) - int mem_base; - int ret_val; - xmlValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDocPtr doc; /* a document instance */ - int n_doc; - xmlNodePtr elem; /* an element instance */ - int n_elem; - xmlChar * qname; /* the qualified name as appearing in the serialization */ - int n_qname; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { - for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - elem = gen_xmlNodePtr(n_elem, 2); - qname = gen_const_xmlChar_ptr(n_qname, 3); - - ret_val = xmlValidatePushElement(ctxt, doc, elem, (const xmlChar *)qname); - desret_int(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - des_xmlNodePtr(n_elem, elem, 2); - des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidatePushElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf(" %d", n_elem); - printf(" %d", n_qname); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlValidateRoot(void) { - int test_ret = 0; - -#if defined(LIBXML_VALID_ENABLED) - int mem_base; - int ret_val; - xmlValidCtxtPtr ctxt; /* the validation context */ - int n_ctxt; - xmlDocPtr doc; /* a document instance */ - int n_doc; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - - ret_val = xmlValidateRoot(ctxt, doc); - desret_int(ret_val); - call_tests++; - des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlValidateRoot", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_valid(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing valid : 50 of 70 functions ...\n"); - test_ret += test_xmlAddAttributeDecl(); - test_ret += test_xmlAddElementDecl(); - test_ret += test_xmlAddID(); - test_ret += test_xmlAddNotationDecl(); - test_ret += test_xmlAddRef(); - test_ret += test_xmlCopyAttributeTable(); - test_ret += test_xmlCopyDocElementContent(); - test_ret += test_xmlCopyElementContent(); - test_ret += test_xmlCopyElementTable(); - test_ret += test_xmlCopyEnumeration(); - test_ret += test_xmlCopyNotationTable(); - test_ret += test_xmlCreateEnumeration(); - test_ret += test_xmlDumpAttributeDecl(); - test_ret += test_xmlDumpAttributeTable(); - test_ret += test_xmlDumpElementDecl(); - test_ret += test_xmlDumpElementTable(); - test_ret += test_xmlDumpNotationDecl(); - test_ret += test_xmlDumpNotationTable(); - test_ret += test_xmlGetDtdAttrDesc(); - test_ret += test_xmlGetDtdElementDesc(); - test_ret += test_xmlGetDtdNotationDesc(); - test_ret += test_xmlGetDtdQAttrDesc(); - test_ret += test_xmlGetDtdQElementDesc(); - test_ret += test_xmlGetID(); - test_ret += test_xmlGetRefs(); - test_ret += test_xmlIsID(); - test_ret += test_xmlIsMixedElement(); - test_ret += test_xmlIsRef(); - test_ret += test_xmlNewDocElementContent(); - test_ret += test_xmlNewElementContent(); - test_ret += test_xmlNewValidCtxt(); - test_ret += test_xmlRemoveID(); - test_ret += test_xmlRemoveRef(); - test_ret += test_xmlSnprintfElementContent(); - test_ret += test_xmlSprintfElementContent(); - test_ret += test_xmlValidBuildContentModel(); - test_ret += test_xmlValidCtxtNormalizeAttributeValue(); - test_ret += test_xmlValidGetPotentialChildren(); - test_ret += test_xmlValidGetValidElements(); - test_ret += test_xmlValidNormalizeAttributeValue(); - test_ret += test_xmlValidateAttributeDecl(); - test_ret += test_xmlValidateAttributeValue(); - test_ret += test_xmlValidateDocument(); - test_ret += test_xmlValidateDocumentFinal(); - test_ret += test_xmlValidateDtd(); - test_ret += test_xmlValidateDtdFinal(); - test_ret += test_xmlValidateElement(); - test_ret += test_xmlValidateElementDecl(); - test_ret += test_xmlValidateNameValue(); - test_ret += test_xmlValidateNamesValue(); - test_ret += test_xmlValidateNmtokenValue(); - test_ret += test_xmlValidateNmtokensValue(); - test_ret += test_xmlValidateNotationDecl(); - test_ret += test_xmlValidateNotationUse(); - test_ret += test_xmlValidateOneAttribute(); - test_ret += test_xmlValidateOneElement(); - test_ret += test_xmlValidateOneNamespace(); - test_ret += test_xmlValidatePopElement(); - test_ret += test_xmlValidatePushCData(); - test_ret += test_xmlValidatePushElement(); - test_ret += test_xmlValidateRoot(); - - if (test_ret != 0) - printf("Module valid: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlXIncludeNewContext(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlXIncludeProcess(void) { - int test_ret = 0; - -#if defined(LIBXML_XINCLUDE_ENABLED) - int mem_base; - int ret_val; - xmlDocPtr doc; /* an XML document */ - int n_doc; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - - ret_val = xmlXIncludeProcess(doc); - desret_int(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXIncludeProcess", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXIncludeProcessFlags(void) { - int test_ret = 0; - -#if defined(LIBXML_XINCLUDE_ENABLED) - int mem_base; - int ret_val; - xmlDocPtr doc; /* an XML document */ - int n_doc; - int flags; /* a set of xmlParserOption used for parsing XML includes */ - int n_flags; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_flags = 0;n_flags < gen_nb_int;n_flags++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - flags = gen_int(n_flags, 1); - - ret_val = xmlXIncludeProcessFlags(doc, flags); - desret_int(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_int(n_flags, flags, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXIncludeProcessFlags", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_flags); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXIncludeProcessFlagsData(void) { - int test_ret = 0; - -#if defined(LIBXML_XINCLUDE_ENABLED) - int mem_base; - int ret_val; - xmlDocPtr doc; /* an XML document */ - int n_doc; - int flags; /* a set of xmlParserOption used for parsing XML includes */ - int n_flags; - void * data; /* application data that will be passed to the parser context in the _private field of the parser context(s) */ - int n_data; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_flags = 0;n_flags < gen_nb_int;n_flags++) { - for (n_data = 0;n_data < gen_nb_userdata;n_data++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - flags = gen_int(n_flags, 1); - data = gen_userdata(n_data, 2); - - ret_val = xmlXIncludeProcessFlagsData(doc, flags, data); - desret_int(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_int(n_flags, flags, 1); - des_userdata(n_data, data, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXIncludeProcessFlagsData", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_flags); - printf(" %d", n_data); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -#ifdef LIBXML_XINCLUDE_ENABLED - -#define gen_nb_xmlXIncludeCtxtPtr 1 -static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlXIncludeProcessNode(void) { - int test_ret = 0; - -#if defined(LIBXML_XINCLUDE_ENABLED) - int mem_base; - int ret_val; - xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */ - int n_ctxt; - xmlNodePtr node; /* a node in an XML document */ - int n_node; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0); - node = gen_xmlNodePtr(n_node, 1); - - ret_val = xmlXIncludeProcessNode(ctxt, node); - desret_int(ret_val); - call_tests++; - des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0); - des_xmlNodePtr(n_node, node, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXIncludeProcessNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_node); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXIncludeProcessTree(void) { - int test_ret = 0; - -#if defined(LIBXML_XINCLUDE_ENABLED) - int mem_base; - int ret_val; - xmlNodePtr tree; /* a node in an XML document */ - int n_tree; - - for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) { - mem_base = xmlMemBlocks(); - tree = gen_xmlNodePtr(n_tree, 0); - - ret_val = xmlXIncludeProcessTree(tree); - desret_int(ret_val); - call_tests++; - des_xmlNodePtr(n_tree, tree, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXIncludeProcessTree", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_tree); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXIncludeProcessTreeFlags(void) { - int test_ret = 0; - -#if defined(LIBXML_XINCLUDE_ENABLED) - int mem_base; - int ret_val; - xmlNodePtr tree; /* a node in an XML document */ - int n_tree; - int flags; /* a set of xmlParserOption used for parsing XML includes */ - int n_flags; - - for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) { - for (n_flags = 0;n_flags < gen_nb_int;n_flags++) { - mem_base = xmlMemBlocks(); - tree = gen_xmlNodePtr(n_tree, 0); - flags = gen_int(n_flags, 1); - - ret_val = xmlXIncludeProcessTreeFlags(tree, flags); - desret_int(ret_val); - call_tests++; - des_xmlNodePtr(n_tree, tree, 0); - des_int(n_flags, flags, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_tree); - printf(" %d", n_flags); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXIncludeProcessTreeFlagsData(void) { - int test_ret = 0; - -#if defined(LIBXML_XINCLUDE_ENABLED) - int mem_base; - int ret_val; - xmlNodePtr tree; /* an XML node */ - int n_tree; - int flags; /* a set of xmlParserOption used for parsing XML includes */ - int n_flags; - void * data; /* application data that will be passed to the parser context in the _private field of the parser context(s) */ - int n_data; - - for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) { - for (n_flags = 0;n_flags < gen_nb_int;n_flags++) { - for (n_data = 0;n_data < gen_nb_userdata;n_data++) { - mem_base = xmlMemBlocks(); - tree = gen_xmlNodePtr(n_tree, 0); - flags = gen_int(n_flags, 1); - data = gen_userdata(n_data, 2); - - ret_val = xmlXIncludeProcessTreeFlagsData(tree, flags, data); - desret_int(ret_val); - call_tests++; - des_xmlNodePtr(n_tree, tree, 0); - des_int(n_flags, flags, 1); - des_userdata(n_data, data, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlagsData", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_tree); - printf(" %d", n_flags); - printf(" %d", n_data); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXIncludeSetFlags(void) { - int test_ret = 0; - -#if defined(LIBXML_XINCLUDE_ENABLED) - int mem_base; - int ret_val; - xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */ - int n_ctxt; - int flags; /* a set of xmlParserOption used for parsing XML includes */ - int n_flags; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) { - for (n_flags = 0;n_flags < gen_nb_int;n_flags++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0); - flags = gen_int(n_flags, 1); - - ret_val = xmlXIncludeSetFlags(ctxt, flags); - desret_int(ret_val); - call_tests++; - des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0); - des_int(n_flags, flags, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXIncludeSetFlags", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_flags); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_xinclude(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing xinclude : 8 of 10 functions ...\n"); - test_ret += test_xmlXIncludeNewContext(); - test_ret += test_xmlXIncludeProcess(); - test_ret += test_xmlXIncludeProcessFlags(); - test_ret += test_xmlXIncludeProcessFlagsData(); - test_ret += test_xmlXIncludeProcessNode(); - test_ret += test_xmlXIncludeProcessTree(); - test_ret += test_xmlXIncludeProcessTreeFlags(); - test_ret += test_xmlXIncludeProcessTreeFlagsData(); - test_ret += test_xmlXIncludeSetFlags(); - - if (test_ret != 0) - printf("Module xinclude: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlAllocOutputBuffer(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlOutputBufferPtr ret_val; - xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */ - int n_encoder; - - for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) { - mem_base = xmlMemBlocks(); - encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0); - - ret_val = xmlAllocOutputBuffer(encoder); - desret_xmlOutputBufferPtr(ret_val); - call_tests++; - des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAllocOutputBuffer", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_encoder); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlAllocParserInputBuffer(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputBufferPtr ret_val; - xmlCharEncoding enc; /* the charset encoding if known */ - int n_enc; - - for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { - mem_base = xmlMemBlocks(); - enc = gen_xmlCharEncoding(n_enc, 0); - - ret_val = xmlAllocParserInputBuffer(enc); - desret_xmlParserInputBufferPtr(ret_val); - call_tests++; - des_xmlCharEncoding(n_enc, enc, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAllocParserInputBuffer", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_enc); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCheckFilename(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - char * path; /* the path to check */ - int n_path; - - for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) { - mem_base = xmlMemBlocks(); - path = gen_const_char_ptr(n_path, 0); - - ret_val = xmlCheckFilename((const char *)path); - desret_int(ret_val); - call_tests++; - des_const_char_ptr(n_path, (const char *)path, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCheckFilename", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_path); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCheckHTTPInput(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputPtr ret_val; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - xmlParserInputPtr ret; /* an XML parser input */ - int n_ret; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - ret = gen_xmlParserInputPtr(n_ret, 1); - - ret_val = xmlCheckHTTPInput(ctxt, ret); - desret_xmlParserInputPtr(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_xmlParserInputPtr(n_ret, ret, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCheckHTTPInput", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_ret); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCleanupInputCallbacks(void) { - int test_ret = 0; - - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlCleanupInputCallbacks(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCleanupInputCallbacks", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCleanupOutputCallbacks(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlCleanupOutputCallbacks(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCleanupOutputCallbacks", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlFileClose(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - void * context; /* the I/O context */ - int n_context; - - for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) { - mem_base = xmlMemBlocks(); - context = gen_void_ptr(n_context, 0); - - ret_val = xmlFileClose(context); - desret_int(ret_val); - call_tests++; - des_void_ptr(n_context, context, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlFileClose", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_context); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlFileMatch(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - const char * filename; /* the URI for matching */ - int n_filename; - - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - mem_base = xmlMemBlocks(); - filename = gen_filepath(n_filename, 0); - - ret_val = xmlFileMatch(filename); - desret_int(ret_val); - call_tests++; - des_filepath(n_filename, filename, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlFileMatch", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlFileOpen(void) { - int test_ret = 0; - - int mem_base; - void * ret_val; - const char * filename; /* the URI for matching */ - int n_filename; - - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - mem_base = xmlMemBlocks(); - filename = gen_filepath(n_filename, 0); - - ret_val = xmlFileOpen(filename); - desret_void_ptr(ret_val); - call_tests++; - des_filepath(n_filename, filename, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlFileOpen", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlFileRead(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - void * context; /* the I/O context */ - int n_context; - char * buffer; /* where to drop data */ - int n_buffer; - int len; /* number of bytes to write */ - int n_len; - - for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) { - for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - context = gen_void_ptr(n_context, 0); - buffer = gen_char_ptr(n_buffer, 1); - len = gen_int(n_len, 2); - - ret_val = xmlFileRead(context, buffer, len); - desret_int(ret_val); - call_tests++; - des_void_ptr(n_context, context, 0); - des_char_ptr(n_buffer, buffer, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlFileRead", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_context); - printf(" %d", n_buffer); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlIOFTPClose(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - void * context; /* the I/O context */ - int n_context; - - for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) { - mem_base = xmlMemBlocks(); - context = gen_void_ptr(n_context, 0); - - ret_val = xmlIOFTPClose(context); - desret_int(ret_val); - call_tests++; - des_void_ptr(n_context, context, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIOFTPClose", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_context); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlIOFTPMatch(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - const char * filename; /* the URI for matching */ - int n_filename; - - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - mem_base = xmlMemBlocks(); - filename = gen_filepath(n_filename, 0); - - ret_val = xmlIOFTPMatch(filename); - desret_int(ret_val); - call_tests++; - des_filepath(n_filename, filename, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIOFTPMatch", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlIOFTPOpen(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - void * ret_val; - const char * filename; /* the URI for matching */ - int n_filename; - - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - mem_base = xmlMemBlocks(); - filename = gen_filepath(n_filename, 0); - - ret_val = xmlIOFTPOpen(filename); - desret_void_ptr(ret_val); - call_tests++; - des_filepath(n_filename, filename, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIOFTPOpen", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlIOFTPRead(void) { - int test_ret = 0; - -#if defined(LIBXML_FTP_ENABLED) - int mem_base; - int ret_val; - void * context; /* the I/O context */ - int n_context; - char * buffer; /* where to drop data */ - int n_buffer; - int len; /* number of bytes to write */ - int n_len; - - for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) { - for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - context = gen_void_ptr(n_context, 0); - buffer = gen_char_ptr(n_buffer, 1); - len = gen_int(n_len, 2); - - ret_val = xmlIOFTPRead(context, buffer, len); - desret_int(ret_val); - call_tests++; - des_void_ptr(n_context, context, 0); - des_char_ptr(n_buffer, buffer, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIOFTPRead", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_context); - printf(" %d", n_buffer); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlIOHTTPClose(void) { - int test_ret = 0; - -#if defined(LIBXML_HTTP_ENABLED) - int mem_base; - int ret_val; - void * context; /* the I/O context */ - int n_context; - - for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) { - mem_base = xmlMemBlocks(); - context = gen_void_ptr(n_context, 0); - - ret_val = xmlIOHTTPClose(context); - desret_int(ret_val); - call_tests++; - des_void_ptr(n_context, context, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIOHTTPClose", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_context); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlIOHTTPMatch(void) { - int test_ret = 0; - -#if defined(LIBXML_HTTP_ENABLED) - int mem_base; - int ret_val; - const char * filename; /* the URI for matching */ - int n_filename; - - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - mem_base = xmlMemBlocks(); - filename = gen_filepath(n_filename, 0); - - ret_val = xmlIOHTTPMatch(filename); - desret_int(ret_val); - call_tests++; - des_filepath(n_filename, filename, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIOHTTPMatch", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlIOHTTPOpen(void) { - int test_ret = 0; - -#if defined(LIBXML_HTTP_ENABLED) - int mem_base; - void * ret_val; - const char * filename; /* the URI for matching */ - int n_filename; - - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - mem_base = xmlMemBlocks(); - filename = gen_filepath(n_filename, 0); - - ret_val = xmlIOHTTPOpen(filename); - desret_xmlNanoHTTPCtxtPtr(ret_val); - call_tests++; - des_filepath(n_filename, filename, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIOHTTPOpen", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlIOHTTPRead(void) { - int test_ret = 0; - -#if defined(LIBXML_HTTP_ENABLED) - int mem_base; - int ret_val; - void * context; /* the I/O context */ - int n_context; - char * buffer; /* where to drop data */ - int n_buffer; - int len; /* number of bytes to write */ - int n_len; - - for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) { - for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - context = gen_void_ptr(n_context, 0); - buffer = gen_char_ptr(n_buffer, 1); - len = gen_int(n_len, 2); - - ret_val = xmlIOHTTPRead(context, buffer, len); - desret_int(ret_val); - call_tests++; - des_void_ptr(n_context, context, 0); - des_char_ptr(n_buffer, buffer, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIOHTTPRead", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_context); - printf(" %d", n_buffer); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNoNetExternalEntityLoader(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputPtr ret_val; - const char * URL; /* the URL for the entity to load */ - int n_URL; - char * ID; /* the System ID for the entity to load */ - int n_ID; - xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */ - int n_ctxt; - - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) { - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - URL = gen_filepath(n_URL, 0); - ID = gen_const_char_ptr(n_ID, 1); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2); - - ret_val = xmlNoNetExternalEntityLoader(URL, (const char *)ID, ctxt); - desret_xmlParserInputPtr(ret_val); - call_tests++; - des_filepath(n_URL, URL, 0); - des_const_char_ptr(n_ID, (const char *)ID, 1); - des_xmlParserCtxtPtr(n_ctxt, ctxt, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URL); - printf(" %d", n_ID); - printf(" %d", n_ctxt); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlNormalizeWindowsPath(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlChar * path; /* the input file path */ - int n_path; - - for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) { - mem_base = xmlMemBlocks(); - path = gen_const_xmlChar_ptr(n_path, 0); - - ret_val = xmlNormalizeWindowsPath((const xmlChar *)path); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNormalizeWindowsPath", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_path); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlOutputBufferCreateBuffer(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlOutputBufferPtr ret_val; - xmlBufferPtr buffer; /* a xmlBufferPtr */ - int n_buffer; - xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */ - int n_encoder; - - for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) { - for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) { - mem_base = xmlMemBlocks(); - buffer = gen_xmlBufferPtr(n_buffer, 0); - encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1); - - ret_val = xmlOutputBufferCreateBuffer(buffer, encoder); - desret_xmlOutputBufferPtr(ret_val); - call_tests++; - des_xmlBufferPtr(n_buffer, buffer, 0); - des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlOutputBufferCreateBuffer", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buffer); - printf(" %d", n_encoder); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlOutputBufferCreateFd(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlOutputBufferPtr ret_val; - int fd; /* a file descriptor number */ - int n_fd; - xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */ - int n_encoder; - - for (n_fd = 0;n_fd < gen_nb_int;n_fd++) { - for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) { - mem_base = xmlMemBlocks(); - fd = gen_int(n_fd, 0); - encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1); - - ret_val = xmlOutputBufferCreateFd(fd, encoder); - desret_xmlOutputBufferPtr(ret_val); - call_tests++; - des_int(n_fd, fd, 0); - des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlOutputBufferCreateFd", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_fd); - printf(" %d", n_encoder); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlOutputBufferCreateFile(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlOutputBufferPtr ret_val; - FILE * file; /* a FILE* */ - int n_file; - xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */ - int n_encoder; - - for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) { - for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) { - mem_base = xmlMemBlocks(); - file = gen_FILE_ptr(n_file, 0); - encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1); - - ret_val = xmlOutputBufferCreateFile(file, encoder); - desret_xmlOutputBufferPtr(ret_val); - call_tests++; - des_FILE_ptr(n_file, file, 0); - des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlOutputBufferCreateFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_file); - printf(" %d", n_encoder); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlOutputBufferCreateFilename(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - xmlOutputBufferPtr ret_val; - const char * URI; /* a C string containing the URI or filename */ - int n_URI; - xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */ - int n_encoder; - int compression; /* the compression ration (0 none, 9 max). */ - int n_compression; - - for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) { - for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) { - for (n_compression = 0;n_compression < gen_nb_int;n_compression++) { - mem_base = xmlMemBlocks(); - URI = gen_fileoutput(n_URI, 0); - encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1); - compression = gen_int(n_compression, 2); - - ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression); - desret_xmlOutputBufferPtr(ret_val); - call_tests++; - des_fileoutput(n_URI, URI, 0); - des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1); - des_int(n_compression, compression, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlOutputBufferCreateFilename", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URI); - printf(" %d", n_encoder); - printf(" %d", n_compression); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlOutputBufferFlush(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - xmlOutputBufferPtr out; /* a buffered output */ - int n_out; - - for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) { - mem_base = xmlMemBlocks(); - out = gen_xmlOutputBufferPtr(n_out, 0); - - ret_val = xmlOutputBufferFlush(out); - desret_int(ret_val); - call_tests++; - des_xmlOutputBufferPtr(n_out, out, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlOutputBufferFlush", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_out); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlOutputBufferGetContent(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - const xmlChar * ret_val; - xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */ - int n_out; - - for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) { - mem_base = xmlMemBlocks(); - out = gen_xmlOutputBufferPtr(n_out, 0); - - ret_val = xmlOutputBufferGetContent(out); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_xmlOutputBufferPtr(n_out, out, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlOutputBufferGetContent", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_out); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlOutputBufferGetSize(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlOutputBufferWrite(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - xmlOutputBufferPtr out; /* a buffered parser output */ - int n_out; - int len; /* the size in bytes of the array. */ - int n_len; - char * buf; /* an char array */ - int n_buf; - - for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) { - mem_base = xmlMemBlocks(); - out = gen_xmlOutputBufferPtr(n_out, 0); - len = gen_int(n_len, 1); - buf = gen_const_char_ptr(n_buf, 2); - - ret_val = xmlOutputBufferWrite(out, len, (const char *)buf); - desret_int(ret_val); - call_tests++; - des_xmlOutputBufferPtr(n_out, out, 0); - des_int(n_len, len, 1); - des_const_char_ptr(n_buf, (const char *)buf, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlOutputBufferWrite", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_out); - printf(" %d", n_len); - printf(" %d", n_buf); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlOutputBufferWriteEscape(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlOutputBufferWriteString(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - xmlOutputBufferPtr out; /* a buffered parser output */ - int n_out; - char * str; /* a zero terminated C string */ - int n_str; - - for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) { - for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) { - mem_base = xmlMemBlocks(); - out = gen_xmlOutputBufferPtr(n_out, 0); - str = gen_const_char_ptr(n_str, 1); - - ret_val = xmlOutputBufferWriteString(out, (const char *)str); - desret_int(ret_val); - call_tests++; - des_xmlOutputBufferPtr(n_out, out, 0); - des_const_char_ptr(n_str, (const char *)str, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlOutputBufferWriteString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_out); - printf(" %d", n_str); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlParserGetDirectory(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlParserInputBufferCreateFd(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputBufferPtr ret_val; - int fd; /* a file descriptor number */ - int n_fd; - xmlCharEncoding enc; /* the charset encoding if known */ - int n_enc; - - for (n_fd = 0;n_fd < gen_nb_int;n_fd++) { - for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { - mem_base = xmlMemBlocks(); - fd = gen_int(n_fd, 0); - enc = gen_xmlCharEncoding(n_enc, 1); - if (fd >= 0) fd = -1; - - ret_val = xmlParserInputBufferCreateFd(fd, enc); - desret_xmlParserInputBufferPtr(ret_val); - call_tests++; - des_int(n_fd, fd, 0); - des_xmlCharEncoding(n_enc, enc, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParserInputBufferCreateFd", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_fd); - printf(" %d", n_enc); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlParserInputBufferCreateFile(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputBufferPtr ret_val; - FILE * file; /* a FILE* */ - int n_file; - xmlCharEncoding enc; /* the charset encoding if known */ - int n_enc; - - for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) { - for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { - mem_base = xmlMemBlocks(); - file = gen_FILE_ptr(n_file, 0); - enc = gen_xmlCharEncoding(n_enc, 1); - - ret_val = xmlParserInputBufferCreateFile(file, enc); - desret_xmlParserInputBufferPtr(ret_val); - call_tests++; - des_FILE_ptr(n_file, file, 0); - des_xmlCharEncoding(n_enc, enc, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParserInputBufferCreateFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_file); - printf(" %d", n_enc); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlParserInputBufferCreateFilename(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputBufferPtr ret_val; - const char * URI; /* a C string containing the URI or filename */ - int n_URI; - xmlCharEncoding enc; /* the charset encoding if known */ - int n_enc; - - for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) { - for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { - mem_base = xmlMemBlocks(); - URI = gen_fileoutput(n_URI, 0); - enc = gen_xmlCharEncoding(n_enc, 1); - - ret_val = xmlParserInputBufferCreateFilename(URI, enc); - desret_xmlParserInputBufferPtr(ret_val); - call_tests++; - des_fileoutput(n_URI, URI, 0); - des_xmlCharEncoding(n_enc, enc, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URI); - printf(" %d", n_enc); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlParserInputBufferCreateMem(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputBufferPtr ret_val; - char * mem; /* the memory input */ - int n_mem; - int size; /* the length of the memory block */ - int n_size; - xmlCharEncoding enc; /* the charset encoding if known */ - int n_enc; - - for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { - mem_base = xmlMemBlocks(); - mem = gen_const_char_ptr(n_mem, 0); - size = gen_int(n_size, 1); - enc = gen_xmlCharEncoding(n_enc, 2); - - ret_val = xmlParserInputBufferCreateMem((const char *)mem, size, enc); - desret_xmlParserInputBufferPtr(ret_val); - call_tests++; - des_const_char_ptr(n_mem, (const char *)mem, 0); - des_int(n_size, size, 1); - des_xmlCharEncoding(n_enc, enc, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParserInputBufferCreateMem", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_mem); - printf(" %d", n_size); - printf(" %d", n_enc); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlParserInputBufferCreateStatic(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputBufferPtr ret_val; - char * mem; /* the memory input */ - int n_mem; - int size; /* the length of the memory block */ - int n_size; - xmlCharEncoding enc; /* the charset encoding if known */ - int n_enc; - - for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { - mem_base = xmlMemBlocks(); - mem = gen_const_char_ptr(n_mem, 0); - size = gen_int(n_size, 1); - enc = gen_xmlCharEncoding(n_enc, 2); - - ret_val = xmlParserInputBufferCreateStatic((const char *)mem, size, enc); - desret_xmlParserInputBufferPtr(ret_val); - call_tests++; - des_const_char_ptr(n_mem, (const char *)mem, 0); - des_int(n_size, size, 1); - des_xmlCharEncoding(n_enc, enc, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_mem); - printf(" %d", n_size); - printf(" %d", n_enc); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlParserInputBufferGrow(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserInputBufferPtr in; /* a buffered parser input */ - int n_in; - int len; /* indicative value of the amount of chars to read */ - int n_len; - - for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - in = gen_xmlParserInputBufferPtr(n_in, 0); - len = gen_int(n_len, 1); - - ret_val = xmlParserInputBufferGrow(in, len); - desret_int(ret_val); - call_tests++; - des_xmlParserInputBufferPtr(n_in, in, 0); - des_int(n_len, len, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParserInputBufferGrow", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_in); - printf(" %d", n_len); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlParserInputBufferPush(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserInputBufferPtr in; /* a buffered parser input */ - int n_in; - int len; /* the size in bytes of the array. */ - int n_len; - char * buf; /* an char array */ - int n_buf; - - for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) { - mem_base = xmlMemBlocks(); - in = gen_xmlParserInputBufferPtr(n_in, 0); - len = gen_int(n_len, 1); - buf = gen_const_char_ptr(n_buf, 2); - - ret_val = xmlParserInputBufferPush(in, len, (const char *)buf); - desret_int(ret_val); - call_tests++; - des_xmlParserInputBufferPtr(n_in, in, 0); - des_int(n_len, len, 1); - des_const_char_ptr(n_buf, (const char *)buf, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParserInputBufferPush", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_in); - printf(" %d", n_len); - printf(" %d", n_buf); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlParserInputBufferRead(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlParserInputBufferPtr in; /* a buffered parser input */ - int n_in; - int len; /* indicative value of the amount of chars to read */ - int n_len; - - for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - in = gen_xmlParserInputBufferPtr(n_in, 0); - len = gen_int(n_len, 1); - - ret_val = xmlParserInputBufferRead(in, len); - desret_int(ret_val); - call_tests++; - des_xmlParserInputBufferPtr(n_in, in, 0); - des_int(n_len, len, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParserInputBufferRead", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_in); - printf(" %d", n_len); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlPopInputCallbacks(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - - mem_base = xmlMemBlocks(); - - ret_val = xmlPopInputCallbacks(); - desret_int(ret_val); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlPopInputCallbacks", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlRegisterDefaultInputCallbacks(void) { - int test_ret = 0; - - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlRegisterDefaultInputCallbacks(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlRegisterDefaultOutputCallbacks(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlRegisterDefaultOutputCallbacks(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlRegisterHTTPPostCallbacks(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTTP_ENABLED) - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlRegisterHTTPPostCallbacks(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_xmlIO(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing xmlIO : 40 of 50 functions ...\n"); - test_ret += test_xmlAllocOutputBuffer(); - test_ret += test_xmlAllocParserInputBuffer(); - test_ret += test_xmlCheckFilename(); - test_ret += test_xmlCheckHTTPInput(); - test_ret += test_xmlCleanupInputCallbacks(); - test_ret += test_xmlCleanupOutputCallbacks(); - test_ret += test_xmlFileClose(); - test_ret += test_xmlFileMatch(); - test_ret += test_xmlFileOpen(); - test_ret += test_xmlFileRead(); - test_ret += test_xmlIOFTPClose(); - test_ret += test_xmlIOFTPMatch(); - test_ret += test_xmlIOFTPOpen(); - test_ret += test_xmlIOFTPRead(); - test_ret += test_xmlIOHTTPClose(); - test_ret += test_xmlIOHTTPMatch(); - test_ret += test_xmlIOHTTPOpen(); - test_ret += test_xmlIOHTTPRead(); - test_ret += test_xmlNoNetExternalEntityLoader(); - test_ret += test_xmlNormalizeWindowsPath(); - test_ret += test_xmlOutputBufferCreateBuffer(); - test_ret += test_xmlOutputBufferCreateFd(); - test_ret += test_xmlOutputBufferCreateFile(); - test_ret += test_xmlOutputBufferCreateFilename(); - test_ret += test_xmlOutputBufferFlush(); - test_ret += test_xmlOutputBufferGetContent(); - test_ret += test_xmlOutputBufferGetSize(); - test_ret += test_xmlOutputBufferWrite(); - test_ret += test_xmlOutputBufferWriteEscape(); - test_ret += test_xmlOutputBufferWriteString(); - test_ret += test_xmlParserGetDirectory(); - test_ret += test_xmlParserInputBufferCreateFd(); - test_ret += test_xmlParserInputBufferCreateFile(); - test_ret += test_xmlParserInputBufferCreateFilename(); - test_ret += test_xmlParserInputBufferCreateMem(); - test_ret += test_xmlParserInputBufferCreateStatic(); - test_ret += test_xmlParserInputBufferGrow(); - test_ret += test_xmlParserInputBufferPush(); - test_ret += test_xmlParserInputBufferRead(); - test_ret += test_xmlPopInputCallbacks(); - test_ret += test_xmlRegisterDefaultInputCallbacks(); - test_ret += test_xmlRegisterDefaultOutputCallbacks(); - test_ret += test_xmlRegisterHTTPPostCallbacks(); - - if (test_ret != 0) - printf("Module xmlIO: %d errors\n", test_ret); - return(test_ret); -} -#ifdef LIBXML_AUTOMATA_ENABLED - -#define gen_nb_xmlAutomataPtr 1 -static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlAutomataCompile(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlAutomataGetInitState(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlAutomataIsDeterminist(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) - int mem_base; - int ret_val; - xmlAutomataPtr am; /* an automata */ - int n_am; - - for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) { - mem_base = xmlMemBlocks(); - am = gen_xmlAutomataPtr(n_am, 0); - - ret_val = xmlAutomataIsDeterminist(am); - desret_int(ret_val); - call_tests++; - des_xmlAutomataPtr(n_am, am, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAutomataIsDeterminist", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_am); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - -#ifdef LIBXML_AUTOMATA_ENABLED - -#define gen_nb_xmlAutomataStatePtr 1 -static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlAutomataNewAllTrans(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlAutomataNewCountTrans(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlAutomataNewCountTrans2(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlAutomataNewCountedTrans(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlAutomataNewCounter(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) - int mem_base; - int ret_val; - xmlAutomataPtr am; /* an automata */ - int n_am; - int min; /* the minimal value on the counter */ - int n_min; - int max; /* the maximal value on the counter */ - int n_max; - - for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) { - for (n_min = 0;n_min < gen_nb_int;n_min++) { - for (n_max = 0;n_max < gen_nb_int;n_max++) { - mem_base = xmlMemBlocks(); - am = gen_xmlAutomataPtr(n_am, 0); - min = gen_int(n_min, 1); - max = gen_int(n_max, 2); - - ret_val = xmlAutomataNewCounter(am, min, max); - desret_int(ret_val); - call_tests++; - des_xmlAutomataPtr(n_am, am, 0); - des_int(n_min, min, 1); - des_int(n_max, max, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAutomataNewCounter", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_am); - printf(" %d", n_min); - printf(" %d", n_max); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlAutomataNewCounterTrans(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlAutomataNewEpsilon(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlAutomataNewNegTrans(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlAutomataNewOnceTrans(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlAutomataNewOnceTrans2(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlAutomataNewState(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlAutomataNewTransition(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlAutomataNewTransition2(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlAutomataSetFinalState(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) - int mem_base; - int ret_val; - xmlAutomataPtr am; /* an automata */ - int n_am; - xmlAutomataStatePtr state; /* a state in this automata */ - int n_state; - - for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) { - for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) { - mem_base = xmlMemBlocks(); - am = gen_xmlAutomataPtr(n_am, 0); - state = gen_xmlAutomataStatePtr(n_state, 1); - - ret_val = xmlAutomataSetFinalState(am, state); - desret_int(ret_val); - call_tests++; - des_xmlAutomataPtr(n_am, am, 0); - des_xmlAutomataStatePtr(n_state, state, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlAutomataSetFinalState", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_am); - printf(" %d", n_state); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNewAutomata(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - -static int -test_xmlautomata(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing xmlautomata : 3 of 19 functions ...\n"); - test_ret += test_xmlAutomataCompile(); - test_ret += test_xmlAutomataGetInitState(); - test_ret += test_xmlAutomataIsDeterminist(); - test_ret += test_xmlAutomataNewAllTrans(); - test_ret += test_xmlAutomataNewCountTrans(); - test_ret += test_xmlAutomataNewCountTrans2(); - test_ret += test_xmlAutomataNewCountedTrans(); - test_ret += test_xmlAutomataNewCounter(); - test_ret += test_xmlAutomataNewCounterTrans(); - test_ret += test_xmlAutomataNewEpsilon(); - test_ret += test_xmlAutomataNewNegTrans(); - test_ret += test_xmlAutomataNewOnceTrans(); - test_ret += test_xmlAutomataNewOnceTrans2(); - test_ret += test_xmlAutomataNewState(); - test_ret += test_xmlAutomataNewTransition(); - test_ret += test_xmlAutomataNewTransition2(); - test_ret += test_xmlAutomataSetFinalState(); - test_ret += test_xmlNewAutomata(); - - if (test_ret != 0) - printf("Module xmlautomata: %d errors\n", test_ret); - return(test_ret); -} - -#define gen_nb_xmlGenericErrorFunc_ptr 1 -static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_initGenericErrorDefaultFunc(void) { - int test_ret = 0; - - int mem_base; - xmlGenericErrorFunc * handler; /* the handler */ - int n_handler; - - for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) { - mem_base = xmlMemBlocks(); - handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0); - - initGenericErrorDefaultFunc(handler); - call_tests++; - des_xmlGenericErrorFunc_ptr(n_handler, handler, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in initGenericErrorDefaultFunc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_handler); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -#define gen_nb_xmlErrorPtr 1 -static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} - -static int -test_xmlCopyError(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlErrorPtr from; /* a source error */ - int n_from; - xmlErrorPtr to; /* a target error */ - int n_to; - - for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) { - for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) { - mem_base = xmlMemBlocks(); - from = gen_xmlErrorPtr(n_from, 0); - to = gen_xmlErrorPtr(n_to, 1); - - ret_val = xmlCopyError(from, to); - desret_int(ret_val); - call_tests++; - des_xmlErrorPtr(n_from, from, 0); - des_xmlErrorPtr(n_to, to, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCopyError", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_from); - printf(" %d", n_to); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCtxtGetLastError(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlCtxtResetLastError(void) { - int test_ret = 0; - - int mem_base; - void * ctx; /* an XML parser context */ - int n_ctx; - - for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctx = gen_void_ptr(n_ctx, 0); - - xmlCtxtResetLastError(ctx); - call_tests++; - des_void_ptr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCtxtResetLastError", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetLastError(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlParserError(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlParserPrintFileContext(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputPtr input; /* an xmlParserInputPtr input */ - int n_input; - - for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) { - mem_base = xmlMemBlocks(); - input = gen_xmlParserInputPtr(n_input, 0); - - xmlParserPrintFileContext(input); - call_tests++; - des_xmlParserInputPtr(n_input, input, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParserPrintFileContext", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_input); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlParserPrintFileInfo(void) { - int test_ret = 0; - - int mem_base; - xmlParserInputPtr input; /* an xmlParserInputPtr input */ - int n_input; - - for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) { - mem_base = xmlMemBlocks(); - input = gen_xmlParserInputPtr(n_input, 0); - - xmlParserPrintFileInfo(input); - call_tests++; - des_xmlParserInputPtr(n_input, input, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlParserPrintFileInfo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_input); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlParserValidityError(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlParserValidityWarning(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlParserWarning(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlResetError(void) { - int test_ret = 0; - - int mem_base; - xmlErrorPtr err; /* pointer to the error. */ - int n_err; - - for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) { - mem_base = xmlMemBlocks(); - err = gen_xmlErrorPtr(n_err, 0); - - xmlResetError(err); - call_tests++; - des_xmlErrorPtr(n_err, err, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlResetError", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_err); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlResetLastError(void) { - int test_ret = 0; - - - - xmlResetLastError(); - call_tests++; - xmlResetLastError(); - function_tests++; - - return(test_ret); -} - - -static int -test_xmlSetGenericErrorFunc(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSetStructuredErrorFunc(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - -static int -test_xmlerror(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing xmlerror : 7 of 15 functions ...\n"); - test_ret += test_initGenericErrorDefaultFunc(); - test_ret += test_xmlCopyError(); - test_ret += test_xmlCtxtGetLastError(); - test_ret += test_xmlCtxtResetLastError(); - test_ret += test_xmlGetLastError(); - test_ret += test_xmlParserError(); - test_ret += test_xmlParserPrintFileContext(); - test_ret += test_xmlParserPrintFileInfo(); - test_ret += test_xmlParserValidityError(); - test_ret += test_xmlParserValidityWarning(); - test_ret += test_xmlParserWarning(); - test_ret += test_xmlResetError(); - test_ret += test_xmlResetLastError(); - test_ret += test_xmlSetGenericErrorFunc(); - test_ret += test_xmlSetStructuredErrorFunc(); - - if (test_ret != 0) - printf("Module xmlerror: %d errors\n", test_ret); - return(test_ret); -} -#ifdef LIBXML_MODULES_ENABLED - -#define gen_nb_xmlModulePtr 1 -static xmlModulePtr gen_xmlModulePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlModulePtr(int no ATTRIBUTE_UNUSED, xmlModulePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlModuleClose(void) { - int test_ret = 0; - -#if defined(LIBXML_MODULES_ENABLED) - int mem_base; - int ret_val; - xmlModulePtr module; /* the module handle */ - int n_module; - - for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) { - mem_base = xmlMemBlocks(); - module = gen_xmlModulePtr(n_module, 0); - - ret_val = xmlModuleClose(module); - desret_int(ret_val); - call_tests++; - des_xmlModulePtr(n_module, module, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlModuleClose", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_module); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlModuleOpen(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlModuleSymbol(void) { - int test_ret = 0; - -#if defined(LIBXML_MODULES_ENABLED) - int mem_base; - int ret_val; - xmlModulePtr module; /* the module */ - int n_module; - char * name; /* the name of the symbol */ - int n_name; - void ** symbol; /* the resulting symbol address */ - int n_symbol; - - for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) { - for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) { - for (n_symbol = 0;n_symbol < gen_nb_void_ptr_ptr;n_symbol++) { - mem_base = xmlMemBlocks(); - module = gen_xmlModulePtr(n_module, 0); - name = gen_const_char_ptr(n_name, 1); - symbol = gen_void_ptr_ptr(n_symbol, 2); - - ret_val = xmlModuleSymbol(module, (const char *)name, symbol); - desret_int(ret_val); - call_tests++; - des_xmlModulePtr(n_module, module, 0); - des_const_char_ptr(n_name, (const char *)name, 1); - des_void_ptr_ptr(n_symbol, symbol, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlModuleSymbol", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_module); - printf(" %d", n_name); - printf(" %d", n_symbol); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_xmlmodule(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing xmlmodule : 2 of 4 functions ...\n"); - test_ret += test_xmlModuleClose(); - test_ret += test_xmlModuleOpen(); - test_ret += test_xmlModuleSymbol(); - - if (test_ret != 0) - printf("Module xmlmodule: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlNewTextReader(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlTextReaderPtr ret_val; - xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */ - int n_input; - const char * URI; /* the URI information for the source if available */ - int n_URI; - - for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) { - for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) { - mem_base = xmlMemBlocks(); - input = gen_xmlParserInputBufferPtr(n_input, 0); - URI = gen_filepath(n_URI, 1); - - ret_val = xmlNewTextReader(input, URI); - desret_xmlTextReaderPtr(ret_val); - call_tests++; - des_xmlParserInputBufferPtr(n_input, input, 0); - des_filepath(n_URI, URI, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewTextReader", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_input); - printf(" %d", n_URI); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNewTextReaderFilename(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlTextReaderPtr ret_val; - const char * URI; /* the URI of the resource to process */ - int n_URI; - - for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) { - mem_base = xmlMemBlocks(); - URI = gen_filepath(n_URI, 0); - - ret_val = xmlNewTextReaderFilename(URI); - desret_xmlTextReaderPtr(ret_val); - call_tests++; - des_filepath(n_URI, URI, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewTextReaderFilename", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URI); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlReaderForDoc(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlTextReaderPtr ret_val; - xmlChar * cur; /* a pointer to a zero terminated string */ - int n_cur; - const char * URL; /* the base URL to use for the document */ - int n_URL; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of xmlParserOption */ - int n_options; - - for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { - mem_base = xmlMemBlocks(); - cur = gen_const_xmlChar_ptr(n_cur, 0); - URL = gen_filepath(n_URL, 1); - encoding = gen_const_char_ptr(n_encoding, 2); - options = gen_parseroptions(n_options, 3); - - ret_val = xmlReaderForDoc((const xmlChar *)cur, URL, (const char *)encoding, options); - desret_xmlTextReaderPtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0); - des_filepath(n_URL, URL, 1); - des_const_char_ptr(n_encoding, (const char *)encoding, 2); - des_parseroptions(n_options, options, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlReaderForDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_URL); - printf(" %d", n_encoding); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlReaderForFile(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlTextReaderPtr ret_val; - const char * filename; /* a file or URL */ - int n_filename; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of xmlParserOption */ - int n_options; - - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { - mem_base = xmlMemBlocks(); - filename = gen_filepath(n_filename, 0); - encoding = gen_const_char_ptr(n_encoding, 1); - options = gen_parseroptions(n_options, 2); - - ret_val = xmlReaderForFile(filename, (const char *)encoding, options); - desret_xmlTextReaderPtr(ret_val); - call_tests++; - des_filepath(n_filename, filename, 0); - des_const_char_ptr(n_encoding, (const char *)encoding, 1); - des_parseroptions(n_options, options, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlReaderForFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_filename); - printf(" %d", n_encoding); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlReaderForMemory(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlTextReaderPtr ret_val; - char * buffer; /* a pointer to a char array */ - int n_buffer; - int size; /* the size of the array */ - int n_size; - const char * URL; /* the base URL to use for the document */ - int n_URL; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of xmlParserOption */ - int n_options; - - for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { - mem_base = xmlMemBlocks(); - buffer = gen_const_char_ptr(n_buffer, 0); - size = gen_int(n_size, 1); - URL = gen_filepath(n_URL, 2); - encoding = gen_const_char_ptr(n_encoding, 3); - options = gen_parseroptions(n_options, 4); - - ret_val = xmlReaderForMemory((const char *)buffer, size, URL, (const char *)encoding, options); - desret_xmlTextReaderPtr(ret_val); - call_tests++; - des_const_char_ptr(n_buffer, (const char *)buffer, 0); - des_int(n_size, size, 1); - des_filepath(n_URL, URL, 2); - des_const_char_ptr(n_encoding, (const char *)encoding, 3); - des_parseroptions(n_options, options, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlReaderForMemory", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buffer); - printf(" %d", n_size); - printf(" %d", n_URL); - printf(" %d", n_encoding); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlReaderNewDoc(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* an XML reader */ - int n_reader; - xmlChar * cur; /* a pointer to a zero terminated string */ - int n_cur; - const char * URL; /* the base URL to use for the document */ - int n_URL; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of xmlParserOption */ - int n_options; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - cur = gen_const_xmlChar_ptr(n_cur, 1); - URL = gen_filepath(n_URL, 2); - encoding = gen_const_char_ptr(n_encoding, 3); - options = gen_parseroptions(n_options, 4); - - ret_val = xmlReaderNewDoc(reader, (const xmlChar *)cur, URL, (const char *)encoding, options); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1); - des_filepath(n_URL, URL, 2); - des_const_char_ptr(n_encoding, (const char *)encoding, 3); - des_parseroptions(n_options, options, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlReaderNewDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_cur); - printf(" %d", n_URL); - printf(" %d", n_encoding); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlReaderNewFile(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* an XML reader */ - int n_reader; - const char * filename; /* a file or URL */ - int n_filename; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of xmlParserOption */ - int n_options; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - filename = gen_filepath(n_filename, 1); - encoding = gen_const_char_ptr(n_encoding, 2); - options = gen_parseroptions(n_options, 3); - - ret_val = xmlReaderNewFile(reader, filename, (const char *)encoding, options); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_filepath(n_filename, filename, 1); - des_const_char_ptr(n_encoding, (const char *)encoding, 2); - des_parseroptions(n_options, options, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlReaderNewFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_filename); - printf(" %d", n_encoding); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlReaderNewMemory(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* an XML reader */ - int n_reader; - char * buffer; /* a pointer to a char array */ - int n_buffer; - int size; /* the size of the array */ - int n_size; - const char * URL; /* the base URL to use for the document */ - int n_URL; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of xmlParserOption */ - int n_options; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - buffer = gen_const_char_ptr(n_buffer, 1); - size = gen_int(n_size, 2); - URL = gen_filepath(n_URL, 3); - encoding = gen_const_char_ptr(n_encoding, 4); - options = gen_parseroptions(n_options, 5); - - ret_val = xmlReaderNewMemory(reader, (const char *)buffer, size, URL, (const char *)encoding, options); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_const_char_ptr(n_buffer, (const char *)buffer, 1); - des_int(n_size, size, 2); - des_filepath(n_URL, URL, 3); - des_const_char_ptr(n_encoding, (const char *)encoding, 4); - des_parseroptions(n_options, options, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlReaderNewMemory", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_buffer); - printf(" %d", n_size); - printf(" %d", n_URL); - printf(" %d", n_encoding); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlReaderNewWalker(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* an XML reader */ - int n_reader; - xmlDocPtr doc; /* a preparsed document */ - int n_doc; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - doc = gen_xmlDocPtr(n_doc, 1); - - ret_val = xmlReaderNewWalker(reader, doc); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_xmlDocPtr(n_doc, doc, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlReaderNewWalker", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_doc); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlReaderWalker(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlTextReaderPtr ret_val; - xmlDocPtr doc; /* a preparsed document */ - int n_doc; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - - ret_val = xmlReaderWalker(doc); - desret_xmlTextReaderPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlReaderWalker", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderAttributeCount(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderAttributeCount(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderAttributeCount", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderBaseUri(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderBaseUri(reader); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderBaseUri", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderByteConsumed(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - long ret_val; - xmlTextReaderPtr reader; /* an XML reader */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderByteConsumed(reader); - desret_long(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderByteConsumed", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderClose(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderClose(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderClose", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderConstBaseUri(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - const xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderConstBaseUri(reader); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderConstBaseUri", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderConstEncoding(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - const xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderConstEncoding(reader); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderConstEncoding", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderConstLocalName(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - const xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderConstLocalName(reader); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderConstLocalName", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderConstName(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - const xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderConstName(reader); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderConstName", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderConstNamespaceUri(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - const xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderConstNamespaceUri(reader); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderConstPrefix(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - const xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderConstPrefix(reader); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderConstPrefix", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderConstString(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - const xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - xmlChar * str; /* the string to intern. */ - int n_str; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - str = gen_const_xmlChar_ptr(n_str, 1); - - ret_val = xmlTextReaderConstString(reader, (const xmlChar *)str); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderConstString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_str); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderConstValue(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - const xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderConstValue(reader); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderConstValue", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderConstXmlLang(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - const xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderConstXmlLang(reader); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderConstXmlLang", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderConstXmlVersion(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - const xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderConstXmlVersion(reader); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderCurrentDoc(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlDocPtr ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderCurrentDoc(reader); - desret_xmlDocPtr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderCurrentDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderCurrentNode(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderCurrentNode(reader); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderCurrentNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderDepth(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderDepth(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderDepth", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderExpand(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderExpand(reader); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderExpand", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderGetAttribute(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - xmlChar * name; /* the qualified name of the attribute. */ - int n_name; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlTextReaderGetAttribute(reader, (const xmlChar *)name); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderGetAttribute", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderGetAttributeNo(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - int no; /* the zero-based index of the attribute relative to the containing element */ - int n_no; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_no = 0;n_no < gen_nb_int;n_no++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - no = gen_int(n_no, 1); - - ret_val = xmlTextReaderGetAttributeNo(reader, no); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_int(n_no, no, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_no); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderGetAttributeNs(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - xmlChar * localName; /* the local name of the attribute. */ - int n_localName; - xmlChar * namespaceURI; /* the namespace URI of the attribute. */ - int n_namespaceURI; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) { - for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - localName = gen_const_xmlChar_ptr(n_localName, 1); - namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2); - - ret_val = xmlTextReaderGetAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1); - des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_localName); - printf(" %d", n_namespaceURI); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -#ifdef LIBXML_READER_ENABLED - -#define gen_nb_xmlTextReaderErrorFunc_ptr 1 -static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlTextReaderGetErrorHandler(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */ - int n_f; - void ** arg; /* a user argument */ - int n_arg; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) { - for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1); - arg = gen_void_ptr_ptr(n_arg, 2); - - xmlTextReaderGetErrorHandler(reader, f, arg); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_xmlTextReaderErrorFunc_ptr(n_f, f, 1); - des_void_ptr_ptr(n_arg, arg, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_f); - printf(" %d", n_arg); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderGetParserColumnNumber(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the user data (XML reader context) */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderGetParserColumnNumber(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderGetParserColumnNumber", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderGetParserLineNumber(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the user data (XML reader context) */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderGetParserLineNumber(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderGetParserLineNumber", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderGetParserProp(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - int prop; /* the xmlParserProperties to get */ - int n_prop; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_prop = 0;n_prop < gen_nb_int;n_prop++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - prop = gen_int(n_prop, 1); - - ret_val = xmlTextReaderGetParserProp(reader, prop); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_int(n_prop, prop, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderGetParserProp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_prop); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderGetRemainder(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlParserInputBufferPtr ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderGetRemainder(reader); - desret_xmlParserInputBufferPtr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderGetRemainder", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderHasAttributes(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderHasAttributes(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderHasAttributes", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderHasValue(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderHasValue(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderHasValue", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderIsDefault(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderIsDefault(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderIsDefault", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderIsEmptyElement(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderIsEmptyElement(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderIsNamespaceDecl(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderIsNamespaceDecl(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderIsValid(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderIsValid(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderIsValid", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderLocalName(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderLocalName(reader); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderLocalName", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - -#ifdef LIBXML_READER_ENABLED - -#define gen_nb_xmlTextReaderLocatorPtr 1 -static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlTextReaderLocatorBaseURI(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */ - int n_locator; - - for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) { - mem_base = xmlMemBlocks(); - locator = gen_xmlTextReaderLocatorPtr(n_locator, 0); - - ret_val = xmlTextReaderLocatorBaseURI(locator); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderLocatorPtr(n_locator, locator, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_locator); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderLocatorLineNumber(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */ - int n_locator; - - for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) { - mem_base = xmlMemBlocks(); - locator = gen_xmlTextReaderLocatorPtr(n_locator, 0); - - ret_val = xmlTextReaderLocatorLineNumber(locator); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderLocatorPtr(n_locator, locator, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_locator); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderLookupNamespace(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - xmlChar * prefix; /* the prefix whose namespace URI is to be resolved. To return the default namespace, specify NULL */ - int n_prefix; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - prefix = gen_const_xmlChar_ptr(n_prefix, 1); - - ret_val = xmlTextReaderLookupNamespace(reader, (const xmlChar *)prefix); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderLookupNamespace", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_prefix); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderMoveToAttribute(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - xmlChar * name; /* the qualified name of the attribute. */ - int n_name; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlTextReaderMoveToAttribute(reader, (const xmlChar *)name); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderMoveToAttributeNo(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - int no; /* the zero-based index of the attribute relative to the containing element. */ - int n_no; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_no = 0;n_no < gen_nb_int;n_no++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - no = gen_int(n_no, 1); - - ret_val = xmlTextReaderMoveToAttributeNo(reader, no); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_int(n_no, no, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_no); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderMoveToAttributeNs(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - xmlChar * localName; /* the local name of the attribute. */ - int n_localName; - xmlChar * namespaceURI; /* the namespace URI of the attribute. */ - int n_namespaceURI; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) { - for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - localName = gen_const_xmlChar_ptr(n_localName, 1); - namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2); - - ret_val = xmlTextReaderMoveToAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1); - des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_localName); - printf(" %d", n_namespaceURI); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderMoveToElement(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderMoveToElement(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderMoveToElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderMoveToFirstAttribute(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderMoveToFirstAttribute(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderMoveToNextAttribute(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderMoveToNextAttribute(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderName(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderName(reader); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderName", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderNamespaceUri(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderNamespaceUri(reader); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderNamespaceUri", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderNext(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderNext(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderNext", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderNextSibling(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderNextSibling(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderNextSibling", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderNodeType(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderNodeType(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderNodeType", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderNormalization(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderNormalization(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderNormalization", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderPrefix(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderPrefix(reader); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderPrefix", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderPreserve(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderPreserve(reader); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderPreserve", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderPreservePattern(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED) -#ifdef LIBXML_PATTERN_ENABLED - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - xmlChar * pattern; /* an XPath subset pattern */ - int n_pattern; - xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */ - int n_namespaces; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) { - for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - pattern = gen_const_xmlChar_ptr(n_pattern, 1); - namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2); - - ret_val = xmlTextReaderPreservePattern(reader, (const xmlChar *)pattern, (const xmlChar **)namespaces); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_const_xmlChar_ptr(n_pattern, (const xmlChar *)pattern, 1); - des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderPreservePattern", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_pattern); - printf(" %d", n_namespaces); - printf("\n"); - } - } - } - } - function_tests++; -#endif -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderQuoteChar(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderQuoteChar(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderQuoteChar", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderRead(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderRead(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderRead", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderReadAttributeValue(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderReadAttributeValue(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderReadState(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderReadState(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderReadState", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderRelaxNGSetSchema(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */ - int n_schema; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - schema = gen_xmlRelaxNGPtr(n_schema, 1); - - ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_xmlRelaxNGPtr(n_schema, schema, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_schema); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderRelaxNGValidate(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - char * rng; /* the path to a RelaxNG schema or NULL */ - int n_rng; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - rng = gen_const_char_ptr(n_rng, 1); - - ret_val = xmlTextReaderRelaxNGValidate(reader, (const char *)rng); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_const_char_ptr(n_rng, (const char *)rng, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_rng); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderRelaxNGValidateCtxt(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG schema validation context or NULL */ - int n_ctxt; - int options; /* options (not used yet) */ - int n_options; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) { - for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 1); - options = gen_parseroptions(n_options, 2); - - ret_val = xmlTextReaderRelaxNGValidateCtxt(reader, ctxt, options); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 1); - des_parseroptions(n_options, options, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidateCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_ctxt); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderSchemaValidate(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - char * xsd; /* the path to a W3C XSD schema or NULL */ - int n_xsd; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_xsd = 0;n_xsd < gen_nb_const_char_ptr;n_xsd++) { - reader = gen_xmlTextReaderPtr(n_reader, 0); - xsd = gen_const_char_ptr(n_xsd, 1); - - ret_val = xmlTextReaderSchemaValidate(reader, (const char *)xsd); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_const_char_ptr(n_xsd, (const char *)xsd, 1); - xmlResetLastError(); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderSchemaValidateCtxt(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - xmlSchemaValidCtxtPtr ctxt; /* the XML Schema validation context or NULL */ - int n_ctxt; - int options; /* options (not used yet) */ - int n_options; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { - for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 1); - options = gen_parseroptions(n_options, 2); - - ret_val = xmlTextReaderSchemaValidateCtxt(reader, ctxt, options); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 1); - des_parseroptions(n_options, options, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderSchemaValidateCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_ctxt); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderSetErrorHandler(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextReaderSetParserProp(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - int prop; /* the xmlParserProperties to set */ - int n_prop; - int value; /* usually 0 or 1 to (de)activate it */ - int n_value; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_prop = 0;n_prop < gen_nb_int;n_prop++) { - for (n_value = 0;n_value < gen_nb_int;n_value++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - prop = gen_int(n_prop, 1); - value = gen_int(n_value, 2); - - ret_val = xmlTextReaderSetParserProp(reader, prop, value); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_int(n_prop, prop, 1); - des_int(n_value, value, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderSetParserProp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_prop); - printf(" %d", n_value); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderSetSchema(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - xmlSchemaPtr schema; /* a precompiled Schema schema */ - int n_schema; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - schema = gen_xmlSchemaPtr(n_schema, 1); - - ret_val = xmlTextReaderSetSchema(reader, schema); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_xmlSchemaPtr(n_schema, schema, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderSetSchema", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_schema); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderSetStructuredErrorHandler(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextReaderSetup(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* an XML reader */ - int n_reader; - xmlParserInputBufferPtr input; /* xmlParserInputBufferPtr used to feed the reader, will be destroyed with it. */ - int n_input; - const char * URL; /* the base URL to use for the document */ - int n_URL; - char * encoding; /* the document encoding, or NULL */ - int n_encoding; - int options; /* a combination of xmlParserOption */ - int n_options; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) { - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - input = gen_xmlParserInputBufferPtr(n_input, 1); - URL = gen_filepath(n_URL, 2); - encoding = gen_const_char_ptr(n_encoding, 3); - options = gen_parseroptions(n_options, 4); - - ret_val = xmlTextReaderSetup(reader, input, URL, (const char *)encoding, options); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - des_filepath(n_URL, URL, 2); - des_const_char_ptr(n_encoding, (const char *)encoding, 3); - des_parseroptions(n_options, options, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderSetup", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf(" %d", n_input); - printf(" %d", n_URL); - printf(" %d", n_encoding); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderStandalone(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - int ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderStandalone(reader); - desret_int(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderStandalone", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderValue(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderValue(reader); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderValue", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextReaderXmlLang(void) { - int test_ret = 0; - -#if defined(LIBXML_READER_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ - int n_reader; - - for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { - mem_base = xmlMemBlocks(); - reader = gen_xmlTextReaderPtr(n_reader, 0); - - ret_val = xmlTextReaderXmlLang(reader); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlTextReaderPtr(n_reader, reader, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextReaderXmlLang", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_reader); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_xmlreader(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing xmlreader : 76 of 86 functions ...\n"); - test_ret += test_xmlNewTextReader(); - test_ret += test_xmlNewTextReaderFilename(); - test_ret += test_xmlReaderForDoc(); - test_ret += test_xmlReaderForFile(); - test_ret += test_xmlReaderForMemory(); - test_ret += test_xmlReaderNewDoc(); - test_ret += test_xmlReaderNewFile(); - test_ret += test_xmlReaderNewMemory(); - test_ret += test_xmlReaderNewWalker(); - test_ret += test_xmlReaderWalker(); - test_ret += test_xmlTextReaderAttributeCount(); - test_ret += test_xmlTextReaderBaseUri(); - test_ret += test_xmlTextReaderByteConsumed(); - test_ret += test_xmlTextReaderClose(); - test_ret += test_xmlTextReaderConstBaseUri(); - test_ret += test_xmlTextReaderConstEncoding(); - test_ret += test_xmlTextReaderConstLocalName(); - test_ret += test_xmlTextReaderConstName(); - test_ret += test_xmlTextReaderConstNamespaceUri(); - test_ret += test_xmlTextReaderConstPrefix(); - test_ret += test_xmlTextReaderConstString(); - test_ret += test_xmlTextReaderConstValue(); - test_ret += test_xmlTextReaderConstXmlLang(); - test_ret += test_xmlTextReaderConstXmlVersion(); - test_ret += test_xmlTextReaderCurrentDoc(); - test_ret += test_xmlTextReaderCurrentNode(); - test_ret += test_xmlTextReaderDepth(); - test_ret += test_xmlTextReaderExpand(); - test_ret += test_xmlTextReaderGetAttribute(); - test_ret += test_xmlTextReaderGetAttributeNo(); - test_ret += test_xmlTextReaderGetAttributeNs(); - test_ret += test_xmlTextReaderGetErrorHandler(); - test_ret += test_xmlTextReaderGetParserColumnNumber(); - test_ret += test_xmlTextReaderGetParserLineNumber(); - test_ret += test_xmlTextReaderGetParserProp(); - test_ret += test_xmlTextReaderGetRemainder(); - test_ret += test_xmlTextReaderHasAttributes(); - test_ret += test_xmlTextReaderHasValue(); - test_ret += test_xmlTextReaderIsDefault(); - test_ret += test_xmlTextReaderIsEmptyElement(); - test_ret += test_xmlTextReaderIsNamespaceDecl(); - test_ret += test_xmlTextReaderIsValid(); - test_ret += test_xmlTextReaderLocalName(); - test_ret += test_xmlTextReaderLocatorBaseURI(); - test_ret += test_xmlTextReaderLocatorLineNumber(); - test_ret += test_xmlTextReaderLookupNamespace(); - test_ret += test_xmlTextReaderMoveToAttribute(); - test_ret += test_xmlTextReaderMoveToAttributeNo(); - test_ret += test_xmlTextReaderMoveToAttributeNs(); - test_ret += test_xmlTextReaderMoveToElement(); - test_ret += test_xmlTextReaderMoveToFirstAttribute(); - test_ret += test_xmlTextReaderMoveToNextAttribute(); - test_ret += test_xmlTextReaderName(); - test_ret += test_xmlTextReaderNamespaceUri(); - test_ret += test_xmlTextReaderNext(); - test_ret += test_xmlTextReaderNextSibling(); - test_ret += test_xmlTextReaderNodeType(); - test_ret += test_xmlTextReaderNormalization(); - test_ret += test_xmlTextReaderPrefix(); - test_ret += test_xmlTextReaderPreserve(); - test_ret += test_xmlTextReaderPreservePattern(); - test_ret += test_xmlTextReaderQuoteChar(); - test_ret += test_xmlTextReaderRead(); - test_ret += test_xmlTextReaderReadAttributeValue(); - test_ret += test_xmlTextReaderReadState(); - test_ret += test_xmlTextReaderRelaxNGSetSchema(); - test_ret += test_xmlTextReaderRelaxNGValidate(); - test_ret += test_xmlTextReaderRelaxNGValidateCtxt(); - test_ret += test_xmlTextReaderSchemaValidate(); - test_ret += test_xmlTextReaderSchemaValidateCtxt(); - test_ret += test_xmlTextReaderSetErrorHandler(); - test_ret += test_xmlTextReaderSetParserProp(); - test_ret += test_xmlTextReaderSetSchema(); - test_ret += test_xmlTextReaderSetStructuredErrorHandler(); - test_ret += test_xmlTextReaderSetup(); - test_ret += test_xmlTextReaderStandalone(); - test_ret += test_xmlTextReaderValue(); - test_ret += test_xmlTextReaderXmlLang(); - - if (test_ret != 0) - printf("Module xmlreader: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlExpCtxtNbCons(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) - int mem_base; - int ret_val; - xmlExpCtxtPtr ctxt; /* an expression context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlExpCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlExpCtxtPtr(n_ctxt, 0); - - ret_val = xmlExpCtxtNbCons(ctxt); - desret_int(ret_val); - call_tests++; - des_xmlExpCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlExpCtxtNbCons", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlExpCtxtNbNodes(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) - int mem_base; - int ret_val; - xmlExpCtxtPtr ctxt; /* an expression context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlExpCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlExpCtxtPtr(n_ctxt, 0); - - ret_val = xmlExpCtxtNbNodes(ctxt); - desret_int(ret_val); - call_tests++; - des_xmlExpCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlExpCtxtNbNodes", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlExpDump(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) - int mem_base; - xmlBufferPtr buf; /* a buffer to receive the output */ - int n_buf; - xmlExpNodePtr expr; /* the compiled expression */ - int n_expr; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_expr = 0;n_expr < gen_nb_xmlExpNodePtr;n_expr++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - expr = gen_xmlExpNodePtr(n_expr, 1); - - xmlExpDump(buf, expr); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_xmlExpNodePtr(n_expr, expr, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlExpDump", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_expr); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlExpExpDerive(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlExpGetLanguage(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) - int mem_base; - int ret_val; - xmlExpCtxtPtr ctxt; /* the expression context */ - int n_ctxt; - xmlExpNodePtr exp; /* the expression */ - int n_exp; - xmlChar ** langList; /* where to store the tokens */ - int n_langList; - int len; /* the allocated lenght of @list */ - int n_len; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlExpCtxtPtr;n_ctxt++) { - for (n_exp = 0;n_exp < gen_nb_xmlExpNodePtr;n_exp++) { - for (n_langList = 0;n_langList < gen_nb_const_xmlChar_ptr_ptr;n_langList++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlExpCtxtPtr(n_ctxt, 0); - exp = gen_xmlExpNodePtr(n_exp, 1); - langList = gen_const_xmlChar_ptr_ptr(n_langList, 2); - len = gen_int(n_len, 3); - - ret_val = xmlExpGetLanguage(ctxt, exp, (const xmlChar **)langList, len); - desret_int(ret_val); - call_tests++; - des_xmlExpCtxtPtr(n_ctxt, ctxt, 0); - des_xmlExpNodePtr(n_exp, exp, 1); - des_const_xmlChar_ptr_ptr(n_langList, (const xmlChar **)langList, 2); - des_int(n_len, len, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlExpGetLanguage", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_exp); - printf(" %d", n_langList); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlExpGetStart(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) - int mem_base; - int ret_val; - xmlExpCtxtPtr ctxt; /* the expression context */ - int n_ctxt; - xmlExpNodePtr exp; /* the expression */ - int n_exp; - xmlChar ** tokList; /* where to store the tokens */ - int n_tokList; - int len; /* the allocated lenght of @list */ - int n_len; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlExpCtxtPtr;n_ctxt++) { - for (n_exp = 0;n_exp < gen_nb_xmlExpNodePtr;n_exp++) { - for (n_tokList = 0;n_tokList < gen_nb_const_xmlChar_ptr_ptr;n_tokList++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlExpCtxtPtr(n_ctxt, 0); - exp = gen_xmlExpNodePtr(n_exp, 1); - tokList = gen_const_xmlChar_ptr_ptr(n_tokList, 2); - len = gen_int(n_len, 3); - - ret_val = xmlExpGetStart(ctxt, exp, (const xmlChar **)tokList, len); - desret_int(ret_val); - call_tests++; - des_xmlExpCtxtPtr(n_ctxt, ctxt, 0); - des_xmlExpNodePtr(n_exp, exp, 1); - des_const_xmlChar_ptr_ptr(n_tokList, (const xmlChar **)tokList, 2); - des_int(n_len, len, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlExpGetStart", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_exp); - printf(" %d", n_tokList); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlExpIsNillable(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) - int mem_base; - int ret_val; - xmlExpNodePtr exp; /* the expression */ - int n_exp; - - for (n_exp = 0;n_exp < gen_nb_xmlExpNodePtr;n_exp++) { - mem_base = xmlMemBlocks(); - exp = gen_xmlExpNodePtr(n_exp, 0); - - ret_val = xmlExpIsNillable(exp); - desret_int(ret_val); - call_tests++; - des_xmlExpNodePtr(n_exp, exp, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlExpIsNillable", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_exp); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlExpMaxToken(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) - int mem_base; - int ret_val; - xmlExpNodePtr expr; /* a compiled expression */ - int n_expr; - - for (n_expr = 0;n_expr < gen_nb_xmlExpNodePtr;n_expr++) { - mem_base = xmlMemBlocks(); - expr = gen_xmlExpNodePtr(n_expr, 0); - - ret_val = xmlExpMaxToken(expr); - desret_int(ret_val); - call_tests++; - des_xmlExpNodePtr(n_expr, expr, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlExpMaxToken", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_expr); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlExpNewAtom(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlExpNewCtxt(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlExpNewOr(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlExpNewRange(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlExpNewSeq(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlExpParse(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlExpRef(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) - int mem_base; - xmlExpNodePtr exp; /* the expression */ - int n_exp; - - for (n_exp = 0;n_exp < gen_nb_xmlExpNodePtr;n_exp++) { - mem_base = xmlMemBlocks(); - exp = gen_xmlExpNodePtr(n_exp, 0); - - xmlExpRef(exp); - call_tests++; - des_xmlExpNodePtr(n_exp, exp, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlExpRef", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_exp); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlExpStringDerive(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlExpSubsume(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) - int mem_base; - int ret_val; - xmlExpCtxtPtr ctxt; /* the expressions context */ - int n_ctxt; - xmlExpNodePtr exp; /* the englobing expression */ - int n_exp; - xmlExpNodePtr sub; /* the subexpression */ - int n_sub; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlExpCtxtPtr;n_ctxt++) { - for (n_exp = 0;n_exp < gen_nb_xmlExpNodePtr;n_exp++) { - for (n_sub = 0;n_sub < gen_nb_xmlExpNodePtr;n_sub++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlExpCtxtPtr(n_ctxt, 0); - exp = gen_xmlExpNodePtr(n_exp, 1); - sub = gen_xmlExpNodePtr(n_sub, 2); - - ret_val = xmlExpSubsume(ctxt, exp, sub); - desret_int(ret_val); - call_tests++; - des_xmlExpCtxtPtr(n_ctxt, ctxt, 0); - des_xmlExpNodePtr(n_exp, exp, 1); - des_xmlExpNodePtr(n_sub, sub, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlExpSubsume", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_exp); - printf(" %d", n_sub); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -#ifdef LIBXML_REGEXP_ENABLED - -#define gen_nb_xmlRegExecCtxtPtr 1 -static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlRegExecErrInfo(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) - int mem_base; - int ret_val; - xmlRegExecCtxtPtr exec; /* a regexp execution context generating an error */ - int n_exec; - xmlChar ** string; /* return value for the error string */ - int n_string; - int * nbval; /* pointer to the number of accepted values IN/OUT */ - int n_nbval; - int * nbneg; /* return number of negative transitions */ - int n_nbneg; - xmlChar ** values; /* pointer to the array of acceptable values */ - int n_values; - int * terminal; /* return value if this was a terminal state */ - int n_terminal; - - for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) { - for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr_ptr;n_string++) { - for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) { - for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) { - for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) { - for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) { - mem_base = xmlMemBlocks(); - exec = gen_xmlRegExecCtxtPtr(n_exec, 0); - string = gen_const_xmlChar_ptr_ptr(n_string, 1); - nbval = gen_int_ptr(n_nbval, 2); - nbneg = gen_int_ptr(n_nbneg, 3); - values = gen_xmlChar_ptr_ptr(n_values, 4); - terminal = gen_int_ptr(n_terminal, 5); - - ret_val = xmlRegExecErrInfo(exec, (const xmlChar **)string, nbval, nbneg, values, terminal); - desret_int(ret_val); - call_tests++; - des_xmlRegExecCtxtPtr(n_exec, exec, 0); - des_const_xmlChar_ptr_ptr(n_string, (const xmlChar **)string, 1); - des_int_ptr(n_nbval, nbval, 2); - des_int_ptr(n_nbneg, nbneg, 3); - des_xmlChar_ptr_ptr(n_values, values, 4); - des_int_ptr(n_terminal, terminal, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRegExecErrInfo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_exec); - printf(" %d", n_string); - printf(" %d", n_nbval); - printf(" %d", n_nbneg); - printf(" %d", n_values); - printf(" %d", n_terminal); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlRegExecNextValues(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) - int mem_base; - int ret_val; - xmlRegExecCtxtPtr exec; /* a regexp execution context */ - int n_exec; - int * nbval; /* pointer to the number of accepted values IN/OUT */ - int n_nbval; - int * nbneg; /* return number of negative transitions */ - int n_nbneg; - xmlChar ** values; /* pointer to the array of acceptable values */ - int n_values; - int * terminal; /* return value if this was a terminal state */ - int n_terminal; - - for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) { - for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) { - for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) { - for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) { - for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) { - mem_base = xmlMemBlocks(); - exec = gen_xmlRegExecCtxtPtr(n_exec, 0); - nbval = gen_int_ptr(n_nbval, 1); - nbneg = gen_int_ptr(n_nbneg, 2); - values = gen_xmlChar_ptr_ptr(n_values, 3); - terminal = gen_int_ptr(n_terminal, 4); - - ret_val = xmlRegExecNextValues(exec, nbval, nbneg, values, terminal); - desret_int(ret_val); - call_tests++; - des_xmlRegExecCtxtPtr(n_exec, exec, 0); - des_int_ptr(n_nbval, nbval, 1); - des_int_ptr(n_nbneg, nbneg, 2); - des_xmlChar_ptr_ptr(n_values, values, 3); - des_int_ptr(n_terminal, terminal, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRegExecNextValues", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_exec); - printf(" %d", n_nbval); - printf(" %d", n_nbneg); - printf(" %d", n_values); - printf(" %d", n_terminal); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlRegExecPushString(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) - int mem_base; - int ret_val; - xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */ - int n_exec; - xmlChar * value; /* a string token input */ - int n_value; - void * data; /* data associated to the token to reuse in callbacks */ - int n_data; - - for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - for (n_data = 0;n_data < gen_nb_userdata;n_data++) { - mem_base = xmlMemBlocks(); - exec = gen_xmlRegExecCtxtPtr(n_exec, 0); - value = gen_const_xmlChar_ptr(n_value, 1); - data = gen_userdata(n_data, 2); - - ret_val = xmlRegExecPushString(exec, (const xmlChar *)value, data); - desret_int(ret_val); - call_tests++; - des_xmlRegExecCtxtPtr(n_exec, exec, 0); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); - des_userdata(n_data, data, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRegExecPushString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_exec); - printf(" %d", n_value); - printf(" %d", n_data); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlRegExecPushString2(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) - int mem_base; - int ret_val; - xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */ - int n_exec; - xmlChar * value; /* the first string token input */ - int n_value; - xmlChar * value2; /* the second string token input */ - int n_value2; - void * data; /* data associated to the token to reuse in callbacks */ - int n_data; - - for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) { - for (n_data = 0;n_data < gen_nb_userdata;n_data++) { - mem_base = xmlMemBlocks(); - exec = gen_xmlRegExecCtxtPtr(n_exec, 0); - value = gen_const_xmlChar_ptr(n_value, 1); - value2 = gen_const_xmlChar_ptr(n_value2, 2); - data = gen_userdata(n_data, 3); - - ret_val = xmlRegExecPushString2(exec, (const xmlChar *)value, (const xmlChar *)value2, data); - desret_int(ret_val); - call_tests++; - des_xmlRegExecCtxtPtr(n_exec, exec, 0); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); - des_const_xmlChar_ptr(n_value2, (const xmlChar *)value2, 2); - des_userdata(n_data, data, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRegExecPushString2", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_exec); - printf(" %d", n_value); - printf(" %d", n_value2); - printf(" %d", n_data); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -#ifdef LIBXML_REGEXP_ENABLED - -#define gen_nb_xmlRegexpPtr 1 -static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlRegNewExecCtxt(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlRegexpCompile(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlRegexpExec(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) - int mem_base; - int ret_val; - xmlRegexpPtr comp; /* the compiled regular expression */ - int n_comp; - xmlChar * content; /* the value to check against the regular expression */ - int n_content; - - for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - comp = gen_xmlRegexpPtr(n_comp, 0); - content = gen_const_xmlChar_ptr(n_content, 1); - - ret_val = xmlRegexpExec(comp, (const xmlChar *)content); - desret_int(ret_val); - call_tests++; - des_xmlRegexpPtr(n_comp, comp, 0); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRegexpExec", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_comp); - printf(" %d", n_content); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlRegexpIsDeterminist(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) - int mem_base; - int ret_val; - xmlRegexpPtr comp; /* the compiled regular expression */ - int n_comp; - - for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) { - mem_base = xmlMemBlocks(); - comp = gen_xmlRegexpPtr(n_comp, 0); - - ret_val = xmlRegexpIsDeterminist(comp); - desret_int(ret_val); - call_tests++; - des_xmlRegexpPtr(n_comp, comp, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRegexpIsDeterminist", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_comp); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlRegexpPrint(void) { - int test_ret = 0; - -#if defined(LIBXML_REGEXP_ENABLED) - int mem_base; - FILE * output; /* the file for the output debug */ - int n_output; - xmlRegexpPtr regexp; /* the compiled regexp */ - int n_regexp; - - for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) { - for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) { - mem_base = xmlMemBlocks(); - output = gen_FILE_ptr(n_output, 0); - regexp = gen_xmlRegexpPtr(n_regexp, 1); - - xmlRegexpPrint(output, regexp); - call_tests++; - des_FILE_ptr(n_output, output, 0); - des_xmlRegexpPtr(n_regexp, regexp, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlRegexpPrint", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_output); - printf(" %d", n_regexp); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_xmlregexp(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing xmlregexp : 16 of 30 functions ...\n"); - test_ret += test_xmlExpCtxtNbCons(); - test_ret += test_xmlExpCtxtNbNodes(); - test_ret += test_xmlExpDump(); - test_ret += test_xmlExpExpDerive(); - test_ret += test_xmlExpGetLanguage(); - test_ret += test_xmlExpGetStart(); - test_ret += test_xmlExpIsNillable(); - test_ret += test_xmlExpMaxToken(); - test_ret += test_xmlExpNewAtom(); - test_ret += test_xmlExpNewCtxt(); - test_ret += test_xmlExpNewOr(); - test_ret += test_xmlExpNewRange(); - test_ret += test_xmlExpNewSeq(); - test_ret += test_xmlExpParse(); - test_ret += test_xmlExpRef(); - test_ret += test_xmlExpStringDerive(); - test_ret += test_xmlExpSubsume(); - test_ret += test_xmlRegExecErrInfo(); - test_ret += test_xmlRegExecNextValues(); - test_ret += test_xmlRegExecPushString(); - test_ret += test_xmlRegExecPushString2(); - test_ret += test_xmlRegNewExecCtxt(); - test_ret += test_xmlRegexpCompile(); - test_ret += test_xmlRegexpExec(); - test_ret += test_xmlRegexpIsDeterminist(); - test_ret += test_xmlRegexpPrint(); - - if (test_ret != 0) - printf("Module xmlregexp: %d errors\n", test_ret); - return(test_ret); -} -#ifdef LIBXML_OUTPUT_ENABLED - -#define gen_nb_xmlSaveCtxtPtr 1 -static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlSaveClose(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - xmlSaveCtxtPtr ctxt; /* a document saving context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0); - - ret_val = xmlSaveClose(ctxt); - desret_int(ret_val); - call_tests++; - des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSaveClose", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSaveDoc(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - long ret_val; - xmlSaveCtxtPtr ctxt; /* a document saving context */ - int n_ctxt; - xmlDocPtr doc; /* a document */ - int n_doc; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - - ret_val = xmlSaveDoc(ctxt, doc); - desret_long(ret_val); - call_tests++; - des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSaveDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSaveFlush(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - int ret_val; - xmlSaveCtxtPtr ctxt; /* a document saving context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0); - - ret_val = xmlSaveFlush(ctxt); - desret_int(ret_val); - call_tests++; - des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSaveFlush", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSaveSetAttrEscape(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSaveSetEscape(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSaveToBuffer(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSaveToFd(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSaveToFilename(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSaveTree(void) { - int test_ret = 0; - -#if defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - long ret_val; - xmlSaveCtxtPtr ctxt; /* a document saving context */ - int n_ctxt; - xmlNodePtr node; /* the top node of the subtree to save */ - int n_node; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0); - node = gen_xmlNodePtr(n_node, 1); - - ret_val = xmlSaveTree(ctxt, node); - desret_long(ret_val); - call_tests++; - des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0); - des_xmlNodePtr(n_node, node, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSaveTree", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_node); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_xmlsave(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing xmlsave : 4 of 10 functions ...\n"); - test_ret += test_xmlSaveClose(); - test_ret += test_xmlSaveDoc(); - test_ret += test_xmlSaveFlush(); - test_ret += test_xmlSaveSetAttrEscape(); - test_ret += test_xmlSaveSetEscape(); - test_ret += test_xmlSaveToBuffer(); - test_ret += test_xmlSaveToFd(); - test_ret += test_xmlSaveToFilename(); - test_ret += test_xmlSaveTree(); - - if (test_ret != 0) - printf("Module xmlsave: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlSchemaDump(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - int mem_base; - FILE * output; /* the file output */ - int n_output; - xmlSchemaPtr schema; /* a schema structure */ - int n_schema; - - for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) { - for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) { - mem_base = xmlMemBlocks(); - output = gen_FILE_ptr(n_output, 0); - schema = gen_xmlSchemaPtr(n_schema, 1); - - xmlSchemaDump(output, schema); - call_tests++; - des_FILE_ptr(n_output, output, 0); - des_xmlSchemaPtr(n_schema, schema, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaDump", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_output); - printf(" %d", n_schema); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -#ifdef LIBXML_SCHEMAS_ENABLED - -#define gen_nb_xmlSchemaParserCtxtPtr 1 -static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - -#ifdef LIBXML_SCHEMAS_ENABLED - -#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1 -static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - -#ifdef LIBXML_SCHEMAS_ENABLED - -#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1 -static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlSchemaGetParserErrors(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */ - int n_ctxt; - xmlSchemaValidityErrorFunc * err; /* the error callback result */ - int n_err; - xmlSchemaValidityWarningFunc * warn; /* the warning callback result */ - int n_warn; - void ** ctx; /* contextual data for the callbacks result */ - int n_ctx; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) { - for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) { - for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) { - for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0); - err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1); - warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2); - ctx = gen_void_ptr_ptr(n_ctx, 3); - - ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx); - desret_int(ret_val); - call_tests++; - des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0); - des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1); - des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2); - des_void_ptr_ptr(n_ctx, ctx, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaGetParserErrors", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_err); - printf(" %d", n_warn); - printf(" %d", n_ctx); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaGetValidErrors(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */ - int n_ctxt; - xmlSchemaValidityErrorFunc * err; /* the error function result */ - int n_err; - xmlSchemaValidityWarningFunc * warn; /* the warning function result */ - int n_warn; - void ** ctx; /* the functions context result */ - int n_ctx; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { - for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) { - for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) { - for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0); - err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1); - warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2); - ctx = gen_void_ptr_ptr(n_ctx, 3); - - ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx); - desret_int(ret_val); - call_tests++; - des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1); - des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2); - des_void_ptr_ptr(n_ctx, ctx, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaGetValidErrors", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_err); - printf(" %d", n_warn); - printf(" %d", n_ctx); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaIsValid(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* the schema validation context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0); - - ret_val = xmlSchemaIsValid(ctxt); - desret_int(ret_val); - call_tests++; - des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaIsValid", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaNewDocParserCtxt(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - xmlSchemaParserCtxtPtr ret_val; - xmlDocPtr doc; /* a preparsed document tree */ - int n_doc; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - - ret_val = xmlSchemaNewDocParserCtxt(doc); - desret_xmlSchemaParserCtxtPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaNewMemParserCtxt(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - xmlSchemaParserCtxtPtr ret_val; - char * buffer; /* a pointer to a char array containing the schemas */ - int n_buffer; - int size; /* the size of the array */ - int n_size; - - for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { - for (n_size = 0;n_size < gen_nb_int;n_size++) { - mem_base = xmlMemBlocks(); - buffer = gen_const_char_ptr(n_buffer, 0); - size = gen_int(n_size, 1); - - ret_val = xmlSchemaNewMemParserCtxt((const char *)buffer, size); - desret_xmlSchemaParserCtxtPtr(ret_val); - call_tests++; - des_const_char_ptr(n_buffer, (const char *)buffer, 0); - des_int(n_size, size, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buffer); - printf(" %d", n_size); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaNewParserCtxt(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - xmlSchemaParserCtxtPtr ret_val; - char * URL; /* the location of the schema */ - int n_URL; - - for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) { - mem_base = xmlMemBlocks(); - URL = gen_const_char_ptr(n_URL, 0); - - ret_val = xmlSchemaNewParserCtxt((const char *)URL); - desret_xmlSchemaParserCtxtPtr(ret_val); - call_tests++; - des_const_char_ptr(n_URL, (const char *)URL, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaNewParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URL); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaNewValidCtxt(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSchemaParse(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - -#ifdef LIBXML_SCHEMAS_ENABLED - -#define gen_nb_xmlSAXHandlerPtr_ptr 1 -static xmlSAXHandlerPtr * gen_xmlSAXHandlerPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSAXHandlerPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlSchemaSAXPlug(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - -#ifdef LIBXML_SCHEMAS_ENABLED - -#define gen_nb_xmlSchemaSAXPlugPtr 1 -static xmlSchemaSAXPlugPtr gen_xmlSchemaSAXPlugPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaSAXPlugPtr(int no ATTRIBUTE_UNUSED, xmlSchemaSAXPlugPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlSchemaSAXUnplug(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaSAXPlugPtr plug; /* a data structure returned by xmlSchemaSAXPlug */ - int n_plug; - - for (n_plug = 0;n_plug < gen_nb_xmlSchemaSAXPlugPtr;n_plug++) { - mem_base = xmlMemBlocks(); - plug = gen_xmlSchemaSAXPlugPtr(n_plug, 0); - - ret_val = xmlSchemaSAXUnplug(plug); - desret_int(ret_val); - call_tests++; - des_xmlSchemaSAXPlugPtr(n_plug, plug, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaSAXUnplug", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_plug); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaSetParserErrors(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSchemaSetParserStructuredErrors(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSchemaSetValidErrors(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSchemaSetValidOptions(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ - int n_ctxt; - int options; /* a combination of xmlSchemaValidOption */ - int n_options; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { - for (n_options = 0;n_options < gen_nb_int;n_options++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0); - options = gen_int(n_options, 1); - - ret_val = xmlSchemaSetValidOptions(ctxt, options); - desret_int(ret_val); - call_tests++; - des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0); - des_int(n_options, options, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaSetValidOptions", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_options); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaSetValidStructuredErrors(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSchemaValidCtxtGetOptions(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0); - - ret_val = xmlSchemaValidCtxtGetOptions(ctxt); - desret_int(ret_val); - call_tests++; - des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaValidCtxtGetParserCtxt(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - xmlParserCtxtPtr ret_val; - xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0); - - ret_val = xmlSchemaValidCtxtGetParserCtxt(ctxt); - desret_xmlParserCtxtPtr(ret_val); - call_tests++; - des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaValidCtxtGetParserCtxt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaValidateDoc(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ - int n_ctxt; - xmlDocPtr doc; /* a parsed document tree */ - int n_doc; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0); - doc = gen_xmlDocPtr(n_doc, 1); - - ret_val = xmlSchemaValidateDoc(ctxt, doc); - desret_int(ret_val); - call_tests++; - des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_doc, doc, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaValidateDoc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_doc); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaValidateFile(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ - int n_ctxt; - const char * filename; /* the URI of the instance */ - int n_filename; - int options; /* a future set of options, currently unused */ - int n_options; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - for (n_options = 0;n_options < gen_nb_int;n_options++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0); - filename = gen_filepath(n_filename, 1); - options = gen_int(n_options, 2); - - ret_val = xmlSchemaValidateFile(ctxt, filename, options); - desret_int(ret_val); - call_tests++; - des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0); - des_filepath(n_filename, filename, 1); - des_int(n_options, options, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaValidateFile", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_filename); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaValidateOneElement(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ - int n_ctxt; - xmlNodePtr elem; /* an element node */ - int n_elem; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { - for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0); - elem = gen_xmlNodePtr(n_elem, 1); - - ret_val = xmlSchemaValidateOneElement(ctxt, elem); - desret_int(ret_val); - call_tests++; - des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlNodePtr(n_elem, elem, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaValidateOneElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_elem); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaValidateSetFilename(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - xmlSchemaValidCtxtPtr vctxt; /* the schema validation context */ - int n_vctxt; - const char * filename; /* the file name */ - int n_filename; - - for (n_vctxt = 0;n_vctxt < gen_nb_xmlSchemaValidCtxtPtr;n_vctxt++) { - for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { - mem_base = xmlMemBlocks(); - vctxt = gen_xmlSchemaValidCtxtPtr(n_vctxt, 0); - filename = gen_filepath(n_filename, 1); - - xmlSchemaValidateSetFilename(vctxt, filename); - call_tests++; - des_xmlSchemaValidCtxtPtr(n_vctxt, vctxt, 0); - des_filepath(n_filename, filename, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaValidateSetFilename", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_vctxt); - printf(" %d", n_filename); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaValidateSetLocator(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSchemaValidateStream(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ - int n_ctxt; - xmlParserInputBufferPtr input; /* the input to use for reading the data */ - int n_input; - xmlCharEncoding enc; /* an optional encoding information */ - int n_enc; - xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */ - int n_sax; - void * user_data; /* the context to provide to the SAX handler. */ - int n_user_data; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { - for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) { - for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { - for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { - for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0); - input = gen_xmlParserInputBufferPtr(n_input, 1); - enc = gen_xmlCharEncoding(n_enc, 2); - sax = gen_xmlSAXHandlerPtr(n_sax, 3); - user_data = gen_userdata(n_user_data, 4); - - ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data); - desret_int(ret_val); - call_tests++; - des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlParserInputBufferPtr(n_input, input, 1); - des_xmlCharEncoding(n_enc, enc, 2); - des_xmlSAXHandlerPtr(n_sax, sax, 3); - des_userdata(n_user_data, user_data, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaValidateStream", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_input); - printf(" %d", n_enc); - printf(" %d", n_sax); - printf(" %d", n_user_data); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_xmlschemas(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing xmlschemas : 16 of 27 functions ...\n"); - test_ret += test_xmlSchemaDump(); - test_ret += test_xmlSchemaGetParserErrors(); - test_ret += test_xmlSchemaGetValidErrors(); - test_ret += test_xmlSchemaIsValid(); - test_ret += test_xmlSchemaNewDocParserCtxt(); - test_ret += test_xmlSchemaNewMemParserCtxt(); - test_ret += test_xmlSchemaNewParserCtxt(); - test_ret += test_xmlSchemaNewValidCtxt(); - test_ret += test_xmlSchemaParse(); - test_ret += test_xmlSchemaSAXPlug(); - test_ret += test_xmlSchemaSAXUnplug(); - test_ret += test_xmlSchemaSetParserErrors(); - test_ret += test_xmlSchemaSetParserStructuredErrors(); - test_ret += test_xmlSchemaSetValidErrors(); - test_ret += test_xmlSchemaSetValidOptions(); - test_ret += test_xmlSchemaSetValidStructuredErrors(); - test_ret += test_xmlSchemaValidCtxtGetOptions(); - test_ret += test_xmlSchemaValidCtxtGetParserCtxt(); - test_ret += test_xmlSchemaValidateDoc(); - test_ret += test_xmlSchemaValidateFile(); - test_ret += test_xmlSchemaValidateOneElement(); - test_ret += test_xmlSchemaValidateSetFilename(); - test_ret += test_xmlSchemaValidateSetLocator(); - test_ret += test_xmlSchemaValidateStream(); - - if (test_ret != 0) - printf("Module xmlschemas: %d errors\n", test_ret); - return(test_ret); -} -#ifdef LIBXML_SCHEMAS_ENABLED - -#define gen_nb_xmlSchemaFacetPtr 1 -static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - -#ifdef LIBXML_SCHEMAS_ENABLED - -#define gen_nb_xmlSchemaTypePtr 1 -static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlSchemaCheckFacet(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaFacetPtr facet; /* the facet */ - int n_facet; - xmlSchemaTypePtr typeDecl; /* the schema type definition */ - int n_typeDecl; - xmlSchemaParserCtxtPtr pctxt; /* the schema parser context or NULL */ - int n_pctxt; - xmlChar * name; /* the optional name of the type */ - int n_name; - - for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) { - for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) { - for (n_pctxt = 0;n_pctxt < gen_nb_xmlSchemaParserCtxtPtr;n_pctxt++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - facet = gen_xmlSchemaFacetPtr(n_facet, 0); - typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1); - pctxt = gen_xmlSchemaParserCtxtPtr(n_pctxt, 2); - name = gen_const_xmlChar_ptr(n_name, 3); - - ret_val = xmlSchemaCheckFacet(facet, typeDecl, pctxt, (const xmlChar *)name); - desret_int(ret_val); - call_tests++; - des_xmlSchemaFacetPtr(n_facet, facet, 0); - des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1); - des_xmlSchemaParserCtxtPtr(n_pctxt, pctxt, 2); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaCheckFacet", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_facet); - printf(" %d", n_typeDecl); - printf(" %d", n_pctxt); - printf(" %d", n_name); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaCleanupTypes(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - - - xmlSchemaCleanupTypes(); - call_tests++; - xmlResetLastError(); - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaCollapseString(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlChar * value; /* a value */ - int n_value; - - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - value = gen_const_xmlChar_ptr(n_value, 0); - - ret_val = xmlSchemaCollapseString((const xmlChar *)value); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaCollapseString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_value); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - -#ifdef LIBXML_SCHEMAS_ENABLED - -#define gen_nb_xmlSchemaValPtr 1 -static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlSchemaCompareValues(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaValPtr x; /* a first value */ - int n_x; - xmlSchemaValPtr y; /* a second value */ - int n_y; - - for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) { - for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) { - mem_base = xmlMemBlocks(); - x = gen_xmlSchemaValPtr(n_x, 0); - y = gen_xmlSchemaValPtr(n_y, 1); - - ret_val = xmlSchemaCompareValues(x, y); - desret_int(ret_val); - call_tests++; - des_xmlSchemaValPtr(n_x, x, 0); - des_xmlSchemaValPtr(n_y, y, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaCompareValues", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_x); - printf(" %d", n_y); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaCompareValuesWhtsp(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaValPtr x; /* a first value */ - int n_x; - xmlSchemaWhitespaceValueType xws; /* the whitespace value of x */ - int n_xws; - xmlSchemaValPtr y; /* a second value */ - int n_y; - xmlSchemaWhitespaceValueType yws; /* the whitespace value of y */ - int n_yws; - - for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) { - for (n_xws = 0;n_xws < gen_nb_xmlSchemaWhitespaceValueType;n_xws++) { - for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) { - for (n_yws = 0;n_yws < gen_nb_xmlSchemaWhitespaceValueType;n_yws++) { - mem_base = xmlMemBlocks(); - x = gen_xmlSchemaValPtr(n_x, 0); - xws = gen_xmlSchemaWhitespaceValueType(n_xws, 1); - y = gen_xmlSchemaValPtr(n_y, 2); - yws = gen_xmlSchemaWhitespaceValueType(n_yws, 3); - - ret_val = xmlSchemaCompareValuesWhtsp(x, xws, y, yws); - desret_int(ret_val); - call_tests++; - des_xmlSchemaValPtr(n_x, x, 0); - des_xmlSchemaWhitespaceValueType(n_xws, xws, 1); - des_xmlSchemaValPtr(n_y, y, 2); - des_xmlSchemaWhitespaceValueType(n_yws, yws, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaCompareValuesWhtsp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_x); - printf(" %d", n_xws); - printf(" %d", n_y); - printf(" %d", n_yws); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaCopyValue(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - xmlSchemaTypePtr ret_val; - xmlSchemaTypePtr type; /* the built-in simple type. */ - int n_type; - - for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) { - mem_base = xmlMemBlocks(); - type = gen_xmlSchemaTypePtr(n_type, 0); - - ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type); - desret_xmlSchemaTypePtr(ret_val); - call_tests++; - des_xmlSchemaTypePtr(n_type, type, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_type); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaGetBuiltInType(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - xmlSchemaTypePtr ret_val; - xmlSchemaValType type; /* the type of the built in type */ - int n_type; - - for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) { - type = gen_xmlSchemaValType(n_type, 0); - - ret_val = xmlSchemaGetBuiltInType(type); - desret_xmlSchemaTypePtr(ret_val); - call_tests++; - des_xmlSchemaValType(n_type, type, 0); - xmlResetLastError(); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaGetCanonValue(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaValPtr val; /* the precomputed value */ - int n_val; - xmlChar ** retValue; /* the returned value */ - int n_retValue; - - for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) { - for (n_retValue = 0;n_retValue < gen_nb_const_xmlChar_ptr_ptr;n_retValue++) { - mem_base = xmlMemBlocks(); - val = gen_xmlSchemaValPtr(n_val, 0); - retValue = gen_const_xmlChar_ptr_ptr(n_retValue, 1); - - ret_val = xmlSchemaGetCanonValue(val, (const xmlChar **)retValue); - desret_int(ret_val); - call_tests++; - des_xmlSchemaValPtr(n_val, val, 0); - des_const_xmlChar_ptr_ptr(n_retValue, (const xmlChar **)retValue, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaGetCanonValue", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf(" %d", n_retValue); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaGetCanonValueWhtsp(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaValPtr val; /* the precomputed value */ - int n_val; - xmlChar ** retValue; /* the returned value */ - int n_retValue; - xmlSchemaWhitespaceValueType ws; /* the whitespace type of the value */ - int n_ws; - - for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) { - for (n_retValue = 0;n_retValue < gen_nb_const_xmlChar_ptr_ptr;n_retValue++) { - for (n_ws = 0;n_ws < gen_nb_xmlSchemaWhitespaceValueType;n_ws++) { - mem_base = xmlMemBlocks(); - val = gen_xmlSchemaValPtr(n_val, 0); - retValue = gen_const_xmlChar_ptr_ptr(n_retValue, 1); - ws = gen_xmlSchemaWhitespaceValueType(n_ws, 2); - - ret_val = xmlSchemaGetCanonValueWhtsp(val, (const xmlChar **)retValue, ws); - desret_int(ret_val); - call_tests++; - des_xmlSchemaValPtr(n_val, val, 0); - des_const_xmlChar_ptr_ptr(n_retValue, (const xmlChar **)retValue, 1); - des_xmlSchemaWhitespaceValueType(n_ws, ws, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaGetCanonValueWhtsp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf(" %d", n_retValue); - printf(" %d", n_ws); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaGetFacetValueAsULong(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - unsigned long ret_val; - xmlSchemaFacetPtr facet; /* an schemas type facet */ - int n_facet; - - for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) { - mem_base = xmlMemBlocks(); - facet = gen_xmlSchemaFacetPtr(n_facet, 0); - - ret_val = xmlSchemaGetFacetValueAsULong(facet); - desret_unsigned_long(ret_val); - call_tests++; - des_xmlSchemaFacetPtr(n_facet, facet, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaGetFacetValueAsULong", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_facet); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaGetPredefinedType(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - xmlSchemaTypePtr ret_val; - xmlChar * name; /* the type name */ - int n_name; - xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */ - int n_ns; - - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) { - mem_base = xmlMemBlocks(); - name = gen_const_xmlChar_ptr(n_name, 0); - ns = gen_const_xmlChar_ptr(n_ns, 1); - - ret_val = xmlSchemaGetPredefinedType((const xmlChar *)name, (const xmlChar *)ns); - desret_xmlSchemaTypePtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0); - des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaGetPredefinedType", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_name); - printf(" %d", n_ns); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaGetValType(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - xmlSchemaValType ret_val; - xmlSchemaValPtr val; /* a schemas value */ - int n_val; - - for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_xmlSchemaValPtr(n_val, 0); - - ret_val = xmlSchemaGetValType(val); - desret_xmlSchemaValType(ret_val); - call_tests++; - des_xmlSchemaValPtr(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaGetValType", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaInitTypes(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - - - xmlSchemaInitTypes(); - call_tests++; - xmlResetLastError(); - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaIsBuiltInTypeFacet(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaTypePtr type; /* the built-in type */ - int n_type; - int facetType; /* the facet type */ - int n_facetType; - - for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) { - for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) { - mem_base = xmlMemBlocks(); - type = gen_xmlSchemaTypePtr(n_type, 0); - facetType = gen_int(n_facetType, 1); - - ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType); - desret_int(ret_val); - call_tests++; - des_xmlSchemaTypePtr(n_type, type, 0); - des_int(n_facetType, facetType, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_type); - printf(" %d", n_facetType); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaNewFacet(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSchemaNewNOTATIONValue(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSchemaNewQNameValue(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSchemaNewStringValue(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - -#ifdef LIBXML_SCHEMAS_ENABLED - -#define gen_nb_xmlSchemaValPtr_ptr 1 -static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlSchemaValPredefTypeNode(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaTypePtr type; /* the predefined type */ - int n_type; - xmlChar * value; /* the value to check */ - int n_value; - xmlSchemaValPtr * val; /* the return computed value */ - int n_val; - xmlNodePtr node; /* the node containing the value */ - int n_node; - - for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - type = gen_xmlSchemaTypePtr(n_type, 0); - value = gen_const_xmlChar_ptr(n_value, 1); - val = gen_xmlSchemaValPtr_ptr(n_val, 2); - node = gen_xmlNodePtr(n_node, 3); - - ret_val = xmlSchemaValPredefTypeNode(type, (const xmlChar *)value, val, node); - desret_int(ret_val); - call_tests++; - des_xmlSchemaTypePtr(n_type, type, 0); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); - des_xmlSchemaValPtr_ptr(n_val, val, 2); - des_xmlNodePtr(n_node, node, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_type); - printf(" %d", n_value); - printf(" %d", n_val); - printf(" %d", n_node); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaValPredefTypeNodeNoNorm(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaTypePtr type; /* the predefined type */ - int n_type; - xmlChar * value; /* the value to check */ - int n_value; - xmlSchemaValPtr * val; /* the return computed value */ - int n_val; - xmlNodePtr node; /* the node containing the value */ - int n_node; - - for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - type = gen_xmlSchemaTypePtr(n_type, 0); - value = gen_const_xmlChar_ptr(n_value, 1); - val = gen_xmlSchemaValPtr_ptr(n_val, 2); - node = gen_xmlNodePtr(n_node, 3); - - ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, (const xmlChar *)value, val, node); - desret_int(ret_val); - call_tests++; - des_xmlSchemaTypePtr(n_type, type, 0); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); - des_xmlSchemaValPtr_ptr(n_val, val, 2); - des_xmlNodePtr(n_node, node, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_type); - printf(" %d", n_value); - printf(" %d", n_val); - printf(" %d", n_node); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaValidateFacet(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaTypePtr base; /* the base type */ - int n_base; - xmlSchemaFacetPtr facet; /* the facet to check */ - int n_facet; - xmlChar * value; /* the lexical repr of the value to validate */ - int n_value; - xmlSchemaValPtr val; /* the precomputed value */ - int n_val; - - for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) { - for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) { - mem_base = xmlMemBlocks(); - base = gen_xmlSchemaTypePtr(n_base, 0); - facet = gen_xmlSchemaFacetPtr(n_facet, 1); - value = gen_const_xmlChar_ptr(n_value, 2); - val = gen_xmlSchemaValPtr(n_val, 3); - - ret_val = xmlSchemaValidateFacet(base, facet, (const xmlChar *)value, val); - desret_int(ret_val); - call_tests++; - des_xmlSchemaTypePtr(n_base, base, 0); - des_xmlSchemaFacetPtr(n_facet, facet, 1); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2); - des_xmlSchemaValPtr(n_val, val, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaValidateFacet", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_base); - printf(" %d", n_facet); - printf(" %d", n_value); - printf(" %d", n_val); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaValidateFacetWhtsp(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaFacetPtr facet; /* the facet to check */ - int n_facet; - xmlSchemaWhitespaceValueType fws; /* the whitespace type of the facet's value */ - int n_fws; - xmlSchemaValType valType; /* the built-in type of the value */ - int n_valType; - xmlChar * value; /* the lexical (or normalized for pattern) repr of the value to validate */ - int n_value; - xmlSchemaValPtr val; /* the precomputed value */ - int n_val; - xmlSchemaWhitespaceValueType ws; /* the whitespace type of the value */ - int n_ws; - - for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) { - for (n_fws = 0;n_fws < gen_nb_xmlSchemaWhitespaceValueType;n_fws++) { - for (n_valType = 0;n_valType < gen_nb_xmlSchemaValType;n_valType++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) { - for (n_ws = 0;n_ws < gen_nb_xmlSchemaWhitespaceValueType;n_ws++) { - mem_base = xmlMemBlocks(); - facet = gen_xmlSchemaFacetPtr(n_facet, 0); - fws = gen_xmlSchemaWhitespaceValueType(n_fws, 1); - valType = gen_xmlSchemaValType(n_valType, 2); - value = gen_const_xmlChar_ptr(n_value, 3); - val = gen_xmlSchemaValPtr(n_val, 4); - ws = gen_xmlSchemaWhitespaceValueType(n_ws, 5); - - ret_val = xmlSchemaValidateFacetWhtsp(facet, fws, valType, (const xmlChar *)value, val, ws); - desret_int(ret_val); - call_tests++; - des_xmlSchemaFacetPtr(n_facet, facet, 0); - des_xmlSchemaWhitespaceValueType(n_fws, fws, 1); - des_xmlSchemaValType(n_valType, valType, 2); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3); - des_xmlSchemaValPtr(n_val, val, 4); - des_xmlSchemaWhitespaceValueType(n_ws, ws, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaValidateFacetWhtsp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_facet); - printf(" %d", n_fws); - printf(" %d", n_valType); - printf(" %d", n_value); - printf(" %d", n_val); - printf(" %d", n_ws); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaValidateLengthFacet(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaTypePtr type; /* the built-in type */ - int n_type; - xmlSchemaFacetPtr facet; /* the facet to check */ - int n_facet; - xmlChar * value; /* the lexical repr. of the value to be validated */ - int n_value; - xmlSchemaValPtr val; /* the precomputed value */ - int n_val; - unsigned long * length; /* the actual length of the value */ - int n_length; - - for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) { - for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) { - for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) { - mem_base = xmlMemBlocks(); - type = gen_xmlSchemaTypePtr(n_type, 0); - facet = gen_xmlSchemaFacetPtr(n_facet, 1); - value = gen_const_xmlChar_ptr(n_value, 2); - val = gen_xmlSchemaValPtr(n_val, 3); - length = gen_unsigned_long_ptr(n_length, 4); - - ret_val = xmlSchemaValidateLengthFacet(type, facet, (const xmlChar *)value, val, length); - desret_int(ret_val); - call_tests++; - des_xmlSchemaTypePtr(n_type, type, 0); - des_xmlSchemaFacetPtr(n_facet, facet, 1); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2); - des_xmlSchemaValPtr(n_val, val, 3); - des_unsigned_long_ptr(n_length, length, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_type); - printf(" %d", n_facet); - printf(" %d", n_value); - printf(" %d", n_val); - printf(" %d", n_length); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaValidateLengthFacetWhtsp(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaFacetPtr facet; /* the facet to check */ - int n_facet; - xmlSchemaValType valType; /* the built-in type */ - int n_valType; - xmlChar * value; /* the lexical repr. of the value to be validated */ - int n_value; - xmlSchemaValPtr val; /* the precomputed value */ - int n_val; - unsigned long * length; /* the actual length of the value */ - int n_length; - xmlSchemaWhitespaceValueType ws; /* the whitespace type of the value */ - int n_ws; - - for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) { - for (n_valType = 0;n_valType < gen_nb_xmlSchemaValType;n_valType++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) { - for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) { - for (n_ws = 0;n_ws < gen_nb_xmlSchemaWhitespaceValueType;n_ws++) { - mem_base = xmlMemBlocks(); - facet = gen_xmlSchemaFacetPtr(n_facet, 0); - valType = gen_xmlSchemaValType(n_valType, 1); - value = gen_const_xmlChar_ptr(n_value, 2); - val = gen_xmlSchemaValPtr(n_val, 3); - length = gen_unsigned_long_ptr(n_length, 4); - ws = gen_xmlSchemaWhitespaceValueType(n_ws, 5); - - ret_val = xmlSchemaValidateLengthFacetWhtsp(facet, valType, (const xmlChar *)value, val, length, ws); - desret_int(ret_val); - call_tests++; - des_xmlSchemaFacetPtr(n_facet, facet, 0); - des_xmlSchemaValType(n_valType, valType, 1); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2); - des_xmlSchemaValPtr(n_val, val, 3); - des_unsigned_long_ptr(n_length, length, 4); - des_xmlSchemaWhitespaceValueType(n_ws, ws, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaValidateLengthFacetWhtsp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_facet); - printf(" %d", n_valType); - printf(" %d", n_value); - printf(" %d", n_val); - printf(" %d", n_length); - printf(" %d", n_ws); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaValidateListSimpleTypeFacet(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaFacetPtr facet; /* the facet to check */ - int n_facet; - xmlChar * value; /* the lexical repr of the value to validate */ - int n_value; - unsigned long actualLen; /* the number of list items */ - int n_actualLen; - unsigned long * expectedLen; /* the resulting expected number of list items */ - int n_expectedLen; - - for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) { - for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) { - mem_base = xmlMemBlocks(); - facet = gen_xmlSchemaFacetPtr(n_facet, 0); - value = gen_const_xmlChar_ptr(n_value, 1); - actualLen = gen_unsigned_long(n_actualLen, 2); - expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3); - - ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, (const xmlChar *)value, actualLen, expectedLen); - desret_int(ret_val); - call_tests++; - des_xmlSchemaFacetPtr(n_facet, facet, 0); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); - des_unsigned_long(n_actualLen, actualLen, 2); - des_unsigned_long_ptr(n_expectedLen, expectedLen, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_facet); - printf(" %d", n_value); - printf(" %d", n_actualLen); - printf(" %d", n_expectedLen); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaValidatePredefinedType(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaTypePtr type; /* the predefined type */ - int n_type; - xmlChar * value; /* the value to check */ - int n_value; - xmlSchemaValPtr * val; /* the return computed value */ - int n_val; - - for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) { - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) { - mem_base = xmlMemBlocks(); - type = gen_xmlSchemaTypePtr(n_type, 0); - value = gen_const_xmlChar_ptr(n_value, 1); - val = gen_xmlSchemaValPtr_ptr(n_val, 2); - - ret_val = xmlSchemaValidatePredefinedType(type, (const xmlChar *)value, val); - desret_int(ret_val); - call_tests++; - des_xmlSchemaTypePtr(n_type, type, 0); - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); - des_xmlSchemaValPtr_ptr(n_val, val, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_type); - printf(" %d", n_value); - printf(" %d", n_val); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaValueAppend(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaValPtr prev; /* the value */ - int n_prev; - xmlSchemaValPtr cur; /* the value to be appended */ - int n_cur; - - for (n_prev = 0;n_prev < gen_nb_xmlSchemaValPtr;n_prev++) { - for (n_cur = 0;n_cur < gen_nb_xmlSchemaValPtr;n_cur++) { - mem_base = xmlMemBlocks(); - prev = gen_xmlSchemaValPtr(n_prev, 0); - cur = gen_xmlSchemaValPtr(n_cur, 1); - - ret_val = xmlSchemaValueAppend(prev, cur); - desret_int(ret_val); - call_tests++; - des_xmlSchemaValPtr(n_prev, prev, 0); - des_xmlSchemaValPtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaValueAppend", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_prev); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaValueGetAsBoolean(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - xmlSchemaValPtr val; /* the value */ - int n_val; - - for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_xmlSchemaValPtr(n_val, 0); - - ret_val = xmlSchemaValueGetAsBoolean(val); - desret_int(ret_val); - call_tests++; - des_xmlSchemaValPtr(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaValueGetAsBoolean", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaValueGetAsString(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - const xmlChar * ret_val; - xmlSchemaValPtr val; /* the value */ - int n_val; - - for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_xmlSchemaValPtr(n_val, 0); - - ret_val = xmlSchemaValueGetAsString(val); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_xmlSchemaValPtr(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaValueGetAsString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlSchemaValueGetNext(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlSchemaWhiteSpaceReplace(void) { - int test_ret = 0; - -#if defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlChar * value; /* a value */ - int n_value; - - for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { - mem_base = xmlMemBlocks(); - value = gen_const_xmlChar_ptr(n_value, 0); - - ret_val = xmlSchemaWhiteSpaceReplace((const xmlChar *)value); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlSchemaWhiteSpaceReplace", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_value); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_xmlschemastypes(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing xmlschemastypes : 26 of 34 functions ...\n"); - test_ret += test_xmlSchemaCheckFacet(); - test_ret += test_xmlSchemaCleanupTypes(); - test_ret += test_xmlSchemaCollapseString(); - test_ret += test_xmlSchemaCompareValues(); - test_ret += test_xmlSchemaCompareValuesWhtsp(); - test_ret += test_xmlSchemaCopyValue(); - test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType(); - test_ret += test_xmlSchemaGetBuiltInType(); - test_ret += test_xmlSchemaGetCanonValue(); - test_ret += test_xmlSchemaGetCanonValueWhtsp(); - test_ret += test_xmlSchemaGetFacetValueAsULong(); - test_ret += test_xmlSchemaGetPredefinedType(); - test_ret += test_xmlSchemaGetValType(); - test_ret += test_xmlSchemaInitTypes(); - test_ret += test_xmlSchemaIsBuiltInTypeFacet(); - test_ret += test_xmlSchemaNewFacet(); - test_ret += test_xmlSchemaNewNOTATIONValue(); - test_ret += test_xmlSchemaNewQNameValue(); - test_ret += test_xmlSchemaNewStringValue(); - test_ret += test_xmlSchemaValPredefTypeNode(); - test_ret += test_xmlSchemaValPredefTypeNodeNoNorm(); - test_ret += test_xmlSchemaValidateFacet(); - test_ret += test_xmlSchemaValidateFacetWhtsp(); - test_ret += test_xmlSchemaValidateLengthFacet(); - test_ret += test_xmlSchemaValidateLengthFacetWhtsp(); - test_ret += test_xmlSchemaValidateListSimpleTypeFacet(); - test_ret += test_xmlSchemaValidatePredefinedType(); - test_ret += test_xmlSchemaValueAppend(); - test_ret += test_xmlSchemaValueGetAsBoolean(); - test_ret += test_xmlSchemaValueGetAsString(); - test_ret += test_xmlSchemaValueGetNext(); - test_ret += test_xmlSchemaWhiteSpaceReplace(); - - if (test_ret != 0) - printf("Module xmlschemastypes: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlCharStrdup(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - char * cur; /* the input char * */ - int n_cur; - - for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) { - mem_base = xmlMemBlocks(); - cur = gen_const_char_ptr(n_cur, 0); - - ret_val = xmlCharStrdup((const char *)cur); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_char_ptr(n_cur, (const char *)cur, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCharStrdup", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCharStrndup(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - char * cur; /* the input char * */ - int n_cur; - int len; /* the len of @cur */ - int n_len; - - for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - cur = gen_const_char_ptr(n_cur, 0); - len = gen_int(n_len, 1); - - ret_val = xmlCharStrndup((const char *)cur, len); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_char_ptr(n_cur, (const char *)cur, 0); - des_int(n_len, len, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCharStrndup", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_len); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlCheckUTF8(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */ - int n_utf; - - for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) { - mem_base = xmlMemBlocks(); - utf = gen_const_unsigned_char_ptr(n_utf, 0); - - ret_val = xmlCheckUTF8((const unsigned char *)utf); - desret_int(ret_val); - call_tests++; - des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCheckUTF8", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_utf); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlGetUTF8Char(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - unsigned char * utf; /* a sequence of UTF-8 encoded bytes */ - int n_utf; - int * len; /* a pointer to the minimum number of bytes present in the sequence. This is used to assure the next character is completely contained within the sequence. */ - int n_len; - - for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) { - for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) { - mem_base = xmlMemBlocks(); - utf = gen_const_unsigned_char_ptr(n_utf, 0); - len = gen_int_ptr(n_len, 1); - - ret_val = xmlGetUTF8Char((const unsigned char *)utf, len); - desret_int(ret_val); - call_tests++; - des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0); - des_int_ptr(n_len, len, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlGetUTF8Char", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_utf); - printf(" %d", n_len); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStrEqual(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlChar * str1; /* the first xmlChar * */ - int n_str1; - xmlChar * str2; /* the second xmlChar * */ - int n_str2; - - for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) { - for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) { - mem_base = xmlMemBlocks(); - str1 = gen_const_xmlChar_ptr(n_str1, 0); - str2 = gen_const_xmlChar_ptr(n_str2, 1); - - ret_val = xmlStrEqual((const xmlChar *)str1, (const xmlChar *)str2); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0); - des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrEqual", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_str1); - printf(" %d", n_str2); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStrPrintf(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlStrQEqual(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlChar * pref; /* the prefix of the QName */ - int n_pref; - xmlChar * name; /* the localname of the QName */ - int n_name; - xmlChar * str; /* the second xmlChar * */ - int n_str; - - for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - mem_base = xmlMemBlocks(); - pref = gen_const_xmlChar_ptr(n_pref, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - str = gen_const_xmlChar_ptr(n_str, 2); - - ret_val = xmlStrQEqual((const xmlChar *)pref, (const xmlChar *)name, (const xmlChar *)str); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_pref, (const xmlChar *)pref, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrQEqual", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_pref); - printf(" %d", n_name); - printf(" %d", n_str); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStrVPrintf(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlStrcasecmp(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlChar * str1; /* the first xmlChar * */ - int n_str1; - xmlChar * str2; /* the second xmlChar * */ - int n_str2; - - for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) { - for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) { - mem_base = xmlMemBlocks(); - str1 = gen_const_xmlChar_ptr(n_str1, 0); - str2 = gen_const_xmlChar_ptr(n_str2, 1); - - ret_val = xmlStrcasecmp((const xmlChar *)str1, (const xmlChar *)str2); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0); - des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrcasecmp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_str1); - printf(" %d", n_str2); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStrcasestr(void) { - int test_ret = 0; - - int mem_base; - const xmlChar * ret_val; - xmlChar * str; /* the xmlChar * array (haystack) */ - int n_str; - xmlChar * val; /* the xmlChar to search (needle) */ - int n_val; - - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) { - mem_base = xmlMemBlocks(); - str = gen_const_xmlChar_ptr(n_str, 0); - val = gen_const_xmlChar_ptr(n_val, 1); - - ret_val = xmlStrcasestr((const xmlChar *)str, (const xmlChar *)val); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0); - des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrcasestr", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_str); - printf(" %d", n_val); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStrchr(void) { - int test_ret = 0; - - int mem_base; - const xmlChar * ret_val; - xmlChar * str; /* the xmlChar * array */ - int n_str; - xmlChar val; /* the xmlChar to search */ - int n_val; - - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) { - mem_base = xmlMemBlocks(); - str = gen_const_xmlChar_ptr(n_str, 0); - val = gen_xmlChar(n_val, 1); - - ret_val = xmlStrchr((const xmlChar *)str, val); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0); - des_xmlChar(n_val, val, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrchr", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_str); - printf(" %d", n_val); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStrcmp(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlChar * str1; /* the first xmlChar * */ - int n_str1; - xmlChar * str2; /* the second xmlChar * */ - int n_str2; - - for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) { - for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) { - mem_base = xmlMemBlocks(); - str1 = gen_const_xmlChar_ptr(n_str1, 0); - str2 = gen_const_xmlChar_ptr(n_str2, 1); - - ret_val = xmlStrcmp((const xmlChar *)str1, (const xmlChar *)str2); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0); - des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrcmp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_str1); - printf(" %d", n_str2); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStrdup(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlChar * cur; /* the input xmlChar * */ - int n_cur; - - for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { - mem_base = xmlMemBlocks(); - cur = gen_const_xmlChar_ptr(n_cur, 0); - - ret_val = xmlStrdup((const xmlChar *)cur); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrdup", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStrlen(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlChar * str; /* the xmlChar * array */ - int n_str; - - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - mem_base = xmlMemBlocks(); - str = gen_const_xmlChar_ptr(n_str, 0); - - ret_val = xmlStrlen((const xmlChar *)str); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrlen", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_str); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStrncasecmp(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlChar * str1; /* the first xmlChar * */ - int n_str1; - xmlChar * str2; /* the second xmlChar * */ - int n_str2; - int len; /* the max comparison length */ - int n_len; - - for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) { - for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - str1 = gen_const_xmlChar_ptr(n_str1, 0); - str2 = gen_const_xmlChar_ptr(n_str2, 1); - len = gen_int(n_len, 2); - - ret_val = xmlStrncasecmp((const xmlChar *)str1, (const xmlChar *)str2, len); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0); - des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrncasecmp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_str1); - printf(" %d", n_str2); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStrncatNew(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlChar * str1; /* first xmlChar string */ - int n_str1; - xmlChar * str2; /* second xmlChar string */ - int n_str2; - int len; /* the len of @str2 or < 0 */ - int n_len; - - for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) { - for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - str1 = gen_const_xmlChar_ptr(n_str1, 0); - str2 = gen_const_xmlChar_ptr(n_str2, 1); - len = gen_int(n_len, 2); - - ret_val = xmlStrncatNew((const xmlChar *)str1, (const xmlChar *)str2, len); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0); - des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrncatNew", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_str1); - printf(" %d", n_str2); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStrncmp(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlChar * str1; /* the first xmlChar * */ - int n_str1; - xmlChar * str2; /* the second xmlChar * */ - int n_str2; - int len; /* the max comparison length */ - int n_len; - - for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) { - for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - str1 = gen_const_xmlChar_ptr(n_str1, 0); - str2 = gen_const_xmlChar_ptr(n_str2, 1); - len = gen_int(n_len, 2); - - ret_val = xmlStrncmp((const xmlChar *)str1, (const xmlChar *)str2, len); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0); - des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrncmp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_str1); - printf(" %d", n_str2); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStrndup(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlChar * cur; /* the input xmlChar * */ - int n_cur; - int len; /* the len of @cur */ - int n_len; - - for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - cur = gen_const_xmlChar_ptr(n_cur, 0); - len = gen_int(n_len, 1); - - ret_val = xmlStrndup((const xmlChar *)cur, len); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0); - des_int(n_len, len, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrndup", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_len); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStrstr(void) { - int test_ret = 0; - - int mem_base; - const xmlChar * ret_val; - xmlChar * str; /* the xmlChar * array (haystack) */ - int n_str; - xmlChar * val; /* the xmlChar to search (needle) */ - int n_val; - - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) { - mem_base = xmlMemBlocks(); - str = gen_const_xmlChar_ptr(n_str, 0); - val = gen_const_xmlChar_ptr(n_val, 1); - - ret_val = xmlStrstr((const xmlChar *)str, (const xmlChar *)val); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0); - des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrstr", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_str); - printf(" %d", n_val); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlStrsub(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlChar * str; /* the xmlChar * array (haystack) */ - int n_str; - int start; /* the index of the first char (zero based) */ - int n_start; - int len; /* the length of the substring */ - int n_len; - - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - for (n_start = 0;n_start < gen_nb_int;n_start++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - str = gen_const_xmlChar_ptr(n_str, 0); - start = gen_int(n_start, 1); - len = gen_int(n_len, 2); - - ret_val = xmlStrsub((const xmlChar *)str, start, len); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0); - des_int(n_start, start, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlStrsub", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_str); - printf(" %d", n_start); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlUTF8Charcmp(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlChar * utf1; /* pointer to first UTF8 char */ - int n_utf1; - xmlChar * utf2; /* pointer to second UTF8 char */ - int n_utf2; - - for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) { - for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) { - mem_base = xmlMemBlocks(); - utf1 = gen_const_xmlChar_ptr(n_utf1, 0); - utf2 = gen_const_xmlChar_ptr(n_utf2, 1); - - ret_val = xmlUTF8Charcmp((const xmlChar *)utf1, (const xmlChar *)utf2); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_utf1, (const xmlChar *)utf1, 0); - des_const_xmlChar_ptr(n_utf2, (const xmlChar *)utf2, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUTF8Charcmp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_utf1); - printf(" %d", n_utf2); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlUTF8Size(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlChar * utf; /* pointer to the UTF8 character */ - int n_utf; - - for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) { - mem_base = xmlMemBlocks(); - utf = gen_const_xmlChar_ptr(n_utf, 0); - - ret_val = xmlUTF8Size((const xmlChar *)utf); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUTF8Size", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_utf); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlUTF8Strlen(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlChar * utf; /* a sequence of UTF-8 encoded bytes */ - int n_utf; - - for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) { - mem_base = xmlMemBlocks(); - utf = gen_const_xmlChar_ptr(n_utf, 0); - - ret_val = xmlUTF8Strlen((const xmlChar *)utf); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUTF8Strlen", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_utf); - printf("\n"); - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlUTF8Strloc(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlChar * utf; /* the input UTF8 * */ - int n_utf; - xmlChar * utfchar; /* the UTF8 character to be found */ - int n_utfchar; - - for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) { - for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) { - mem_base = xmlMemBlocks(); - utf = gen_const_xmlChar_ptr(n_utf, 0); - utfchar = gen_const_xmlChar_ptr(n_utfchar, 1); - - ret_val = xmlUTF8Strloc((const xmlChar *)utf, (const xmlChar *)utfchar); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0); - des_const_xmlChar_ptr(n_utfchar, (const xmlChar *)utfchar, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUTF8Strloc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_utf); - printf(" %d", n_utfchar); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlUTF8Strndup(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlChar * utf; /* the input UTF8 * */ - int n_utf; - int len; /* the len of @utf (in chars) */ - int n_len; - - for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - utf = gen_const_xmlChar_ptr(n_utf, 0); - len = gen_int(n_len, 1); - - ret_val = xmlUTF8Strndup((const xmlChar *)utf, len); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0); - des_int(n_len, len, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUTF8Strndup", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_utf); - printf(" %d", n_len); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlUTF8Strpos(void) { - int test_ret = 0; - - int mem_base; - const xmlChar * ret_val; - xmlChar * utf; /* the input UTF8 * */ - int n_utf; - int pos; /* the position of the desired UTF8 char (in chars) */ - int n_pos; - - for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) { - for (n_pos = 0;n_pos < gen_nb_int;n_pos++) { - mem_base = xmlMemBlocks(); - utf = gen_const_xmlChar_ptr(n_utf, 0); - pos = gen_int(n_pos, 1); - - ret_val = xmlUTF8Strpos((const xmlChar *)utf, pos); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0); - des_int(n_pos, pos, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUTF8Strpos", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_utf); - printf(" %d", n_pos); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlUTF8Strsize(void) { - int test_ret = 0; - - int mem_base; - int ret_val; - xmlChar * utf; /* a sequence of UTF-8 encoded bytes */ - int n_utf; - int len; /* the number of characters in the array */ - int n_len; - - for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - utf = gen_const_xmlChar_ptr(n_utf, 0); - len = gen_int(n_len, 1); - - ret_val = xmlUTF8Strsize((const xmlChar *)utf, len); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0); - des_int(n_len, len, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUTF8Strsize", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_utf); - printf(" %d", n_len); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int -test_xmlUTF8Strsub(void) { - int test_ret = 0; - - int mem_base; - xmlChar * ret_val; - xmlChar * utf; /* a sequence of UTF-8 encoded bytes */ - int n_utf; - int start; /* relative pos of first char */ - int n_start; - int len; /* total number to copy */ - int n_len; - - for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) { - for (n_start = 0;n_start < gen_nb_int;n_start++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - utf = gen_const_xmlChar_ptr(n_utf, 0); - start = gen_int(n_start, 1); - len = gen_int(n_len, 2); - - ret_val = xmlUTF8Strsub((const xmlChar *)utf, start, len); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0); - des_int(n_start, start, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUTF8Strsub", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_utf); - printf(" %d", n_start); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; - - return(test_ret); -} - -static int -test_xmlstring(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n"); - test_ret += test_xmlCharStrdup(); - test_ret += test_xmlCharStrndup(); - test_ret += test_xmlCheckUTF8(); - test_ret += test_xmlGetUTF8Char(); - test_ret += test_xmlStrEqual(); - test_ret += test_xmlStrPrintf(); - test_ret += test_xmlStrQEqual(); - test_ret += test_xmlStrVPrintf(); - test_ret += test_xmlStrcasecmp(); - test_ret += test_xmlStrcasestr(); - test_ret += test_xmlStrchr(); - test_ret += test_xmlStrcmp(); - test_ret += test_xmlStrdup(); - test_ret += test_xmlStrlen(); - test_ret += test_xmlStrncasecmp(); - test_ret += test_xmlStrncatNew(); - test_ret += test_xmlStrncmp(); - test_ret += test_xmlStrndup(); - test_ret += test_xmlStrstr(); - test_ret += test_xmlStrsub(); - test_ret += test_xmlUTF8Charcmp(); - test_ret += test_xmlUTF8Size(); - test_ret += test_xmlUTF8Strlen(); - test_ret += test_xmlUTF8Strloc(); - test_ret += test_xmlUTF8Strndup(); - test_ret += test_xmlUTF8Strpos(); - test_ret += test_xmlUTF8Strsize(); - test_ret += test_xmlUTF8Strsub(); - - if (test_ret != 0) - printf("Module xmlstring: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlUCSIsAegeanNumbers(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsAegeanNumbers(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsAlphabeticPresentationForms(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsAlphabeticPresentationForms(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsArabic(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsArabic(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsArabic", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsArabicPresentationFormsA(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsArabicPresentationFormsA(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsArabicPresentationFormsB(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsArabicPresentationFormsB(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsArmenian(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsArmenian(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsArmenian", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsArrows(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsArrows(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsArrows", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsBasicLatin(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsBasicLatin(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsBasicLatin", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsBengali(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsBengali(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsBengali", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsBlock(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - char * block; /* UCS block name */ - int n_block; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - block = gen_const_char_ptr(n_block, 1); - - ret_val = xmlUCSIsBlock(code, (const char *)block); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - des_const_char_ptr(n_block, (const char *)block, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsBlock", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf(" %d", n_block); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsBlockElements(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsBlockElements(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsBlockElements", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsBopomofo(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsBopomofo(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsBopomofo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsBopomofoExtended(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsBopomofoExtended(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsBoxDrawing(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsBoxDrawing(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsBoxDrawing", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsBraillePatterns(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsBraillePatterns(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsBraillePatterns", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsBuhid(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsBuhid(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsBuhid", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsByzantineMusicalSymbols(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsByzantineMusicalSymbols(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCJKCompatibility(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCJKCompatibility(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCJKCompatibilityForms(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCJKCompatibilityForms(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCJKCompatibilityIdeographs(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCJKCompatibilityIdeographs(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCJKRadicalsSupplement(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCJKRadicalsSupplement(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCJKSymbolsandPunctuation(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCJKSymbolsandPunctuation(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCJKUnifiedIdeographs(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCJKUnifiedIdeographs(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCat(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - char * cat; /* UCS Category name */ - int n_cat; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - cat = gen_const_char_ptr(n_cat, 1); - - ret_val = xmlUCSIsCat(code, (const char *)cat); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - des_const_char_ptr(n_cat, (const char *)cat, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCat", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf(" %d", n_cat); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatC(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatC(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatC", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatCc(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatCc(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatCc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatCf(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatCf(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatCf", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatCo(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatCo(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatCo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatCs(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatCs(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatCs", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatL(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatL(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatL", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatLl(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatLl(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatLl", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatLm(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatLm(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatLm", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatLo(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatLo(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatLo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatLt(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatLt(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatLt", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatLu(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatLu(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatLu", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatM(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatM(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatM", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatMc(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatMc(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatMc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatMe(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatMe(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatMe", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatMn(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatMn(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatMn", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatN(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatN(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatN", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatNd(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatNd(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatNd", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatNl(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatNl(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatNl", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatNo(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatNo(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatNo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatP(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatP(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatP", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatPc(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatPc(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatPc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatPd(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatPd(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatPd", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatPe(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatPe(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatPe", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatPf(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatPf(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatPf", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatPi(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatPi(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatPi", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatPo(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatPo(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatPo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatPs(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatPs(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatPs", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatS(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatS(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatS", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatSc(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatSc(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatSc", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatSk(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatSk(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatSk", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatSm(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatSm(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatSm", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatSo(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatSo(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatSo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatZ(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatZ(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatZ", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatZl(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatZl(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatZl", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatZp(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatZp(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatZp", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCatZs(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCatZs(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCatZs", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCherokee(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCherokee(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCherokee", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCombiningDiacriticalMarks(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCombiningDiacriticalMarks(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCombiningHalfMarks(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCombiningHalfMarks(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCombiningMarksforSymbols(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCombiningMarksforSymbols(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsControlPictures(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsControlPictures(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsControlPictures", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCurrencySymbols(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCurrencySymbols(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCypriotSyllabary(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCypriotSyllabary(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCyrillic(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCyrillic(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCyrillic", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsCyrillicSupplement(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsCyrillicSupplement(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsDeseret(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsDeseret(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsDeseret", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsDevanagari(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsDevanagari(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsDevanagari", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsDingbats(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsDingbats(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsDingbats", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsEnclosedAlphanumerics(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsEnclosedAlphanumerics(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsEnclosedCJKLettersandMonths(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsEthiopic(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsEthiopic(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsEthiopic", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsGeneralPunctuation(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsGeneralPunctuation(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsGeometricShapes(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsGeometricShapes(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsGeometricShapes", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsGeorgian(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsGeorgian(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsGeorgian", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsGothic(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsGothic(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsGothic", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsGreek(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsGreek(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsGreek", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsGreekExtended(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsGreekExtended(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsGreekExtended", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsGreekandCoptic(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsGreekandCoptic(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsGujarati(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsGujarati(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsGujarati", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsGurmukhi(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsGurmukhi(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsGurmukhi", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsHalfwidthandFullwidthForms(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsHalfwidthandFullwidthForms(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsHangulCompatibilityJamo(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsHangulCompatibilityJamo(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsHangulJamo(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsHangulJamo(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsHangulJamo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsHangulSyllables(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsHangulSyllables(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsHangulSyllables", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsHanunoo(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsHanunoo(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsHanunoo", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsHebrew(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsHebrew(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsHebrew", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsHighPrivateUseSurrogates(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsHighPrivateUseSurrogates(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsHighSurrogates(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsHighSurrogates(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsHighSurrogates", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsHiragana(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsHiragana(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsHiragana", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsIPAExtensions(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsIPAExtensions(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsIPAExtensions", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsIdeographicDescriptionCharacters(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsIdeographicDescriptionCharacters(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsKanbun(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsKanbun(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsKanbun", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsKangxiRadicals(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsKangxiRadicals(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsKannada(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsKannada(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsKannada", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsKatakana(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsKatakana(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsKatakana", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsKatakanaPhoneticExtensions(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsKatakanaPhoneticExtensions(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsKhmer(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsKhmer(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsKhmer", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsKhmerSymbols(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsKhmerSymbols(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsLao(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsLao(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsLao", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsLatin1Supplement(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsLatin1Supplement(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsLatinExtendedA(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsLatinExtendedA(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsLatinExtendedAdditional(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsLatinExtendedAdditional(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsLatinExtendedB(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsLatinExtendedB(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsLetterlikeSymbols(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsLetterlikeSymbols(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsLimbu(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsLimbu(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsLimbu", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsLinearBIdeograms(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsLinearBIdeograms(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsLinearBSyllabary(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsLinearBSyllabary(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsLowSurrogates(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsLowSurrogates(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsLowSurrogates", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsMalayalam(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsMalayalam(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsMalayalam", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsMathematicalAlphanumericSymbols(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsMathematicalOperators(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsMathematicalOperators(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsMiscellaneousSymbols(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsMiscellaneousSymbols(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsMiscellaneousSymbolsandArrows(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsMiscellaneousTechnical(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsMiscellaneousTechnical(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsMongolian(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsMongolian(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsMongolian", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsMusicalSymbols(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsMusicalSymbols(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsMyanmar(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsMyanmar(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsMyanmar", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsNumberForms(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsNumberForms(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsNumberForms", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsOgham(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsOgham(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsOgham", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsOldItalic(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsOldItalic(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsOldItalic", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsOpticalCharacterRecognition(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsOpticalCharacterRecognition(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsOriya(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsOriya(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsOriya", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsOsmanya(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsOsmanya(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsOsmanya", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsPhoneticExtensions(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsPhoneticExtensions(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsPrivateUse(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsPrivateUse(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsPrivateUse", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsPrivateUseArea(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsPrivateUseArea(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsRunic(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsRunic(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsRunic", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsShavian(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsShavian(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsShavian", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsSinhala(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsSinhala(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsSinhala", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsSmallFormVariants(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsSmallFormVariants(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsSpacingModifierLetters(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsSpacingModifierLetters(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsSpecials(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsSpecials(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsSpecials", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsSuperscriptsandSubscripts(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsSuperscriptsandSubscripts(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsSupplementalArrowsA(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsSupplementalArrowsA(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsSupplementalArrowsB(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsSupplementalArrowsB(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsSupplementalMathematicalOperators(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsSupplementalMathematicalOperators(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsSupplementaryPrivateUseAreaA(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsSupplementaryPrivateUseAreaB(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsSyriac(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsSyriac(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsSyriac", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsTagalog(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsTagalog(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsTagalog", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsTagbanwa(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsTagbanwa(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsTagbanwa", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsTags(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsTags(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsTags", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsTaiLe(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsTaiLe(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsTaiLe", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsTaiXuanJingSymbols(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsTaiXuanJingSymbols(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsTamil(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsTamil(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsTamil", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsTelugu(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsTelugu(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsTelugu", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsThaana(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsThaana(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsThaana", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsThai(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsThai(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsThai", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsTibetan(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsTibetan(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsTibetan", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsUgaritic(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsUgaritic(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsUgaritic", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsVariationSelectors(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsVariationSelectors(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsVariationSelectors", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsVariationSelectorsSupplement(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsVariationSelectorsSupplement(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsYiRadicals(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsYiRadicals(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsYiRadicals", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsYiSyllables(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsYiSyllables(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsYiSyllables", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlUCSIsYijingHexagramSymbols(void) { - int test_ret = 0; - -#if defined(LIBXML_UNICODE_ENABLED) - int mem_base; - int ret_val; - int code; /* UCS code point */ - int n_code; - - for (n_code = 0;n_code < gen_nb_int;n_code++) { - mem_base = xmlMemBlocks(); - code = gen_int(n_code, 0); - - ret_val = xmlUCSIsYijingHexagramSymbols(code); - desret_int(ret_val); - call_tests++; - des_int(n_code, code, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_code); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_xmlunicode(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing xmlunicode : 166 of 166 functions ...\n"); - test_ret += test_xmlUCSIsAegeanNumbers(); - test_ret += test_xmlUCSIsAlphabeticPresentationForms(); - test_ret += test_xmlUCSIsArabic(); - test_ret += test_xmlUCSIsArabicPresentationFormsA(); - test_ret += test_xmlUCSIsArabicPresentationFormsB(); - test_ret += test_xmlUCSIsArmenian(); - test_ret += test_xmlUCSIsArrows(); - test_ret += test_xmlUCSIsBasicLatin(); - test_ret += test_xmlUCSIsBengali(); - test_ret += test_xmlUCSIsBlock(); - test_ret += test_xmlUCSIsBlockElements(); - test_ret += test_xmlUCSIsBopomofo(); - test_ret += test_xmlUCSIsBopomofoExtended(); - test_ret += test_xmlUCSIsBoxDrawing(); - test_ret += test_xmlUCSIsBraillePatterns(); - test_ret += test_xmlUCSIsBuhid(); - test_ret += test_xmlUCSIsByzantineMusicalSymbols(); - test_ret += test_xmlUCSIsCJKCompatibility(); - test_ret += test_xmlUCSIsCJKCompatibilityForms(); - test_ret += test_xmlUCSIsCJKCompatibilityIdeographs(); - test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement(); - test_ret += test_xmlUCSIsCJKRadicalsSupplement(); - test_ret += test_xmlUCSIsCJKSymbolsandPunctuation(); - test_ret += test_xmlUCSIsCJKUnifiedIdeographs(); - test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA(); - test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB(); - test_ret += test_xmlUCSIsCat(); - test_ret += test_xmlUCSIsCatC(); - test_ret += test_xmlUCSIsCatCc(); - test_ret += test_xmlUCSIsCatCf(); - test_ret += test_xmlUCSIsCatCo(); - test_ret += test_xmlUCSIsCatCs(); - test_ret += test_xmlUCSIsCatL(); - test_ret += test_xmlUCSIsCatLl(); - test_ret += test_xmlUCSIsCatLm(); - test_ret += test_xmlUCSIsCatLo(); - test_ret += test_xmlUCSIsCatLt(); - test_ret += test_xmlUCSIsCatLu(); - test_ret += test_xmlUCSIsCatM(); - test_ret += test_xmlUCSIsCatMc(); - test_ret += test_xmlUCSIsCatMe(); - test_ret += test_xmlUCSIsCatMn(); - test_ret += test_xmlUCSIsCatN(); - test_ret += test_xmlUCSIsCatNd(); - test_ret += test_xmlUCSIsCatNl(); - test_ret += test_xmlUCSIsCatNo(); - test_ret += test_xmlUCSIsCatP(); - test_ret += test_xmlUCSIsCatPc(); - test_ret += test_xmlUCSIsCatPd(); - test_ret += test_xmlUCSIsCatPe(); - test_ret += test_xmlUCSIsCatPf(); - test_ret += test_xmlUCSIsCatPi(); - test_ret += test_xmlUCSIsCatPo(); - test_ret += test_xmlUCSIsCatPs(); - test_ret += test_xmlUCSIsCatS(); - test_ret += test_xmlUCSIsCatSc(); - test_ret += test_xmlUCSIsCatSk(); - test_ret += test_xmlUCSIsCatSm(); - test_ret += test_xmlUCSIsCatSo(); - test_ret += test_xmlUCSIsCatZ(); - test_ret += test_xmlUCSIsCatZl(); - test_ret += test_xmlUCSIsCatZp(); - test_ret += test_xmlUCSIsCatZs(); - test_ret += test_xmlUCSIsCherokee(); - test_ret += test_xmlUCSIsCombiningDiacriticalMarks(); - test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols(); - test_ret += test_xmlUCSIsCombiningHalfMarks(); - test_ret += test_xmlUCSIsCombiningMarksforSymbols(); - test_ret += test_xmlUCSIsControlPictures(); - test_ret += test_xmlUCSIsCurrencySymbols(); - test_ret += test_xmlUCSIsCypriotSyllabary(); - test_ret += test_xmlUCSIsCyrillic(); - test_ret += test_xmlUCSIsCyrillicSupplement(); - test_ret += test_xmlUCSIsDeseret(); - test_ret += test_xmlUCSIsDevanagari(); - test_ret += test_xmlUCSIsDingbats(); - test_ret += test_xmlUCSIsEnclosedAlphanumerics(); - test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths(); - test_ret += test_xmlUCSIsEthiopic(); - test_ret += test_xmlUCSIsGeneralPunctuation(); - test_ret += test_xmlUCSIsGeometricShapes(); - test_ret += test_xmlUCSIsGeorgian(); - test_ret += test_xmlUCSIsGothic(); - test_ret += test_xmlUCSIsGreek(); - test_ret += test_xmlUCSIsGreekExtended(); - test_ret += test_xmlUCSIsGreekandCoptic(); - test_ret += test_xmlUCSIsGujarati(); - test_ret += test_xmlUCSIsGurmukhi(); - test_ret += test_xmlUCSIsHalfwidthandFullwidthForms(); - test_ret += test_xmlUCSIsHangulCompatibilityJamo(); - test_ret += test_xmlUCSIsHangulJamo(); - test_ret += test_xmlUCSIsHangulSyllables(); - test_ret += test_xmlUCSIsHanunoo(); - test_ret += test_xmlUCSIsHebrew(); - test_ret += test_xmlUCSIsHighPrivateUseSurrogates(); - test_ret += test_xmlUCSIsHighSurrogates(); - test_ret += test_xmlUCSIsHiragana(); - test_ret += test_xmlUCSIsIPAExtensions(); - test_ret += test_xmlUCSIsIdeographicDescriptionCharacters(); - test_ret += test_xmlUCSIsKanbun(); - test_ret += test_xmlUCSIsKangxiRadicals(); - test_ret += test_xmlUCSIsKannada(); - test_ret += test_xmlUCSIsKatakana(); - test_ret += test_xmlUCSIsKatakanaPhoneticExtensions(); - test_ret += test_xmlUCSIsKhmer(); - test_ret += test_xmlUCSIsKhmerSymbols(); - test_ret += test_xmlUCSIsLao(); - test_ret += test_xmlUCSIsLatin1Supplement(); - test_ret += test_xmlUCSIsLatinExtendedA(); - test_ret += test_xmlUCSIsLatinExtendedAdditional(); - test_ret += test_xmlUCSIsLatinExtendedB(); - test_ret += test_xmlUCSIsLetterlikeSymbols(); - test_ret += test_xmlUCSIsLimbu(); - test_ret += test_xmlUCSIsLinearBIdeograms(); - test_ret += test_xmlUCSIsLinearBSyllabary(); - test_ret += test_xmlUCSIsLowSurrogates(); - test_ret += test_xmlUCSIsMalayalam(); - test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols(); - test_ret += test_xmlUCSIsMathematicalOperators(); - test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA(); - test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB(); - test_ret += test_xmlUCSIsMiscellaneousSymbols(); - test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows(); - test_ret += test_xmlUCSIsMiscellaneousTechnical(); - test_ret += test_xmlUCSIsMongolian(); - test_ret += test_xmlUCSIsMusicalSymbols(); - test_ret += test_xmlUCSIsMyanmar(); - test_ret += test_xmlUCSIsNumberForms(); - test_ret += test_xmlUCSIsOgham(); - test_ret += test_xmlUCSIsOldItalic(); - test_ret += test_xmlUCSIsOpticalCharacterRecognition(); - test_ret += test_xmlUCSIsOriya(); - test_ret += test_xmlUCSIsOsmanya(); - test_ret += test_xmlUCSIsPhoneticExtensions(); - test_ret += test_xmlUCSIsPrivateUse(); - test_ret += test_xmlUCSIsPrivateUseArea(); - test_ret += test_xmlUCSIsRunic(); - test_ret += test_xmlUCSIsShavian(); - test_ret += test_xmlUCSIsSinhala(); - test_ret += test_xmlUCSIsSmallFormVariants(); - test_ret += test_xmlUCSIsSpacingModifierLetters(); - test_ret += test_xmlUCSIsSpecials(); - test_ret += test_xmlUCSIsSuperscriptsandSubscripts(); - test_ret += test_xmlUCSIsSupplementalArrowsA(); - test_ret += test_xmlUCSIsSupplementalArrowsB(); - test_ret += test_xmlUCSIsSupplementalMathematicalOperators(); - test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA(); - test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB(); - test_ret += test_xmlUCSIsSyriac(); - test_ret += test_xmlUCSIsTagalog(); - test_ret += test_xmlUCSIsTagbanwa(); - test_ret += test_xmlUCSIsTags(); - test_ret += test_xmlUCSIsTaiLe(); - test_ret += test_xmlUCSIsTaiXuanJingSymbols(); - test_ret += test_xmlUCSIsTamil(); - test_ret += test_xmlUCSIsTelugu(); - test_ret += test_xmlUCSIsThaana(); - test_ret += test_xmlUCSIsThai(); - test_ret += test_xmlUCSIsTibetan(); - test_ret += test_xmlUCSIsUgaritic(); - test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(); - test_ret += test_xmlUCSIsVariationSelectors(); - test_ret += test_xmlUCSIsVariationSelectorsSupplement(); - test_ret += test_xmlUCSIsYiRadicals(); - test_ret += test_xmlUCSIsYiSyllables(); - test_ret += test_xmlUCSIsYijingHexagramSymbols(); - - if (test_ret != 0) - printf("Module xmlunicode: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlNewTextWriter(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - xmlTextWriterPtr ret_val; - xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */ - int n_out; - - for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) { - mem_base = xmlMemBlocks(); - out = gen_xmlOutputBufferPtr(n_out, 0); - - ret_val = xmlNewTextWriter(out); - if (ret_val != NULL) out = NULL; - desret_xmlTextWriterPtr(ret_val); - call_tests++; - des_xmlOutputBufferPtr(n_out, out, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewTextWriter", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_out); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNewTextWriterFilename(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - xmlTextWriterPtr ret_val; - const char * uri; /* the URI of the resource for the output */ - int n_uri; - int compression; /* compress the output? */ - int n_compression; - - for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) { - for (n_compression = 0;n_compression < gen_nb_int;n_compression++) { - mem_base = xmlMemBlocks(); - uri = gen_fileoutput(n_uri, 0); - compression = gen_int(n_compression, 1); - - ret_val = xmlNewTextWriterFilename(uri, compression); - desret_xmlTextWriterPtr(ret_val); - call_tests++; - des_fileoutput(n_uri, uri, 0); - des_int(n_compression, compression, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewTextWriterFilename", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_uri); - printf(" %d", n_compression); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNewTextWriterMemory(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - xmlTextWriterPtr ret_val; - xmlBufferPtr buf; /* xmlBufferPtr */ - int n_buf; - int compression; /* compress the output? */ - int n_compression; - - for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { - for (n_compression = 0;n_compression < gen_nb_int;n_compression++) { - mem_base = xmlMemBlocks(); - buf = gen_xmlBufferPtr(n_buf, 0); - compression = gen_int(n_compression, 1); - - ret_val = xmlNewTextWriterMemory(buf, compression); - desret_xmlTextWriterPtr(ret_val); - call_tests++; - des_xmlBufferPtr(n_buf, buf, 0); - des_int(n_compression, compression, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewTextWriterMemory", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_buf); - printf(" %d", n_compression); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNewTextWriterPushParser(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - xmlTextWriterPtr ret_val; - xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */ - int n_ctxt; - int compression; /* compress the output? */ - int n_compression; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_compression = 0;n_compression < gen_nb_int;n_compression++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - compression = gen_int(n_compression, 1); - - ret_val = xmlNewTextWriterPushParser(ctxt, compression); - if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL; - desret_xmlTextWriterPtr(ret_val); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_int(n_compression, compression, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewTextWriterPushParser", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_compression); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNewTextWriterTree(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - xmlTextWriterPtr ret_val; - xmlDocPtr doc; /* xmlDocPtr */ - int n_doc; - xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */ - int n_node; - int compression; /* compress the output? */ - int n_compression; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_compression = 0;n_compression < gen_nb_int;n_compression++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - node = gen_xmlNodePtr(n_node, 1); - compression = gen_int(n_compression, 2); - - ret_val = xmlNewTextWriterTree(doc, node, compression); - desret_xmlTextWriterPtr(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - des_xmlNodePtr(n_node, node, 1); - des_int(n_compression, compression, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNewTextWriterTree", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf(" %d", n_node); - printf(" %d", n_compression); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterEndAttribute(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - - ret_val = xmlTextWriterEndAttribute(writer); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterEndAttribute", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterEndCDATA(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - - ret_val = xmlTextWriterEndCDATA(writer); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterEndCDATA", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterEndComment(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - - ret_val = xmlTextWriterEndComment(writer); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterEndComment", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterEndDTD(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - - ret_val = xmlTextWriterEndDTD(writer); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterEndDTD", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterEndDTDAttlist(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - - ret_val = xmlTextWriterEndDTDAttlist(writer); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterEndDTDElement(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - - ret_val = xmlTextWriterEndDTDElement(writer); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterEndDTDElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterEndDTDEntity(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - - ret_val = xmlTextWriterEndDTDEntity(writer); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterEndDocument(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - - ret_val = xmlTextWriterEndDocument(writer); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterEndDocument", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterEndElement(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - - ret_val = xmlTextWriterEndElement(writer); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterEndElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterEndPI(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - - ret_val = xmlTextWriterEndPI(writer); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterEndPI", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterFlush(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - - ret_val = xmlTextWriterFlush(writer); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterFlush", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterFullEndElement(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - - ret_val = xmlTextWriterFullEndElement(writer); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterFullEndElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterSetIndent(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - int indent; /* do indentation? */ - int n_indent; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_indent = 0;n_indent < gen_nb_int;n_indent++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - indent = gen_int(n_indent, 1); - - ret_val = xmlTextWriterSetIndent(writer, indent); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_int(n_indent, indent, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterSetIndent", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_indent); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterSetIndentString(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * str; /* the xmlChar string */ - int n_str; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - str = gen_const_xmlChar_ptr(n_str, 1); - - ret_val = xmlTextWriterSetIndentString(writer, (const xmlChar *)str); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterSetIndentString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_str); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterSetQuoteChar(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar quotechar; /* the quote character */ - int n_quotechar; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_quotechar = 0;n_quotechar < gen_nb_xmlChar;n_quotechar++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - quotechar = gen_xmlChar(n_quotechar, 1); - - ret_val = xmlTextWriterSetQuoteChar(writer, quotechar); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_xmlChar(n_quotechar, quotechar, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterSetQuoteChar", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_quotechar); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterStartAttribute(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * name; /* element name */ - int n_name; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlTextWriterStartAttribute(writer, (const xmlChar *)name); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterStartAttribute", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterStartAttributeNS(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * prefix; /* namespace prefix or NULL */ - int n_prefix; - xmlChar * name; /* element local name */ - int n_name; - xmlChar * namespaceURI; /* namespace URI or NULL */ - int n_namespaceURI; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - prefix = gen_const_xmlChar_ptr(n_prefix, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3); - - ret_val = xmlTextWriterStartAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_prefix); - printf(" %d", n_name); - printf(" %d", n_namespaceURI); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterStartCDATA(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - - ret_val = xmlTextWriterStartCDATA(writer); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterStartCDATA", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterStartComment(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - - ret_val = xmlTextWriterStartComment(writer); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterStartComment", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterStartDTD(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * name; /* the name of the DTD */ - int n_name; - xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */ - int n_pubid; - xmlChar * sysid; /* the system identifier, which is the URI of the DTD */ - int n_sysid; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) { - for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - pubid = gen_const_xmlChar_ptr(n_pubid, 2); - sysid = gen_const_xmlChar_ptr(n_sysid, 3); - - ret_val = xmlTextWriterStartDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2); - des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterStartDTD", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_name); - printf(" %d", n_pubid); - printf(" %d", n_sysid); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterStartDTDAttlist(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * name; /* the name of the DTD ATTLIST */ - int n_name; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlTextWriterStartDTDAttlist(writer, (const xmlChar *)name); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterStartDTDElement(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * name; /* the name of the DTD element */ - int n_name; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlTextWriterStartDTDElement(writer, (const xmlChar *)name); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterStartDTDElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterStartDTDEntity(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - int pe; /* TRUE if this is a parameter entity, FALSE if not */ - int n_pe; - xmlChar * name; /* the name of the DTD ATTLIST */ - int n_name; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_pe = 0;n_pe < gen_nb_int;n_pe++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - pe = gen_int(n_pe, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - - ret_val = xmlTextWriterStartDTDEntity(writer, pe, (const xmlChar *)name); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_int(n_pe, pe, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_pe); - printf(" %d", n_name); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterStartDocument(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - char * version; /* the xml version ("1.0") or NULL for default ("1.0") */ - int n_version; - char * encoding; /* the encoding or NULL for default */ - int n_encoding; - char * standalone; /* "yes" or "no" or NULL for default */ - int n_standalone; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) { - for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { - for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - version = gen_const_char_ptr(n_version, 1); - encoding = gen_const_char_ptr(n_encoding, 2); - standalone = gen_const_char_ptr(n_standalone, 3); - - ret_val = xmlTextWriterStartDocument(writer, (const char *)version, (const char *)encoding, (const char *)standalone); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_char_ptr(n_version, (const char *)version, 1); - des_const_char_ptr(n_encoding, (const char *)encoding, 2); - des_const_char_ptr(n_standalone, (const char *)standalone, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterStartDocument", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_version); - printf(" %d", n_encoding); - printf(" %d", n_standalone); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterStartElement(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * name; /* element name */ - int n_name; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlTextWriterStartElement(writer, (const xmlChar *)name); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterStartElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterStartElementNS(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * prefix; /* namespace prefix or NULL */ - int n_prefix; - xmlChar * name; /* element local name */ - int n_name; - xmlChar * namespaceURI; /* namespace URI or NULL */ - int n_namespaceURI; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - prefix = gen_const_xmlChar_ptr(n_prefix, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3); - - ret_val = xmlTextWriterStartElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterStartElementNS", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_prefix); - printf(" %d", n_name); - printf(" %d", n_namespaceURI); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterStartPI(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * target; /* PI target */ - int n_target; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - target = gen_const_xmlChar_ptr(n_target, 1); - - ret_val = xmlTextWriterStartPI(writer, (const xmlChar *)target); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterStartPI", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_target); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteAttribute(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * name; /* attribute name */ - int n_name; - xmlChar * content; /* attribute content */ - int n_content; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - content = gen_const_xmlChar_ptr(n_content, 2); - - ret_val = xmlTextWriterWriteAttribute(writer, (const xmlChar *)name, (const xmlChar *)content); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteAttribute", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_name); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteAttributeNS(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * prefix; /* namespace prefix */ - int n_prefix; - xmlChar * name; /* attribute local name */ - int n_name; - xmlChar * namespaceURI; /* namespace URI */ - int n_namespaceURI; - xmlChar * content; /* attribute content */ - int n_content; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - prefix = gen_const_xmlChar_ptr(n_prefix, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3); - content = gen_const_xmlChar_ptr(n_content, 4); - - ret_val = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_prefix); - printf(" %d", n_name); - printf(" %d", n_namespaceURI); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteBase64(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - char * data; /* binary data */ - int n_data; - int start; /* the position within the data of the first byte to encode */ - int n_start; - int len; /* the number of bytes to encode */ - int n_len; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) { - for (n_start = 0;n_start < gen_nb_int;n_start++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - data = gen_const_char_ptr(n_data, 1); - start = gen_int(n_start, 2); - len = gen_int(n_len, 3); - - ret_val = xmlTextWriterWriteBase64(writer, (const char *)data, start, len); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_char_ptr(n_data, (const char *)data, 1); - des_int(n_start, start, 2); - des_int(n_len, len, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteBase64", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_data); - printf(" %d", n_start); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteBinHex(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - char * data; /* binary data */ - int n_data; - int start; /* the position within the data of the first byte to encode */ - int n_start; - int len; /* the number of bytes to encode */ - int n_len; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) { - for (n_start = 0;n_start < gen_nb_int;n_start++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - data = gen_const_char_ptr(n_data, 1); - start = gen_int(n_start, 2); - len = gen_int(n_len, 3); - - ret_val = xmlTextWriterWriteBinHex(writer, (const char *)data, start, len); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_char_ptr(n_data, (const char *)data, 1); - des_int(n_start, start, 2); - des_int(n_len, len, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteBinHex", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_data); - printf(" %d", n_start); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteCDATA(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * content; /* CDATA content */ - int n_content; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - content = gen_const_xmlChar_ptr(n_content, 1); - - ret_val = xmlTextWriterWriteCDATA(writer, (const xmlChar *)content); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteCDATA", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_content); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteComment(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * content; /* comment string */ - int n_content; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - content = gen_const_xmlChar_ptr(n_content, 1); - - ret_val = xmlTextWriterWriteComment(writer, (const xmlChar *)content); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteComment", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_content); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteDTD(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * name; /* the name of the DTD */ - int n_name; - xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */ - int n_pubid; - xmlChar * sysid; /* the system identifier, which is the URI of the DTD */ - int n_sysid; - xmlChar * subset; /* string content of the DTD */ - int n_subset; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) { - for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) { - for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - pubid = gen_const_xmlChar_ptr(n_pubid, 2); - sysid = gen_const_xmlChar_ptr(n_sysid, 3); - subset = gen_const_xmlChar_ptr(n_subset, 4); - - ret_val = xmlTextWriterWriteDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)subset); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2); - des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3); - des_const_xmlChar_ptr(n_subset, (const xmlChar *)subset, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteDTD", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_name); - printf(" %d", n_pubid); - printf(" %d", n_sysid); - printf(" %d", n_subset); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteDTDAttlist(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * name; /* the name of the DTD ATTLIST */ - int n_name; - xmlChar * content; /* content of the ATTLIST */ - int n_content; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - content = gen_const_xmlChar_ptr(n_content, 2); - - ret_val = xmlTextWriterWriteDTDAttlist(writer, (const xmlChar *)name, (const xmlChar *)content); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_name); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteDTDElement(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * name; /* the name of the DTD element */ - int n_name; - xmlChar * content; /* content of the element */ - int n_content; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - content = gen_const_xmlChar_ptr(n_content, 2); - - ret_val = xmlTextWriterWriteDTDElement(writer, (const xmlChar *)name, (const xmlChar *)content); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_name); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteDTDEntity(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - int pe; /* TRUE if this is a parameter entity, FALSE if not */ - int n_pe; - xmlChar * name; /* the name of the DTD entity */ - int n_name; - xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */ - int n_pubid; - xmlChar * sysid; /* the system identifier, which is the URI of the DTD */ - int n_sysid; - xmlChar * ndataid; /* the xml notation name. */ - int n_ndataid; - xmlChar * content; /* content of the entity */ - int n_content; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_pe = 0;n_pe < gen_nb_int;n_pe++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) { - for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) { - for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - pe = gen_int(n_pe, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - pubid = gen_const_xmlChar_ptr(n_pubid, 3); - sysid = gen_const_xmlChar_ptr(n_sysid, 4); - ndataid = gen_const_xmlChar_ptr(n_ndataid, 5); - content = gen_const_xmlChar_ptr(n_content, 6); - - ret_val = xmlTextWriterWriteDTDEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid, (const xmlChar *)content); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_int(n_pe, pe, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3); - des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4); - des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 6); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_pe); - printf(" %d", n_name); - printf(" %d", n_pubid); - printf(" %d", n_sysid); - printf(" %d", n_ndataid); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteDTDExternalEntity(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - int pe; /* TRUE if this is a parameter entity, FALSE if not */ - int n_pe; - xmlChar * name; /* the name of the DTD entity */ - int n_name; - xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */ - int n_pubid; - xmlChar * sysid; /* the system identifier, which is the URI of the DTD */ - int n_sysid; - xmlChar * ndataid; /* the xml notation name. */ - int n_ndataid; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_pe = 0;n_pe < gen_nb_int;n_pe++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) { - for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) { - for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - pe = gen_int(n_pe, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - pubid = gen_const_xmlChar_ptr(n_pubid, 3); - sysid = gen_const_xmlChar_ptr(n_sysid, 4); - ndataid = gen_const_xmlChar_ptr(n_ndataid, 5); - - ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_int(n_pe, pe, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3); - des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4); - des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_pe); - printf(" %d", n_name); - printf(" %d", n_pubid); - printf(" %d", n_sysid); - printf(" %d", n_ndataid); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteDTDExternalEntityContents(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */ - int n_pubid; - xmlChar * sysid; /* the system identifier, which is the URI of the DTD */ - int n_sysid; - xmlChar * ndataid; /* the xml notation name. */ - int n_ndataid; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) { - for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) { - for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - pubid = gen_const_xmlChar_ptr(n_pubid, 1); - sysid = gen_const_xmlChar_ptr(n_sysid, 2); - ndataid = gen_const_xmlChar_ptr(n_ndataid, 3); - - ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 1); - des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 2); - des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_pubid); - printf(" %d", n_sysid); - printf(" %d", n_ndataid); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteDTDInternalEntity(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - int pe; /* TRUE if this is a parameter entity, FALSE if not */ - int n_pe; - xmlChar * name; /* the name of the DTD entity */ - int n_name; - xmlChar * content; /* content of the entity */ - int n_content; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_pe = 0;n_pe < gen_nb_int;n_pe++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - pe = gen_int(n_pe, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - content = gen_const_xmlChar_ptr(n_content, 3); - - ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)content); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_int(n_pe, pe, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_pe); - printf(" %d", n_name); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteDTDNotation(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * name; /* the name of the xml notation */ - int n_name; - xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */ - int n_pubid; - xmlChar * sysid; /* the system identifier, which is the URI of the DTD */ - int n_sysid; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) { - for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - pubid = gen_const_xmlChar_ptr(n_pubid, 2); - sysid = gen_const_xmlChar_ptr(n_sysid, 3); - - ret_val = xmlTextWriterWriteDTDNotation(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2); - des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_name); - printf(" %d", n_pubid); - printf(" %d", n_sysid); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteElement(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * name; /* element name */ - int n_name; - xmlChar * content; /* element content */ - int n_content; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - content = gen_const_xmlChar_ptr(n_content, 2); - - ret_val = xmlTextWriterWriteElement(writer, (const xmlChar *)name, (const xmlChar *)content); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteElement", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_name); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteElementNS(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * prefix; /* namespace prefix */ - int n_prefix; - xmlChar * name; /* element local name */ - int n_name; - xmlChar * namespaceURI; /* namespace URI */ - int n_namespaceURI; - xmlChar * content; /* element content */ - int n_content; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - prefix = gen_const_xmlChar_ptr(n_prefix, 1); - name = gen_const_xmlChar_ptr(n_name, 2); - namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3); - content = gen_const_xmlChar_ptr(n_content, 4); - - ret_val = xmlTextWriterWriteElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); - des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteElementNS", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_prefix); - printf(" %d", n_name); - printf(" %d", n_namespaceURI); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteFormatAttribute(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteFormatAttributeNS(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteFormatCDATA(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteFormatComment(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteFormatDTD(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteFormatDTDAttlist(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteFormatDTDElement(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteFormatDTDInternalEntity(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteFormatElement(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteFormatElementNS(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteFormatPI(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteFormatRaw(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteFormatString(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWritePI(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * target; /* PI target */ - int n_target; - xmlChar * content; /* PI content */ - int n_content; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - target = gen_const_xmlChar_ptr(n_target, 1); - content = gen_const_xmlChar_ptr(n_content, 2); - - ret_val = xmlTextWriterWritePI(writer, (const xmlChar *)target, (const xmlChar *)content); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWritePI", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_target); - printf(" %d", n_content); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteRaw(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * content; /* text string */ - int n_content; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - content = gen_const_xmlChar_ptr(n_content, 1); - - ret_val = xmlTextWriterWriteRaw(writer, (const xmlChar *)content); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteRaw", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_content); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteRawLen(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * content; /* text string */ - int n_content; - int len; /* length of the text string */ - int n_len; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - for (n_len = 0;n_len < gen_nb_int;n_len++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - content = gen_const_xmlChar_ptr(n_content, 1); - len = gen_int(n_len, 2); - - ret_val = xmlTextWriterWriteRawLen(writer, (const xmlChar *)content, len); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1); - des_int(n_len, len, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteRawLen", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_content); - printf(" %d", n_len); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteString(void) { - int test_ret = 0; - -#if defined(LIBXML_WRITER_ENABLED) - int mem_base; - int ret_val; - xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ - int n_writer; - xmlChar * content; /* text string */ - int n_content; - - for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { - for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { - mem_base = xmlMemBlocks(); - writer = gen_xmlTextWriterPtr(n_writer, 0); - content = gen_const_xmlChar_ptr(n_content, 1); - - ret_val = xmlTextWriterWriteString(writer, (const xmlChar *)content); - desret_int(ret_val); - call_tests++; - des_xmlTextWriterPtr(n_writer, writer, 0); - des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlTextWriterWriteString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_writer); - printf(" %d", n_content); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlTextWriterWriteVFormatAttribute(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteVFormatAttributeNS(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteVFormatCDATA(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteVFormatComment(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteVFormatDTD(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteVFormatDTDAttlist(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteVFormatDTDElement(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteVFormatDTDInternalEntity(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteVFormatElement(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteVFormatElementNS(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteVFormatPI(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteVFormatRaw(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlTextWriterWriteVFormatString(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - -static int -test_xmlwriter(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing xmlwriter : 52 of 80 functions ...\n"); - test_ret += test_xmlNewTextWriter(); - test_ret += test_xmlNewTextWriterFilename(); - test_ret += test_xmlNewTextWriterMemory(); - test_ret += test_xmlNewTextWriterPushParser(); - test_ret += test_xmlNewTextWriterTree(); - test_ret += test_xmlTextWriterEndAttribute(); - test_ret += test_xmlTextWriterEndCDATA(); - test_ret += test_xmlTextWriterEndComment(); - test_ret += test_xmlTextWriterEndDTD(); - test_ret += test_xmlTextWriterEndDTDAttlist(); - test_ret += test_xmlTextWriterEndDTDElement(); - test_ret += test_xmlTextWriterEndDTDEntity(); - test_ret += test_xmlTextWriterEndDocument(); - test_ret += test_xmlTextWriterEndElement(); - test_ret += test_xmlTextWriterEndPI(); - test_ret += test_xmlTextWriterFlush(); - test_ret += test_xmlTextWriterFullEndElement(); - test_ret += test_xmlTextWriterSetIndent(); - test_ret += test_xmlTextWriterSetIndentString(); - test_ret += test_xmlTextWriterSetQuoteChar(); - test_ret += test_xmlTextWriterStartAttribute(); - test_ret += test_xmlTextWriterStartAttributeNS(); - test_ret += test_xmlTextWriterStartCDATA(); - test_ret += test_xmlTextWriterStartComment(); - test_ret += test_xmlTextWriterStartDTD(); - test_ret += test_xmlTextWriterStartDTDAttlist(); - test_ret += test_xmlTextWriterStartDTDElement(); - test_ret += test_xmlTextWriterStartDTDEntity(); - test_ret += test_xmlTextWriterStartDocument(); - test_ret += test_xmlTextWriterStartElement(); - test_ret += test_xmlTextWriterStartElementNS(); - test_ret += test_xmlTextWriterStartPI(); - test_ret += test_xmlTextWriterWriteAttribute(); - test_ret += test_xmlTextWriterWriteAttributeNS(); - test_ret += test_xmlTextWriterWriteBase64(); - test_ret += test_xmlTextWriterWriteBinHex(); - test_ret += test_xmlTextWriterWriteCDATA(); - test_ret += test_xmlTextWriterWriteComment(); - test_ret += test_xmlTextWriterWriteDTD(); - test_ret += test_xmlTextWriterWriteDTDAttlist(); - test_ret += test_xmlTextWriterWriteDTDElement(); - test_ret += test_xmlTextWriterWriteDTDEntity(); - test_ret += test_xmlTextWriterWriteDTDExternalEntity(); - test_ret += test_xmlTextWriterWriteDTDExternalEntityContents(); - test_ret += test_xmlTextWriterWriteDTDInternalEntity(); - test_ret += test_xmlTextWriterWriteDTDNotation(); - test_ret += test_xmlTextWriterWriteElement(); - test_ret += test_xmlTextWriterWriteElementNS(); - test_ret += test_xmlTextWriterWriteFormatAttribute(); - test_ret += test_xmlTextWriterWriteFormatAttributeNS(); - test_ret += test_xmlTextWriterWriteFormatCDATA(); - test_ret += test_xmlTextWriterWriteFormatComment(); - test_ret += test_xmlTextWriterWriteFormatDTD(); - test_ret += test_xmlTextWriterWriteFormatDTDAttlist(); - test_ret += test_xmlTextWriterWriteFormatDTDElement(); - test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity(); - test_ret += test_xmlTextWriterWriteFormatElement(); - test_ret += test_xmlTextWriterWriteFormatElementNS(); - test_ret += test_xmlTextWriterWriteFormatPI(); - test_ret += test_xmlTextWriterWriteFormatRaw(); - test_ret += test_xmlTextWriterWriteFormatString(); - test_ret += test_xmlTextWriterWritePI(); - test_ret += test_xmlTextWriterWriteRaw(); - test_ret += test_xmlTextWriterWriteRawLen(); - test_ret += test_xmlTextWriterWriteString(); - test_ret += test_xmlTextWriterWriteVFormatAttribute(); - test_ret += test_xmlTextWriterWriteVFormatAttributeNS(); - test_ret += test_xmlTextWriterWriteVFormatCDATA(); - test_ret += test_xmlTextWriterWriteVFormatComment(); - test_ret += test_xmlTextWriterWriteVFormatDTD(); - test_ret += test_xmlTextWriterWriteVFormatDTDAttlist(); - test_ret += test_xmlTextWriterWriteVFormatDTDElement(); - test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity(); - test_ret += test_xmlTextWriterWriteVFormatElement(); - test_ret += test_xmlTextWriterWriteVFormatElementNS(); - test_ret += test_xmlTextWriterWriteVFormatPI(); - test_ret += test_xmlTextWriterWriteVFormatRaw(); - test_ret += test_xmlTextWriterWriteVFormatString(); - - if (test_ret != 0) - printf("Module xmlwriter: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlXPathCastBooleanToNumber(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - double ret_val; - int val; /* a boolean */ - int n_val; - - for (n_val = 0;n_val < gen_nb_int;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_int(n_val, 0); - - ret_val = xmlXPathCastBooleanToNumber(val); - desret_double(ret_val); - call_tests++; - des_int(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCastBooleanToString(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlChar * ret_val; - int val; /* a boolean */ - int n_val; - - for (n_val = 0;n_val < gen_nb_int;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_int(n_val, 0); - - ret_val = xmlXPathCastBooleanToString(val); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_int(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCastBooleanToString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCastNodeSetToBoolean(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlNodeSetPtr ns; /* a node-set */ - int n_ns; - - for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) { - mem_base = xmlMemBlocks(); - ns = gen_xmlNodeSetPtr(n_ns, 0); - - ret_val = xmlXPathCastNodeSetToBoolean(ns); - desret_int(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_ns, ns, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ns); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCastNodeSetToNumber(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - double ret_val; - xmlNodeSetPtr ns; /* a node-set */ - int n_ns; - - for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) { - mem_base = xmlMemBlocks(); - ns = gen_xmlNodeSetPtr(n_ns, 0); - - ret_val = xmlXPathCastNodeSetToNumber(ns); - desret_double(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_ns, ns, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ns); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCastNodeSetToString(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlNodeSetPtr ns; /* a node-set */ - int n_ns; - - for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) { - mem_base = xmlMemBlocks(); - ns = gen_xmlNodeSetPtr(n_ns, 0); - - ret_val = xmlXPathCastNodeSetToString(ns); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_ns, ns, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCastNodeSetToString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ns); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCastNodeToNumber(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - double ret_val; - xmlNodePtr node; /* a node */ - int n_node; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - - ret_val = xmlXPathCastNodeToNumber(node); - desret_double(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCastNodeToNumber", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCastNodeToString(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlNodePtr node; /* a node */ - int n_node; - - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - node = gen_xmlNodePtr(n_node, 0); - - ret_val = xmlXPathCastNodeToString(node); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlNodePtr(n_node, node, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCastNodeToString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCastNumberToBoolean(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - double val; /* a number */ - int n_val; - - for (n_val = 0;n_val < gen_nb_double;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_double(n_val, 0); - - ret_val = xmlXPathCastNumberToBoolean(val); - desret_int(ret_val); - call_tests++; - des_double(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCastNumberToString(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlChar * ret_val; - double val; /* a number */ - int n_val; - - for (n_val = 0;n_val < gen_nb_double;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_double(n_val, 0); - - ret_val = xmlXPathCastNumberToString(val); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_double(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCastNumberToString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCastStringToBoolean(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlChar * val; /* a string */ - int n_val; - - for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_const_xmlChar_ptr(n_val, 0); - - ret_val = xmlXPathCastStringToBoolean((const xmlChar *)val); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCastStringToBoolean", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCastStringToNumber(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - double ret_val; - xmlChar * val; /* a string */ - int n_val; - - for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_const_xmlChar_ptr(n_val, 0); - - ret_val = xmlXPathCastStringToNumber((const xmlChar *)val); - desret_double(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCastStringToNumber", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCastToBoolean(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlXPathObjectPtr val; /* an XPath object */ - int n_val; - - for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_xmlXPathObjectPtr(n_val, 0); - - ret_val = xmlXPathCastToBoolean(val); - desret_int(ret_val); - call_tests++; - des_xmlXPathObjectPtr(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCastToBoolean", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCastToNumber(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - double ret_val; - xmlXPathObjectPtr val; /* an XPath object */ - int n_val; - - for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_xmlXPathObjectPtr(n_val, 0); - - ret_val = xmlXPathCastToNumber(val); - desret_double(ret_val); - call_tests++; - des_xmlXPathObjectPtr(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCastToNumber", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCastToString(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlXPathObjectPtr val; /* an XPath object */ - int n_val; - - for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_xmlXPathObjectPtr(n_val, 0); - - ret_val = xmlXPathCastToString(val); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlXPathObjectPtr(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCastToString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCmpNodes(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlNodePtr node1; /* the first node */ - int n_node1; - xmlNodePtr node2; /* the second node */ - int n_node2; - - for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) { - for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { - mem_base = xmlMemBlocks(); - node1 = gen_xmlNodePtr(n_node1, 0); - node2 = gen_xmlNodePtr(n_node2, 1); - - ret_val = xmlXPathCmpNodes(node1, node2); - desret_int(ret_val); - call_tests++; - des_xmlNodePtr(n_node1, node1, 0); - des_xmlNodePtr(n_node2, node2, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCmpNodes", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_node1); - printf(" %d", n_node2); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCompile(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - -#ifdef LIBXML_XPATH_ENABLED - -#define gen_nb_xmlXPathCompExprPtr 1 -static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - -#ifdef LIBXML_XPATH_ENABLED - -#define gen_nb_xmlXPathContextPtr 1 -static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlXPathCompiledEval(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlXPathCompExprPtr comp; /* the compiled XPath expression */ - int n_comp; - xmlXPathContextPtr ctx; /* the XPath context */ - int n_ctx; - - for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) { - for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) { - mem_base = xmlMemBlocks(); - comp = gen_xmlXPathCompExprPtr(n_comp, 0); - ctx = gen_xmlXPathContextPtr(n_ctx, 1); - - ret_val = xmlXPathCompiledEval(comp, ctx); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlXPathCompExprPtr(n_comp, comp, 0); - des_xmlXPathContextPtr(n_ctx, ctx, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCompiledEval", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_comp); - printf(" %d", n_ctx); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCompiledEvalToBoolean(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlXPathCompExprPtr comp; /* the compiled XPath expression */ - int n_comp; - xmlXPathContextPtr ctxt; /* the XPath context */ - int n_ctxt; - - for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) { - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - comp = gen_xmlXPathCompExprPtr(n_comp, 0); - ctxt = gen_xmlXPathContextPtr(n_ctxt, 1); - - ret_val = xmlXPathCompiledEvalToBoolean(comp, ctxt); - desret_int(ret_val); - call_tests++; - des_xmlXPathCompExprPtr(n_comp, comp, 0); - des_xmlXPathContextPtr(n_ctxt, ctxt, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCompiledEvalToBoolean", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_comp); - printf(" %d", n_ctxt); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathContextSetCache(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlXPathContextPtr ctxt; /* the XPath context */ - int n_ctxt; - int active; /* enables/disables (creates/frees) the cache */ - int n_active; - int value; /* a value with semantics dependant on @options */ - int n_value; - int options; /* options (currently only the value 0 is used) */ - int n_options; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { - for (n_active = 0;n_active < gen_nb_int;n_active++) { - for (n_value = 0;n_value < gen_nb_int;n_value++) { - for (n_options = 0;n_options < gen_nb_int;n_options++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); - active = gen_int(n_active, 1); - value = gen_int(n_value, 2); - options = gen_int(n_options, 3); - - ret_val = xmlXPathContextSetCache(ctxt, active, value, options); - desret_int(ret_val); - call_tests++; - des_xmlXPathContextPtr(n_ctxt, ctxt, 0); - des_int(n_active, active, 1); - des_int(n_value, value, 2); - des_int(n_options, options, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathContextSetCache", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_active); - printf(" %d", n_value); - printf(" %d", n_options); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathConvertBoolean(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlXPathObjectPtr val; /* an XPath object */ - int n_val; - - for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_xmlXPathObjectPtr(n_val, 0); - - ret_val = xmlXPathConvertBoolean(val); - val = NULL; - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlXPathObjectPtr(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathConvertBoolean", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathConvertNumber(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlXPathObjectPtr val; /* an XPath object */ - int n_val; - - for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_xmlXPathObjectPtr(n_val, 0); - - ret_val = xmlXPathConvertNumber(val); - val = NULL; - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlXPathObjectPtr(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathConvertNumber", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathConvertString(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlXPathObjectPtr val; /* an XPath object */ - int n_val; - - for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_xmlXPathObjectPtr(n_val, 0); - - ret_val = xmlXPathConvertString(val); - val = NULL; - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlXPathObjectPtr(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathConvertString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCtxtCompile(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlXPathEval(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlChar * str; /* the XPath expression */ - int n_str; - xmlXPathContextPtr ctx; /* the XPath context */ - int n_ctx; - - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) { - mem_base = xmlMemBlocks(); - str = gen_const_xmlChar_ptr(n_str, 0); - ctx = gen_xmlXPathContextPtr(n_ctx, 1); - - ret_val = xmlXPathEval((const xmlChar *)str, ctx); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0); - des_xmlXPathContextPtr(n_ctx, ctx, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathEval", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_str); - printf(" %d", n_ctx); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathEvalExpression(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlChar * str; /* the XPath expression */ - int n_str; - xmlXPathContextPtr ctxt; /* the XPath context */ - int n_ctxt; - - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - str = gen_const_xmlChar_ptr(n_str, 0); - ctxt = gen_xmlXPathContextPtr(n_ctxt, 1); - - ret_val = xmlXPathEvalExpression((const xmlChar *)str, ctxt); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0); - des_xmlXPathContextPtr(n_ctxt, ctxt, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathEvalExpression", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_str); - printf(" %d", n_ctxt); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathEvalPredicate(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlXPathContextPtr ctxt; /* the XPath context */ - int n_ctxt; - xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */ - int n_res; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { - for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); - res = gen_xmlXPathObjectPtr(n_res, 1); - - ret_val = xmlXPathEvalPredicate(ctxt, res); - desret_int(ret_val); - call_tests++; - des_xmlXPathContextPtr(n_ctxt, ctxt, 0); - des_xmlXPathObjectPtr(n_res, res, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathEvalPredicate", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_res); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathInit(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - - mem_base = xmlMemBlocks(); - - xmlXPathInit(); - call_tests++; - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathInit", - xmlMemBlocks() - mem_base); - test_ret++; - printf("\n"); - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathIsInf(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - double val; /* a double value */ - int n_val; - - for (n_val = 0;n_val < gen_nb_double;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_double(n_val, 0); - - ret_val = xmlXPathIsInf(val); - desret_int(ret_val); - call_tests++; - des_double(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathIsInf", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathIsNaN(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) - int mem_base; - int ret_val; - double val; /* a double value */ - int n_val; - - for (n_val = 0;n_val < gen_nb_double;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_double(n_val, 0); - - ret_val = xmlXPathIsNaN(val); - desret_int(ret_val); - call_tests++; - des_double(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathIsNaN", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNewContext(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlXPathNodeSetCreate(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodeSetPtr ret_val; - xmlNodePtr val; /* an initial xmlNodePtr, or NULL */ - int n_val; - - for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_xmlNodePtr(n_val, 0); - - ret_val = xmlXPathNodeSetCreate(val); - desret_xmlNodeSetPtr(ret_val); - call_tests++; - des_xmlNodePtr(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNodeSetCreate", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathObjectCopy(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlXPathObjectPtr val; /* the original object */ - int n_val; - - for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_xmlXPathObjectPtr(n_val, 0); - - ret_val = xmlXPathObjectCopy(val); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlXPathObjectPtr(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathObjectCopy", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathOrderDocElems(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - long ret_val; - xmlDocPtr doc; /* an input document */ - int n_doc; - - for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { - mem_base = xmlMemBlocks(); - doc = gen_xmlDocPtr(n_doc, 0); - - ret_val = xmlXPathOrderDocElems(doc); - desret_long(ret_val); - call_tests++; - des_xmlDocPtr(n_doc, doc, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathOrderDocElems", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_doc); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_xpath(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing xpath : 30 of 38 functions ...\n"); - test_ret += test_xmlXPathCastBooleanToNumber(); - test_ret += test_xmlXPathCastBooleanToString(); - test_ret += test_xmlXPathCastNodeSetToBoolean(); - test_ret += test_xmlXPathCastNodeSetToNumber(); - test_ret += test_xmlXPathCastNodeSetToString(); - test_ret += test_xmlXPathCastNodeToNumber(); - test_ret += test_xmlXPathCastNodeToString(); - test_ret += test_xmlXPathCastNumberToBoolean(); - test_ret += test_xmlXPathCastNumberToString(); - test_ret += test_xmlXPathCastStringToBoolean(); - test_ret += test_xmlXPathCastStringToNumber(); - test_ret += test_xmlXPathCastToBoolean(); - test_ret += test_xmlXPathCastToNumber(); - test_ret += test_xmlXPathCastToString(); - test_ret += test_xmlXPathCmpNodes(); - test_ret += test_xmlXPathCompile(); - test_ret += test_xmlXPathCompiledEval(); - test_ret += test_xmlXPathCompiledEvalToBoolean(); - test_ret += test_xmlXPathContextSetCache(); - test_ret += test_xmlXPathConvertBoolean(); - test_ret += test_xmlXPathConvertNumber(); - test_ret += test_xmlXPathConvertString(); - test_ret += test_xmlXPathCtxtCompile(); - test_ret += test_xmlXPathEval(); - test_ret += test_xmlXPathEvalExpression(); - test_ret += test_xmlXPathEvalPredicate(); - test_ret += test_xmlXPathInit(); - test_ret += test_xmlXPathIsInf(); - test_ret += test_xmlXPathIsNaN(); - test_ret += test_xmlXPathNewContext(); - test_ret += test_xmlXPathNodeSetCreate(); - test_ret += test_xmlXPathObjectCopy(); - test_ret += test_xmlXPathOrderDocElems(); - - if (test_ret != 0) - printf("Module xpath: %d errors\n", test_ret); - return(test_ret); -} -#ifdef LIBXML_XPATH_ENABLED - -#define gen_nb_xmlXPathParserContextPtr 1 -static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_valuePop(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - ret_val = valuePop(ctxt); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in valuePop", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_valuePush(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */ - int n_ctxt; - xmlXPathObjectPtr value; /* the XPath object */ - int n_value; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - value = gen_xmlXPathObjectPtr(n_value, 1); - - ret_val = valuePush(ctxt, value); - desret_int(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_xmlXPathObjectPtr(n_value, value, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in valuePush", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_value); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathAddValues(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - xmlXPathAddValues(ctxt); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathAddValues", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathBooleanFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathBooleanFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathBooleanFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCeilingFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathCeilingFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCeilingFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCompareValues(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int inf; /* less than (1) or greater than (0) */ - int n_inf; - int strict; /* is the comparison strict */ - int n_strict; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_inf = 0;n_inf < gen_nb_int;n_inf++) { - for (n_strict = 0;n_strict < gen_nb_int;n_strict++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - inf = gen_int(n_inf, 1); - strict = gen_int(n_strict, 2); - - ret_val = xmlXPathCompareValues(ctxt, inf, strict); - desret_int(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_inf, inf, 1); - des_int(n_strict, strict, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCompareValues", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_inf); - printf(" %d", n_strict); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathConcatFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathConcatFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathConcatFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathContainsFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathContainsFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathContainsFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathCountFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathCountFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathCountFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathDebugDumpCompExpr(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED) - int mem_base; - FILE * output; /* the FILE * for the output */ - int n_output; - xmlXPathCompExprPtr comp; /* the precompiled XPath expression */ - int n_comp; - int depth; /* the indentation level. */ - int n_depth; - - for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) { - for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) { - for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { - mem_base = xmlMemBlocks(); - output = gen_FILE_ptr(n_output, 0); - comp = gen_xmlXPathCompExprPtr(n_comp, 1); - depth = gen_int(n_depth, 2); - - xmlXPathDebugDumpCompExpr(output, comp, depth); - call_tests++; - des_FILE_ptr(n_output, output, 0); - des_xmlXPathCompExprPtr(n_comp, comp, 1); - des_int(n_depth, depth, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_output); - printf(" %d", n_comp); - printf(" %d", n_depth); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathDebugDumpObject(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED) - int mem_base; - FILE * output; /* the FILE * to dump the output */ - int n_output; - xmlXPathObjectPtr cur; /* the object to inspect */ - int n_cur; - int depth; /* indentation level */ - int n_depth; - - for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) { - for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) { - for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { - mem_base = xmlMemBlocks(); - output = gen_FILE_ptr(n_output, 0); - cur = gen_xmlXPathObjectPtr(n_cur, 1); - depth = gen_int(n_depth, 2); - - xmlXPathDebugDumpObject(output, cur, depth); - call_tests++; - des_FILE_ptr(n_output, output, 0); - des_xmlXPathObjectPtr(n_cur, cur, 1); - des_int(n_depth, depth, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathDebugDumpObject", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_output); - printf(" %d", n_cur); - printf(" %d", n_depth); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathDifference(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodeSetPtr ret_val; - xmlNodeSetPtr nodes1; /* a node-set */ - int n_nodes1; - xmlNodeSetPtr nodes2; /* a node-set */ - int n_nodes2; - - for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) { - for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) { - mem_base = xmlMemBlocks(); - nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0); - nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1); - - ret_val = xmlXPathDifference(nodes1, nodes2); - desret_xmlNodeSetPtr(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_nodes1, nodes1, 0); - des_xmlNodeSetPtr(n_nodes2, nodes2, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathDifference", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_nodes1); - printf(" %d", n_nodes2); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathDistinct(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodeSetPtr ret_val; - xmlNodeSetPtr nodes; /* a node-set */ - int n_nodes; - - for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { - mem_base = xmlMemBlocks(); - nodes = gen_xmlNodeSetPtr(n_nodes, 0); - - ret_val = xmlXPathDistinct(nodes); - desret_xmlNodeSetPtr(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_nodes, nodes, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathDistinct", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_nodes); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathDistinctSorted(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodeSetPtr ret_val; - xmlNodeSetPtr nodes; /* a node-set, sorted by document order */ - int n_nodes; - - for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { - mem_base = xmlMemBlocks(); - nodes = gen_xmlNodeSetPtr(n_nodes, 0); - - ret_val = xmlXPathDistinctSorted(nodes); - desret_xmlNodeSetPtr(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_nodes, nodes, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathDistinctSorted", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_nodes); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathDivValues(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - xmlXPathDivValues(ctxt); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathDivValues", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathEqualValues(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - ret_val = xmlXPathEqualValues(ctxt); - desret_int(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathEqualValues", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathErr(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* a XPath parser context */ - int n_ctxt; - int error; /* the error code */ - int n_error; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_error = 0;n_error < gen_nb_int;n_error++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - error = gen_int(n_error, 1); - - xmlXPathErr(ctxt, error); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_error, error, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathErr", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_error); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathEvalExpr(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - xmlXPathEvalExpr(ctxt); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathEvalExpr", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathEvaluatePredicateResult(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */ - int n_res; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - res = gen_xmlXPathObjectPtr(n_res, 1); - - ret_val = xmlXPathEvaluatePredicateResult(ctxt, res); - desret_int(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_xmlXPathObjectPtr(n_res, res, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_res); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathFalseFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathFalseFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathFalseFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathFloorFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathFloorFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathFloorFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathFunctionLookup(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlXPathFunctionLookupNS(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlXPathHasSameNodes(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlNodeSetPtr nodes1; /* a node-set */ - int n_nodes1; - xmlNodeSetPtr nodes2; /* a node-set */ - int n_nodes2; - - for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) { - for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) { - mem_base = xmlMemBlocks(); - nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0); - nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1); - - ret_val = xmlXPathHasSameNodes(nodes1, nodes2); - desret_int(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_nodes1, nodes1, 0); - des_xmlNodeSetPtr(n_nodes2, nodes2, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathHasSameNodes", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_nodes1); - printf(" %d", n_nodes2); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathIdFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathIdFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathIdFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathIntersection(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodeSetPtr ret_val; - xmlNodeSetPtr nodes1; /* a node-set */ - int n_nodes1; - xmlNodeSetPtr nodes2; /* a node-set */ - int n_nodes2; - - for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) { - for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) { - mem_base = xmlMemBlocks(); - nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0); - nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1); - - ret_val = xmlXPathIntersection(nodes1, nodes2); - desret_xmlNodeSetPtr(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_nodes1, nodes1, 0); - des_xmlNodeSetPtr(n_nodes2, nodes2, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathIntersection", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_nodes1); - printf(" %d", n_nodes2); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathIsNodeType(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlChar * name; /* a name string */ - int n_name; - - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - name = gen_const_xmlChar_ptr(n_name, 0); - - ret_val = xmlXPathIsNodeType((const xmlChar *)name); - desret_int(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathIsNodeType", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_name); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathLangFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathLangFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathLangFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathLastFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathLastFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathLastFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathLeading(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodeSetPtr ret_val; - xmlNodeSetPtr nodes1; /* a node-set */ - int n_nodes1; - xmlNodeSetPtr nodes2; /* a node-set */ - int n_nodes2; - - for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) { - for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) { - mem_base = xmlMemBlocks(); - nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0); - nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1); - - ret_val = xmlXPathLeading(nodes1, nodes2); - desret_xmlNodeSetPtr(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_nodes1, nodes1, 0); - des_xmlNodeSetPtr(n_nodes2, nodes2, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathLeading", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_nodes1); - printf(" %d", n_nodes2); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathLeadingSorted(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodeSetPtr ret_val; - xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */ - int n_nodes1; - xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */ - int n_nodes2; - - for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) { - for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) { - mem_base = xmlMemBlocks(); - nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0); - nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1); - - ret_val = xmlXPathLeadingSorted(nodes1, nodes2); - desret_xmlNodeSetPtr(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_nodes1, nodes1, 0); - des_xmlNodeSetPtr(n_nodes2, nodes2, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathLeadingSorted", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_nodes1); - printf(" %d", n_nodes2); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathLocalNameFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathLocalNameFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathLocalNameFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathModValues(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - xmlXPathModValues(ctxt); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathModValues", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathMultValues(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - xmlXPathMultValues(ctxt); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathMultValues", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNamespaceURIFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathNamespaceURIFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNewBoolean(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - int val; /* the boolean value */ - int n_val; - - for (n_val = 0;n_val < gen_nb_int;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_int(n_val, 0); - - ret_val = xmlXPathNewBoolean(val); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_int(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNewBoolean", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNewCString(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - char * val; /* the char * value */ - int n_val; - - for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_const_char_ptr(n_val, 0); - - ret_val = xmlXPathNewCString((const char *)val); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_const_char_ptr(n_val, (const char *)val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNewCString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNewFloat(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - double val; /* the double value */ - int n_val; - - for (n_val = 0;n_val < gen_nb_double;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_double(n_val, 0); - - ret_val = xmlXPathNewFloat(val); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_double(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNewFloat", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNewNodeSet(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlNodePtr val; /* the NodePtr value */ - int n_val; - - for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_xmlNodePtr(n_val, 0); - - ret_val = xmlXPathNewNodeSet(val); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlNodePtr(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNewNodeSet", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNewNodeSetList(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlNodeSetPtr val; /* an existing NodeSet */ - int n_val; - - for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_xmlNodeSetPtr(n_val, 0); - - ret_val = xmlXPathNewNodeSetList(val); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNewNodeSetList", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNewParserContext(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlXPathNewString(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlChar * val; /* the xmlChar * value */ - int n_val; - - for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_const_xmlChar_ptr(n_val, 0); - - ret_val = xmlXPathNewString((const xmlChar *)val); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNewString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNextAncestor(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - xmlNodePtr cur; /* the current node in the traversal */ - int n_cur; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - cur = gen_xmlNodePtr(n_cur, 1); - - ret_val = xmlXPathNextAncestor(ctxt, cur); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_xmlNodePtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNextAncestor", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNextAncestorOrSelf(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - xmlNodePtr cur; /* the current node in the traversal */ - int n_cur; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - cur = gen_xmlNodePtr(n_cur, 1); - - ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_xmlNodePtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNextAttribute(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - xmlNodePtr cur; /* the current attribute in the traversal */ - int n_cur; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - cur = gen_xmlNodePtr(n_cur, 1); - - ret_val = xmlXPathNextAttribute(ctxt, cur); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_xmlNodePtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNextAttribute", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNextChild(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - xmlNodePtr cur; /* the current node in the traversal */ - int n_cur; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - cur = gen_xmlNodePtr(n_cur, 1); - - ret_val = xmlXPathNextChild(ctxt, cur); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_xmlNodePtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNextChild", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNextDescendant(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - xmlNodePtr cur; /* the current node in the traversal */ - int n_cur; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - cur = gen_xmlNodePtr(n_cur, 1); - - ret_val = xmlXPathNextDescendant(ctxt, cur); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_xmlNodePtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNextDescendant", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNextDescendantOrSelf(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - xmlNodePtr cur; /* the current node in the traversal */ - int n_cur; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - cur = gen_xmlNodePtr(n_cur, 1); - - ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_xmlNodePtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNextFollowing(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - xmlNodePtr cur; /* the current node in the traversal */ - int n_cur; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - cur = gen_xmlNodePtr(n_cur, 1); - - ret_val = xmlXPathNextFollowing(ctxt, cur); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_xmlNodePtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNextFollowing", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNextFollowingSibling(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - xmlNodePtr cur; /* the current node in the traversal */ - int n_cur; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - cur = gen_xmlNodePtr(n_cur, 1); - - ret_val = xmlXPathNextFollowingSibling(ctxt, cur); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_xmlNodePtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNextFollowingSibling", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNextNamespace(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - xmlNodePtr cur; /* the current attribute in the traversal */ - int n_cur; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - cur = gen_xmlNodePtr(n_cur, 1); - - ret_val = xmlXPathNextNamespace(ctxt, cur); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_xmlNodePtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNextNamespace", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNextParent(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - xmlNodePtr cur; /* the current node in the traversal */ - int n_cur; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - cur = gen_xmlNodePtr(n_cur, 1); - - ret_val = xmlXPathNextParent(ctxt, cur); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_xmlNodePtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNextParent", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNextPreceding(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - xmlNodePtr cur; /* the current node in the traversal */ - int n_cur; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - cur = gen_xmlNodePtr(n_cur, 1); - - ret_val = xmlXPathNextPreceding(ctxt, cur); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_xmlNodePtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNextPreceding", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNextPrecedingSibling(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - xmlNodePtr cur; /* the current node in the traversal */ - int n_cur; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - cur = gen_xmlNodePtr(n_cur, 1); - - ret_val = xmlXPathNextPrecedingSibling(ctxt, cur); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_xmlNodePtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNextSelf(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - xmlNodePtr cur; /* the current node in the traversal */ - int n_cur; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - cur = gen_xmlNodePtr(n_cur, 1); - - ret_val = xmlXPathNextSelf(ctxt, cur); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_xmlNodePtr(n_cur, cur, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNextSelf", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_cur); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNodeLeading(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodeSetPtr ret_val; - xmlNodeSetPtr nodes; /* a node-set */ - int n_nodes; - xmlNodePtr node; /* a node */ - int n_node; - - for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - nodes = gen_xmlNodeSetPtr(n_nodes, 0); - node = gen_xmlNodePtr(n_node, 1); - - ret_val = xmlXPathNodeLeading(nodes, node); - desret_xmlNodeSetPtr(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_nodes, nodes, 0); - des_xmlNodePtr(n_node, node, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNodeLeading", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_nodes); - printf(" %d", n_node); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNodeLeadingSorted(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodeSetPtr ret_val; - xmlNodeSetPtr nodes; /* a node-set, sorted by document order */ - int n_nodes; - xmlNodePtr node; /* a node */ - int n_node; - - for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - nodes = gen_xmlNodeSetPtr(n_nodes, 0); - node = gen_xmlNodePtr(n_node, 1); - - ret_val = xmlXPathNodeLeadingSorted(nodes, node); - desret_xmlNodeSetPtr(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_nodes, nodes, 0); - des_xmlNodePtr(n_node, node, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_nodes); - printf(" %d", n_node); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNodeSetAdd(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlNodeSetPtr cur; /* the initial node set */ - int n_cur; - xmlNodePtr val; /* a new xmlNodePtr */ - int n_val; - - for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) { - for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodeSetPtr(n_cur, 0); - val = gen_xmlNodePtr(n_val, 1); - - ret_val = xmlXPathNodeSetAdd(cur, val); - desret_int(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_cur, cur, 0); - des_xmlNodePtr(n_val, val, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNodeSetAdd", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_val); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNodeSetAddNs(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlNodeSetPtr cur; /* the initial node set */ - int n_cur; - xmlNodePtr node; /* the hosting node */ - int n_node; - xmlNsPtr ns; /* a the namespace node */ - int n_ns; - - for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodeSetPtr(n_cur, 0); - node = gen_xmlNodePtr(n_node, 1); - ns = gen_xmlNsPtr(n_ns, 2); - - ret_val = xmlXPathNodeSetAddNs(cur, node, ns); - desret_int(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_cur, cur, 0); - des_xmlNodePtr(n_node, node, 1); - des_xmlNsPtr(n_ns, ns, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNodeSetAddNs", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_node); - printf(" %d", n_ns); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNodeSetAddUnique(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlNodeSetPtr cur; /* the initial node set */ - int n_cur; - xmlNodePtr val; /* a new xmlNodePtr */ - int n_val; - - for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) { - for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodeSetPtr(n_cur, 0); - val = gen_xmlNodePtr(n_val, 1); - - ret_val = xmlXPathNodeSetAddUnique(cur, val); - desret_int(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_cur, cur, 0); - des_xmlNodePtr(n_val, val, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_val); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNodeSetContains(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlNodeSetPtr cur; /* the node-set */ - int n_cur; - xmlNodePtr val; /* the node */ - int n_val; - - for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) { - for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodeSetPtr(n_cur, 0); - val = gen_xmlNodePtr(n_val, 1); - - ret_val = xmlXPathNodeSetContains(cur, val); - desret_int(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_cur, cur, 0); - des_xmlNodePtr(n_val, val, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNodeSetContains", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_val); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNodeSetDel(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodeSetPtr cur; /* the initial node set */ - int n_cur; - xmlNodePtr val; /* an xmlNodePtr */ - int n_val; - - for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) { - for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodeSetPtr(n_cur, 0); - val = gen_xmlNodePtr(n_val, 1); - - xmlXPathNodeSetDel(cur, val); - call_tests++; - des_xmlNodeSetPtr(n_cur, cur, 0); - des_xmlNodePtr(n_val, val, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNodeSetDel", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_val); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNodeSetMerge(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodeSetPtr ret_val; - xmlNodeSetPtr val1; /* the first NodeSet or NULL */ - int n_val1; - xmlNodeSetPtr val2; /* the second NodeSet */ - int n_val2; - - for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) { - for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) { - mem_base = xmlMemBlocks(); - val1 = gen_xmlNodeSetPtr(n_val1, 0); - val2 = gen_xmlNodeSetPtr(n_val2, 1); - - ret_val = xmlXPathNodeSetMerge(val1, val2); - desret_xmlNodeSetPtr(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_val1, val1, 0); - des_xmlNodeSetPtr(n_val2, val2, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNodeSetMerge", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val1); - printf(" %d", n_val2); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNodeSetRemove(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodeSetPtr cur; /* the initial node set */ - int n_cur; - int val; /* the index to remove */ - int n_val; - - for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) { - for (n_val = 0;n_val < gen_nb_int;n_val++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlNodeSetPtr(n_cur, 0); - val = gen_int(n_val, 1); - - xmlXPathNodeSetRemove(cur, val); - call_tests++; - des_xmlNodeSetPtr(n_cur, cur, 0); - des_int(n_val, val, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNodeSetRemove", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_val); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNodeSetSort(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodeSetPtr set; /* the node set */ - int n_set; - - for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) { - mem_base = xmlMemBlocks(); - set = gen_xmlNodeSetPtr(n_set, 0); - - xmlXPathNodeSetSort(set); - call_tests++; - des_xmlNodeSetPtr(n_set, set, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNodeSetSort", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_set); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNodeTrailing(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodeSetPtr ret_val; - xmlNodeSetPtr nodes; /* a node-set */ - int n_nodes; - xmlNodePtr node; /* a node */ - int n_node; - - for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - nodes = gen_xmlNodeSetPtr(n_nodes, 0); - node = gen_xmlNodePtr(n_node, 1); - - ret_val = xmlXPathNodeTrailing(nodes, node); - desret_xmlNodeSetPtr(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_nodes, nodes, 0); - des_xmlNodePtr(n_node, node, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNodeTrailing", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_nodes); - printf(" %d", n_node); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNodeTrailingSorted(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodeSetPtr ret_val; - xmlNodeSetPtr nodes; /* a node-set, sorted by document order */ - int n_nodes; - xmlNodePtr node; /* a node */ - int n_node; - - for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { - for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { - mem_base = xmlMemBlocks(); - nodes = gen_xmlNodeSetPtr(n_nodes, 0); - node = gen_xmlNodePtr(n_node, 1); - - ret_val = xmlXPathNodeTrailingSorted(nodes, node); - desret_xmlNodeSetPtr(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_nodes, nodes, 0); - des_xmlNodePtr(n_node, node, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_nodes); - printf(" %d", n_node); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNormalizeFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathNormalizeFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNormalizeFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNotEqualValues(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - ret_val = xmlXPathNotEqualValues(ctxt); - desret_int(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNotEqualValues", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNotFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathNotFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNotFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNsLookup(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - const xmlChar * ret_val; - xmlXPathContextPtr ctxt; /* the XPath context */ - int n_ctxt; - xmlChar * prefix; /* the namespace prefix value */ - int n_prefix; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { - for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); - prefix = gen_const_xmlChar_ptr(n_prefix, 1); - - ret_val = xmlXPathNsLookup(ctxt, (const xmlChar *)prefix); - desret_const_xmlChar_ptr(ret_val); - call_tests++; - des_xmlXPathContextPtr(n_ctxt, ctxt, 0); - des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNsLookup", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_prefix); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathNumberFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathNumberFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathNumberFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathParseNCName(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - ret_val = xmlXPathParseNCName(ctxt); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathParseNCName", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathParseName(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - ret_val = xmlXPathParseName(ctxt); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathParseName", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathPopBoolean(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlXPathParserContextPtr ctxt; /* an XPath parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - ret_val = xmlXPathPopBoolean(ctxt); - desret_int(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathPopBoolean", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathPopExternal(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - void * ret_val; - xmlXPathParserContextPtr ctxt; /* an XPath parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - ret_val = xmlXPathPopExternal(ctxt); - desret_void_ptr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathPopExternal", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathPopNodeSet(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodeSetPtr ret_val; - xmlXPathParserContextPtr ctxt; /* an XPath parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - ret_val = xmlXPathPopNodeSet(ctxt); - desret_xmlNodeSetPtr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathPopNodeSet", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathPopNumber(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - double ret_val; - xmlXPathParserContextPtr ctxt; /* an XPath parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - ret_val = xmlXPathPopNumber(ctxt); - desret_double(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathPopNumber", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathPopString(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlChar * ret_val; - xmlXPathParserContextPtr ctxt; /* an XPath parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - ret_val = xmlXPathPopString(ctxt); - desret_xmlChar_ptr(ret_val); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathPopString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathPositionFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathPositionFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathPositionFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathRegisterAllFunctions(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathContextPtr ctxt; /* the XPath context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); - - xmlXPathRegisterAllFunctions(ctxt); - call_tests++; - des_xmlXPathContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathRegisterFunc(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlXPathRegisterFuncLookup(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlXPathRegisterFuncNS(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlXPathRegisterNs(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlXPathContextPtr ctxt; /* the XPath context */ - int n_ctxt; - xmlChar * prefix; /* the namespace prefix cannot be NULL or empty string */ - int n_prefix; - xmlChar * ns_uri; /* the namespace name */ - int n_ns_uri; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { - for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { - for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); - prefix = gen_const_xmlChar_ptr(n_prefix, 1); - ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2); - - ret_val = xmlXPathRegisterNs(ctxt, (const xmlChar *)prefix, (const xmlChar *)ns_uri); - desret_int(ret_val); - call_tests++; - des_xmlXPathContextPtr(n_ctxt, ctxt, 0); - des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1); - des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathRegisterNs", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_prefix); - printf(" %d", n_ns_uri); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathRegisterVariable(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlXPathContextPtr ctxt; /* the XPath context */ - int n_ctxt; - xmlChar * name; /* the variable name */ - int n_name; - xmlXPathObjectPtr value; /* the variable value or NULL */ - int n_value; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - value = gen_xmlXPathObjectPtr(n_value, 2); - - ret_val = xmlXPathRegisterVariable(ctxt, (const xmlChar *)name, value); - desret_int(ret_val); - call_tests++; - des_xmlXPathContextPtr(n_ctxt, ctxt, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_xmlXPathObjectPtr(n_value, value, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathRegisterVariable", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_name); - printf(" %d", n_value); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathRegisterVariableLookup(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlXPathRegisterVariableNS(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - int ret_val; - xmlXPathContextPtr ctxt; /* the XPath context */ - int n_ctxt; - xmlChar * name; /* the variable name */ - int n_name; - xmlChar * ns_uri; /* the variable namespace URI */ - int n_ns_uri; - xmlXPathObjectPtr value; /* the variable value or NULL */ - int n_value; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) { - for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2); - value = gen_xmlXPathObjectPtr(n_value, 3); - - ret_val = xmlXPathRegisterVariableNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri, value); - desret_int(ret_val); - call_tests++; - des_xmlXPathContextPtr(n_ctxt, ctxt, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2); - des_xmlXPathObjectPtr(n_value, value, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathRegisterVariableNS", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_name); - printf(" %d", n_ns_uri); - printf(" %d", n_value); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathRegisteredFuncsCleanup(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathContextPtr ctxt; /* the XPath context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); - - xmlXPathRegisteredFuncsCleanup(ctxt); - call_tests++; - des_xmlXPathContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathRegisteredNsCleanup(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathContextPtr ctxt; /* the XPath context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); - - xmlXPathRegisteredNsCleanup(ctxt); - call_tests++; - des_xmlXPathContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathRegisteredVariablesCleanup(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathContextPtr ctxt; /* the XPath context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); - - xmlXPathRegisteredVariablesCleanup(ctxt); - call_tests++; - des_xmlXPathContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathRoot(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - xmlXPathRoot(ctxt); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathRoot", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathRoundFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathRoundFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathRoundFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathStartsWithFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathStartsWithFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathStartsWithFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathStringEvalNumber(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - double ret_val; - xmlChar * str; /* A string to scan */ - int n_str; - - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - mem_base = xmlMemBlocks(); - str = gen_const_xmlChar_ptr(n_str, 0); - - ret_val = xmlXPathStringEvalNumber((const xmlChar *)str); - desret_double(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathStringEvalNumber", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_str); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathStringFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathStringFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathStringFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathStringLengthFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathStringLengthFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathStringLengthFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathSubValues(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - xmlXPathSubValues(ctxt); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathSubValues", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathSubstringAfterFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathSubstringAfterFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathSubstringBeforeFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathSubstringBeforeFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathSubstringFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathSubstringFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathSubstringFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathSumFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathSumFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathSumFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathTrailing(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodeSetPtr ret_val; - xmlNodeSetPtr nodes1; /* a node-set */ - int n_nodes1; - xmlNodeSetPtr nodes2; /* a node-set */ - int n_nodes2; - - for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) { - for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) { - mem_base = xmlMemBlocks(); - nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0); - nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1); - - ret_val = xmlXPathTrailing(nodes1, nodes2); - desret_xmlNodeSetPtr(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_nodes1, nodes1, 0); - des_xmlNodeSetPtr(n_nodes2, nodes2, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathTrailing", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_nodes1); - printf(" %d", n_nodes2); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathTrailingSorted(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlNodeSetPtr ret_val; - xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */ - int n_nodes1; - xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */ - int n_nodes2; - - for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) { - for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) { - mem_base = xmlMemBlocks(); - nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0); - nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1); - - ret_val = xmlXPathTrailingSorted(nodes1, nodes2); - desret_xmlNodeSetPtr(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_nodes1, nodes1, 0); - des_xmlNodeSetPtr(n_nodes2, nodes2, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathTrailingSorted", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_nodes1); - printf(" %d", n_nodes2); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathTranslateFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathTranslateFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathTranslateFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathTrueFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - int nargs; /* the number of arguments */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPathTrueFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathTrueFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathValueFlipSign(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - xmlXPathValueFlipSign(ctxt); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathValueFlipSign", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathVariableLookup(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlXPathContextPtr ctxt; /* the XPath context */ - int n_ctxt; - xmlChar * name; /* the variable name */ - int n_name; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - - ret_val = xmlXPathVariableLookup(ctxt, (const xmlChar *)name); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlXPathContextPtr(n_ctxt, ctxt, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathVariableLookup", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_name); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathVariableLookupNS(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlXPathContextPtr ctxt; /* the XPath context */ - int n_ctxt; - xmlChar * name; /* the variable name */ - int n_name; - xmlChar * ns_uri; /* the variable namespace URI */ - int n_ns_uri; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { - for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { - for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); - name = gen_const_xmlChar_ptr(n_name, 1); - ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2); - - ret_val = xmlXPathVariableLookupNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlXPathContextPtr(n_ctxt, ctxt, 0); - des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); - des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathVariableLookupNS", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_name); - printf(" %d", n_ns_uri); - printf("\n"); - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathWrapCString(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - char * val; /* the char * value */ - int n_val; - - for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_char_ptr(n_val, 0); - - ret_val = xmlXPathWrapCString(val); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_char_ptr(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathWrapCString", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathWrapExternal(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - void * val; /* the user data */ - int n_val; - - for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_void_ptr(n_val, 0); - - ret_val = xmlXPathWrapExternal(val); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_void_ptr(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathWrapExternal", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPathWrapNodeSet(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlNodeSetPtr val; /* the NodePtr value */ - int n_val; - - for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_xmlNodeSetPtr(n_val, 0); - - ret_val = xmlXPathWrapNodeSet(val); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPathWrapNodeSet", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPatherror(void) { - int test_ret = 0; - -#if defined(LIBXML_XPATH_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ - int n_ctxt; - const char * file; /* the file name */ - int n_file; - int line; /* the line number */ - int n_line; - int no; /* the error number */ - int n_no; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_file = 0;n_file < gen_nb_filepath;n_file++) { - for (n_line = 0;n_line < gen_nb_int;n_line++) { - for (n_no = 0;n_no < gen_nb_int;n_no++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - file = gen_filepath(n_file, 1); - line = gen_int(n_line, 2); - no = gen_int(n_no, 3); - - xmlXPatherror(ctxt, file, line, no); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_filepath(n_file, file, 1); - des_int(n_line, line, 2); - des_int(n_no, no, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPatherror", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_file); - printf(" %d", n_line); - printf(" %d", n_no); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_xpathInternals(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n"); - test_ret += test_valuePop(); - test_ret += test_valuePush(); - test_ret += test_xmlXPathAddValues(); - test_ret += test_xmlXPathBooleanFunction(); - test_ret += test_xmlXPathCeilingFunction(); - test_ret += test_xmlXPathCompareValues(); - test_ret += test_xmlXPathConcatFunction(); - test_ret += test_xmlXPathContainsFunction(); - test_ret += test_xmlXPathCountFunction(); - test_ret += test_xmlXPathDebugDumpCompExpr(); - test_ret += test_xmlXPathDebugDumpObject(); - test_ret += test_xmlXPathDifference(); - test_ret += test_xmlXPathDistinct(); - test_ret += test_xmlXPathDistinctSorted(); - test_ret += test_xmlXPathDivValues(); - test_ret += test_xmlXPathEqualValues(); - test_ret += test_xmlXPathErr(); - test_ret += test_xmlXPathEvalExpr(); - test_ret += test_xmlXPathEvaluatePredicateResult(); - test_ret += test_xmlXPathFalseFunction(); - test_ret += test_xmlXPathFloorFunction(); - test_ret += test_xmlXPathFunctionLookup(); - test_ret += test_xmlXPathFunctionLookupNS(); - test_ret += test_xmlXPathHasSameNodes(); - test_ret += test_xmlXPathIdFunction(); - test_ret += test_xmlXPathIntersection(); - test_ret += test_xmlXPathIsNodeType(); - test_ret += test_xmlXPathLangFunction(); - test_ret += test_xmlXPathLastFunction(); - test_ret += test_xmlXPathLeading(); - test_ret += test_xmlXPathLeadingSorted(); - test_ret += test_xmlXPathLocalNameFunction(); - test_ret += test_xmlXPathModValues(); - test_ret += test_xmlXPathMultValues(); - test_ret += test_xmlXPathNamespaceURIFunction(); - test_ret += test_xmlXPathNewBoolean(); - test_ret += test_xmlXPathNewCString(); - test_ret += test_xmlXPathNewFloat(); - test_ret += test_xmlXPathNewNodeSet(); - test_ret += test_xmlXPathNewNodeSetList(); - test_ret += test_xmlXPathNewParserContext(); - test_ret += test_xmlXPathNewString(); - test_ret += test_xmlXPathNextAncestor(); - test_ret += test_xmlXPathNextAncestorOrSelf(); - test_ret += test_xmlXPathNextAttribute(); - test_ret += test_xmlXPathNextChild(); - test_ret += test_xmlXPathNextDescendant(); - test_ret += test_xmlXPathNextDescendantOrSelf(); - test_ret += test_xmlXPathNextFollowing(); - test_ret += test_xmlXPathNextFollowingSibling(); - test_ret += test_xmlXPathNextNamespace(); - test_ret += test_xmlXPathNextParent(); - test_ret += test_xmlXPathNextPreceding(); - test_ret += test_xmlXPathNextPrecedingSibling(); - test_ret += test_xmlXPathNextSelf(); - test_ret += test_xmlXPathNodeLeading(); - test_ret += test_xmlXPathNodeLeadingSorted(); - test_ret += test_xmlXPathNodeSetAdd(); - test_ret += test_xmlXPathNodeSetAddNs(); - test_ret += test_xmlXPathNodeSetAddUnique(); - test_ret += test_xmlXPathNodeSetContains(); - test_ret += test_xmlXPathNodeSetDel(); - test_ret += test_xmlXPathNodeSetMerge(); - test_ret += test_xmlXPathNodeSetRemove(); - test_ret += test_xmlXPathNodeSetSort(); - test_ret += test_xmlXPathNodeTrailing(); - test_ret += test_xmlXPathNodeTrailingSorted(); - test_ret += test_xmlXPathNormalizeFunction(); - test_ret += test_xmlXPathNotEqualValues(); - test_ret += test_xmlXPathNotFunction(); - test_ret += test_xmlXPathNsLookup(); - test_ret += test_xmlXPathNumberFunction(); - test_ret += test_xmlXPathParseNCName(); - test_ret += test_xmlXPathParseName(); - test_ret += test_xmlXPathPopBoolean(); - test_ret += test_xmlXPathPopExternal(); - test_ret += test_xmlXPathPopNodeSet(); - test_ret += test_xmlXPathPopNumber(); - test_ret += test_xmlXPathPopString(); - test_ret += test_xmlXPathPositionFunction(); - test_ret += test_xmlXPathRegisterAllFunctions(); - test_ret += test_xmlXPathRegisterFunc(); - test_ret += test_xmlXPathRegisterFuncLookup(); - test_ret += test_xmlXPathRegisterFuncNS(); - test_ret += test_xmlXPathRegisterNs(); - test_ret += test_xmlXPathRegisterVariable(); - test_ret += test_xmlXPathRegisterVariableLookup(); - test_ret += test_xmlXPathRegisterVariableNS(); - test_ret += test_xmlXPathRegisteredFuncsCleanup(); - test_ret += test_xmlXPathRegisteredNsCleanup(); - test_ret += test_xmlXPathRegisteredVariablesCleanup(); - test_ret += test_xmlXPathRoot(); - test_ret += test_xmlXPathRoundFunction(); - test_ret += test_xmlXPathStartsWithFunction(); - test_ret += test_xmlXPathStringEvalNumber(); - test_ret += test_xmlXPathStringFunction(); - test_ret += test_xmlXPathStringLengthFunction(); - test_ret += test_xmlXPathSubValues(); - test_ret += test_xmlXPathSubstringAfterFunction(); - test_ret += test_xmlXPathSubstringBeforeFunction(); - test_ret += test_xmlXPathSubstringFunction(); - test_ret += test_xmlXPathSumFunction(); - test_ret += test_xmlXPathTrailing(); - test_ret += test_xmlXPathTrailingSorted(); - test_ret += test_xmlXPathTranslateFunction(); - test_ret += test_xmlXPathTrueFunction(); - test_ret += test_xmlXPathValueFlipSign(); - test_ret += test_xmlXPathVariableLookup(); - test_ret += test_xmlXPathVariableLookupNS(); - test_ret += test_xmlXPathWrapCString(); - test_ret += test_xmlXPathWrapExternal(); - test_ret += test_xmlXPathWrapNodeSet(); - test_ret += test_xmlXPatherror(); - - if (test_ret != 0) - printf("Module xpathInternals: %d errors\n", test_ret); - return(test_ret); -} - -static int -test_xmlXPtrBuildNodeList(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlNodePtr ret_val; - xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */ - int n_obj; - - for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) { - mem_base = xmlMemBlocks(); - obj = gen_xmlXPathObjectPtr(n_obj, 0); - - ret_val = xmlXPtrBuildNodeList(obj); - desret_xmlNodePtr(ret_val); - call_tests++; - des_xmlXPathObjectPtr(n_obj, obj, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrBuildNodeList", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_obj); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPtrEval(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlChar * str; /* the XPointer expression */ - int n_str; - xmlXPathContextPtr ctx; /* the XPointer context */ - int n_ctx; - - for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) { - mem_base = xmlMemBlocks(); - str = gen_const_xmlChar_ptr(n_str, 0); - ctx = gen_xmlXPathContextPtr(n_ctx, 1); - - ret_val = xmlXPtrEval((const xmlChar *)str, ctx); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0); - des_xmlXPathContextPtr(n_ctx, ctx, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrEval", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_str); - printf(" %d", n_ctx); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPtrEvalRangePredicate(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */ - int n_ctxt; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - - xmlXPtrEvalRangePredicate(ctxt); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - -#ifdef LIBXML_XPTR_ENABLED - -#define gen_nb_xmlLocationSetPtr 1 -static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - - -static int -test_xmlXPtrLocationSetAdd(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlLocationSetPtr cur; /* the initial range set */ - int n_cur; - xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */ - int n_val; - - for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) { - for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlLocationSetPtr(n_cur, 0); - val = gen_xmlXPathObjectPtr(n_val, 1); - - xmlXPtrLocationSetAdd(cur, val); - call_tests++; - des_xmlLocationSetPtr(n_cur, cur, 0); - des_xmlXPathObjectPtr(n_val, val, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrLocationSetAdd", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_val); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPtrLocationSetCreate(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlXPtrLocationSetDel(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlLocationSetPtr cur; /* the initial range set */ - int n_cur; - xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */ - int n_val; - - for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) { - for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlLocationSetPtr(n_cur, 0); - val = gen_xmlXPathObjectPtr(n_val, 1); - - xmlXPtrLocationSetDel(cur, val); - call_tests++; - des_xmlLocationSetPtr(n_cur, cur, 0); - des_xmlXPathObjectPtr(n_val, val, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrLocationSetDel", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_val); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPtrLocationSetMerge(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlXPtrLocationSetRemove(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlLocationSetPtr cur; /* the initial range set */ - int n_cur; - int val; /* the index to remove */ - int n_val; - - for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) { - for (n_val = 0;n_val < gen_nb_int;n_val++) { - mem_base = xmlMemBlocks(); - cur = gen_xmlLocationSetPtr(n_cur, 0); - val = gen_int(n_val, 1); - - xmlXPtrLocationSetRemove(cur, val); - call_tests++; - des_xmlLocationSetPtr(n_cur, cur, 0); - des_int(n_val, val, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrLocationSetRemove", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_cur); - printf(" %d", n_val); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPtrNewCollapsedRange(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlNodePtr start; /* the starting and ending node */ - int n_start; - - for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) { - mem_base = xmlMemBlocks(); - start = gen_xmlNodePtr(n_start, 0); - - ret_val = xmlXPtrNewCollapsedRange(start); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlNodePtr(n_start, start, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_start); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPtrNewContext(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int -test_xmlXPtrNewLocationSetNodeSet(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlNodeSetPtr set; /* a node set */ - int n_set; - - for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) { - mem_base = xmlMemBlocks(); - set = gen_xmlNodeSetPtr(n_set, 0); - - ret_val = xmlXPtrNewLocationSetNodeSet(set); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlNodeSetPtr(n_set, set, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_set); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPtrNewLocationSetNodes(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlNodePtr start; /* the start NodePtr value */ - int n_start; - xmlNodePtr end; /* the end NodePtr value or NULL */ - int n_end; - - for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) { - for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) { - mem_base = xmlMemBlocks(); - start = gen_xmlNodePtr(n_start, 0); - end = gen_xmlNodePtr(n_end, 1); - - ret_val = xmlXPtrNewLocationSetNodes(start, end); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlNodePtr(n_start, start, 0); - des_xmlNodePtr(n_end, end, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_start); - printf(" %d", n_end); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPtrNewRange(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlNodePtr start; /* the starting node */ - int n_start; - int startindex; /* the start index */ - int n_startindex; - xmlNodePtr end; /* the ending point */ - int n_end; - int endindex; /* the ending index */ - int n_endindex; - - for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) { - for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) { - for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) { - for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) { - mem_base = xmlMemBlocks(); - start = gen_xmlNodePtr(n_start, 0); - startindex = gen_int(n_startindex, 1); - end = gen_xmlNodePtr(n_end, 2); - endindex = gen_int(n_endindex, 3); - - ret_val = xmlXPtrNewRange(start, startindex, end, endindex); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlNodePtr(n_start, start, 0); - des_int(n_startindex, startindex, 1); - des_xmlNodePtr(n_end, end, 2); - des_int(n_endindex, endindex, 3); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrNewRange", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_start); - printf(" %d", n_startindex); - printf(" %d", n_end); - printf(" %d", n_endindex); - printf("\n"); - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPtrNewRangeNodeObject(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlNodePtr start; /* the starting node */ - int n_start; - xmlXPathObjectPtr end; /* the ending object */ - int n_end; - - for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) { - for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) { - mem_base = xmlMemBlocks(); - start = gen_xmlNodePtr(n_start, 0); - end = gen_xmlXPathObjectPtr(n_end, 1); - - ret_val = xmlXPtrNewRangeNodeObject(start, end); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlNodePtr(n_start, start, 0); - des_xmlXPathObjectPtr(n_end, end, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_start); - printf(" %d", n_end); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPtrNewRangeNodePoint(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlNodePtr start; /* the starting node */ - int n_start; - xmlXPathObjectPtr end; /* the ending point */ - int n_end; - - for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) { - for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) { - mem_base = xmlMemBlocks(); - start = gen_xmlNodePtr(n_start, 0); - end = gen_xmlXPathObjectPtr(n_end, 1); - - ret_val = xmlXPtrNewRangeNodePoint(start, end); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlNodePtr(n_start, start, 0); - des_xmlXPathObjectPtr(n_end, end, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_start); - printf(" %d", n_end); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPtrNewRangeNodes(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlNodePtr start; /* the starting node */ - int n_start; - xmlNodePtr end; /* the ending node */ - int n_end; - - for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) { - for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) { - mem_base = xmlMemBlocks(); - start = gen_xmlNodePtr(n_start, 0); - end = gen_xmlNodePtr(n_end, 1); - - ret_val = xmlXPtrNewRangeNodes(start, end); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlNodePtr(n_start, start, 0); - des_xmlNodePtr(n_end, end, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrNewRangeNodes", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_start); - printf(" %d", n_end); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPtrNewRangePointNode(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlXPathObjectPtr start; /* the starting point */ - int n_start; - xmlNodePtr end; /* the ending node */ - int n_end; - - for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) { - for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) { - mem_base = xmlMemBlocks(); - start = gen_xmlXPathObjectPtr(n_start, 0); - end = gen_xmlNodePtr(n_end, 1); - - ret_val = xmlXPtrNewRangePointNode(start, end); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlXPathObjectPtr(n_start, start, 0); - des_xmlNodePtr(n_end, end, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrNewRangePointNode", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_start); - printf(" %d", n_end); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPtrNewRangePoints(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlXPathObjectPtr start; /* the starting point */ - int n_start; - xmlXPathObjectPtr end; /* the ending point */ - int n_end; - - for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) { - for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) { - mem_base = xmlMemBlocks(); - start = gen_xmlXPathObjectPtr(n_start, 0); - end = gen_xmlXPathObjectPtr(n_end, 1); - - ret_val = xmlXPtrNewRangePoints(start, end); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlXPathObjectPtr(n_start, start, 0); - des_xmlXPathObjectPtr(n_end, end, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrNewRangePoints", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_start); - printf(" %d", n_end); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPtrRangeToFunction(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */ - int n_ctxt; - int nargs; /* the number of args */ - int n_nargs; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { - for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); - nargs = gen_int(n_nargs, 1); - - xmlXPtrRangeToFunction(ctxt, nargs); - call_tests++; - des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); - des_int(n_nargs, nargs, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrRangeToFunction", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_nargs); - printf("\n"); - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlXPtrWrapLocationSet(void) { - int test_ret = 0; - -#if defined(LIBXML_XPTR_ENABLED) - int mem_base; - xmlXPathObjectPtr ret_val; - xmlLocationSetPtr val; /* the LocationSet value */ - int n_val; - - for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) { - mem_base = xmlMemBlocks(); - val = gen_xmlLocationSetPtr(n_val, 0); - - ret_val = xmlXPtrWrapLocationSet(val); - desret_xmlXPathObjectPtr(ret_val); - call_tests++; - des_xmlLocationSetPtr(n_val, val, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlXPtrWrapLocationSet", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_val); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - -static int -test_xpointer(void) { - int test_ret = 0; - - if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n"); - test_ret += test_xmlXPtrBuildNodeList(); - test_ret += test_xmlXPtrEval(); - test_ret += test_xmlXPtrEvalRangePredicate(); - test_ret += test_xmlXPtrLocationSetAdd(); - test_ret += test_xmlXPtrLocationSetCreate(); - test_ret += test_xmlXPtrLocationSetDel(); - test_ret += test_xmlXPtrLocationSetMerge(); - test_ret += test_xmlXPtrLocationSetRemove(); - test_ret += test_xmlXPtrNewCollapsedRange(); - test_ret += test_xmlXPtrNewContext(); - test_ret += test_xmlXPtrNewLocationSetNodeSet(); - test_ret += test_xmlXPtrNewLocationSetNodes(); - test_ret += test_xmlXPtrNewRange(); - test_ret += test_xmlXPtrNewRangeNodeObject(); - test_ret += test_xmlXPtrNewRangeNodePoint(); - test_ret += test_xmlXPtrNewRangeNodes(); - test_ret += test_xmlXPtrNewRangePointNode(); - test_ret += test_xmlXPtrNewRangePoints(); - test_ret += test_xmlXPtrRangeToFunction(); - test_ret += test_xmlXPtrWrapLocationSet(); - - if (test_ret != 0) - printf("Module xpointer: %d errors\n", test_ret); - return(test_ret); -} -static int -test_module(const char *module) { - if (!strcmp(module, "HTMLparser")) return(test_HTMLparser()); - if (!strcmp(module, "HTMLtree")) return(test_HTMLtree()); - if (!strcmp(module, "SAX2")) return(test_SAX2()); - if (!strcmp(module, "c14n")) return(test_c14n()); - if (!strcmp(module, "catalog")) return(test_catalog()); - if (!strcmp(module, "chvalid")) return(test_chvalid()); - if (!strcmp(module, "debugXML")) return(test_debugXML()); - if (!strcmp(module, "dict")) return(test_dict()); - if (!strcmp(module, "encoding")) return(test_encoding()); - if (!strcmp(module, "entities")) return(test_entities()); - if (!strcmp(module, "hash")) return(test_hash()); - if (!strcmp(module, "list")) return(test_list()); - if (!strcmp(module, "nanoftp")) return(test_nanoftp()); - if (!strcmp(module, "nanohttp")) return(test_nanohttp()); - if (!strcmp(module, "parser")) return(test_parser()); - if (!strcmp(module, "parserInternals")) return(test_parserInternals()); - if (!strcmp(module, "pattern")) return(test_pattern()); - if (!strcmp(module, "relaxng")) return(test_relaxng()); - if (!strcmp(module, "schemasInternals")) return(test_schemasInternals()); - if (!strcmp(module, "schematron")) return(test_schematron()); - if (!strcmp(module, "tree")) return(test_tree()); - if (!strcmp(module, "uri")) return(test_uri()); - if (!strcmp(module, "valid")) return(test_valid()); - if (!strcmp(module, "xinclude")) return(test_xinclude()); - if (!strcmp(module, "xmlIO")) return(test_xmlIO()); - if (!strcmp(module, "xmlautomata")) return(test_xmlautomata()); - if (!strcmp(module, "xmlerror")) return(test_xmlerror()); - if (!strcmp(module, "xmlmodule")) return(test_xmlmodule()); - if (!strcmp(module, "xmlreader")) return(test_xmlreader()); - if (!strcmp(module, "xmlregexp")) return(test_xmlregexp()); - if (!strcmp(module, "xmlsave")) return(test_xmlsave()); - if (!strcmp(module, "xmlschemas")) return(test_xmlschemas()); - if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes()); - if (!strcmp(module, "xmlstring")) return(test_xmlstring()); - if (!strcmp(module, "xmlunicode")) return(test_xmlunicode()); - if (!strcmp(module, "xmlwriter")) return(test_xmlwriter()); - if (!strcmp(module, "xpath")) return(test_xpath()); - if (!strcmp(module, "xpathInternals")) return(test_xpathInternals()); - if (!strcmp(module, "xpointer")) return(test_xpointer()); - return(0); -} diff --git a/lib/3rdparty/libxml2/testchar.c b/lib/3rdparty/libxml2/testchar.c deleted file mode 100644 index 0d087927a7e..00000000000 --- a/lib/3rdparty/libxml2/testchar.c +++ /dev/null @@ -1,617 +0,0 @@ -/** - * Test the UTF-8 decoding routines - * - * author: Daniel Veillard - * copy: see Copyright for the status of this software. - */ - -#include -#include -#include -#include - -#include "buf.h" - -int lastError; - -static void errorHandler(void *unused, xmlErrorPtr err) { - if ((unused == NULL) && (err != NULL) && (lastError == 0)) { - lastError = err->code; - } -} - -char document1[100] = "XXXX"; -char document2[100] = ""; - -static void testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document, - int len, char *data, int forbid1, int forbid2) { - int i; - xmlDocPtr res; - - for (i = 0;i <= 0xFF;i++) { - lastError = 0; - xmlCtxtReset(ctxt); - - data[0] = i; - - res = xmlReadMemory(document, len, "test", NULL, 0); - - if ((i == forbid1) || (i == forbid2)) { - if ((lastError == 0) || (res != NULL)) - fprintf(stderr, - "Failed to detect invalid char for Byte 0x%02X: %c\n", - i, i); - } - - else if ((i == '<') || (i == '&')) { - if ((lastError == 0) || (res != NULL)) - fprintf(stderr, - "Failed to detect illegal char %c for Byte 0x%02X\n", i, i); - } - else if (((i < 0x20) || (i >= 0x80)) && - (i != 0x9) && (i != 0xA) && (i != 0xD)) { - if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL)) - fprintf(stderr, - "Failed to detect invalid char for Byte 0x%02X\n", i); - } - else if (res == NULL) { - fprintf(stderr, - "Failed to parse valid char for Byte 0x%02X : %c\n", i, i); - } - if (res != NULL) - xmlFreeDoc(res); - } -} - -static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, - int len, char *data) { - int i, j; - xmlDocPtr res; - - for (i = 0x80;i <= 0xFF;i++) { - for (j = 0;j <= 0xFF;j++) { - lastError = 0; - xmlCtxtReset(ctxt); - - data[0] = i; - data[1] = j; - - res = xmlReadMemory(document, len, "test", NULL, 0); - - /* if first bit of first char is set, then second bit must too */ - if ((i & 0x80) && ((i & 0x40) == 0)) { - if ((lastError == 0) || (res != NULL)) - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", - i, j); - } - - /* - * if first bit of first char is set, then second char first - * bits must be 10 - */ - else if ((i & 0x80) && ((j & 0xC0) != 0x80)) { - if ((lastError == 0) || (res != NULL)) - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", - i, j); - } - - /* - * if using a 2 byte encoding then the value must be greater - * than 0x80, i.e. one of bits 5 to 1 of i must be set - */ - else if ((i & 0x80) && ((i & 0x1E) == 0)) { - if ((lastError == 0) || (res != NULL)) - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", - i, j); - } - - /* - * if third bit of first char is set, then the sequence would need - * at least 3 bytes, but we give only 2 ! - */ - else if ((i & 0xE0) == 0xE0) { - if ((lastError == 0) || (res != NULL)) - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n", - i, j); - } - - /* - * We should see no error in remaning cases - */ - else if ((lastError != 0) || (res == NULL)) { - fprintf(stderr, - "Failed to parse document for Bytes 0x%02X 0x%02X\n", i, j); - } - if (res != NULL) - xmlFreeDoc(res); - } - } -} - -/** - * testDocumentRanges: - * - * Test the correct UTF8 character parsing in context of XML documents - * Those are in-context injection tests checking the parser behaviour on - * edge case values at different point in content, beginning and end of - * CDATA in text or in attribute values. - */ - -static void testDocumentRanges(void) { - xmlParserCtxtPtr ctxt; - char *data; - - /* - * Set up a parsing context using the first document as - * the current input source. - */ - ctxt = xmlNewParserCtxt(); - if (ctxt == NULL) { - fprintf(stderr, "Failed to allocate parser context\n"); - return; - } - - printf("testing 1 byte char in document: 1"); - fflush(stdout); - data = &document1[5]; - data[0] = ' '; - data[1] = ' '; - data[2] = ' '; - data[3] = ' '; - /* test 1 byte injection at beginning of area */ - testDocumentRangeByte1(ctxt, &document1[0], strlen(document1), - data, -1, -1); - printf(" 2"); - fflush(stdout); - data[0] = ' '; - data[1] = ' '; - data[2] = ' '; - data[3] = ' '; - /* test 1 byte injection at end of area */ - testDocumentRangeByte1(ctxt, &document1[0], strlen(document1), - data + 3, -1, -1); - - printf(" 3"); - fflush(stdout); - data = &document2[10]; - data[0] = ' '; - data[1] = ' '; - data[2] = ' '; - data[3] = ' '; - /* test 1 byte injection at beginning of area */ - testDocumentRangeByte1(ctxt, &document2[0], strlen(document2), - data, '\'', -1); - printf(" 4"); - fflush(stdout); - data[0] = ' '; - data[1] = ' '; - data[2] = ' '; - data[3] = ' '; - /* test 1 byte injection at end of area */ - testDocumentRangeByte1(ctxt, &document2[0], strlen(document2), - data + 3, '\'', -1); - printf(" done\n"); - - printf("testing 2 byte char in document: 1"); - fflush(stdout); - data = &document1[5]; - data[0] = ' '; - data[1] = ' '; - data[2] = ' '; - data[3] = ' '; - /* test 2 byte injection at beginning of area */ - testDocumentRangeByte2(ctxt, &document1[0], strlen(document1), - data); - printf(" 2"); - fflush(stdout); - data[0] = ' '; - data[1] = ' '; - data[2] = ' '; - data[3] = ' '; - /* test 2 byte injection at end of area */ - testDocumentRangeByte2(ctxt, &document1[0], strlen(document1), - data + 2); - - printf(" 3"); - fflush(stdout); - data = &document2[10]; - data[0] = ' '; - data[1] = ' '; - data[2] = ' '; - data[3] = ' '; - /* test 2 byte injection at beginning of area */ - testDocumentRangeByte2(ctxt, &document2[0], strlen(document2), - data); - printf(" 4"); - fflush(stdout); - data[0] = ' '; - data[1] = ' '; - data[2] = ' '; - data[3] = ' '; - /* test 2 byte injection at end of area */ - testDocumentRangeByte2(ctxt, &document2[0], strlen(document2), - data + 2); - printf(" done\n"); - - xmlFreeParserCtxt(ctxt); -} - -static void testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) { - int i = 0; - int len, c; - - data[1] = 0; - data[2] = 0; - data[3] = 0; - for (i = 0;i <= 0xFF;i++) { - data[0] = i; - ctxt->charset = XML_CHAR_ENCODING_UTF8; - - lastError = 0; - c = xmlCurrentChar(ctxt, &len); - if ((i == 0) || (i >= 0x80)) { - /* we must see an error there */ - if (lastError != XML_ERR_INVALID_CHAR) - fprintf(stderr, - "Failed to detect invalid char for Byte 0x%02X\n", i); - } else if (i == 0xD) { - if ((c != 0xA) || (len != 1)) - fprintf(stderr, "Failed to convert char for Byte 0x%02X\n", i); - } else if ((c != i) || (len != 1)) { - fprintf(stderr, "Failed to parse char for Byte 0x%02X\n", i); - } - } -} - -static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { - int i, j; - int len, c; - - data[2] = 0; - data[3] = 0; - for (i = 0x80;i <= 0xFF;i++) { - for (j = 0;j <= 0xFF;j++) { - data[0] = i; - data[1] = j; - ctxt->charset = XML_CHAR_ENCODING_UTF8; - - lastError = 0; - c = xmlCurrentChar(ctxt, &len); - - /* if first bit of first char is set, then second bit must too */ - if ((i & 0x80) && ((i & 0x40) == 0)) { - if (lastError != XML_ERR_INVALID_CHAR) - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", - i, j); - } - - /* - * if first bit of first char is set, then second char first - * bits must be 10 - */ - else if ((i & 0x80) && ((j & 0xC0) != 0x80)) { - if (lastError != XML_ERR_INVALID_CHAR) - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n", - i, j, c); - } - - /* - * if using a 2 byte encoding then the value must be greater - * than 0x80, i.e. one of bits 5 to 1 of i must be set - */ - else if ((i & 0x80) && ((i & 0x1E) == 0)) { - if (lastError != XML_ERR_INVALID_CHAR) - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n", - i, j, c); - } - - /* - * if third bit of first char is set, then the sequence would need - * at least 3 bytes, but we give only 2 ! - */ - else if ((i & 0xE0) == 0xE0) { - if (lastError != XML_ERR_INVALID_CHAR) - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n", - i, j); - } - - /* - * We should see no error in remaning cases - */ - else if ((lastError != 0) || (len != 2)) { - fprintf(stderr, - "Failed to parse char for Bytes 0x%02X 0x%02X\n", i, j); - } - - /* - * Finally check the value is right - */ - else if (c != (j & 0x3F) + ((i & 0x1F) << 6)) { - fprintf(stderr, - "Failed to parse char for Bytes 0x%02X 0x%02X: expect %d got %d\n", - i, j, ((j & 0x3F) + ((i & 0x1F) << 6)), c); - } - } - } -} - -static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) { - int i, j, k, K; - int len, c; - unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF}; - int value; - - data[3] = 0; - for (i = 0xE0;i <= 0xFF;i++) { - for (j = 0;j <= 0xFF;j++) { - for (k = 0;k < 6;k++) { - data[0] = i; - data[1] = j; - K = lows[k]; - data[2] = (char) K; - value = (K & 0x3F) + ((j & 0x3F) << 6) + ((i & 0xF) << 12); - ctxt->charset = XML_CHAR_ENCODING_UTF8; - - lastError = 0; - c = xmlCurrentChar(ctxt, &len); - - /* - * if fourth bit of first char is set, then the sequence would need - * at least 4 bytes, but we give only 3 ! - */ - if ((i & 0xF0) == 0xF0) { - if (lastError != XML_ERR_INVALID_CHAR) - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", - i, j, K, data[3]); - } - - /* - * The second and the third bytes must start with 10 - */ - else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80)) { - if (lastError != XML_ERR_INVALID_CHAR) - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n", - i, j, K); - } - - /* - * if using a 3 byte encoding then the value must be greater - * than 0x800, i.e. one of bits 4 to 0 of i must be set or - * the 6th byte of data[1] must be set - */ - else if (((i & 0xF) == 0) && ((j & 0x20) == 0)) { - if (lastError != XML_ERR_INVALID_CHAR) - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n", - i, j, K); - } - - /* - * There are values in that range that are not allowed in XML-1.0 - */ - else if (((value > 0xD7FF) && (value <0xE000)) || - ((value > 0xFFFD) && (value <0x10000))) { - if (lastError != XML_ERR_INVALID_CHAR) - fprintf(stderr, - "Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X\n", - value, i, j, K); - } - - /* - * We should see no error in remaining cases - */ - else if ((lastError != 0) || (len != 3)) { - fprintf(stderr, - "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n", - i, j, K); - } - - /* - * Finally check the value is right - */ - else if (c != value) { - fprintf(stderr, - "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n", - i, j, data[2], value, c); - } - } - } - } -} - -static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { - int i, j, k, K, l, L; - int len, c; - unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF}; - int value; - - data[4] = 0; - for (i = 0xF0;i <= 0xFF;i++) { - for (j = 0;j <= 0xFF;j++) { - for (k = 0;k < 6;k++) { - for (l = 0;l < 6;l++) { - data[0] = i; - data[1] = j; - K = lows[k]; - data[2] = (char) K; - L = lows[l]; - data[3] = (char) L; - value = (L & 0x3F) + ((K & 0x3F) << 6) + ((j & 0x3F) << 12) + - ((i & 0x7) << 18); - ctxt->charset = XML_CHAR_ENCODING_UTF8; - - lastError = 0; - c = xmlCurrentChar(ctxt, &len); - - /* - * if fifth bit of first char is set, then the sequence would need - * at least 5 bytes, but we give only 4 ! - */ - if ((i & 0xF8) == 0xF8) { - if (lastError != XML_ERR_INVALID_CHAR) - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", - i, j, K, data[3]); - } - - /* - * The second, third and fourth bytes must start with 10 - */ - else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80) || - ((L & 0xC0) != 0x80)) { - if (lastError != XML_ERR_INVALID_CHAR) - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", - i, j, K, L); - } - - /* - * if using a 3 byte encoding then the value must be greater - * than 0x10000, i.e. one of bits 3 to 0 of i must be set or - * the 6 or 5th byte of j must be set - */ - else if (((i & 0x7) == 0) && ((j & 0x30) == 0)) { - if (lastError != XML_ERR_INVALID_CHAR) - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", - i, j, K, L); - } - - /* - * There are values in that range that are not allowed in XML-1.0 - */ - else if (((value > 0xD7FF) && (value <0xE000)) || - ((value > 0xFFFD) && (value <0x10000)) || - (value > 0x10FFFF)) { - if (lastError != XML_ERR_INVALID_CHAR) - fprintf(stderr, -"Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", - value, i, j, K, L); - } - - /* - * We should see no error in remaining cases - */ - else if ((lastError != 0) || (len != 4)) { - fprintf(stderr, - "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n", - i, j, K); - } - - /* - * Finally check the value is right - */ - else if (c != value) { - fprintf(stderr, - "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n", - i, j, data[2], value, c); - } - } - } - } - } -} - -/** - * testCharRanges: - * - * Test the correct UTF8 character parsing in isolation i.e. - * not when parsing a full document, this is less expensive and we can - * cover the full range of UTF-8 chars accepted by XML-1.0 - */ - -static void testCharRanges(void) { - char data[5]; - xmlParserCtxtPtr ctxt; - xmlParserInputBufferPtr buf; - xmlParserInputPtr input; - - memset(data, 0, 5); - - /* - * Set up a parsing context using the above data buffer as - * the current input source. - */ - ctxt = xmlNewParserCtxt(); - if (ctxt == NULL) { - fprintf(stderr, "Failed to allocate parser context\n"); - return; - } - buf = xmlParserInputBufferCreateStatic(data, sizeof(data), - XML_CHAR_ENCODING_NONE); - if (buf == NULL) { - fprintf(stderr, "Failed to allocate input buffer\n"); - goto error; - } - input = xmlNewInputStream(ctxt); - if (input == NULL) { - xmlFreeParserInputBuffer(buf); - goto error; - } - input->filename = NULL; - input->buf = buf; - input->cur = - input->base = xmlBufContent(input->buf->buffer); - input->end = input->base + 4; - inputPush(ctxt, input); - - printf("testing char range: 1"); - fflush(stdout); - testCharRangeByte1(ctxt, data); - printf(" 2"); - fflush(stdout); - testCharRangeByte2(ctxt, data); - printf(" 3"); - fflush(stdout); - testCharRangeByte3(ctxt, data); - printf(" 4"); - fflush(stdout); - testCharRangeByte4(ctxt, data); - printf(" done\n"); - fflush(stdout); - -error: - xmlFreeParserCtxt(ctxt); -} - -int main(void) { - - /* - * this initialize the library and check potential ABI mismatches - * between the version it was compiled for and the actual shared - * library used. - */ - LIBXML_TEST_VERSION - - /* - * Catch errors separately - */ - - xmlSetStructuredErrorFunc(NULL, errorHandler); - - /* - * Run the tests - */ - testCharRanges(); - testDocumentRanges(); - - /* - * Cleanup function for the XML library. - */ - xmlCleanupParser(); - /* - * this is to debug memory for regression tests - */ - xmlMemoryDump(); - return(0); -} diff --git a/lib/3rdparty/libxml2/testdict.c b/lib/3rdparty/libxml2/testdict.c deleted file mode 100644 index 4e8581f85c3..00000000000 --- a/lib/3rdparty/libxml2/testdict.c +++ /dev/null @@ -1,444 +0,0 @@ -#include -#include -#include - -/* #define WITH_PRINT */ - -static const char *seeds1[] = { - "a", "b", "c", - "d", "e", "f", - "g", "h", "i", - "j", "k", "l", - - NULL -}; - -static const char *seeds2[] = { - "m", "n", "o", - "p", "q", "r", - "s", "t", "u", - "v", "w", "x", - - NULL -}; - -#define NB_STRINGS_NS 100 -#define NB_STRINGS_MAX 10000 -#define NB_STRINGS_MIN 10 - -static xmlChar *strings1[NB_STRINGS_MAX]; -static xmlChar *strings2[NB_STRINGS_MAX]; -static const xmlChar *test1[NB_STRINGS_MAX]; -static const xmlChar *test2[NB_STRINGS_MAX]; -static int nbErrors = 0; - -static void fill_strings(void) { - int i, j, k; - - /* - * That's a bit nasty but the output is fine and it doesn't take hours - * there is a small but sufficient number of duplicates, and we have - * ":xxx" and full QNames in the last NB_STRINGS_NS values - */ - for (i = 0; seeds1[i] != NULL; i++) { - strings1[i] = xmlStrdup((const xmlChar *) seeds1[i]); - if (strings1[i] == NULL) { - fprintf(stderr, "Out of memory while generating strings1\n"); - exit(1); - } - } - for (j = 0, k = 0;i < NB_STRINGS_MAX - NB_STRINGS_NS;i++,j++) { - strings1[i] = xmlStrncatNew(strings1[j], strings1[k], -1); - if (strings1[i] == NULL) { - fprintf(stderr, "Out of memory while generating strings1\n"); - exit(1); - } - if (j >= 50) { - j = 0; - k++; - } - } - for (j = 0; (j < 50) && (i < NB_STRINGS_MAX); i++, j+=2) { - strings1[i] = xmlStrncatNew(strings1[j], (const xmlChar *) ":", -1); - if (strings1[i] == NULL) { - fprintf(stderr, "Out of memory while generating strings1\n"); - exit(1); - } - } - for (j = NB_STRINGS_MAX - NB_STRINGS_NS, k = 0; - i < NB_STRINGS_MAX;i++,j++) { - strings1[i] = xmlStrncatNew(strings1[j], strings1[k], -1); - if (strings1[i] == NULL) { - fprintf(stderr, "Out of memory while generating strings1\n"); - exit(1); - } - k += 3; - if (k >= 50) k = 0; - } - - /* - * Now do the same with the second pool of strings - */ - for (i = 0; seeds2[i] != NULL; i++) { - strings2[i] = xmlStrdup((const xmlChar *) seeds2[i]); - if (strings2[i] == NULL) { - fprintf(stderr, "Out of memory while generating strings2\n"); - exit(1); - } - } - for (j = 0, k = 0;i < NB_STRINGS_MAX - NB_STRINGS_NS;i++,j++) { - strings2[i] = xmlStrncatNew(strings2[j], strings2[k], -1); - if (strings2[i] == NULL) { - fprintf(stderr, "Out of memory while generating strings2\n"); - exit(1); - } - if (j >= 50) { - j = 0; - k++; - } - } - for (j = 0; (j < 50) && (i < NB_STRINGS_MAX); i++, j+=2) { - strings2[i] = xmlStrncatNew(strings2[j], (const xmlChar *) ":", -1); - if (strings2[i] == NULL) { - fprintf(stderr, "Out of memory while generating strings2\n"); - exit(1); - } - } - for (j = NB_STRINGS_MAX - NB_STRINGS_NS, k = 0; - i < NB_STRINGS_MAX;i++,j++) { - strings2[i] = xmlStrncatNew(strings2[j], strings2[k], -1); - if (strings2[i] == NULL) { - fprintf(stderr, "Out of memory while generating strings2\n"); - exit(1); - } - k += 3; - if (k >= 50) k = 0; - } - -} - -#ifdef WITH_PRINT -static void print_strings(void) { - int i; - - for (i = 0; i < NB_STRINGS_MAX;i++) { - printf("%s\n", strings1[i]); - } - for (i = 0; i < NB_STRINGS_MAX;i++) { - printf("%s\n", strings2[i]); - } -} -#endif - -static void clean_strings(void) { - int i; - - for (i = 0; i < NB_STRINGS_MAX; i++) { - if (strings1[i] != NULL) /* really should not happen */ - xmlFree(strings1[i]); - } - for (i = 0; i < NB_STRINGS_MAX; i++) { - if (strings2[i] != NULL) /* really should not happen */ - xmlFree(strings2[i]); - } -} - -/* - * This tests the sub-dictionary support - */ -static int run_test2(xmlDictPtr parent) { - int i, j; - xmlDictPtr dict; - int ret = 0; - xmlChar prefix[40]; - xmlChar *cur, *pref; - const xmlChar *tmp; - - dict = xmlDictCreateSub(parent); - if (dict == NULL) { - fprintf(stderr, "Out of memory while creating sub-dictionary\n"); - exit(1); - } - memset(test2, 0, sizeof(test2)); - - /* - * Fill in NB_STRINGS_MIN, at this point the dictionary should not grow - * and we allocate all those doing the fast key computations - * All the strings are based on a different seeds subset so we know - * they are allocated in the main dictionary, not coming from the parent - */ - for (i = 0;i < NB_STRINGS_MIN;i++) { - test2[i] = xmlDictLookup(dict, strings2[i], -1); - if (test2[i] == NULL) { - fprintf(stderr, "Failed lookup for '%s'\n", strings2[i]); - ret = 1; - nbErrors++; - } - } - j = NB_STRINGS_MAX - NB_STRINGS_NS; - /* ":foo" like strings2 */ - for (i = 0;i < NB_STRINGS_MIN;i++, j++) { - test2[j] = xmlDictLookup(dict, strings2[j], xmlStrlen(strings2[j])); - if (test2[j] == NULL) { - fprintf(stderr, "Failed lookup for '%s'\n", strings2[j]); - ret = 1; - nbErrors++; - } - } - /* "a:foo" like strings2 */ - j = NB_STRINGS_MAX - NB_STRINGS_MIN; - for (i = 0;i < NB_STRINGS_MIN;i++, j++) { - test2[j] = xmlDictLookup(dict, strings2[j], xmlStrlen(strings2[j])); - if (test2[j] == NULL) { - fprintf(stderr, "Failed lookup for '%s'\n", strings2[j]); - ret = 1; - nbErrors++; - } - } - - /* - * At this point allocate all the strings - * the dictionary will grow in the process, reallocate more string tables - * and switch to the better key generator - */ - for (i = 0;i < NB_STRINGS_MAX;i++) { - if (test2[i] != NULL) - continue; - test2[i] = xmlDictLookup(dict, strings2[i], -1); - if (test2[i] == NULL) { - fprintf(stderr, "Failed lookup for '%s'\n", strings2[i]); - ret = 1; - nbErrors++; - } - } - - /* - * Now we can start to test things, first that all strings2 belongs to - * the dict, and that none of them was actually allocated in the parent - */ - for (i = 0;i < NB_STRINGS_MAX;i++) { - if (!xmlDictOwns(dict, test2[i])) { - fprintf(stderr, "Failed ownership failure for '%s'\n", - strings2[i]); - ret = 1; - nbErrors++; - } - if (xmlDictOwns(parent, test2[i])) { - fprintf(stderr, "Failed parent ownership failure for '%s'\n", - strings2[i]); - ret = 1; - nbErrors++; - } - } - - /* - * Also verify that all strings from the parent are seen from the subdict - */ - for (i = 0;i < NB_STRINGS_MAX;i++) { - if (!xmlDictOwns(dict, test1[i])) { - fprintf(stderr, "Failed sub-ownership failure for '%s'\n", - strings1[i]); - ret = 1; - nbErrors++; - } - } - - /* - * Then that another lookup to the string in sub will return the same - */ - for (i = 0;i < NB_STRINGS_MAX;i++) { - if (xmlDictLookup(dict, strings2[i], -1) != test2[i]) { - fprintf(stderr, "Failed re-lookup check for %d, '%s'\n", - i, strings2[i]); - ret = 1; - nbErrors++; - } - } - /* - * But also that any lookup for a string in the parent will be provided - * as in the parent - */ - for (i = 0;i < NB_STRINGS_MAX;i++) { - if (xmlDictLookup(dict, strings1[i], -1) != test1[i]) { - fprintf(stderr, "Failed parent string lookup check for %d, '%s'\n", - i, strings1[i]); - ret = 1; - nbErrors++; - } - } - - /* - * check the QName lookups - */ - for (i = NB_STRINGS_MAX - NB_STRINGS_NS;i < NB_STRINGS_MAX;i++) { - cur = strings2[i]; - pref = &prefix[0]; - while (*cur != ':') *pref++ = *cur++; - cur++; - *pref = 0; - tmp = xmlDictQLookup(dict, &prefix[0], cur); - if (xmlDictQLookup(dict, &prefix[0], cur) != test2[i]) { - fprintf(stderr, "Failed lookup check for '%s':'%s'\n", - &prefix[0], cur); - ret = 1; - nbErrors++; - } - } - /* - * check the QName lookups for strings from the parent - */ - for (i = NB_STRINGS_MAX - NB_STRINGS_NS;i < NB_STRINGS_MAX;i++) { - cur = strings1[i]; - pref = &prefix[0]; - while (*cur != ':') *pref++ = *cur++; - cur++; - *pref = 0; - tmp = xmlDictQLookup(dict, &prefix[0], cur); - if (xmlDictQLookup(dict, &prefix[0], cur) != test1[i]) { - fprintf(stderr, "Failed parent lookup check for '%s':'%s'\n", - &prefix[0], cur); - ret = 1; - nbErrors++; - } - } - - xmlDictFree(dict); - return(ret); -} - -/* - * Test a single dictionary - */ -static int run_test1(void) { - int i, j; - xmlDictPtr dict; - int ret = 0; - xmlChar prefix[40]; - xmlChar *cur, *pref; - const xmlChar *tmp; - - dict = xmlDictCreate(); - if (dict == NULL) { - fprintf(stderr, "Out of memory while creating dictionary\n"); - exit(1); - } - memset(test1, 0, sizeof(test1)); - - /* - * Fill in NB_STRINGS_MIN, at this point the dictionary should not grow - * and we allocate all those doing the fast key computations - */ - for (i = 0;i < NB_STRINGS_MIN;i++) { - test1[i] = xmlDictLookup(dict, strings1[i], -1); - if (test1[i] == NULL) { - fprintf(stderr, "Failed lookup for '%s'\n", strings1[i]); - ret = 1; - nbErrors++; - } - } - j = NB_STRINGS_MAX - NB_STRINGS_NS; - /* ":foo" like strings1 */ - for (i = 0;i < NB_STRINGS_MIN;i++, j++) { - test1[j] = xmlDictLookup(dict, strings1[j], xmlStrlen(strings1[j])); - if (test1[j] == NULL) { - fprintf(stderr, "Failed lookup for '%s'\n", strings1[j]); - ret = 1; - nbErrors++; - } - } - /* "a:foo" like strings1 */ - j = NB_STRINGS_MAX - NB_STRINGS_MIN; - for (i = 0;i < NB_STRINGS_MIN;i++, j++) { - test1[j] = xmlDictLookup(dict, strings1[j], xmlStrlen(strings1[j])); - if (test1[j] == NULL) { - fprintf(stderr, "Failed lookup for '%s'\n", strings1[j]); - ret = 1; - nbErrors++; - } - } - - /* - * At this point allocate all the strings - * the dictionary will grow in the process, reallocate more string tables - * and switch to the better key generator - */ - for (i = 0;i < NB_STRINGS_MAX;i++) { - if (test1[i] != NULL) - continue; - test1[i] = xmlDictLookup(dict, strings1[i], -1); - if (test1[i] == NULL) { - fprintf(stderr, "Failed lookup for '%s'\n", strings1[i]); - ret = 1; - nbErrors++; - } - } - - /* - * Now we can start to test things, first that all strings1 belongs to - * the dict - */ - for (i = 0;i < NB_STRINGS_MAX;i++) { - if (!xmlDictOwns(dict, test1[i])) { - fprintf(stderr, "Failed ownership failure for '%s'\n", - strings1[i]); - ret = 1; - nbErrors++; - } - } - - /* - * Then that another lookup to the string will return the same - */ - for (i = 0;i < NB_STRINGS_MAX;i++) { - if (xmlDictLookup(dict, strings1[i], -1) != test1[i]) { - fprintf(stderr, "Failed re-lookup check for %d, '%s'\n", - i, strings1[i]); - ret = 1; - nbErrors++; - } - } - - /* - * More complex, check the QName lookups - */ - for (i = NB_STRINGS_MAX - NB_STRINGS_NS;i < NB_STRINGS_MAX;i++) { - cur = strings1[i]; - pref = &prefix[0]; - while (*cur != ':') *pref++ = *cur++; - cur++; - *pref = 0; - tmp = xmlDictQLookup(dict, &prefix[0], cur); - if (xmlDictQLookup(dict, &prefix[0], cur) != test1[i]) { - fprintf(stderr, "Failed lookup check for '%s':'%s'\n", - &prefix[0], cur); - ret = 1; - nbErrors++; - } - } - - run_test2(dict); - - xmlDictFree(dict); - return(ret); -} - -int main(void) -{ - int ret; - - LIBXML_TEST_VERSION - fill_strings(); -#ifdef WITH_PRINT - print_strings(); -#endif - ret = run_test1(); - if (ret == 0) { - printf("dictionary tests succeeded %d strings\n", 2 * NB_STRINGS_MAX); - } else { - printf("dictionary tests failed with %d errors\n", nbErrors); - } - clean_strings(); - xmlCleanupParser(); - xmlMemoryDump(); - return(ret); -} diff --git a/lib/3rdparty/libxml2/testdso.c b/lib/3rdparty/libxml2/testdso.c deleted file mode 100644 index bd4ff0865d9..00000000000 --- a/lib/3rdparty/libxml2/testdso.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -#define IN_LIBXML -#include "libxml/xmlexports.h" - -XMLPUBFUN int hello_world(void); - -int hello_world(void) -{ - printf("Success!\n"); - return 0; -} diff --git a/lib/3rdparty/libxml2/testlimits.c b/lib/3rdparty/libxml2/testlimits.c deleted file mode 100644 index 7ee6fb9721a..00000000000 --- a/lib/3rdparty/libxml2/testlimits.c +++ /dev/null @@ -1,1634 +0,0 @@ -/* - * testlimits.c: C program to run libxml2 regression tests checking various - * limits in document size. Will consume a lot of RAM and CPU cycles - * - * To compile on Unixes: - * cc -o testlimits `xml2-config --cflags` testlimits.c `xml2-config --libs` -lpthread - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#ifdef HAVE_CONFIG_H -#include "libxml.h" -#else -#include -#endif - -#if !defined(_WIN32) || defined(__CYGWIN__) -#include -#endif -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#ifdef LIBXML_READER_ENABLED -#include -#endif - -static int verbose = 0; -static int tests_quiet = 0; - -/************************************************************************ - * * - * time handling * - * * - ************************************************************************/ - -/* maximum time for one parsing before declaring a timeout */ -#define MAX_TIME 2 /* seconds */ - -static clock_t t0; -int timeout = 0; - -static void reset_timout(void) { - timeout = 0; - t0 = clock(); -} - -static int check_time(void) { - clock_t tnow = clock(); - if (((tnow - t0) / CLOCKS_PER_SEC) > MAX_TIME) { - timeout = 1; - return(0); - } - return(1); -} - -/************************************************************************ - * * - * Huge document generator * - * * - ************************************************************************/ - -#include - -/* - * Huge documents are built using fixed start and end chunks - * and filling between the two an unconventional amount of char data - */ -typedef struct hugeTest hugeTest; -typedef hugeTest *hugeTestPtr; -struct hugeTest { - const char *description; - const char *name; - const char *start; - const char *end; -}; - -static struct hugeTest hugeTests[] = { - { "Huge text node", "huge:textNode", "", "" }, - { "Huge attribute node", "huge:attrNode", "" }, - { "Huge comment node", "huge:commentNode", "" }, - { "Huge PI node", "huge:piNode", "" }, -}; - -static const char *current; -static int rlen; -static unsigned int currentTest = 0; -static int instate = 0; - -/** - * hugeMatch: - * @URI: an URI to test - * - * Check for an huge: query - * - * Returns 1 if yes and 0 if another Input module should be used - */ -static int -hugeMatch(const char * URI) { - if ((URI != NULL) && (!strncmp(URI, "huge:", 5))) - return(1); - return(0); -} - -/** - * hugeOpen: - * @URI: an URI to test - * - * Return a pointer to the huge: query handler, in this example simply - * the current pointer... - * - * Returns an Input context or NULL in case or error - */ -static void * -hugeOpen(const char * URI) { - if ((URI == NULL) || (strncmp(URI, "huge:", 5))) - return(NULL); - - for (currentTest = 0;currentTest < sizeof(hugeTests)/sizeof(hugeTests[0]); - currentTest++) - if (!strcmp(hugeTests[currentTest].name, URI)) - goto found; - - return(NULL); - -found: - rlen = strlen(hugeTests[currentTest].start); - current = hugeTests[currentTest].start; - instate = 0; - return((void *) current); -} - -/** - * hugeClose: - * @context: the read context - * - * Close the huge: query handler - * - * Returns 0 or -1 in case of error - */ -static int -hugeClose(void * context) { - if (context == NULL) return(-1); - fprintf(stderr, "\n"); - return(0); -} - -#define CHUNK 4096 - -char filling[CHUNK + 1]; - -static void fillFilling(void) { - int i; - - for (i = 0;i < CHUNK;i++) { - filling[i] = 'a'; - } - filling[CHUNK] = 0; -} - -size_t maxlen = 64 * 1024 * 1024; -size_t curlen = 0; -size_t dotlen; - -/** - * hugeRead: - * @context: the read context - * @buffer: where to store data - * @len: number of bytes to read - * - * Implement an huge: query read. - * - * Returns the number of bytes read or -1 in case of error - */ -static int -hugeRead(void *context, char *buffer, int len) -{ - if ((context == NULL) || (buffer == NULL) || (len < 0)) - return (-1); - - if (instate == 0) { - if (len >= rlen) { - len = rlen; - rlen = 0; - memcpy(buffer, current, len); - instate = 1; - curlen = 0; - dotlen = maxlen / 10; - } else { - memcpy(buffer, current, len); - rlen -= len; - current += len; - } - } else if (instate == 2) { - if (len >= rlen) { - len = rlen; - rlen = 0; - memcpy(buffer, current, len); - instate = 3; - curlen = 0; - } else { - memcpy(buffer, current, len); - rlen -= len; - current += len; - } - } else if (instate == 1) { - if (len > CHUNK) len = CHUNK; - memcpy(buffer, &filling[0], len); - curlen += len; - if (curlen >= maxlen) { - rlen = strlen(hugeTests[currentTest].end); - current = hugeTests[currentTest].end; - instate = 2; - } else { - if (curlen > dotlen) { - fprintf(stderr, "."); - dotlen += maxlen / 10; - } - } - } else - len = 0; - return (len); -} - -/************************************************************************ - * * - * Crazy document generator * - * * - ************************************************************************/ - -unsigned int crazy_indx = 0; - -const char *crazy = "\ -\ -\ -\ -\ -\ -\ -]>\ -\ -\ -\ -\ -\ -foo\ -\ -\ -\ -"; - -/** - * crazyMatch: - * @URI: an URI to test - * - * Check for a crazy: query - * - * Returns 1 if yes and 0 if another Input module should be used - */ -static int -crazyMatch(const char * URI) { - if ((URI != NULL) && (!strncmp(URI, "crazy:", 6))) - return(1); - return(0); -} - -/** - * crazyOpen: - * @URI: an URI to test - * - * Return a pointer to the crazy: query handler, in this example simply - * the current pointer... - * - * Returns an Input context or NULL in case or error - */ -static void * -crazyOpen(const char * URI) { - if ((URI == NULL) || (strncmp(URI, "crazy:", 6))) - return(NULL); - - if (crazy_indx > strlen(crazy)) - return(NULL); - reset_timout(); - rlen = crazy_indx; - current = &crazy[0]; - instate = 0; - return((void *) current); -} - -/** - * crazyClose: - * @context: the read context - * - * Close the crazy: query handler - * - * Returns 0 or -1 in case of error - */ -static int -crazyClose(void * context) { - if (context == NULL) return(-1); - return(0); -} - - -/** - * crazyRead: - * @context: the read context - * @buffer: where to store data - * @len: number of bytes to read - * - * Implement an crazy: query read. - * - * Returns the number of bytes read or -1 in case of error - */ -static int -crazyRead(void *context, char *buffer, int len) -{ - if ((context == NULL) || (buffer == NULL) || (len < 0)) - return (-1); - - if ((check_time() <= 0) && (instate == 1)) { - fprintf(stderr, "\ntimeout in crazy(%d)\n", crazy_indx); - rlen = strlen(crazy) - crazy_indx; - current = &crazy[crazy_indx]; - instate = 2; - } - if (instate == 0) { - if (len >= rlen) { - len = rlen; - rlen = 0; - memcpy(buffer, current, len); - instate = 1; - curlen = 0; - } else { - memcpy(buffer, current, len); - rlen -= len; - current += len; - } - } else if (instate == 2) { - if (len >= rlen) { - len = rlen; - rlen = 0; - memcpy(buffer, current, len); - instate = 3; - curlen = 0; - } else { - memcpy(buffer, current, len); - rlen -= len; - current += len; - } - } else if (instate == 1) { - if (len > CHUNK) len = CHUNK; - memcpy(buffer, &filling[0], len); - curlen += len; - if (curlen >= maxlen) { - rlen = strlen(crazy) - crazy_indx; - current = &crazy[crazy_indx]; - instate = 2; - } - } else - len = 0; - return (len); -} -/************************************************************************ - * * - * Libxml2 specific routines * - * * - ************************************************************************/ - -static int nb_tests = 0; -static int nb_errors = 0; -static int nb_leaks = 0; -static int extraMemoryFromResolver = 0; - -/* - * We need to trap calls to the resolver to not account memory for the catalog - * which is shared to the current running test. We also don't want to have - * network downloads modifying tests. - */ -static xmlParserInputPtr -testExternalEntityLoader(const char *URL, const char *ID, - xmlParserCtxtPtr ctxt) { - xmlParserInputPtr ret; - int memused = xmlMemUsed(); - - ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); - extraMemoryFromResolver += xmlMemUsed() - memused; - - return(ret); -} - -/* - * Trapping the error messages at the generic level to grab the equivalent of - * stderr messages on CLI tools. - */ -static char testErrors[32769]; -static int testErrorsSize = 0; - -static void XMLCDECL -channel(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) { - va_list args; - int res; - - if (testErrorsSize >= 32768) - return; - va_start(args, msg); - res = vsnprintf(&testErrors[testErrorsSize], - 32768 - testErrorsSize, - msg, args); - va_end(args); - if (testErrorsSize + res >= 32768) { - /* buffer is full */ - testErrorsSize = 32768; - testErrors[testErrorsSize] = 0; - } else { - testErrorsSize += res; - } - testErrors[testErrorsSize] = 0; -} - -/** - * xmlParserPrintFileContext: - * @input: an xmlParserInputPtr input - * - * Displays current context within the input content for error tracking - */ - -static void -xmlParserPrintFileContextInternal(xmlParserInputPtr input , - xmlGenericErrorFunc chanl, void *data ) { - const xmlChar *cur, *base; - unsigned int n, col; /* GCC warns if signed, because compared with sizeof() */ - xmlChar content[81]; /* space for 80 chars + line terminator */ - xmlChar *ctnt; - - if (input == NULL) return; - cur = input->cur; - base = input->base; - /* skip backwards over any end-of-lines */ - while ((cur > base) && ((*(cur) == '\n') || (*(cur) == '\r'))) { - cur--; - } - n = 0; - /* search backwards for beginning-of-line (to max buff size) */ - while ((n++ < (sizeof(content)-1)) && (cur > base) && - (*(cur) != '\n') && (*(cur) != '\r')) - cur--; - if ((*(cur) == '\n') || (*(cur) == '\r')) cur++; - /* calculate the error position in terms of the current position */ - col = input->cur - cur; - /* search forward for end-of-line (to max buff size) */ - n = 0; - ctnt = content; - /* copy selected text to our buffer */ - while ((*cur != 0) && (*(cur) != '\n') && - (*(cur) != '\r') && (n < sizeof(content)-1)) { - *ctnt++ = *cur++; - n++; - } - *ctnt = 0; - /* print out the selected text */ - chanl(data ,"%s\n", content); - /* create blank line with problem pointer */ - n = 0; - ctnt = content; - /* (leave buffer space for pointer + line terminator) */ - while ((nfile; - line = err->line; - code = err->code; - domain = err->domain; - level = err->level; - node = err->node; - if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) || - (domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) || - (domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) { - ctxt = err->ctxt; - } - str = err->message; - - if (code == XML_ERR_OK) - return; - - if ((node != NULL) && (node->type == XML_ELEMENT_NODE)) - name = node->name; - - /* - * Maintain the compatibility with the legacy error handling - */ - if (ctxt != NULL) { - input = ctxt->input; - if ((input != NULL) && (input->filename == NULL) && - (ctxt->inputNr > 1)) { - cur = input; - input = ctxt->inputTab[ctxt->inputNr - 2]; - } - if (input != NULL) { - if (input->filename) - channel(data, "%s:%d: ", input->filename, input->line); - else if ((line != 0) && (domain == XML_FROM_PARSER)) - channel(data, "Entity: line %d: ", input->line); - } - } else { - if (file != NULL) - channel(data, "%s:%d: ", file, line); - else if ((line != 0) && (domain == XML_FROM_PARSER)) - channel(data, "Entity: line %d: ", line); - } - if (name != NULL) { - channel(data, "element %s: ", name); - } - if (code == XML_ERR_OK) - return; - switch (domain) { - case XML_FROM_PARSER: - channel(data, "parser "); - break; - case XML_FROM_NAMESPACE: - channel(data, "namespace "); - break; - case XML_FROM_DTD: - case XML_FROM_VALID: - channel(data, "validity "); - break; - case XML_FROM_HTML: - channel(data, "HTML parser "); - break; - case XML_FROM_MEMORY: - channel(data, "memory "); - break; - case XML_FROM_OUTPUT: - channel(data, "output "); - break; - case XML_FROM_IO: - channel(data, "I/O "); - break; - case XML_FROM_XINCLUDE: - channel(data, "XInclude "); - break; - case XML_FROM_XPATH: - channel(data, "XPath "); - break; - case XML_FROM_XPOINTER: - channel(data, "parser "); - break; - case XML_FROM_REGEXP: - channel(data, "regexp "); - break; - case XML_FROM_MODULE: - channel(data, "module "); - break; - case XML_FROM_SCHEMASV: - channel(data, "Schemas validity "); - break; - case XML_FROM_SCHEMASP: - channel(data, "Schemas parser "); - break; - case XML_FROM_RELAXNGP: - channel(data, "Relax-NG parser "); - break; - case XML_FROM_RELAXNGV: - channel(data, "Relax-NG validity "); - break; - case XML_FROM_CATALOG: - channel(data, "Catalog "); - break; - case XML_FROM_C14N: - channel(data, "C14N "); - break; - case XML_FROM_XSLT: - channel(data, "XSLT "); - break; - default: - break; - } - if (code == XML_ERR_OK) - return; - switch (level) { - case XML_ERR_NONE: - channel(data, ": "); - break; - case XML_ERR_WARNING: - channel(data, "warning : "); - break; - case XML_ERR_ERROR: - channel(data, "error : "); - break; - case XML_ERR_FATAL: - channel(data, "error : "); - break; - } - if (code == XML_ERR_OK) - return; - if (str != NULL) { - int len; - len = xmlStrlen((const xmlChar *)str); - if ((len > 0) && (str[len - 1] != '\n')) - channel(data, "%s\n", str); - else - channel(data, "%s", str); - } else { - channel(data, "%s\n", "out of memory error"); - } - if (code == XML_ERR_OK) - return; - - if (ctxt != NULL) { - xmlParserPrintFileContextInternal(input, channel, data); - if (cur != NULL) { - if (cur->filename) - channel(data, "%s:%d: \n", cur->filename, cur->line); - else if ((line != 0) && (domain == XML_FROM_PARSER)) - channel(data, "Entity: line %d: \n", cur->line); - xmlParserPrintFileContextInternal(cur, channel, data); - } - } - if ((domain == XML_FROM_XPATH) && (err->str1 != NULL) && - (err->int1 < 100) && - (err->int1 < xmlStrlen((const xmlChar *)err->str1))) { - xmlChar buf[150]; - int i; - - channel(data, "%s\n", err->str1); - for (i=0;i < err->int1;i++) - buf[i] = ' '; - buf[i++] = '^'; - buf[i] = 0; - channel(data, "%s\n", buf); - } -} - -static void -initializeLibxml2(void) { - xmlGetWarningsDefaultValue = 0; - xmlPedanticParserDefault(0); - - xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup); - xmlInitParser(); - xmlSetExternalEntityLoader(testExternalEntityLoader); - xmlSetStructuredErrorFunc(NULL, testStructuredErrorHandler); - /* - * register the new I/O handlers - */ - if (xmlRegisterInputCallbacks(hugeMatch, hugeOpen, - hugeRead, hugeClose) < 0) { - fprintf(stderr, "failed to register Huge handlers\n"); - exit(1); - } - if (xmlRegisterInputCallbacks(crazyMatch, crazyOpen, - crazyRead, crazyClose) < 0) { - fprintf(stderr, "failed to register Crazy handlers\n"); - exit(1); - } -} - -/************************************************************************ - * * - * SAX empty callbacks * - * * - ************************************************************************/ - -unsigned long callbacks = 0; - -/** - * isStandaloneCallback: - * @ctxt: An XML parser context - * - * Is this document tagged standalone ? - * - * Returns 1 if true - */ -static int -isStandaloneCallback(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - return (0); -} - -/** - * hasInternalSubsetCallback: - * @ctxt: An XML parser context - * - * Does this document has an internal subset - * - * Returns 1 if true - */ -static int -hasInternalSubsetCallback(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - return (0); -} - -/** - * hasExternalSubsetCallback: - * @ctxt: An XML parser context - * - * Does this document has an external subset - * - * Returns 1 if true - */ -static int -hasExternalSubsetCallback(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - return (0); -} - -/** - * internalSubsetCallback: - * @ctxt: An XML parser context - * - * Does this document has an internal subset - */ -static void -internalSubsetCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * name ATTRIBUTE_UNUSED, - const xmlChar * ExternalID ATTRIBUTE_UNUSED, - const xmlChar * SystemID ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -/** - * externalSubsetCallback: - * @ctxt: An XML parser context - * - * Does this document has an external subset - */ -static void -externalSubsetCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * name ATTRIBUTE_UNUSED, - const xmlChar * ExternalID ATTRIBUTE_UNUSED, - const xmlChar * SystemID ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -/** - * resolveEntityCallback: - * @ctxt: An XML parser context - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * Special entity resolver, better left to the parser, it has - * more context than the application layer. - * The default behaviour is to NOT resolve the entities, in that case - * the ENTITY_REF nodes are built in the structure (and the parameter - * values). - * - * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. - */ -static xmlParserInputPtr -resolveEntityCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * publicId ATTRIBUTE_UNUSED, - const xmlChar * systemId ATTRIBUTE_UNUSED) -{ - callbacks++; - return (NULL); -} - -/** - * getEntityCallback: - * @ctxt: An XML parser context - * @name: The entity name - * - * Get an entity by name - * - * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. - */ -static xmlEntityPtr -getEntityCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * name ATTRIBUTE_UNUSED) -{ - callbacks++; - return (NULL); -} - -/** - * getParameterEntityCallback: - * @ctxt: An XML parser context - * @name: The entity name - * - * Get a parameter entity by name - * - * Returns the xmlParserInputPtr - */ -static xmlEntityPtr -getParameterEntityCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * name ATTRIBUTE_UNUSED) -{ - callbacks++; - return (NULL); -} - - -/** - * entityDeclCallback: - * @ctxt: An XML parser context - * @name: the entity name - * @type: the entity type - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @content: the entity value (without processing). - * - * An entity definition has been parsed - */ -static void -entityDeclCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * name ATTRIBUTE_UNUSED, - int type ATTRIBUTE_UNUSED, - const xmlChar * publicId ATTRIBUTE_UNUSED, - const xmlChar * systemId ATTRIBUTE_UNUSED, - xmlChar * content ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -/** - * attributeDeclCallback: - * @ctxt: An XML parser context - * @name: the attribute name - * @type: the attribute type - * - * An attribute definition has been parsed - */ -static void -attributeDeclCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * elem ATTRIBUTE_UNUSED, - const xmlChar * name ATTRIBUTE_UNUSED, - int type ATTRIBUTE_UNUSED, int def ATTRIBUTE_UNUSED, - const xmlChar * defaultValue ATTRIBUTE_UNUSED, - xmlEnumerationPtr tree ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -/** - * elementDeclCallback: - * @ctxt: An XML parser context - * @name: the element name - * @type: the element type - * @content: the element value (without processing). - * - * An element definition has been parsed - */ -static void -elementDeclCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * name ATTRIBUTE_UNUSED, - int type ATTRIBUTE_UNUSED, - xmlElementContentPtr content ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -/** - * notationDeclCallback: - * @ctxt: An XML parser context - * @name: The name of the notation - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * What to do when a notation declaration has been parsed. - */ -static void -notationDeclCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * name ATTRIBUTE_UNUSED, - const xmlChar * publicId ATTRIBUTE_UNUSED, - const xmlChar * systemId ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -/** - * unparsedEntityDeclCallback: - * @ctxt: An XML parser context - * @name: The name of the entity - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @notationName: the name of the notation - * - * What to do when an unparsed entity declaration is parsed - */ -static void -unparsedEntityDeclCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * name ATTRIBUTE_UNUSED, - const xmlChar * publicId ATTRIBUTE_UNUSED, - const xmlChar * systemId ATTRIBUTE_UNUSED, - const xmlChar * notationName ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -/** - * setDocumentLocatorCallback: - * @ctxt: An XML parser context - * @loc: A SAX Locator - * - * Receive the document locator at startup, actually xmlDefaultSAXLocator - * Everything is available on the context, so this is useless in our case. - */ -static void -setDocumentLocatorCallback(void *ctx ATTRIBUTE_UNUSED, - xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -/** - * startDocumentCallback: - * @ctxt: An XML parser context - * - * called when the document start being processed. - */ -static void -startDocumentCallback(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -/** - * endDocumentCallback: - * @ctxt: An XML parser context - * - * called when the document end has been detected. - */ -static void -endDocumentCallback(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -#if 0 -/** - * startElementCallback: - * @ctxt: An XML parser context - * @name: The element name - * - * called when an opening tag has been processed. - */ -static void -startElementCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * name ATTRIBUTE_UNUSED, - const xmlChar ** atts ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -/** - * endElementCallback: - * @ctxt: An XML parser context - * @name: The element name - * - * called when the end of an element has been detected. - */ -static void -endElementCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * name ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} -#endif - -/** - * charactersCallback: - * @ctxt: An XML parser context - * @ch: a xmlChar string - * @len: the number of xmlChar - * - * receiving some chars from the parser. - * Question: how much at a time ??? - */ -static void -charactersCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * ch ATTRIBUTE_UNUSED, - int len ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -/** - * referenceCallback: - * @ctxt: An XML parser context - * @name: The entity name - * - * called when an entity reference is detected. - */ -static void -referenceCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * name ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -/** - * ignorableWhitespaceCallback: - * @ctxt: An XML parser context - * @ch: a xmlChar string - * @start: the first char in the string - * @len: the number of xmlChar - * - * receiving some ignorable whitespaces from the parser. - * Question: how much at a time ??? - */ -static void -ignorableWhitespaceCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * ch ATTRIBUTE_UNUSED, - int len ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -/** - * processingInstructionCallback: - * @ctxt: An XML parser context - * @target: the target name - * @data: the PI data's - * @len: the number of xmlChar - * - * A processing instruction has been parsed. - */ -static void -processingInstructionCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * target ATTRIBUTE_UNUSED, - const xmlChar * data ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -/** - * cdataBlockCallback: - * @ctx: the user data (XML parser context) - * @value: The pcdata content - * @len: the block length - * - * called when a pcdata block has been parsed - */ -static void -cdataBlockCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * value ATTRIBUTE_UNUSED, - int len ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -/** - * commentCallback: - * @ctxt: An XML parser context - * @value: the comment content - * - * A comment has been parsed. - */ -static void -commentCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * value ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -/** - * warningCallback: - * @ctxt: An XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format a warning messages, gives file, line, position and - * extra parameters. - */ -static void XMLCDECL -warningCallback(void *ctx ATTRIBUTE_UNUSED, - const char *msg ATTRIBUTE_UNUSED, ...) -{ - callbacks++; - return; -} - -/** - * errorCallback: - * @ctxt: An XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format a error messages, gives file, line, position and - * extra parameters. - */ -static void XMLCDECL -errorCallback(void *ctx ATTRIBUTE_UNUSED, const char *msg ATTRIBUTE_UNUSED, - ...) -{ - callbacks++; - return; -} - -/** - * fatalErrorCallback: - * @ctxt: An XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format a fatalError messages, gives file, line, position and - * extra parameters. - */ -static void XMLCDECL -fatalErrorCallback(void *ctx ATTRIBUTE_UNUSED, - const char *msg ATTRIBUTE_UNUSED, ...) -{ - return; -} - - -/* - * SAX2 specific callbacks - */ - -/** - * startElementNsCallback: - * @ctxt: An XML parser context - * @name: The element name - * - * called when an opening tag has been processed. - */ -static void -startElementNsCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * localname ATTRIBUTE_UNUSED, - const xmlChar * prefix ATTRIBUTE_UNUSED, - const xmlChar * URI ATTRIBUTE_UNUSED, - int nb_namespaces ATTRIBUTE_UNUSED, - const xmlChar ** namespaces ATTRIBUTE_UNUSED, - int nb_attributes ATTRIBUTE_UNUSED, - int nb_defaulted ATTRIBUTE_UNUSED, - const xmlChar ** attributes ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -/** - * endElementCallback: - * @ctxt: An XML parser context - * @name: The element name - * - * called when the end of an element has been detected. - */ -static void -endElementNsCallback(void *ctx ATTRIBUTE_UNUSED, - const xmlChar * localname ATTRIBUTE_UNUSED, - const xmlChar * prefix ATTRIBUTE_UNUSED, - const xmlChar * URI ATTRIBUTE_UNUSED) -{ - callbacks++; - return; -} - -static xmlSAXHandler callbackSAX2HandlerStruct = { - internalSubsetCallback, - isStandaloneCallback, - hasInternalSubsetCallback, - hasExternalSubsetCallback, - resolveEntityCallback, - getEntityCallback, - entityDeclCallback, - notationDeclCallback, - attributeDeclCallback, - elementDeclCallback, - unparsedEntityDeclCallback, - setDocumentLocatorCallback, - startDocumentCallback, - endDocumentCallback, - NULL, - NULL, - referenceCallback, - charactersCallback, - ignorableWhitespaceCallback, - processingInstructionCallback, - commentCallback, - warningCallback, - errorCallback, - fatalErrorCallback, - getParameterEntityCallback, - cdataBlockCallback, - externalSubsetCallback, - XML_SAX2_MAGIC, - NULL, - startElementNsCallback, - endElementNsCallback, - NULL -}; - -static xmlSAXHandlerPtr callbackSAX2Handler = &callbackSAX2HandlerStruct; - -/************************************************************************ - * * - * The tests front-ends * - * * - ************************************************************************/ - -/** - * readerTest: - * @filename: the file to parse - * @max_size: size of the limit to test - * @options: parsing options - * @fail: should a failure be reported - * - * Parse a memory generated file using SAX - * - * Returns 0 in case of success, an error code otherwise - */ -static int -saxTest(const char *filename, size_t limit, int options, int fail) { - int res = 0; - xmlParserCtxtPtr ctxt; - xmlDocPtr doc; - xmlSAXHandlerPtr old_sax; - - nb_tests++; - - maxlen = limit; - ctxt = xmlNewParserCtxt(); - if (ctxt == NULL) { - fprintf(stderr, "Failed to create parser context\n"); - return(1); - } - old_sax = ctxt->sax; - ctxt->sax = callbackSAX2Handler; - ctxt->userData = NULL; - doc = xmlCtxtReadFile(ctxt, filename, NULL, options); - - if (doc != NULL) { - fprintf(stderr, "SAX parsing generated a document !\n"); - xmlFreeDoc(doc); - res = 0; - } else if (ctxt->wellFormed == 0) { - if (fail) - res = 0; - else { - fprintf(stderr, "Failed to parse '%s' %lu\n", filename, limit); - res = 1; - } - } else { - if (fail) { - fprintf(stderr, "Failed to get failure for '%s' %lu\n", - filename, limit); - res = 1; - } else - res = 0; - } - ctxt->sax = old_sax; - xmlFreeParserCtxt(ctxt); - - return(res); -} -#ifdef LIBXML_READER_ENABLED -/** - * readerTest: - * @filename: the file to parse - * @max_size: size of the limit to test - * @options: parsing options - * @fail: should a failure be reported - * - * Parse a memory generated file using the xmlReader - * - * Returns 0 in case of success, an error code otherwise - */ -static int -readerTest(const char *filename, size_t limit, int options, int fail) { - xmlTextReaderPtr reader; - int res = 0; - int ret; - - nb_tests++; - - maxlen = limit; - reader = xmlReaderForFile(filename , NULL, options); - if (reader == NULL) { - fprintf(stderr, "Failed to open '%s' test\n", filename); - return(1); - } - ret = xmlTextReaderRead(reader); - while (ret == 1) { - ret = xmlTextReaderRead(reader); - } - if (ret != 0) { - if (fail) - res = 0; - else { - if (strncmp(filename, "crazy:", 6) == 0) - fprintf(stderr, "Failed to parse '%s' %u\n", - filename, crazy_indx); - else - fprintf(stderr, "Failed to parse '%s' %lu\n", - filename, limit); - res = 1; - } - } else { - if (fail) { - if (strncmp(filename, "crazy:", 6) == 0) - fprintf(stderr, "Failed to get failure for '%s' %u\n", - filename, crazy_indx); - else - fprintf(stderr, "Failed to get failure for '%s' %lu\n", - filename, limit); - res = 1; - } else - res = 0; - } - if (timeout) - res = 1; - xmlFreeTextReader(reader); - - return(res); -} -#endif - -/************************************************************************ - * * - * Tests descriptions * - * * - ************************************************************************/ - -typedef int (*functest) (const char *filename, size_t limit, int options, - int fail); - -typedef struct limitDesc limitDesc; -typedef limitDesc *limitDescPtr; -struct limitDesc { - const char *name; /* the huge generator name */ - size_t limit; /* the limit to test */ - int options; /* extra parser options */ - int fail; /* whether the test should fail */ -}; - -static limitDesc limitDescriptions[] = { - /* max lenght of a text node in content */ - {"huge:textNode", XML_MAX_TEXT_LENGTH - CHUNK, 0, 0}, - {"huge:textNode", XML_MAX_TEXT_LENGTH + CHUNK, 0, 1}, - {"huge:textNode", XML_MAX_TEXT_LENGTH + CHUNK, XML_PARSE_HUGE, 0}, - /* max lenght of a text node in content */ - {"huge:attrNode", XML_MAX_TEXT_LENGTH - CHUNK, 0, 0}, - {"huge:attrNode", XML_MAX_TEXT_LENGTH + CHUNK, 0, 1}, - {"huge:attrNode", XML_MAX_TEXT_LENGTH + CHUNK, XML_PARSE_HUGE, 0}, - /* max lenght of a comment node */ - {"huge:commentNode", XML_MAX_TEXT_LENGTH - CHUNK, 0, 0}, - {"huge:commentNode", XML_MAX_TEXT_LENGTH + CHUNK, 0, 1}, - {"huge:commentNode", XML_MAX_TEXT_LENGTH + CHUNK, XML_PARSE_HUGE, 0}, - /* max lenght of a PI node */ - {"huge:piNode", XML_MAX_TEXT_LENGTH - CHUNK, 0, 0}, - {"huge:piNode", XML_MAX_TEXT_LENGTH + CHUNK, 0, 1}, - {"huge:piNode", XML_MAX_TEXT_LENGTH + CHUNK, XML_PARSE_HUGE, 0}, -}; - -typedef struct testDesc testDesc; -typedef testDesc *testDescPtr; -struct testDesc { - const char *desc; /* descripton of the test */ - functest func; /* function implementing the test */ -}; - -static -testDesc testDescriptions[] = { - { "Parsing of huge files with the sax parser", saxTest}, -/* { "Parsing of huge files with the tree parser", treeTest}, */ -#ifdef LIBXML_READER_ENABLED - { "Parsing of huge files with the reader", readerTest}, -#endif - {NULL, NULL} -}; - -typedef struct testException testException; -typedef testException *testExceptionPtr; -struct testException { - unsigned int test; /* the parser test number */ - unsigned int limit; /* the limit test number */ - int fail; /* new fail value or -1*/ - size_t size; /* new limit value or 0 */ -}; - -static -testException testExceptions[] = { - /* the SAX parser doesn't hit a limit of XML_MAX_TEXT_LENGTH text nodes */ - { 0, 1, 0, 0}, -}; - -static int -launchTests(testDescPtr tst, unsigned int test) { - int res = 0, err = 0; - unsigned int i, j; - size_t limit; - int fail; - - if (tst == NULL) return(-1); - - for (i = 0;i < sizeof(limitDescriptions)/sizeof(limitDescriptions[0]);i++) { - limit = limitDescriptions[i].limit; - fail = limitDescriptions[i].fail; - /* - * Handle exceptions if any - */ - for (j = 0;j < sizeof(testExceptions)/sizeof(testExceptions[0]);j++) { - if ((testExceptions[j].test == test) && - (testExceptions[j].limit == i)) { - if (testExceptions[j].fail != -1) - fail = testExceptions[j].fail; - if (testExceptions[j].size != 0) - limit = testExceptions[j].size; - break; - } - } - res = tst->func(limitDescriptions[i].name, limit, - limitDescriptions[i].options, fail); - if (res != 0) { - nb_errors++; - err++; - } - } - return(err); -} - - -static int -runtest(unsigned int i) { - int ret = 0, res; - int old_errors, old_tests, old_leaks; - - old_errors = nb_errors; - old_tests = nb_tests; - old_leaks = nb_leaks; - if ((tests_quiet == 0) && (testDescriptions[i].desc != NULL)) - printf("## %s\n", testDescriptions[i].desc); - res = launchTests(&testDescriptions[i], i); - if (res != 0) - ret++; - if (verbose) { - if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) - printf("Ran %d tests, no errors\n", nb_tests - old_tests); - else - printf("Ran %d tests, %d errors, %d leaks\n", - nb_tests - old_tests, - nb_errors - old_errors, - nb_leaks - old_leaks); - } - return(ret); -} - -static int -launchCrazySAX(unsigned int test, int fail) { - int res = 0, err = 0; - - crazy_indx = test; - - res = saxTest("crazy::test", XML_MAX_LOOKUP_LIMIT - CHUNK, 0, fail); - if (res != 0) { - nb_errors++; - err++; - } - if (tests_quiet == 0) - fprintf(stderr, "%c", crazy[test]); - - return(err); -} - -static int -launchCrazy(unsigned int test, int fail) { - int res = 0, err = 0; - - crazy_indx = test; - - res = readerTest("crazy::test", XML_MAX_LOOKUP_LIMIT - CHUNK, 0, fail); - if (res != 0) { - nb_errors++; - err++; - } - if (tests_quiet == 0) - fprintf(stderr, "%c", crazy[test]); - - return(err); -} - -static int get_crazy_fail(int test) { - /* - * adding 1000000 of character 'a' leads to parser failure mostly - * everywhere except in those special spots. Need to be updated - * each time crazy is updated - */ - int fail = 1; - if ((test == 44) || /* PI in Misc */ - ((test >= 50) && (test <= 55)) || /* Comment in Misc */ - (test == 79) || /* PI in DTD */ - ((test >= 85) && (test <= 90)) || /* Comment in DTD */ - (test == 154) || /* PI in Misc */ - ((test >= 160) && (test <= 165)) || /* Comment in Misc */ - ((test >= 178) && (test <= 181)) || /* attribute value */ - (test == 183) || /* Text */ - (test == 189) || /* PI in Content */ - (test == 191) || /* Text */ - ((test >= 195) && (test <= 200)) || /* Comment in Content */ - ((test >= 203) && (test <= 206)) || /* Text */ - (test == 215) || (test == 216) || /* in CDATA */ - (test == 219) || /* Text */ - (test == 231) || /* PI in Misc */ - ((test >= 237) && (test <= 242))) /* Comment in Misc */ - fail = 0; - return(fail); -} - -static int -runcrazy(void) { - int ret = 0, res = 0; - int old_errors, old_tests, old_leaks; - unsigned int i; - - old_errors = nb_errors; - old_tests = nb_tests; - old_leaks = nb_leaks; - if (tests_quiet == 0) { - printf("## Crazy tests on reader\n"); - } - for (i = 0;i < strlen(crazy);i++) { - res += launchCrazy(i, get_crazy_fail(i)); - if (res != 0) - ret++; - } - if (tests_quiet == 0) { - printf("\n## Crazy tests on SAX\n"); - } - for (i = 0;i < strlen(crazy);i++) { - res += launchCrazySAX(i, get_crazy_fail(i)); - if (res != 0) - ret++; - } - if (tests_quiet == 0) - fprintf(stderr, "\n"); - if (verbose) { - if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) - printf("Ran %d tests, no errors\n", nb_tests - old_tests); - else - printf("Ran %d tests, %d errors, %d leaks\n", - nb_tests - old_tests, - nb_errors - old_errors, - nb_leaks - old_leaks); - } - return(ret); -} - - -int -main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - int i, a, ret = 0; - int subset = 0; - - fillFilling(); - initializeLibxml2(); - - for (a = 1; a < argc;a++) { - if (!strcmp(argv[a], "-v")) - verbose = 1; - else if (!strcmp(argv[a], "-quiet")) - tests_quiet = 1; - else if (!strcmp(argv[a], "-crazy")) - subset = 1; - } - if (subset == 0) { - for (i = 0; testDescriptions[i].func != NULL; i++) { - ret += runtest(i); - } - } - ret += runcrazy(); - if ((nb_errors == 0) && (nb_leaks == 0)) { - ret = 0; - printf("Total %d tests, no errors\n", - nb_tests); - } else { - ret = 1; - printf("Total %d tests, %d errors, %d leaks\n", - nb_tests, nb_errors, nb_leaks); - } - xmlCleanupParser(); - xmlMemoryDump(); - - return(ret); -} diff --git a/lib/3rdparty/libxml2/testrecurse.c b/lib/3rdparty/libxml2/testrecurse.c deleted file mode 100644 index e5d5d1b307a..00000000000 --- a/lib/3rdparty/libxml2/testrecurse.c +++ /dev/null @@ -1,965 +0,0 @@ -/* - * testrecurse.c: C program to run libxml2 regression tests checking entities - * recursions - * - * To compile on Unixes: - * cc -o testrecurse `xml2-config --cflags` testrecurse.c `xml2-config --libs` -lpthread - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#include "libxml.h" -#include - -#if !defined(_WIN32) || defined(__CYGWIN__) -#include -#endif -#include -#include -#include -#include - -#include -#include -#include -#ifdef LIBXML_READER_ENABLED -#include -#endif - -/* - * O_BINARY is just for Windows compatibility - if it isn't defined - * on this system, avoid any compilation error - */ -#ifdef O_BINARY -#define RD_FLAGS O_RDONLY | O_BINARY -#else -#define RD_FLAGS O_RDONLY -#endif - -typedef int (*functest) (const char *filename, const char *result, - const char *error, int options); - -typedef struct testDesc testDesc; -typedef testDesc *testDescPtr; -struct testDesc { - const char *desc; /* descripton of the test */ - functest func; /* function implementing the test */ - const char *in; /* glob to path for input files */ - const char *out; /* output directory */ - const char *suffix;/* suffix for output files */ - const char *err; /* suffix for error output files */ - int options; /* parser options for the test */ -}; - -static int checkTestFile(const char *filename); - - -#if defined(_WIN32) && !defined(__CYGWIN__) - -#include -#include - -typedef struct -{ - size_t gl_pathc; /* Count of paths matched so far */ - char **gl_pathv; /* List of matched pathnames. */ - size_t gl_offs; /* Slots to reserve in 'gl_pathv'. */ -} glob_t; - -#define GLOB_DOOFFS 0 -static int glob(const char *pattern, int flags, - int errfunc(const char *epath, int eerrno), - glob_t *pglob) { - glob_t *ret; - WIN32_FIND_DATA FindFileData; - HANDLE hFind; - unsigned int nb_paths = 0; - char directory[500]; - int len; - - if ((pattern == NULL) || (pglob == NULL)) return(-1); - - strncpy(directory, pattern, 499); - for (len = strlen(directory);len >= 0;len--) { - if (directory[len] == '/') { - len++; - directory[len] = 0; - break; - } - } - if (len <= 0) - len = 0; - - - ret = pglob; - memset(ret, 0, sizeof(glob_t)); - - hFind = FindFirstFileA(pattern, &FindFileData); - if (hFind == INVALID_HANDLE_VALUE) - return(0); - nb_paths = 20; - ret->gl_pathv = (char **) malloc(nb_paths * sizeof(char *)); - if (ret->gl_pathv == NULL) { - FindClose(hFind); - return(-1); - } - strncpy(directory + len, FindFileData.cFileName, 499 - len); - ret->gl_pathv[ret->gl_pathc] = strdup(directory); - if (ret->gl_pathv[ret->gl_pathc] == NULL) - goto done; - ret->gl_pathc++; - while(FindNextFileA(hFind, &FindFileData)) { - if (FindFileData.cFileName[0] == '.') - continue; - if (ret->gl_pathc + 2 > nb_paths) { - char **tmp = realloc(ret->gl_pathv, nb_paths * 2 * sizeof(char *)); - if (tmp == NULL) - break; - ret->gl_pathv = tmp; - nb_paths *= 2; - } - strncpy(directory + len, FindFileData.cFileName, 499 - len); - ret->gl_pathv[ret->gl_pathc] = strdup(directory); - if (ret->gl_pathv[ret->gl_pathc] == NULL) - break; - ret->gl_pathc++; - } - ret->gl_pathv[ret->gl_pathc] = NULL; - -done: - FindClose(hFind); - return(0); -} - - - -static void globfree(glob_t *pglob) { - unsigned int i; - if (pglob == NULL) - return; - - for (i = 0;i < pglob->gl_pathc;i++) { - if (pglob->gl_pathv[i] != NULL) - free(pglob->gl_pathv[i]); - } -} - -#else -#include -#endif - -/************************************************************************ - * * - * Huge document generator * - * * - ************************************************************************/ - -#include - - -static const char *start = " \ - \ - \ -]> \ -"; - -static const char *segment = " &e; &f; &d;\n"; -static const char *finish = ""; - -static int curseg = 0; -static const char *current; -static int rlen; - -/** - * hugeMatch: - * @URI: an URI to test - * - * Check for an huge: query - * - * Returns 1 if yes and 0 if another Input module should be used - */ -static int -hugeMatch(const char * URI) { - if ((URI != NULL) && (!strncmp(URI, "huge:", 4))) - return(1); - return(0); -} - -/** - * hugeOpen: - * @URI: an URI to test - * - * Return a pointer to the huge: query handler, in this example simply - * the current pointer... - * - * Returns an Input context or NULL in case or error - */ -static void * -hugeOpen(const char * URI) { - if ((URI == NULL) || (strncmp(URI, "huge:", 4))) - return(NULL); - rlen = strlen(start); - current = start; - return((void *) current); -} - -/** - * hugeClose: - * @context: the read context - * - * Close the huge: query handler - * - * Returns 0 or -1 in case of error - */ -static int -hugeClose(void * context) { - if (context == NULL) return(-1); - return(0); -} - -#define MAX_NODES 1000000 - -/** - * hugeRead: - * @context: the read context - * @buffer: where to store data - * @len: number of bytes to read - * - * Implement an huge: query read. - * - * Returns the number of bytes read or -1 in case of error - */ -static int -hugeRead(void *context, char *buffer, int len) -{ - if ((context == NULL) || (buffer == NULL) || (len < 0)) - return (-1); - - if (len >= rlen) { - if (curseg >= MAX_NODES + 1) { - rlen = 0; - return(0); - } - len = rlen; - rlen = 0; - memcpy(buffer, current, len); - curseg ++; - if (curseg == MAX_NODES) { - fprintf(stderr, "\n"); - rlen = strlen(finish); - current = finish; - } else { - if (curseg % (MAX_NODES / 10) == 0) - fprintf(stderr, "."); - rlen = strlen(segment); - current = segment; - } - } else { - memcpy(buffer, current, len); - rlen -= len; - current += len; - } - return (len); -} - -/************************************************************************ - * * - * Libxml2 specific routines * - * * - ************************************************************************/ - -static int nb_tests = 0; -static int nb_errors = 0; -static int nb_leaks = 0; -static int extraMemoryFromResolver = 0; - -static int -fatalError(void) { - fprintf(stderr, "Exitting tests on fatal error\n"); - exit(1); -} - -/* - * We need to trap calls to the resolver to not account memory for the catalog - * which is shared to the current running test. We also don't want to have - * network downloads modifying tests. - */ -static xmlParserInputPtr -testExternalEntityLoader(const char *URL, const char *ID, - xmlParserCtxtPtr ctxt) { - xmlParserInputPtr ret; - - if (checkTestFile(URL)) { - ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); - } else { - int memused = xmlMemUsed(); - ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); - extraMemoryFromResolver += xmlMemUsed() - memused; - } - - return(ret); -} - -/* - * Trapping the error messages at the generic level to grab the equivalent of - * stderr messages on CLI tools. - */ -static char testErrors[32769]; -static int testErrorsSize = 0; - -static void XMLCDECL -channel(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) { - va_list args; - int res; - - if (testErrorsSize >= 32768) - return; - va_start(args, msg); - res = vsnprintf(&testErrors[testErrorsSize], - 32768 - testErrorsSize, - msg, args); - va_end(args); - if (testErrorsSize + res >= 32768) { - /* buffer is full */ - testErrorsSize = 32768; - testErrors[testErrorsSize] = 0; - } else { - testErrorsSize += res; - } - testErrors[testErrorsSize] = 0; -} - -/** - * xmlParserPrintFileContext: - * @input: an xmlParserInputPtr input - * - * Displays current context within the input content for error tracking - */ - -static void -xmlParserPrintFileContextInternal(xmlParserInputPtr input , - xmlGenericErrorFunc chanl, void *data ) { - const xmlChar *cur, *base; - unsigned int n, col; /* GCC warns if signed, because compared with sizeof() */ - xmlChar content[81]; /* space for 80 chars + line terminator */ - xmlChar *ctnt; - - if (input == NULL) return; - cur = input->cur; - base = input->base; - /* skip backwards over any end-of-lines */ - while ((cur > base) && ((*(cur) == '\n') || (*(cur) == '\r'))) { - cur--; - } - n = 0; - /* search backwards for beginning-of-line (to max buff size) */ - while ((n++ < (sizeof(content)-1)) && (cur > base) && - (*(cur) != '\n') && (*(cur) != '\r')) - cur--; - if ((*(cur) == '\n') || (*(cur) == '\r')) cur++; - /* calculate the error position in terms of the current position */ - col = input->cur - cur; - /* search forward for end-of-line (to max buff size) */ - n = 0; - ctnt = content; - /* copy selected text to our buffer */ - while ((*cur != 0) && (*(cur) != '\n') && - (*(cur) != '\r') && (n < sizeof(content)-1)) { - *ctnt++ = *cur++; - n++; - } - *ctnt = 0; - /* print out the selected text */ - chanl(data ,"%s\n", content); - /* create blank line with problem pointer */ - n = 0; - ctnt = content; - /* (leave buffer space for pointer + line terminator) */ - while ((nfile; - line = err->line; - code = err->code; - domain = err->domain; - level = err->level; - node = err->node; - if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) || - (domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) || - (domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) { - ctxt = err->ctxt; - } - str = err->message; - - if (code == XML_ERR_OK) - return; - - if ((node != NULL) && (node->type == XML_ELEMENT_NODE)) - name = node->name; - - /* - * Maintain the compatibility with the legacy error handling - */ - if (ctxt != NULL) { - input = ctxt->input; - if ((input != NULL) && (input->filename == NULL) && - (ctxt->inputNr > 1)) { - cur = input; - input = ctxt->inputTab[ctxt->inputNr - 2]; - } - if (input != NULL) { - if (input->filename) - channel(data, "%s:%d: ", input->filename, input->line); - else if ((line != 0) && (domain == XML_FROM_PARSER)) - channel(data, "Entity: line %d: ", input->line); - } - } else { - if (file != NULL) - channel(data, "%s:%d: ", file, line); - else if ((line != 0) && (domain == XML_FROM_PARSER)) - channel(data, "Entity: line %d: ", line); - } - if (name != NULL) { - channel(data, "element %s: ", name); - } - if (code == XML_ERR_OK) - return; - switch (domain) { - case XML_FROM_PARSER: - channel(data, "parser "); - break; - case XML_FROM_NAMESPACE: - channel(data, "namespace "); - break; - case XML_FROM_DTD: - case XML_FROM_VALID: - channel(data, "validity "); - break; - case XML_FROM_HTML: - channel(data, "HTML parser "); - break; - case XML_FROM_MEMORY: - channel(data, "memory "); - break; - case XML_FROM_OUTPUT: - channel(data, "output "); - break; - case XML_FROM_IO: - channel(data, "I/O "); - break; - case XML_FROM_XINCLUDE: - channel(data, "XInclude "); - break; - case XML_FROM_XPATH: - channel(data, "XPath "); - break; - case XML_FROM_XPOINTER: - channel(data, "parser "); - break; - case XML_FROM_REGEXP: - channel(data, "regexp "); - break; - case XML_FROM_MODULE: - channel(data, "module "); - break; - case XML_FROM_SCHEMASV: - channel(data, "Schemas validity "); - break; - case XML_FROM_SCHEMASP: - channel(data, "Schemas parser "); - break; - case XML_FROM_RELAXNGP: - channel(data, "Relax-NG parser "); - break; - case XML_FROM_RELAXNGV: - channel(data, "Relax-NG validity "); - break; - case XML_FROM_CATALOG: - channel(data, "Catalog "); - break; - case XML_FROM_C14N: - channel(data, "C14N "); - break; - case XML_FROM_XSLT: - channel(data, "XSLT "); - break; - default: - break; - } - if (code == XML_ERR_OK) - return; - switch (level) { - case XML_ERR_NONE: - channel(data, ": "); - break; - case XML_ERR_WARNING: - channel(data, "warning : "); - break; - case XML_ERR_ERROR: - channel(data, "error : "); - break; - case XML_ERR_FATAL: - channel(data, "error : "); - break; - } - if (code == XML_ERR_OK) - return; - if (str != NULL) { - int len; - len = xmlStrlen((const xmlChar *)str); - if ((len > 0) && (str[len - 1] != '\n')) - channel(data, "%s\n", str); - else - channel(data, "%s", str); - } else { - channel(data, "%s\n", "out of memory error"); - } - if (code == XML_ERR_OK) - return; - - if (ctxt != NULL) { - xmlParserPrintFileContextInternal(input, channel, data); - if (cur != NULL) { - if (cur->filename) - channel(data, "%s:%d: \n", cur->filename, cur->line); - else if ((line != 0) && (domain == XML_FROM_PARSER)) - channel(data, "Entity: line %d: \n", cur->line); - xmlParserPrintFileContextInternal(cur, channel, data); - } - } - if ((domain == XML_FROM_XPATH) && (err->str1 != NULL) && - (err->int1 < 100) && - (err->int1 < xmlStrlen((const xmlChar *)err->str1))) { - xmlChar buf[150]; - int i; - - channel(data, "%s\n", err->str1); - for (i=0;i < err->int1;i++) - buf[i] = ' '; - buf[i++] = '^'; - buf[i] = 0; - channel(data, "%s\n", buf); - } -} - -static void -initializeLibxml2(void) { - xmlGetWarningsDefaultValue = 0; - xmlPedanticParserDefault(0); - - xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup); - xmlInitParser(); - xmlSetExternalEntityLoader(testExternalEntityLoader); - xmlSetStructuredErrorFunc(NULL, testStructuredErrorHandler); - /* - * register the new I/O handlers - */ - if (xmlRegisterInputCallbacks(hugeMatch, hugeOpen, - hugeRead, hugeClose) < 0) { - fprintf(stderr, "failed to register Huge handler\n"); - exit(1); - } -} - -/************************************************************************ - * * - * File name and path utilities * - * * - ************************************************************************/ - -static const char *baseFilename(const char *filename) { - const char *cur; - if (filename == NULL) - return(NULL); - cur = &filename[strlen(filename)]; - while ((cur > filename) && (*cur != '/')) - cur--; - if (*cur == '/') - return(cur + 1); - return(cur); -} - -static char *resultFilename(const char *filename, const char *out, - const char *suffix) { - const char *base; - char res[500]; - char suffixbuff[500]; - -/************* - if ((filename[0] == 't') && (filename[1] == 'e') && - (filename[2] == 's') && (filename[3] == 't') && - (filename[4] == '/')) - filename = &filename[5]; - *************/ - - base = baseFilename(filename); - if (suffix == NULL) - suffix = ".tmp"; - if (out == NULL) - out = ""; - - strncpy(suffixbuff,suffix,499); -#ifdef VMS - if(strstr(base,".") && suffixbuff[0]=='.') - suffixbuff[0]='_'; -#endif - - snprintf(res, 499, "%s%s%s", out, base, suffixbuff); - res[499] = 0; - return(strdup(res)); -} - -static int checkTestFile(const char *filename) { - struct stat buf; - - if (stat(filename, &buf) == -1) - return(0); - -#if defined(_WIN32) && !defined(__CYGWIN__) - if (!(buf.st_mode & _S_IFREG)) - return(0); -#else - if (!S_ISREG(buf.st_mode)) - return(0); -#endif - - return(1); -} - - - -/************************************************************************ - * * - * Test to detect or not recursive entities * - * * - ************************************************************************/ -/** - * recursiveDetectTest: - * @filename: the file to parse - * @result: the file with expected result - * @err: the file with error messages: unused - * - * Parse a file loading DTD and replacing entities check it fails for - * lol cases - * - * Returns 0 in case of success, an error code otherwise - */ -static int -recursiveDetectTest(const char *filename, - const char *result ATTRIBUTE_UNUSED, - const char *err ATTRIBUTE_UNUSED, - int options ATTRIBUTE_UNUSED) { - xmlDocPtr doc; - xmlParserCtxtPtr ctxt; - int res = 0; - - nb_tests++; - - ctxt = xmlNewParserCtxt(); - /* - * base of the test, parse with the old API - */ - doc = xmlCtxtReadFile(ctxt, filename, NULL, - XML_PARSE_NOENT | XML_PARSE_DTDLOAD); - if ((doc != NULL) || (ctxt->lastError.code != XML_ERR_ENTITY_LOOP)) { - fprintf(stderr, "Failed to detect recursion in %s\n", filename); - xmlFreeParserCtxt(ctxt); - xmlFreeDoc(doc); - return(1); - } - xmlFreeParserCtxt(ctxt); - - return(res); -} - -/** - * notRecursiveDetectTest: - * @filename: the file to parse - * @result: the file with expected result - * @err: the file with error messages: unused - * - * Parse a file loading DTD and replacing entities check it works for - * good cases - * - * Returns 0 in case of success, an error code otherwise - */ -static int -notRecursiveDetectTest(const char *filename, - const char *result ATTRIBUTE_UNUSED, - const char *err ATTRIBUTE_UNUSED, - int options ATTRIBUTE_UNUSED) { - xmlDocPtr doc; - xmlParserCtxtPtr ctxt; - int res = 0; - - nb_tests++; - - ctxt = xmlNewParserCtxt(); - /* - * base of the test, parse with the old API - */ - doc = xmlCtxtReadFile(ctxt, filename, NULL, - XML_PARSE_NOENT | XML_PARSE_DTDLOAD); - if (doc == NULL) { - fprintf(stderr, "Failed to parse correct file %s\n", filename); - xmlFreeParserCtxt(ctxt); - return(1); - } - xmlFreeDoc(doc); - xmlFreeParserCtxt(ctxt); - - return(res); -} - -#ifdef LIBXML_READER_ENABLED -/** - * notRecursiveHugeTest: - * @filename: the file to parse - * @result: the file with expected result - * @err: the file with error messages: unused - * - * Parse a memory generated file - * good cases - * - * Returns 0 in case of success, an error code otherwise - */ -static int -notRecursiveHugeTest(const char *filename ATTRIBUTE_UNUSED, - const char *result ATTRIBUTE_UNUSED, - const char *err ATTRIBUTE_UNUSED, - int options ATTRIBUTE_UNUSED) { - xmlTextReaderPtr reader; - int res = 0; - int ret; - - nb_tests++; - - reader = xmlReaderForFile("huge:test" , NULL, - XML_PARSE_NOENT | XML_PARSE_DTDLOAD); - if (reader == NULL) { - fprintf(stderr, "Failed to open huge:test\n"); - return(1); - } - ret = xmlTextReaderRead(reader); - while (ret == 1) { - ret = xmlTextReaderRead(reader); - } - if (ret != 0) { - fprintf(stderr, "Failed to parser huge:test with entities\n"); - res = 1; - } - xmlFreeTextReader(reader); - - return(res); -} -#endif - -/************************************************************************ - * * - * Tests Descriptions * - * * - ************************************************************************/ - -static -testDesc testDescriptions[] = { - { "Parsing recursive test cases" , - recursiveDetectTest, "./test/recurse/lol*.xml", NULL, NULL, NULL, - 0 }, - { "Parsing non-recursive test cases" , - notRecursiveDetectTest, "./test/recurse/good*.xml", NULL, NULL, NULL, - 0 }, -#ifdef LIBXML_READER_ENABLED - { "Parsing non-recursive huge case" , - notRecursiveHugeTest, NULL, NULL, NULL, NULL, - 0 }, -#endif - {NULL, NULL, NULL, NULL, NULL, NULL, 0} -}; - -/************************************************************************ - * * - * The main code driving the tests * - * * - ************************************************************************/ - -static int -launchTests(testDescPtr tst) { - int res = 0, err = 0; - size_t i; - char *result; - char *error; - int mem; - - if (tst == NULL) return(-1); - if (tst->in != NULL) { - glob_t globbuf; - - globbuf.gl_offs = 0; - glob(tst->in, GLOB_DOOFFS, NULL, &globbuf); - for (i = 0;i < globbuf.gl_pathc;i++) { - if (!checkTestFile(globbuf.gl_pathv[i])) - continue; - if (tst->suffix != NULL) { - result = resultFilename(globbuf.gl_pathv[i], tst->out, - tst->suffix); - if (result == NULL) { - fprintf(stderr, "Out of memory !\n"); - fatalError(); - } - } else { - result = NULL; - } - if (tst->err != NULL) { - error = resultFilename(globbuf.gl_pathv[i], tst->out, - tst->err); - if (error == NULL) { - fprintf(stderr, "Out of memory !\n"); - fatalError(); - } - } else { - error = NULL; - } - if ((result) &&(!checkTestFile(result))) { - fprintf(stderr, "Missing result file %s\n", result); - } else if ((error) &&(!checkTestFile(error))) { - fprintf(stderr, "Missing error file %s\n", error); - } else { - mem = xmlMemUsed(); - extraMemoryFromResolver = 0; - testErrorsSize = 0; - testErrors[0] = 0; - res = tst->func(globbuf.gl_pathv[i], result, error, - tst->options | XML_PARSE_COMPACT); - xmlResetLastError(); - if (res != 0) { - fprintf(stderr, "File %s generated an error\n", - globbuf.gl_pathv[i]); - nb_errors++; - err++; - } - else if (xmlMemUsed() != mem) { - if ((xmlMemUsed() != mem) && - (extraMemoryFromResolver == 0)) { - fprintf(stderr, "File %s leaked %d bytes\n", - globbuf.gl_pathv[i], xmlMemUsed() - mem); - nb_leaks++; - err++; - } - } - testErrorsSize = 0; - } - if (result) - free(result); - if (error) - free(error); - } - globfree(&globbuf); - } else { - testErrorsSize = 0; - testErrors[0] = 0; - extraMemoryFromResolver = 0; - res = tst->func(NULL, NULL, NULL, tst->options); - if (res != 0) { - nb_errors++; - err++; - } - } - return(err); -} - -static int verbose = 0; -static int tests_quiet = 0; - -static int -runtest(int i) { - int ret = 0, res; - int old_errors, old_tests, old_leaks; - - old_errors = nb_errors; - old_tests = nb_tests; - old_leaks = nb_leaks; - if ((tests_quiet == 0) && (testDescriptions[i].desc != NULL)) - printf("## %s\n", testDescriptions[i].desc); - res = launchTests(&testDescriptions[i]); - if (res != 0) - ret++; - if (verbose) { - if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) - printf("Ran %d tests, no errors\n", nb_tests - old_tests); - else - printf("Ran %d tests, %d errors, %d leaks\n", - nb_tests - old_tests, - nb_errors - old_errors, - nb_leaks - old_leaks); - } - return(ret); -} - -int -main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - int i, a, ret = 0; - int subset = 0; - - initializeLibxml2(); - - for (a = 1; a < argc;a++) { - if (!strcmp(argv[a], "-v")) - verbose = 1; - else if (!strcmp(argv[a], "-quiet")) - tests_quiet = 1; - else { - for (i = 0; testDescriptions[i].func != NULL; i++) { - if (strstr(testDescriptions[i].desc, argv[a])) { - ret += runtest(i); - subset++; - } - } - } - } - if (subset == 0) { - for (i = 0; testDescriptions[i].func != NULL; i++) { - ret += runtest(i); - } - } - if ((nb_errors == 0) && (nb_leaks == 0)) { - ret = 0; - printf("Total %d tests, no errors\n", - nb_tests); - } else { - ret = 1; - printf("Total %d tests, %d errors, %d leaks\n", - nb_tests, nb_errors, nb_leaks); - } - xmlCleanupParser(); - xmlMemoryDump(); - - return(ret); -} diff --git a/lib/3rdparty/libxml2/threads.c b/lib/3rdparty/libxml2/threads.c index 52d6671f491..0d7fe52d016 100644 --- a/lib/3rdparty/libxml2/threads.c +++ b/lib/3rdparty/libxml2/threads.c @@ -146,6 +146,7 @@ struct _xmlRMutex { static pthread_key_t globalkey; static pthread_t mainthread; static pthread_once_t once_control = PTHREAD_ONCE_INIT; +static pthread_once_t once_control_init = PTHREAD_ONCE_INIT; static pthread_mutex_t global_init_lock = PTHREAD_MUTEX_INITIALIZER; #elif defined HAVE_WIN32_THREADS #if defined(HAVE_COMPILER_TLS) @@ -251,7 +252,6 @@ xmlMutexLock(xmlMutexPtr tok) #ifdef DEBUG_THREADS xmlGenericError(xmlGenericErrorContext, "xmlMutexLock():BeOS:Couldn't aquire semaphore\n"); - exit(); #endif } tok->tid = find_thread(NULL); @@ -499,7 +499,6 @@ __xmlGlobalInitMutexLock(void) #ifdef DEBUG_THREADS xmlGenericError(xmlGenericErrorContext, "xmlGlobalInitMutexLock():BeOS:Couldn't acquire semaphore\n"); - exit(); #endif } #endif @@ -915,7 +914,7 @@ xmlCleanupThreads(void) #ifdef HAVE_PTHREAD_H if ((libxml_is_threaded) && (pthread_key_delete != NULL)) pthread_key_delete(globalkey); - once_control = PTHREAD_ONCE_INIT; + once_control = once_control_init; #elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) if (globalkey != TLS_OUT_OF_INDEXES) { xmlGlobalStateCleanupHelperParams *p; @@ -955,6 +954,7 @@ xmlOnceInit(void) #ifdef HAVE_PTHREAD_H (void) pthread_key_create(&globalkey, xmlFreeGlobalState); mainthread = pthread_self(); + __xmlInitializeDict(); #elif defined(HAVE_WIN32_THREADS) if (!run_once.done) { if (InterlockedIncrement(&run_once.control) == 1) { @@ -962,6 +962,7 @@ xmlOnceInit(void) globalkey = TlsAlloc(); #endif mainthread = GetCurrentThreadId(); + __xmlInitializeDict(); run_once.done = 1; } else { /* Another thread is working; give up our slice and @@ -975,6 +976,7 @@ xmlOnceInit(void) globalkey = tls_allocate(); tls_set(globalkey, NULL); mainthread = find_thread(NULL); + __xmlInitializeDict(); } else atomic_add(&run_once_init, -1); #endif diff --git a/lib/3rdparty/libxml2/timsort.h b/lib/3rdparty/libxml2/timsort.h index 54439881c25..99697a04913 100644 --- a/lib/3rdparty/libxml2/timsort.h +++ b/lib/3rdparty/libxml2/timsort.h @@ -30,6 +30,14 @@ typedef unsigned __int64 uint64_t; #endif #endif +#ifndef MK_UINT64 +#if defined(WIN32) && defined(_MSC_VER) && _MSC_VER < 1300 +#define MK_UINT64(x) ((uint64_t)(x)) +#else +#define MK_UINT64(x) x##ULL +#endif +#endif + #ifndef MAX #define MAX(x,y) (((x) > (y) ? (x) : (y))) #endif @@ -37,10 +45,10 @@ typedef unsigned __int64 uint64_t; #define MIN(x,y) (((x) < (y) ? (x) : (y))) #endif -int compute_minrun(const uint64_t); +int compute_minrun(uint64_t); #ifndef CLZ -#ifdef __GNUC__ +#if defined(__GNUC__) && ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ > 3)) #define CLZ __builtin_clzll #else @@ -67,12 +75,12 @@ int clzll(uint64_t x) /* {{{ */ #endif #endif -int compute_minrun(const uint64_t size) /* {{{ */ +int compute_minrun(uint64_t size) /* {{{ */ { const int top_bit = 64 - CLZ(size); const int shift = MAX(top_bit, 6) - 6; const int minrun = size >> shift; - const uint64_t mask = (1ULL << shift) - 1; + const uint64_t mask = (MK_UINT64(1) << shift) - 1; if (mask & size) return minrun + 1; return minrun; } diff --git a/lib/3rdparty/libxml2/tree.c b/lib/3rdparty/libxml2/tree.c index 145a68961ec..7e5af2693a0 100644 --- a/lib/3rdparty/libxml2/tree.c +++ b/lib/3rdparty/libxml2/tree.c @@ -314,7 +314,7 @@ xmlSplitQName2(const xmlChar *name, xmlChar **prefix) { * parse an XML qualified name string,i * * returns NULL if it is not a Qualified Name, otherwise, update len - * with the lenght in byte of the prefix and return a pointer + * with the length in byte of the prefix and return a pointer * to the start of the name without the prefix */ diff --git a/lib/3rdparty/libxml2/valid.c b/lib/3rdparty/libxml2/valid.c index 10bc4f44f89..6e53a76de3a 100644 --- a/lib/3rdparty/libxml2/valid.c +++ b/lib/3rdparty/libxml2/valid.c @@ -5796,7 +5796,7 @@ xmlValidatePushElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, * xmlValidatePushCData: * @ctxt: the validation context * @data: some character data read - * @len: the lenght of the data + * @len: the length of the data * * check the CData parsed for validation in the current stack * diff --git a/lib/3rdparty/libxml2/xml2-config.1 b/lib/3rdparty/libxml2/xml2-config.1 deleted file mode 100644 index 8cf9858ba5e..00000000000 --- a/lib/3rdparty/libxml2/xml2-config.1 +++ /dev/null @@ -1,30 +0,0 @@ -.TH GNOME-XML 1 "3 July 1999" Version 1.1.0 -.SH NAME -xml-config - script to get information about the installed version of GNOME-XML -.SH SYNOPSIS -.B xml-config -[\-\-prefix\fI[=DIR]\fP] [\-\-libs] [\-\-cflags] [\-\-version] [\-\-help] -.SH DESCRIPTION -\fIxml-config\fP is a tool that is used to determine the compile and -linker flags that should be used to compile and link programs that use -\fIGNOME-XML\fP. -.SH OPTIONS -\fIxml-config\fP accepts the following options: -.TP 8 -.B \-\-version -Print the currently installed version of \fIGNOME-XML\fP on the standard output. -.TP 8 -.B \-\-libs -Print the linker flags that are necessary to link a \fIGNOME-XML\fP program. -.TP 8 -.B \-\-cflags -Print the compiler flags that are necessary to compile a \fIGNOME-XML\fP program. -.TP 8 -.B \-\-prefix=PREFIX -If specified, use PREFIX instead of the installation prefix that -\fIGNOME-XML\fP was built with when computing the output for the -\-\-cflags and \-\-libs options. This option must be specified before -any \-\-libs or \-\-cflags options. -.SH AUTHOR -This manual page was written by Fredrik Hallenberg , -for the Debian GNU/linux system (but may be used by others). diff --git a/lib/3rdparty/libxml2/xml2-config.in b/lib/3rdparty/libxml2/xml2-config.in deleted file mode 100644 index 19574864cb6..00000000000 --- a/lib/3rdparty/libxml2/xml2-config.in +++ /dev/null @@ -1,106 +0,0 @@ -#! /bin/sh - -prefix=@prefix@ -exec_prefix=@exec_prefix@ -includedir=@includedir@ -libdir=@libdir@ - -usage() -{ - cat <raw); - nbchars = xmlCharEncInput(in); + nbchars = xmlCharEncInput(in, 1); if (nbchars < 0) { xmlIOErr(XML_IO_ENCODER, NULL); in->error = XML_IO_ENCODER; @@ -3344,7 +3344,7 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) { * convert as much as possible to the parser reading buffer. */ use = xmlBufUse(in->raw); - nbchars = xmlCharEncInput(in); + nbchars = xmlCharEncInput(in, 1); if (nbchars < 0) { xmlIOErr(XML_IO_ENCODER, NULL); in->error = XML_IO_ENCODER; @@ -3726,14 +3726,16 @@ xmlOutputBufferFlush(xmlOutputBufferPtr out) { */ if ((out->conv != NULL) && (out->encoder != NULL)) { /* - * convert as much as possible to the parser reading buffer. + * convert as much as possible to the parser output buffer. */ - nbchars = xmlCharEncOutput(out, 0); - if (nbchars < 0) { - xmlIOErr(XML_IO_ENCODER, NULL); - out->error = XML_IO_ENCODER; - return(-1); - } + do { + nbchars = xmlCharEncOutput(out, 0); + if (nbchars < 0) { + xmlIOErr(XML_IO_ENCODER, NULL); + out->error = XML_IO_ENCODER; + return(-1); + } + } while (nbchars); } /* diff --git a/lib/3rdparty/libxml2/xmllint.c b/lib/3rdparty/libxml2/xmllint.c index 9415d9aa49d..26d8db1c202 100644 --- a/lib/3rdparty/libxml2/xmllint.c +++ b/lib/3rdparty/libxml2/xmllint.c @@ -168,6 +168,7 @@ static int nodefdtd = 0; #endif #ifdef LIBXML_PUSH_ENABLED static int push = 0; +static int pushsize = 4096; #endif /* LIBXML_PUSH_ENABLED */ #ifdef HAVE_MMAP static int memory = 0; @@ -1874,7 +1875,8 @@ static void streamFile(char *filename) { xmlTextReaderSetParserProp(reader, XML_PARSER_VALIDATE, 1); else #endif /* LIBXML_VALID_ENABLED */ - xmlTextReaderSetParserProp(reader, XML_PARSER_LOADDTD, 1); + if (loaddtd) + xmlTextReaderSetParserProp(reader, XML_PARSER_LOADDTD, 1); #ifdef LIBXML_SCHEMAS_ENABLED if (relaxng != NULL) { if ((timing) && (!repeat)) { @@ -2192,17 +2194,15 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) { f = fopen(filename, "r"); #endif if (f != NULL) { - int res, size = 3; + int res; char chars[4096]; htmlParserCtxtPtr ctxt; - /* if (repeat) */ - size = 4096; res = fread(chars, 1, 4, f); if (res > 0) { ctxt = htmlCreatePushParserCtxt(NULL, NULL, chars, res, filename, XML_CHAR_ENCODING_NONE); - while ((res = fread(chars, 1, size, f)) > 0) { + while ((res = fread(chars, 1, pushsize, f)) > 0) { htmlParseChunk(ctxt, chars, res, 0); } htmlParseChunk(ctxt, chars, 0, 1); @@ -3017,6 +3017,7 @@ static void usage(const char *name) { #endif #ifdef LIBXML_PUSH_ENABLED printf("\t--push : use the push mode of the parser\n"); + printf("\t--pushsmall : use the push mode of the parser using tiny increments\n"); #endif /* LIBXML_PUSH_ENABLED */ #ifdef HAVE_MMAP printf("\t--memory : parse from memory\n"); @@ -3076,7 +3077,7 @@ static void usage(const char *name) { printf("\t--sax: do not build a tree but work just at the SAX level\n"); printf("\t--oldxml10: use XML-1.0 parsing rules before the 5th edition\n"); #ifdef LIBXML_XPATH_ENABLED - printf("\t--xpath expr: evaluate the XPath expression, inply --noout\n"); + printf("\t--xpath expr: evaluate the XPath expression, imply --noout\n"); #endif printf("\nLibxml project home page: http://xmlsoft.org/\n"); @@ -3247,6 +3248,11 @@ main(int argc, char **argv) { else if ((!strcmp(argv[i], "-push")) || (!strcmp(argv[i], "--push"))) push++; + else if ((!strcmp(argv[i], "-pushsmall")) || + (!strcmp(argv[i], "--pushsmall"))) { + push++; + pushsize = 10; + } #endif /* LIBXML_PUSH_ENABLED */ #ifdef HAVE_MMAP else if ((!strcmp(argv[i], "-memory")) || diff --git a/lib/3rdparty/libxml2/xmlreader.c b/lib/3rdparty/libxml2/xmlreader.c index 579e9437a45..00083d0e433 100644 --- a/lib/3rdparty/libxml2/xmlreader.c +++ b/lib/3rdparty/libxml2/xmlreader.c @@ -984,7 +984,7 @@ printf("Expand failed !\n"); * xmlTextReaderValidateCData: * @reader: the xmlTextReaderPtr used * @data: pointer to the CData - * @len: lenght of the CData block in bytes. + * @len: length of the CData block in bytes. * * Push some CData for validation */ @@ -1409,8 +1409,7 @@ get_next_node: #endif (reader->entNr == 0) && (reader->node->prev != NULL) && - (reader->node->prev->type != XML_DTD_NODE) && - (reader->entNr == 0)) { + (reader->node->prev->type != XML_DTD_NODE)) { xmlNodePtr tmp = reader->node->prev; if ((tmp->extra & NODE_IS_PRESERVED) == 0) { xmlUnlinkNode(tmp); @@ -1459,8 +1458,7 @@ get_next_node: #endif (reader->entNr == 0) && (oldnode->type != XML_DTD_NODE) && - ((oldnode->extra & NODE_IS_PRESERVED) == 0) && - (reader->entNr == 0)) { + ((oldnode->extra & NODE_IS_PRESERVED) == 0)) { xmlUnlinkNode(oldnode); xmlTextReaderFreeNode(reader, oldnode); } diff --git a/lib/3rdparty/libxml2/xmlregexp.c b/lib/3rdparty/libxml2/xmlregexp.c index 68e7bed9492..1f9911c7462 100644 --- a/lib/3rdparty/libxml2/xmlregexp.c +++ b/lib/3rdparty/libxml2/xmlregexp.c @@ -6838,7 +6838,7 @@ xmlExpRef(xmlExpNodePtr exp) { * xmlExpNewAtom: * @ctxt: the expression context * @name: the atom name - * @len: the atom name lenght in byte (or -1); + * @len: the atom name length in byte (or -1); * * Get the atom associated to this name from that context * @@ -6975,7 +6975,7 @@ tail: * @ctxt: the expression context * @exp: the expression * @langList: where to store the tokens - * @len: the allocated lenght of @list + * @len: the allocated length of @list * * Find all the strings used in @exp and store them in @list * @@ -7041,7 +7041,7 @@ tail: * @ctxt: the expression context * @exp: the expression * @tokList: where to store the tokens - * @len: the allocated lenght of @list + * @len: the allocated length of @list * * Find all the strings that appears at the start of the languages * accepted by @exp and store them in @list. E.g. for (a, b) | c diff --git a/lib/3rdparty/libxml2/xmlsave.c b/lib/3rdparty/libxml2/xmlsave.c index 829abb36b14..774404b884a 100644 --- a/lib/3rdparty/libxml2/xmlsave.c +++ b/lib/3rdparty/libxml2/xmlsave.c @@ -2247,6 +2247,7 @@ xmlBufNodeDump(xmlBufPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, size_t use; int ret; xmlOutputBufferPtr outbuf; + int oldalloc; xmlInitParser(); @@ -2278,7 +2279,10 @@ xmlBufNodeDump(xmlBufPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, outbuf->written = 0; use = xmlBufUse(buf); + oldalloc = xmlBufGetAllocationScheme(buf); + xmlBufSetAllocationScheme(buf, XML_BUFFER_ALLOC_DOUBLEIT); xmlNodeDumpOutput(outbuf, doc, cur, level, format, NULL); + xmlBufSetAllocationScheme(buf, oldalloc); xmlFree(outbuf); ret = xmlBufUse(buf) - use; return (ret); diff --git a/lib/3rdparty/libxml2/xmlschemas.c b/lib/3rdparty/libxml2/xmlschemas.c index d6a47e4d47b..121533fec8f 100644 --- a/lib/3rdparty/libxml2/xmlschemas.c +++ b/lib/3rdparty/libxml2/xmlschemas.c @@ -26063,6 +26063,20 @@ xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt) "AUTOMATON create on '%s'\n", inode->localName); #endif } + + /* + * Do not check further content if the node has been nilled + */ + if (INODE_NILLED(inode)) { + ret = 0; +#ifdef DEBUG_AUTOMATA + xmlGenericError(xmlGenericErrorContext, + "AUTOMATON succeeded on nilled '%s'\n", + inode->localName); +#endif + goto skip_nilled; + } + /* * Get hold of the still expected content, since a further * call to xmlRegExecPushString() will loose this information. @@ -26100,6 +26114,9 @@ xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt) } } + +skip_nilled: + if (inode->typeDef->contentType == XML_SCHEMA_CONTENT_ELEMENTS) goto end_elem; @@ -27846,7 +27863,10 @@ xmlSchemaVDocWalk(xmlSchemaValidCtxtPtr vctxt) const xmlChar *nsName; /* DOC VAL TODO: Move this to the start function. */ - valRoot = xmlDocGetRootElement(vctxt->doc); + if (vctxt->validationRoot != NULL) + valRoot = vctxt->validationRoot; + else + valRoot = xmlDocGetRootElement(vctxt->doc); if (valRoot == NULL) { /* VAL TODO: Error code? */ VERROR(1, NULL, "The document has no document element"); diff --git a/lib/3rdparty/libxml2/xpath.c b/lib/3rdparty/libxml2/xpath.c index 9a82e9091a3..97410e7b63f 100644 --- a/lib/3rdparty/libxml2/xpath.c +++ b/lib/3rdparty/libxml2/xpath.c @@ -12399,7 +12399,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, break; } } else if (cur->type == type) { - if (type == XML_NAMESPACE_DECL) + if (cur->type == XML_NAMESPACE_DECL) XP_TEST_HIT_NS else XP_TEST_HIT @@ -15078,6 +15078,49 @@ xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) { return(res); } +/** + * xmlXPathSetContextNode: + * @node: the node to to use as the context node + * @ctx: the XPath context + * + * Sets 'node' as the context node. The node must be in the same + * document as that associated with the context. + * + * Returns -1 in case of error or 0 if successful + */ +int +xmlXPathSetContextNode(xmlNodePtr node, xmlXPathContextPtr ctx) { + if ((node == NULL) || (ctx == NULL)) + return(-1); + + if (node->doc == ctx->doc) { + ctx->node = node; + return(0); + } + return(-1); +} + +/** + * xmlXPathNodeEval: + * @node: the node to to use as the context node + * @str: the XPath expression + * @ctx: the XPath context + * + * Evaluate the XPath Location Path in the given context. The node 'node' + * is set as the context node. The context node is not restored. + * + * Returns the xmlXPathObjectPtr resulting from the evaluation or NULL. + * the caller has to free the object. + */ +xmlXPathObjectPtr +xmlXPathNodeEval(xmlNodePtr node, const xmlChar *str, xmlXPathContextPtr ctx) { + if (str == NULL) + return(NULL); + if (xmlXPathSetContextNode(node, ctx) < 0) + return(NULL); + return(xmlXPathEval(str, ctx)); +} + /** * xmlXPathEvalExpression: * @str: the XPath expression diff --git a/lib/3rdparty/strmbase/dllfunc.c b/lib/3rdparty/strmbase/dllfunc.c index 4a210e1facc..eb7ab647590 100644 --- a/lib/3rdparty/strmbase/dllfunc.c +++ b/lib/3rdparty/strmbase/dllfunc.c @@ -21,6 +21,12 @@ #include "strmbase_private.h" +#define NO_SHLWAPI_PATH +#define NO_SHLWAPI_STRFCNS +#define NO_SHLWAPI_GDI +#define NO_SHLWAPI_STREAM +#include + extern const int g_cTemplates; extern const FactoryTemplate g_Templates[]; @@ -37,76 +43,6 @@ static const WCHAR ips32_keyname[] = {'I','n','P','r','o','c','S','e','r','v','e static const WCHAR tmodel_keyname[] = {'T','h','r','e','a','d','i','n','g','M','o','d','e','l',0}; static const WCHAR tmodel_both[] = {'B','o','t','h',0}; -#ifdef __REACTOS__ -static LSTATUS WINAPI RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey) -{ - LONG ret; - DWORD dwMaxSubkeyLen, dwMaxValueLen; - DWORD dwMaxLen, dwSize; - WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf; - HKEY hSubKey = hKey; - - TRACE("(hkey=%p,%p %s)\n", hKey, lpszSubKey, debugstr_w(lpszSubKey)); - - if(lpszSubKey) - { - ret = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey); - if (ret) return ret; - } - - /* Get highest length for keys, values */ - ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL, - &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL); - if (ret) goto cleanup; - - dwMaxSubkeyLen++; - dwMaxValueLen++; - dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen); - if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR)) - { - /* Name too big: alloc a buffer for it */ - if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR)))) - { - ret = ERROR_NOT_ENOUGH_MEMORY; - goto cleanup; - } - } - - - /* Recursively delete all the subkeys */ - while (TRUE) - { - dwSize = dwMaxLen; - if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL, - NULL, NULL, NULL)) break; - - ret = RegDeleteTreeW(hSubKey, lpszName); - if (ret) goto cleanup; - } - - if (lpszSubKey) - ret = RegDeleteKeyW(hKey, lpszSubKey); - else - while (TRUE) - { - dwSize = dwMaxLen; - if (RegEnumValueW(hKey, 0, lpszName, &dwSize, - NULL, NULL, NULL, NULL)) break; - - ret = RegDeleteValueW(hKey, lpszName); - if (ret) goto cleanup; - } - -cleanup: - /* Free buffer if allocated */ - if (lpszName != szNameBuf) - HeapFree( GetProcessHeap(), 0, lpszName); - if(lpszSubKey) - RegCloseKey(hSubKey); - return ret; -} -#endif - /* * SetupRegisterClass() */ @@ -174,7 +110,7 @@ static HRESULT SetupRegisterAllClasses(const FactoryTemplate * pList, int num, pList->m_Name, szFileName, ips32_keyname, tmodel_both); else - hr = RegDeleteTreeW(hkey, szCLSID); + hr = SHDeleteKeyW(hkey, szCLSID); } } RegCloseKey(hkey); diff --git a/lib/3rdparty/strmbase/filter.c b/lib/3rdparty/strmbase/filter.c index 456a47c417a..10d946034ba 100644 --- a/lib/3rdparty/strmbase/filter.c +++ b/lib/3rdparty/strmbase/filter.c @@ -27,23 +27,15 @@ static inline BaseFilter *impl_from_IBaseFilter(IBaseFilter *iface) HRESULT WINAPI BaseFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv) { - BaseFilter *This = impl_from_IBaseFilter(iface); TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); *ppv = NULL; - if (IsEqualIID(riid, &IID_IUnknown)) - *ppv = This; - else if (IsEqualIID(riid, &IID_IPersist)) - *ppv = This; - else if (IsEqualIID(riid, &IID_IMediaFilter)) - *ppv = This; - else if (IsEqualIID(riid, &IID_IBaseFilter)) - *ppv = This; - - if (*ppv) + if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IPersist) || + IsEqualIID(riid, &IID_IMediaFilter) || IsEqualIID(riid, &IID_IBaseFilter)) { - IUnknown_AddRef((IUnknown *)(*ppv)); + *ppv = iface; + IBaseFilter_AddRef(iface); return S_OK; } diff --git a/lib/3rdparty/strmbase/pin.c b/lib/3rdparty/strmbase/pin.c index 07741fd54b1..ee0cf7c6beb 100644 --- a/lib/3rdparty/strmbase/pin.c +++ b/lib/3rdparty/strmbase/pin.c @@ -409,6 +409,9 @@ HRESULT WINAPI BaseOutputPinImpl_Connect(IPin * iface, IPin * pReceivePin, const TRACE("(%p/%p)->(%p, %p)\n", This, iface, pReceivePin, pmt); dump_AM_MEDIA_TYPE(pmt); + if (!pReceivePin) + return E_POINTER; + /* If we try to connect to ourselves, we will definitely deadlock. * There are other cases where we could deadlock too, but this * catches the obvious case */ @@ -455,9 +458,11 @@ HRESULT WINAPI BaseOutputPinImpl_Connect(IPin * iface, IPin * pReceivePin, const /* then try receiver filter's media types */ if (hr != S_OK && SUCCEEDED(hr = IPin_EnumMediaTypes(pReceivePin, &pEnumCandidates))) /* if we haven't already connected successfully */ { + ULONG fetched; + hr = VFW_E_NO_ACCEPTABLE_TYPES; /* Assume the worst, but set to S_OK if connected successfully */ - while (S_OK == IEnumMediaTypes_Next(pEnumCandidates, 1, &pmtCandidate, NULL)) + while (S_OK == IEnumMediaTypes_Next(pEnumCandidates, 1, &pmtCandidate, &fetched)) { assert(pmtCandidate); dump_AM_MEDIA_TYPE(pmtCandidate); @@ -780,7 +785,7 @@ HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BasePin* iface, IPin * pRecei return hr; } -static HRESULT OutputPin_Init(const IPinVtbl *OutputPin_Vtbl, const PIN_INFO * pPinInfo, const BasePinFuncTable* pBaseFuncsTable, const BaseOutputPinFuncTable* pBaseOutputFuncsTable, LPCRITICAL_SECTION pCritSec, BaseOutputPin * pPinImpl) +static HRESULT OutputPin_Init(const IPinVtbl *OutputPin_Vtbl, const PIN_INFO * pPinInfo, const BaseOutputPinFuncTable* vtbl, LPCRITICAL_SECTION pCritSec, BaseOutputPin * pPinImpl) { TRACE("\n"); @@ -793,18 +798,18 @@ static HRESULT OutputPin_Init(const IPinVtbl *OutputPin_Vtbl, const PIN_INFO * p pPinImpl->pin.tStop = 0; pPinImpl->pin.dRate = 1.0; Copy_PinInfo(&pPinImpl->pin.pinInfo, pPinInfo); - pPinImpl->pin.pFuncsTable = pBaseFuncsTable; + pPinImpl->pin.pFuncsTable = &vtbl->base; ZeroMemory(&pPinImpl->pin.mtCurrent, sizeof(AM_MEDIA_TYPE)); /* Output pin attributes */ pPinImpl->pMemInputPin = NULL; pPinImpl->pAllocator = NULL; - pPinImpl->pFuncsTable = pBaseOutputFuncsTable; + pPinImpl->pFuncsTable = vtbl; return S_OK; } -HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outputpin_size, const PIN_INFO * pPinInfo, const BasePinFuncTable* pBaseFuncsTable, const BaseOutputPinFuncTable* pBaseOutputFuncsTable, LPCRITICAL_SECTION pCritSec, IPin ** ppPin) +HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outputpin_size, const PIN_INFO * pPinInfo, const BaseOutputPinFuncTable* vtbl, LPCRITICAL_SECTION pCritSec, IPin ** ppPin) { BaseOutputPin * pPinImpl; @@ -817,14 +822,14 @@ HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outp } assert(outputpin_size >= sizeof(BaseOutputPin)); - assert(pBaseFuncsTable->pfnAttemptConnection); + assert(vtbl->base.pfnAttemptConnection); pPinImpl = CoTaskMemAlloc(outputpin_size); if (!pPinImpl) return E_OUTOFMEMORY; - if (SUCCEEDED(OutputPin_Init(OutputPin_Vtbl, pPinInfo, pBaseFuncsTable, pBaseOutputFuncsTable, pCritSec, pPinImpl))) + if (SUCCEEDED(OutputPin_Init(OutputPin_Vtbl, pPinInfo, vtbl, pCritSec, pPinImpl))) { *ppPin = &pPinImpl->pin.IPin_iface; return S_OK; @@ -971,7 +976,7 @@ HRESULT WINAPI BaseInputPinImpl_EndOfStream(IPin * iface) if (This->flushing) hr = S_FALSE; else - This->end_of_stream = 1; + This->end_of_stream = TRUE; LeaveCriticalSection(This->pin.pCritSec); if (hr == S_OK) @@ -991,7 +996,7 @@ HRESULT WINAPI BaseInputPinImpl_BeginFlush(IPin * iface) TRACE("() semi-stub\n"); EnterCriticalSection(This->pin.pCritSec); - This->flushing = 1; + This->flushing = TRUE; hr = SendFurther( iface, deliver_beginflush, NULL, NULL ); LeaveCriticalSection(This->pin.pCritSec); @@ -1011,7 +1016,7 @@ HRESULT WINAPI BaseInputPinImpl_EndFlush(IPin * iface) TRACE("(%p)\n", This); EnterCriticalSection(This->pin.pCritSec); - This->flushing = This->end_of_stream = 0; + This->flushing = This->end_of_stream = FALSE; hr = SendFurther( iface, deliver_endflush, NULL, NULL ); LeaveCriticalSection(This->pin.pCritSec); @@ -1199,7 +1204,7 @@ static const IMemInputPinVtbl MemInputPin_Vtbl = }; static HRESULT InputPin_Init(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinInfo, - const BasePinFuncTable* pBaseFuncsTable, const BaseInputPinFuncTable* pBaseInputFuncsTable, + const BaseInputPinFuncTable* vtbl, LPCRITICAL_SECTION pCritSec, IMemAllocator *allocator, BaseInputPin * pPinImpl) { TRACE("\n"); @@ -1213,29 +1218,30 @@ static HRESULT InputPin_Init(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPi pPinImpl->pin.dRate = 1.0; Copy_PinInfo(&pPinImpl->pin.pinInfo, pPinInfo); ZeroMemory(&pPinImpl->pin.mtCurrent, sizeof(AM_MEDIA_TYPE)); - pPinImpl->pin.pFuncsTable = pBaseFuncsTable; + pPinImpl->pin.pFuncsTable = &vtbl->base; /* Input pin attributes */ - pPinImpl->pFuncsTable = pBaseInputFuncsTable; + pPinImpl->pFuncsTable = vtbl; pPinImpl->pAllocator = pPinImpl->preferred_allocator = allocator; if (pPinImpl->preferred_allocator) IMemAllocator_AddRef(pPinImpl->preferred_allocator); pPinImpl->pin.IPin_iface.lpVtbl = InputPin_Vtbl; pPinImpl->IMemInputPin_iface.lpVtbl = &MemInputPin_Vtbl; - pPinImpl->flushing = pPinImpl->end_of_stream = 0; + pPinImpl->flushing = pPinImpl->end_of_stream = FALSE; return S_OK; } -HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinInfo, - const BasePinFuncTable* pBaseFuncsTable, const BaseInputPinFuncTable* pBaseInputFuncsTable, +HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, LONG inputpin_size, const PIN_INFO * pPinInfo, + const BaseInputPinFuncTable* vtbl, LPCRITICAL_SECTION pCritSec, IMemAllocator *allocator, IPin ** ppPin) { BaseInputPin * pPinImpl; *ppPin = NULL; - assert(pBaseFuncsTable->pfnCheckMediaType); + assert(inputpin_size >= sizeof(BaseInputPin)); + assert(vtbl->base.pfnCheckMediaType); if (pPinInfo->dir != PINDIR_INPUT) { @@ -1243,12 +1249,12 @@ HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * p return E_INVALIDARG; } - pPinImpl = CoTaskMemAlloc(sizeof(*pPinImpl)); + pPinImpl = CoTaskMemAlloc(inputpin_size); if (!pPinImpl) return E_OUTOFMEMORY; - if (SUCCEEDED(InputPin_Init(InputPin_Vtbl, pPinInfo, pBaseFuncsTable, pBaseInputFuncsTable, pCritSec, allocator, pPinImpl))) + if (SUCCEEDED(InputPin_Init(InputPin_Vtbl, pPinInfo, vtbl, pCritSec, allocator, pPinImpl))) { *ppPin = (IPin *)pPinImpl; return S_OK; diff --git a/lib/3rdparty/strmbase/pospass.c b/lib/3rdparty/strmbase/pospass.c index c56a317ec86..57a5999ec9f 100644 --- a/lib/3rdparty/strmbase/pospass.c +++ b/lib/3rdparty/strmbase/pospass.c @@ -253,7 +253,7 @@ HRESULT WINAPI PosPassThru_Construct(IUnknown *pUnkOuter, LPVOID *ppPassThru) fimpl->IMediaPosition_iface.lpVtbl = &IMediaPositionPassThru_Vtbl; fimpl->ref = 1; fimpl->pin = NULL; - fimpl->timevalid = 0; + fimpl->timevalid = FALSE; InitializeCriticalSection(&fimpl->time_cs); fimpl->time_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": PassThruImpl.time_cs"); BaseDispatch_Init(&fimpl->baseDispatch, &IID_IMediaPosition); @@ -589,7 +589,7 @@ HRESULT WINAPI RendererPosPassThru_RegisterMediaTime(IUnknown *iface, REFERENCE_ PassThruImpl *This = impl_from_IUnknown_inner(iface); EnterCriticalSection(&This->time_cs); This->time_earliest = start; - This->timevalid = 1; + This->timevalid = TRUE; LeaveCriticalSection(&This->time_cs); return S_OK; } @@ -598,7 +598,7 @@ HRESULT WINAPI RendererPosPassThru_ResetMediaTime(IUnknown *iface) { PassThruImpl *This = impl_from_IUnknown_inner(iface); EnterCriticalSection(&This->time_cs); - This->timevalid = 0; + This->timevalid = FALSE; LeaveCriticalSection(&This->time_cs); return S_OK; } @@ -611,10 +611,10 @@ HRESULT WINAPI RendererPosPassThru_EOS(IUnknown *iface) hr = IMediaSeeking_GetStopPosition(&This->IMediaSeeking_iface, &time); EnterCriticalSection(&This->time_cs); if (SUCCEEDED(hr)) { - This->timevalid = 1; + This->timevalid = TRUE; This->time_earliest = time; } else - This->timevalid = 0; + This->timevalid = FALSE; LeaveCriticalSection(&This->time_cs); return hr; } diff --git a/lib/3rdparty/strmbase/qualitycontrol.c b/lib/3rdparty/strmbase/qualitycontrol.c index 1048592190b..623964ade19 100644 --- a/lib/3rdparty/strmbase/qualitycontrol.c +++ b/lib/3rdparty/strmbase/qualitycontrol.c @@ -101,8 +101,9 @@ void QualityControlRender_Start(QualityControlImpl *This, REFERENCE_TIME tStart) This->avg_render = This->last_in_time = This->last_left = This->avg_duration = This->avg_pt = -1; This->clockstart = tStart; This->avg_rate = -1.0; - This->rendered = This->dropped = This->is_dropped = 0; - This->qos_handled = 1; /* Lie that will be corrected on first adjustment */ + This->rendered = This->dropped = 0; + This->is_dropped = FALSE; + This->qos_handled = TRUE; /* Lie that will be corrected on first adjustment */ } diff --git a/lib/3rdparty/strmbase/renderer.c b/lib/3rdparty/strmbase/renderer.c index 1815f0fd4c5..433bcba730f 100644 --- a/lib/3rdparty/strmbase/renderer.c +++ b/lib/3rdparty/strmbase/renderer.c @@ -217,15 +217,14 @@ static const BaseFilterFuncTable RendererBaseFilterFuncTable = { BaseRenderer_GetPinCount }; -static const BasePinFuncTable input_BaseFuncTable = { - BaseRenderer_Input_CheckMediaType, - NULL, - BasePinImpl_GetMediaTypeVersion, - BasePinImpl_GetMediaType -}; - static const BaseInputPinFuncTable input_BaseInputFuncTable = { - BaseRenderer_Receive + { + BaseRenderer_Input_CheckMediaType, + NULL, + BasePinImpl_GetMediaTypeVersion, + BasePinImpl_GetMediaType + }, + BaseRenderer_Receive }; @@ -243,7 +242,8 @@ HRESULT WINAPI BaseRenderer_Init(BaseRenderer * This, const IBaseFilterVtbl *Vtb piInput.pFilter = &This->filter.IBaseFilter_iface; lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0])); - hr = BaseInputPin_Construct(&BaseRenderer_InputPin_Vtbl, &piInput, &input_BaseFuncTable, &input_BaseInputFuncTable, &This->filter.csFilter, NULL, (IPin **)&This->pInputPin); + hr = BaseInputPin_Construct(&BaseRenderer_InputPin_Vtbl, sizeof(BaseInputPin), &piInput, + &input_BaseInputFuncTable, &This->filter.csFilter, NULL, (IPin **)&This->pInputPin); if (SUCCEEDED(hr)) { @@ -461,7 +461,7 @@ HRESULT WINAPI BaseRendererImpl_Run(IBaseFilter * iface, REFERENCE_TIME tStart) if (This->pInputPin->pin.pConnectedTo) { - This->pInputPin->end_of_stream = 0; + This->pInputPin->end_of_stream = FALSE; } else if (This->filter.filterInfo.pGraph) { @@ -504,7 +504,7 @@ HRESULT WINAPI BaseRendererImpl_Pause(IBaseFilter * iface) { if (This->pInputPin->pin.pConnectedTo) ResetEvent(This->evComplete); - This->pInputPin->end_of_stream = 0; + This->pInputPin->end_of_stream = FALSE; } else if (This->pFuncsTable->pfnOnStopStreaming) This->pFuncsTable->pfnOnStopStreaming(This); diff --git a/lib/3rdparty/strmbase/transform.c b/lib/3rdparty/strmbase/transform.c index 7ca5db9c46e..8f5815a2bfd 100644 --- a/lib/3rdparty/strmbase/transform.c +++ b/lib/3rdparty/strmbase/transform.c @@ -157,25 +157,23 @@ static const BaseFilterFuncTable tfBaseFuncTable = { TransformFilter_GetPinCount }; -static const BasePinFuncTable tf_input_BaseFuncTable = { - TransformFilter_Input_CheckMediaType, - NULL, - BasePinImpl_GetMediaTypeVersion, - BasePinImpl_GetMediaType -}; - static const BaseInputPinFuncTable tf_input_BaseInputFuncTable = { + { + TransformFilter_Input_CheckMediaType, + NULL, + BasePinImpl_GetMediaTypeVersion, + BasePinImpl_GetMediaType + }, TransformFilter_Input_Receive }; -static const BasePinFuncTable tf_output_BaseFuncTable = { - NULL, - BaseOutputPinImpl_AttemptConnection, - BasePinImpl_GetMediaTypeVersion, - TransformFilter_Output_GetMediaType -}; - static const BaseOutputPinFuncTable tf_output_BaseOutputFuncTable = { + { + NULL, + BaseOutputPinImpl_AttemptConnection, + BasePinImpl_GetMediaTypeVersion, + TransformFilter_Output_GetMediaType + }, TransformFilter_Output_DecideBufferSize, BaseOutputPinImpl_DecideAllocator, BaseOutputPinImpl_BreakConnect @@ -207,11 +205,12 @@ static HRESULT TransformFilter_Init(const IBaseFilterVtbl *pVtbl, const CLSID* p piOutput.pFilter = &pTransformFilter->filter.IBaseFilter_iface; lstrcpynW(piOutput.achName, wcsOutputPinName, sizeof(piOutput.achName) / sizeof(piOutput.achName[0])); - hr = BaseInputPin_Construct(&TransformFilter_InputPin_Vtbl, &piInput, &tf_input_BaseFuncTable, &tf_input_BaseInputFuncTable, &pTransformFilter->filter.csFilter, NULL, &pTransformFilter->ppPins[0]); + hr = BaseInputPin_Construct(&TransformFilter_InputPin_Vtbl, sizeof(BaseInputPin), &piInput, + &tf_input_BaseInputFuncTable, &pTransformFilter->filter.csFilter, NULL, &pTransformFilter->ppPins[0]); if (SUCCEEDED(hr)) { - hr = BaseOutputPin_Construct(&TransformFilter_OutputPin_Vtbl, sizeof(BaseOutputPin), &piOutput, &tf_output_BaseFuncTable, &tf_output_BaseOutputFuncTable, &pTransformFilter->filter.csFilter, &pTransformFilter->ppPins[1]); + hr = BaseOutputPin_Construct(&TransformFilter_OutputPin_Vtbl, sizeof(BaseOutputPin), &piOutput, &tf_output_BaseOutputFuncTable, &pTransformFilter->filter.csFilter, &pTransformFilter->ppPins[1]); if (FAILED(hr)) ERR("Cannot create output pin (%x)\n", hr); @@ -387,7 +386,7 @@ HRESULT WINAPI TransformFilterImpl_Run(IBaseFilter * iface, REFERENCE_TIME tStar { if (This->filter.state == State_Stopped) { - impl_BaseInputPin_from_IPin(This->ppPins[0])->end_of_stream = 0; + impl_BaseInputPin_from_IPin(This->ppPins[0])->end_of_stream = FALSE; if (This->pFuncsTable->pfnStartStreaming) hr = This->pFuncsTable->pfnStartStreaming(This); if (SUCCEEDED(hr)) diff --git a/lib/sdk/crt/except/cpp.c b/lib/sdk/crt/except/cpp.c index 402734e7f20..f54e8a78d21 100644 --- a/lib/sdk/crt/except/cpp.c +++ b/lib/sdk/crt/except/cpp.c @@ -604,7 +604,7 @@ const char * __stdcall MSVCRT_type_info_name(type_info * _this) * Is this '.' really part of the mangled name, or has it some other meaning ? */ char* name = __unDName(0, _this->mangled + 1, 0, - MSVCRT_malloc, MSVCRT_free, 0x2800); + MSVCRT_malloc, MSVCRT_free, UNDNAME_NO_ARGUMENTS | UNDNAME_32_BIT_DECODE); if (name) { size_t len = strlen(name); diff --git a/lib/sdk/crt/include/internal/wine/cppexcept.h b/lib/sdk/crt/include/internal/wine/cppexcept.h index d1b60c3139b..d4dbbee2f34 100644 --- a/lib/sdk/crt/include/internal/wine/cppexcept.h +++ b/lib/sdk/crt/include/internal/wine/cppexcept.h @@ -164,20 +164,21 @@ static inline const char *dbgstr_type_info( const type_info *info ) /* compute the this pointer for a base class of a given type */ static inline void *get_this_pointer( const this_ptr_offsets *off, void *object ) { - void *this_ptr; - int *offset_ptr; - if (!object) return NULL; - this_ptr = (char *)object + off->this_offset; + if (off->vbase_descr >= 0) { + int *offset_ptr; + /* move this ptr to vbase descriptor */ - this_ptr = (char *)this_ptr + off->vbase_descr; + object = (char *)object + off->vbase_descr; /* and fetch additional offset from vbase descriptor */ - offset_ptr = (int *)(*(char **)this_ptr + off->vbase_offset); - this_ptr = (char *)this_ptr + *offset_ptr; + offset_ptr = (int *)(*(char **)object + off->vbase_offset); + object = (char *)object + *offset_ptr; } - return this_ptr; + + object = (char *)object + off->this_offset; + return object; } #endif /* __MSVCRT_CPPEXCEPT_H */ diff --git a/lib/sdk/crt/include/internal/wine/msvcrt.h b/lib/sdk/crt/include/internal/wine/msvcrt.h index f4d30aa97bb..319075a597f 100644 --- a/lib/sdk/crt/include/internal/wine/msvcrt.h +++ b/lib/sdk/crt/include/internal/wine/msvcrt.h @@ -81,9 +81,6 @@ void __cdecl MSVCRT_operator_delete(void*); typedef void* (__cdecl *malloc_func_t)(size_t); typedef void (__cdecl *free_func_t)(void*); -extern char* __cdecl __unDName(char *,const char*,int,malloc_func_t,free_func_t,unsigned short int); -extern char* __cdecl __unDNameEx(char *,const char*,int,malloc_func_t,free_func_t,void *,unsigned short int); - /* Setup and teardown multi threaded locks */ extern void msvcrt_init_mt_locks(void); extern void msvcrt_free_mt_locks(void); @@ -119,6 +116,28 @@ extern unsigned create_io_inherit_block(WORD*, BYTE**); #define MSVCRT__OUT_TO_MSGBOX 2 #define MSVCRT__REPORT_ERRMODE 3 +extern char* __cdecl __unDName(char *,const char*,int,malloc_func_t,free_func_t,unsigned short int); + +/* __unDName/__unDNameEx flags */ +#define UNDNAME_COMPLETE (0x0000) +#define UNDNAME_NO_LEADING_UNDERSCORES (0x0001) /* Don't show __ in calling convention */ +#define UNDNAME_NO_MS_KEYWORDS (0x0002) /* Don't show calling convention at all */ +#define UNDNAME_NO_FUNCTION_RETURNS (0x0004) /* Don't show function/method return value */ +#define UNDNAME_NO_ALLOCATION_MODEL (0x0008) +#define UNDNAME_NO_ALLOCATION_LANGUAGE (0x0010) +#define UNDNAME_NO_MS_THISTYPE (0x0020) +#define UNDNAME_NO_CV_THISTYPE (0x0040) +#define UNDNAME_NO_THISTYPE (0x0060) +#define UNDNAME_NO_ACCESS_SPECIFIERS (0x0080) /* Don't show access specifier (public/protected/private) */ +#define UNDNAME_NO_THROW_SIGNATURES (0x0100) +#define UNDNAME_NO_MEMBER_TYPE (0x0200) /* Don't show static/virtual specifier */ +#define UNDNAME_NO_RETURN_UDT_MODEL (0x0400) +#define UNDNAME_32_BIT_DECODE (0x0800) +#define UNDNAME_NAME_ONLY (0x1000) /* Only report the variable/method name */ +#define UNDNAME_NO_ARGUMENTS (0x2000) /* Don't show method arguments */ +#define UNDNAME_NO_SPECIAL_SYMS (0x4000) +#define UNDNAME_NO_COMPLEX_TYPE (0x8000) + typedef void (*float_handler)(int, int); void _default_handler(int signal); typedef struct _sig_element diff --git a/lib/sdk/crt/string/scanf.h b/lib/sdk/crt/string/scanf.h index 69ca7193592..4aada82b6b9 100644 --- a/lib/sdk/crt/string/scanf.h +++ b/lib/sdk/crt/string/scanf.h @@ -359,7 +359,7 @@ _FUNCTION_ { if (width>0) width--; } /* terminate */ - if (!suppress) *sptr = 0; + if (st && !suppress) *sptr = 0; } break; widecharstring: { /* read a word into a wchar_t* */ @@ -375,7 +375,7 @@ _FUNCTION_ { if (width>0) width--; } /* terminate */ - if (!suppress) *sptr = 0; + if (st && !suppress) *sptr = 0; } break; /* 'c' and 'C work analogously to 's' and 'S' as described diff --git a/lib/sdk/crt/wine/undname.c b/lib/sdk/crt/wine/undname.c index 71956f6c4d3..4d64a4a1fd8 100644 --- a/lib/sdk/crt/wine/undname.c +++ b/lib/sdk/crt/wine/undname.c @@ -33,25 +33,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); * - back-port this new code into tools/winedump/msmangle.c */ -#define UNDNAME_COMPLETE (0x0000) -#define UNDNAME_NO_LEADING_UNDERSCORES (0x0001) /* Don't show __ in calling convention */ -#define UNDNAME_NO_MS_KEYWORDS (0x0002) /* Don't show calling convention at all */ -#define UNDNAME_NO_FUNCTION_RETURNS (0x0004) /* Don't show function/method return value */ -#define UNDNAME_NO_ALLOCATION_MODEL (0x0008) -#define UNDNAME_NO_ALLOCATION_LANGUAGE (0x0010) -#define UNDNAME_NO_MS_THISTYPE (0x0020) -#define UNDNAME_NO_CV_THISTYPE (0x0040) -#define UNDNAME_NO_THISTYPE (0x0060) -#define UNDNAME_NO_ACCESS_SPECIFIERS (0x0080) /* Don't show access specifier (public/protected/private) */ -#define UNDNAME_NO_THROW_SIGNATURES (0x0100) -#define UNDNAME_NO_MEMBER_TYPE (0x0200) /* Don't show static/virtual specifier */ -#define UNDNAME_NO_RETURN_UDT_MODEL (0x0400) -#define UNDNAME_32_BIT_DECODE (0x0800) -#define UNDNAME_NAME_ONLY (0x1000) /* Only report the variable/method name */ -#define UNDNAME_NO_ARGUMENTS (0x2000) /* Don't show method arguments */ -#define UNDNAME_NO_SPECIAL_SYMS (0x4000) -#define UNDNAME_NO_COMPLEX_TYPE (0x8000) - /* How data types modifiers are stored: * M (in the following definitions) is defined for * 'A', 'B', 'C' and 'D' as follows @@ -267,7 +248,7 @@ static char* str_printf(struct parsed_symbol* sym, const char* format, ...) { case 's': t = va_arg(args, char*); if (t) len += (int)strlen(t); break; case 'c': (void)va_arg(args, int); len++; break; - default: i--; /* fall thru */ + default: i--; /* fall through */ case '%': len++; break; } } @@ -294,7 +275,7 @@ static char* str_printf(struct parsed_symbol* sym, const char* format, ...) case 'c': *p++ = (char)va_arg(args, int); break; - default: i--; /* fall thru */ + default: i--; /* fall through */ case '%': *p++ = '%'; break; } } @@ -348,7 +329,7 @@ static const char* get_number(struct parsed_symbol* sym) if (*sym->current != '@') return NULL; ptr = und_alloc(sym, 17); - sprintf(ptr, "%s%d", sgn ? "-" : "", ret); + sprintf(ptr, "%s%u", sgn ? "-" : "", ret); sym->current++; } else return NULL; @@ -423,7 +404,12 @@ static BOOL get_modifier(struct parsed_symbol *sym, const char **ret, const char *ptr_modif = NULL; if (*sym->current == 'E') { - *ptr_modif = "__ptr64"; + if (!(sym->flags & UNDNAME_NO_MS_KEYWORDS)) + { + *ptr_modif = "__ptr64"; + if (sym->flags & UNDNAME_NO_LEADING_UNDERSCORES) + *ptr_modif = *ptr_modif + 2; + } sym->current++; } switch (*sym->current++) @@ -446,7 +432,13 @@ static BOOL get_modified_type(struct datatype_t *ct, struct parsed_symbol* sym, if (*sym->current == 'E') { - ptr_modif = " __ptr64"; + if (!(sym->flags & UNDNAME_NO_MS_KEYWORDS)) + { + if (sym->flags & UNDNAME_NO_LEADING_UNDERSCORES) + ptr_modif = " ptr64"; + else + ptr_modif = " __ptr64"; + } sym->current++; } @@ -556,8 +548,10 @@ static char* get_template_name(struct parsed_symbol* sym) struct array array_pmt; sym->names.start = sym->names.num; - if (!(name = get_literal_string(sym))) + if (!(name = get_literal_string(sym))) { + sym->names.start = start_mark; return FALSE; + } str_array_init(&array_pmt); args = get_args(sym, &array_pmt, FALSE, '<', '>'); if (args != NULL) @@ -1082,6 +1076,7 @@ static BOOL handle_method(struct parsed_symbol* sym, BOOL cast_op) { char accmem; const char* access = NULL; + int access_id = -1; const char* member_type = NULL; struct datatype_t ct_ret; const char* call_conv; @@ -1089,7 +1084,7 @@ static BOOL handle_method(struct parsed_symbol* sym, BOOL cast_op) const char* exported; const char* args_str = NULL; const char* name = NULL; - BOOL ret = FALSE; + BOOL ret = FALSE, has_args = TRUE, has_ret = TRUE; unsigned mark; struct array array_pmt; @@ -1120,50 +1115,104 @@ static BOOL handle_method(struct parsed_symbol* sym, BOOL cast_op) * 'X' public: thunk * 'Y' * 'Z' + * "$0" private: thunk vtordisp + * "$1" private: thunk vtordisp + * "$2" protected: thunk vtordisp + * "$3" protected: thunk vtordisp + * "$4" public: thunk vtordisp + * "$5" public: thunk vtordisp + * "$B" vcall thunk + * "$R" thunk vtordispex */ accmem = *sym->current++; - if (accmem < 'A' || accmem > 'Z') goto done; + if (accmem == '$') + { + if (*sym->current >= '0' && *sym->current <= '5') + access_id = (*sym->current - '0') / 2; + else if (*sym->current == 'R') + access_id = (sym->current[1] - '0') / 2; + else if (*sym->current != 'B') + goto done; + } + else if (accmem >= 'A' && accmem <= 'Z') + access_id = (accmem - 'A') / 8; + else + goto done; - if (!(sym->flags & UNDNAME_NO_ACCESS_SPECIFIERS)) + switch (access_id) { - switch ((accmem - 'A') / 8) + case 0: access = "private: "; break; + case 1: access = "protected: "; break; + case 2: access = "public: "; break; + } + if (accmem == '$' || (accmem - 'A') % 8 == 6 || (accmem - 'A') % 8 == 7) + access = str_printf(sym, "[thunk]:%s", access ? access : " "); + + if (accmem == '$' && *sym->current != 'B') + member_type = "virtual "; + else if (accmem <= 'X') + { + switch ((accmem - 'A') % 8) { - case 0: access = "private: "; break; - case 1: access = "protected: "; break; - case 2: access = "public: "; break; - } - } - if (!(sym->flags & UNDNAME_NO_MEMBER_TYPE)) - { - if (accmem <= 'X') - { - switch ((accmem - 'A') % 8) - { - case 2: case 3: member_type = "static "; break; - case 4: case 5: member_type = "virtual "; break; - case 6: case 7: - access = str_printf(sym, "[thunk]:%s", access); - member_type = "virtual "; - break; - } + case 2: case 3: member_type = "static "; break; + case 4: case 5: case 6: case 7: member_type = "virtual "; break; } } + if (sym->flags & UNDNAME_NO_ACCESS_SPECIFIERS) + access = NULL; + if (sym->flags & UNDNAME_NO_MEMBER_TYPE) + member_type = NULL; + name = get_class_string(sym, 0); - if ((accmem - 'A') % 8 == 6 || (accmem - '8') % 8 == 7) /* a thunk */ + if (accmem == '$' && *sym->current == 'B') /* vcall thunk */ + { + const char *n; + + sym->current++; + n = get_number(sym); + + if(!n || *sym->current++ != 'A') goto done; + name = str_printf(sym, "%s{%s,{flat}}' }'", name, n); + has_args = FALSE; + has_ret = FALSE; + } + else if (accmem == '$' && *sym->current == 'R') /* vtordispex thunk */ + { + const char *n1, *n2, *n3, *n4; + + sym->current += 2; + n1 = get_number(sym); + n2 = get_number(sym); + n3 = get_number(sym); + n4 = get_number(sym); + + if(!n1 || !n2 || !n3 || !n4) goto done; + name = str_printf(sym, "%s`vtordispex{%s,%s,%s,%s}' ", name, n1, n2, n3, n4); + } + else if (accmem == '$') /* vtordisp thunk */ + { + const char *n1, *n2; + + sym->current++; + n1 = get_number(sym); + n2 = get_number(sym); + + if (!n1 || !n2) goto done; + name = str_printf(sym, "%s`vtordisp{%s,%s}' ", name, n1, n2); + } + else if ((accmem - 'A') % 8 == 6 || (accmem - 'A') % 8 == 7) /* a thunk */ name = str_printf(sym, "%s`adjustor{%s}' ", name, get_number(sym)); - if (accmem <= 'X') + if (has_args && (accmem == '$' || + (accmem <= 'X' && (accmem - 'A') % 8 != 2 && (accmem - 'A') % 8 != 3))) { - if (((accmem - 'A') % 8) != 2 && ((accmem - 'A') % 8) != 3) - { - const char *ptr_modif; - /* Implicit 'this' pointer */ - /* If there is an implicit this pointer, const modifier follows */ - if (!get_modifier(sym, &modifier, &ptr_modif)) goto done; - if (modifier || ptr_modif) modifier = str_printf(sym, "%s %s", modifier, ptr_modif); - } + const char *ptr_modif; + /* Implicit 'this' pointer */ + /* If there is an implicit this pointer, const modifier follows */ + if (!get_modifier(sym, &modifier, &ptr_modif)) goto done; + if (modifier || ptr_modif) modifier = str_printf(sym, "%s %s", modifier, ptr_modif); } if (!get_calling_convention(*sym->current++, &call_conv, &exported, @@ -1173,18 +1222,18 @@ static BOOL handle_method(struct parsed_symbol* sym, BOOL cast_op) str_array_init(&array_pmt); /* Return type, or @ if 'void' */ - if (*sym->current == '@') + if (has_ret && *sym->current == '@') { ct_ret.left = "void"; ct_ret.right = NULL; sym->current++; } - else + else if (has_ret) { if (!demangle_datatype(sym, &ct_ret, &array_pmt, FALSE)) goto done; } - if (sym->flags & UNDNAME_NO_FUNCTION_RETURNS) + if (!has_ret || sym->flags & UNDNAME_NO_FUNCTION_RETURNS) ct_ret.left = ct_ret.right = NULL; if (cast_op) { @@ -1193,8 +1242,9 @@ static BOOL handle_method(struct parsed_symbol* sym, BOOL cast_op) } mark = sym->stack.num; - if (!(args_str = get_args(sym, &array_pmt, TRUE, '(', ')'))) goto done; + if (has_args && !(args_str = get_args(sym, &array_pmt, TRUE, '(', ')'))) goto done; if (sym->flags & UNDNAME_NAME_ONLY) args_str = modifier = NULL; + if (sym->flags & UNDNAME_NO_THISTYPE) modifier = NULL; sym->stack.num = mark; /* Note: '()' after 'Z' means 'throws', but we don't care here @@ -1210,23 +1260,6 @@ done: return ret; } -/****************************************************************** - * handle_template - * Does the final parsing and handling for a name with templates - */ -static BOOL handle_template(struct parsed_symbol* sym) -{ - const char* name; - const char* args; - - assert(*sym->current == '$'); - sym->current++; - if (!(name = get_literal_string(sym))) return FALSE; - if (!(args = get_args(sym, NULL, FALSE, '<', '>'))) return FALSE; - sym->result = str_printf(sym, "%s%s", name, args); - return TRUE; -} - /******************************************************************* * symbol_demangle * Demangle a C++ linker symbol @@ -1460,10 +1493,8 @@ static BOOL symbol_demangle(struct parsed_symbol* sym) /* Function/Data type and access level */ if (*sym->current >= '0' && *sym->current <= '9') ret = handle_data(sym); - else if (*sym->current >= 'A' && *sym->current <= 'Z') + else if ((*sym->current >= 'A' && *sym->current <= 'Z') || *sym->current == '$') ret = handle_method(sym, do_after == 3); - else if (*sym->current == '$') - ret = handle_template(sym); else ret = FALSE; done: if (ret) assert(sym->result); diff --git a/media/doc/3rd Party Files.txt b/media/doc/3rd Party Files.txt index e22f8b4c4e3..8905398bf9e 100644 --- a/media/doc/3rd Party Files.txt +++ b/media/doc/3rd Party Files.txt @@ -35,7 +35,7 @@ Used Version: 1.0.6 Website: http://www.bzip.org Title: LibXML -Used Version: 2.9.0 +Used Version: 2.9.1 Website: http://xmlsoft.org | ftp://xmlsoft.org/libxml2/ Title: ZLib diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 4c67a396d54..9a446a15812 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -21,208 +21,209 @@ When porting a new DLL from Wine to ReactOS, please do the following steps The following build tools are shared with Wine. -reactos/tools/unicode # Synced to Wine-1.7.1 -reactos/tools/widl # Synced to Wine-1.5.11 +reactos/tools/unicode # Synced to Wine-1.7.17 +reactos/tools/widl # Synced to Wine-1.7.17 reactos/tools/wpp # Synced to Wine-1.7.1 The following libraries are shared with Wine. -reactos/dll/directx/wine/amstream # Synced to Wine-1.7.1 -reactos/dll/directx/wine/d3d8 # Synced to Wine-1.7.11 -reactos/dll/directx/wine/d3d9 # Synced to Wine-1.7.11 -reactos/dll/directx/wine/d3dcompiler_43 # Synced to Wine-1.7.1 -reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to Wine-1.7.1 -reactos/dll/directx/wine/d3dxof # Synced to Wine-1.7.1 -reactos/dll/directx/wine/ddraw # Synced to Wine-1.7.11 -reactos/dll/directx/wine/devenum # Synced to Wine-1.7.1 -reactos/dll/directx/wine/dinput # Synced to Wine-1.7.1 -reactos/dll/directx/wine/dinput8 # Synced to Wine-1.7.1 -reactos/dll/directx/wine/dmusic # Synced to Wine-1.7.1 +reactos/dll/directx/wine/amstream # Synced to Wine-1.7.17 +reactos/dll/directx/wine/d3d8 # Synced to Wine-1.7.17 +reactos/dll/directx/wine/d3d9 # Synced to Wine-1.7.17 +reactos/dll/directx/wine/d3dcompiler_43 # Synced to Wine-1.7.17 +reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to Wine-1.7.17 +reactos/dll/directx/wine/d3dxof # Synced to Wine-1.7.17 +reactos/dll/directx/wine/ddraw # Synced to Wine-1.7.17 +reactos/dll/directx/wine/devenum # Synced to Wine-1.7.17 +reactos/dll/directx/wine/dinput # Synced to Wine-1.7.17 +reactos/dll/directx/wine/dinput8 # Synced to Wine-1.7.17 +reactos/dll/directx/wine/dmusic # Synced to Wine-1.7.17 reactos/dll/directx/wine/dplay # Synced to Wine-1.7.1 -reactos/dll/directx/wine/dplayx # Synced to Wine-1.7.1 +reactos/dll/directx/wine/dplayx # Synced to Wine-1.7.17 reactos/dll/directx/wine/dsound # Synced to Wine-1.5.26 -reactos/dll/directx/wine/dxdiagn # Synced to Wine-1.7.1 -reactos/dll/directx/wine/dxgi # Synced to Wine-1.7.1 +reactos/dll/directx/wine/dxdiagn # Synced to Wine-1.7.17 +reactos/dll/directx/wine/dxgi # Synced to Wine-1.7.17 reactos/dll/directx/wine/msdmo # Synced to Wine-1.7.1 -reactos/dll/directx/wine/qedit # Synced to Wine-1.7.1 -reactos/dll/directx/wine/quartz # Synced to Wine-1.7.1 -reactos/dll/directx/wine/wined3d # Synced to Wine-1.7.11 +reactos/dll/directx/wine/qedit # Synced to Wine-1.7.17 +reactos/dll/directx/wine/quartz # Synced to Wine-1.7.17 +reactos/dll/directx/wine/wined3d # Synced to Wine-1.7.17 -reactos/dll/win32/activeds # Synced to Wine-1.7.1 -reactos/dll/win32/actxprxy # Synced to Wine-1.7.1 -reactos/dll/win32/advpack # Synced to Wine-1.7.1 -reactos/dll/win32/atl # Synced to Wine-1.7.1 -reactos/dll/win32/atl100 # Synced to Wine-1.7.1 -reactos/dll/win32/atl80 # Synced to Wine-1.7.1 -reactos/dll/win32/avifil32 # Synced to Wine-1.7.1 -reactos/dll/win32/bcrypt # Synced to Wine-1.7.1 -reactos/dll/win32/browseui # Out of sync -reactos/dll/win32/cabinet # Synced to Wine-1.7.1 -reactos/dll/win32/clusapi # Synced to Wine-1.7.1 -reactos/dll/win32/comcat # Synced to Wine-1.7.1 -reactos/dll/win32/comctl32 # Synced to Wine 1.7.1 -reactos/dll/win32/comdlg32 # Synced to Wine 1.7.1 -reactos/dll/win32/compstui # Synced to Wine-1.7.1 -reactos/dll/win32/credui # Synced to Wine-1.7.1 -reactos/dll/win32/crypt32 # Synced to Wine-1.7.1 -reactos/dll/win32/cryptdlg # Synced to Wine-1.7.1 -reactos/dll/win32/cryptdll # Synced to Wine-1.7.1 -reactos/dll/win32/cryptnet # Synced to Wine-1.7.1 -reactos/dll/win32/cryptui # Synced to Wine-1.7.1 -reactos/dll/win32/dbghelp # Synced to Wine-1.7.1 -reactos/dll/win32/dciman32 # Synced to Wine-1.7.1 -reactos/dll/win32/dwmapi # Synced to Wine-1.7.1 -reactos/dll/win32/faultrep # Synced to Wine-1.7.1 -reactos/dll/win32/fusion # Synced to Wine-1.7.1 -reactos/dll/win32/gdiplus # Synced to Wine-1.7.1 -reactos/dll/win32/hhctrl.ocx # Synced to Wine-1.7.1 -reactos/dll/win32/hlink # Synced to Wine-1.7.1 -reactos/dll/win32/hnetcfg # Synced to Wine-1.7.1 -reactos/dll/win32/httpapi # Synced to Wine-1.7.1 -reactos/dll/win32/iccvid # Synced to Wine-1.7.1 -reactos/dll/win32/icmp # Out of sync -reactos/dll/win32/ieframe # Synced to Wine-1.7.1 -reactos/dll/win32/imaadp32.acm # Synced to Wine-1.7.1 -reactos/dll/win32/imagehlp # Synced to Wine-1.7.1 -reactos/dll/win32/imm32 # Synced to Wine-1.7.1 -reactos/dll/win32/inetcomm # Synced to Wine-1.7.1 -reactos/dll/win32/inetmib1 # Synced to Wine-1.7.1 -reactos/dll/win32/initpki # Synced to Wine-1.7.1 -reactos/dll/win32/inseng # Synced to Wine-1.7.1 -reactos/dll/win32/iphlpapi # Out of sync -reactos/dll/win32/itircl # Synced to Wine-1.7.1 -reactos/dll/win32/itss # Synced to Wine-1.7.1 -reactos/dll/win32/jscript # Synced to Wine-1.7.1 -reactos/dll/win32/loadperf # Synced to Wine-1.7.1 -reactos/dll/win32/localspl # Synced to Wine-1.7.1 -reactos/dll/win32/localui # Synced to Wine-1.7.1 -reactos/dll/win32/lz32 # Synced to Wine-1.7.1 -reactos/dll/win32/mapi32 # Synced to Wine-1.7.1 -reactos/dll/win32/mciavi32 # Synced to Wine-1.7.1 -reactos/dll/win32/mcicda # Synced to Wine-1.7.1 -reactos/dll/win32/mciqtz32 # Synced to Wine-1.7.1 -reactos/dll/win32/mciseq # Synced to Wine-1.7.1 -reactos/dll/win32/mciwave # Synced to Wine-1.7.1 -reactos/dll/win32/mlang # Synced to Wine-1.7.1 -reactos/dll/win32/mmdevapi # Synced to Wine-1.7.1 -reactos/dll/win32/mpr # Synced to Wine-1.7.1 -reactos/dll/win32/mprapi # Synced to Wine-1.7.1 -reactos/dll/win32/msacm32 # Synced to Wine-1.7.1 -reactos/dll/win32/msadp32.acm # Synced to Wine-1.7.1 -reactos/dll/win32/mscat32 # Synced to Wine-1.7.1 -reactos/dll/win32/mscms # Synced to Wine-1.7.1 -reactos/dll/win32/mscoree # Synced to Wine-1.5.4 -reactos/dll/win32/msctf # Synced to Wine-1.7.1 -reactos/dll/win32/msftedit # Synced to Wine-1.7.1 -reactos/dll/win32/msg711.acm # Synced to Wine-1.7.1 -reactos/dll/win32/msgsm32.acm # Synced to Wine-1.7.1 -reactos/dll/win32/mshtml # Synced to Wine-1.7.1 -reactos/dll/win32/mshtml.tlb # Synced to Wine-1.7.1 -reactos/dll/win32/msi # Synced to Wine-1.7.1 -reactos/dll/win32/msimg32 # Synced to Wine-1.7.1 -reactos/dll/win32/msimtf # Synced to Wine-1.7.1 -reactos/dll/win32/msisip # Synced to Wine-1.7.1 -reactos/dll/win32/msisys.ocx # Synced to Wine-1.7.1 -reactos/dll/win32/msnet32 # Synced to Wine-1.7.1 -reactos/dll/win32/msrle32 # Synced to Wine-1.7.1 -reactos/dll/win32/mssign32 # Synced to Wine-1.7.1 -reactos/dll/win32/mssip32 # Synced to Wine-1.7.1 -reactos/dll/win32/mstask # Synced to Wine-1.7.1 -reactos/dll/win32/msvcrt20 # Out of sync -reactos/dll/win32/msvcrt40 # Out of sync -reactos/dll/win32/msvfw32 # Synced to Wine-1.7.1 -reactos/dll/win32/msvidc32 # Synced to Wine-1.7.1 -reactos/dll/win32/msxml # Synced to Wine-1.7.1 -reactos/dll/win32/msxml2 # Synced to Wine-1.7.1 -reactos/dll/win32/msxml3 # Synced to Wine-1.7.1 -reactos/dll/win32/msxml4 # Synced to Wine-1.7.1 -reactos/dll/win32/msxml6 # Synced to Wine-1.7.1 -reactos/dll/win32/nddeapi # Synced to Wine-1.7.1 -reactos/dll/win32/netapi32 # Forked at Wine-1.3.34 -reactos/dll/win32/ntdsapi # Synced to Wine-1.7.1 -reactos/dll/win32/ntprint # Synced to Wine-1.7.1 -reactos/dll/win32/objsel # Synced to Wine-1.7.1 -reactos/dll/win32/odbc32 # Synced to Wine-1.7.1. Depends on port of Linux ODBC. -reactos/dll/win32/odbccp32 # Synced to Wine-1.7.1 -reactos/dll/win32/ole32 # Synced to Wine-1.7.1 -reactos/dll/win32/oleacc # Synced to Wine-1.7.1 -reactos/dll/win32/oleaut32 # Synced to Wine-1.7.1 -reactos/dll/win32/olecli32 # Synced to Wine-1.7.1 -reactos/dll/win32/oledlg # Synced to Wine-1.7.1 -reactos/dll/win32/olepro32 # Synced to Wine-1.7.1 -reactos/dll/win32/olesvr32 # Synced to Wine-1.7.1 -reactos/dll/win32/olethk32 # Synced to Wine-1.7.1 -reactos/dll/win32/pdh # Synced to Wine-1.7.1 -reactos/dll/win32/pidgen # Synced to Wine-1.7.1 -reactos/dll/win32/powrprof # Forked at Wine-1.0rc5 -reactos/dll/win32/printui # Synced to Wine-1.7.1 -reactos/dll/win32/propsys # Synced to Wine-1.7.1 -reactos/dll/win32/pstorec # Synced to Wine-1.7.1 -reactos/dll/win32/qmgr # Synced to Wine-1.7.1 -reactos/dll/win32/qmgrprxy # Synced to Wine-1.7.1 -reactos/dll/win32/query # Synced to Wine-1.7.1 -reactos/dll/win32/rasapi32 # Synced to Wine-1.7.1 -reactos/dll/win32/resutils # Synced to Wine-1.7.1 -reactos/dll/win32/riched20 # Synced to Wine-1.7.1 -reactos/dll/win32/riched32 # Synced to Wine-1.7.1 -reactos/dll/win32/rpcrt4 # Synced to Wine-1.7.1 -reactos/dll/win32/rsabase # Synced to Wine-1.7.1 -reactos/dll/win32/rsaenh # Synced to Wine-1.7.1 -reactos/dll/win32/sccbase # Synced to Wine-1.7.1 -reactos/dll/win32/schannel # Synced to Wine-1.7.1 -reactos/dll/win32/scrrun # Synced to Wine-1.7.1 -reactos/dll/win32/secur32 # Forked -reactos/dll/win32/security # Forked (different .spec) -reactos/dll/win32/sensapi # Synced to Wine-1.7.1 -reactos/dll/win32/setupapi # Forked at Wine-20050524 -reactos/dll/win32/shdoclc # Synced to Wine-1.7.1 -reactos/dll/win32/shdocvw # Synced to Wine-1.7.1 -reactos/dll/win32/shell32 # Forked at Wine-20071011 -reactos/dll/win32/shfolder # Synced to Wine-1.7.1 -reactos/dll/win32/shlwapi # Synced to Wine-1.7.1 -reactos/dll/win32/slbcsp # Synced to Wine-1.7.1 -reactos/dll/win32/snmpapi # Synced to Wine-1.7.1 -reactos/dll/win32/softpub # Synced to Wine-1.7.1 -reactos/dll/win32/spoolss # Synced to Wine-1.7.1 -reactos/dll/win32/stdole2.tlb # Synced to Wine-1.7.1 -reactos/dll/win32/stdole32.tlb # Synced to Wine-1.7.1 -reactos/dll/win32/sti # Synced to Wine-1.7.1 -reactos/dll/win32/sxs # Synced to Wine-1.7.1 -reactos/dll/win32/tapi32 # Synced to Wine-1.7.1 -reactos/dll/win32/traffic # Synced to Wine-1.7.1 -reactos/dll/win32/twain_32 # Synced to Wine-1.7.1 -reactos/dll/win32/unicows # Synced to Wine-1.3.32 (Win9x only, why do we need this?!) -reactos/dll/win32/updspapi # Synced to Wine-1.7.1 -reactos/dll/win32/url # Synced to Wine-1.7.1 -reactos/dll/win32/urlmon # Synced to Wine-1.7.1 -reactos/dll/win32/usp10 # Synced to Wine-1.7.14 -reactos/dll/win32/uxtheme # Forked -reactos/dll/win32/vbscript # Synced to Wine-1.7.1 -reactos/dll/win32/version # Synced to Wine-1.7.1 -reactos/dll/win32/wbemdisp # Synced to Wine-1.7.1 -reactos/dll/win32/wbemprox # Synced to Wine-1.7.2 -reactos/dll/win32/wer # Autosync -reactos/dll/win32/windowscodecs # Synced to Wine-1.7.1 -reactos/dll/win32/windowscodecsext # Synced to Wine-1.7.1 -reactos/dll/win32/winemp3.acm # Synced to Wine-1.7.1 -reactos/dll/win32/wing32 # Out of sync -reactos/dll/win32/winhttp # Synced to Wine-1.7.1 -reactos/dll/win32/wininet # Synced to Wine-1.7.1 -reactos/dll/win32/winmm # Forked at Wine-20050628 -reactos/dll/win32/winmm/midimap # Forked at Wine-20050628 -reactos/dll/win32/winmm/wavemap # Forked at Wine-20050628 -reactos/dll/win32/wintrust # Synced to Wine-1.7.1 -reactos/dll/win32/wldap32 # Synced to Wine-1.7.1 -reactos/dll/win32/wmi # Synced to Wine-1.7.1 -reactos/dll/win32/wtsapi32 # Synced to Wine-1.7.1 -reactos/dll/win32/wuapi # Synced to Wine-1.7.1 -reactos/dll/win32/xinput1_1 # Synced to Wine-1.7.1 -reactos/dll/win32/xinput1_2 # Synced to Wine-1.7.1 -reactos/dll/win32/xinput1_3 # Synced to Wine-1.7.1 -reactos/dll/win32/xinput9_1_0 # Synced to Wine-1.7.1 -reactos/dll/win32/xmllite # Synced to Wine-1.7.1 +reactos/dll/win32/activeds # Synced to Wine-1.7.1 +reactos/dll/win32/actxprxy # Synced to Wine-1.7.17 +reactos/dll/win32/advpack # Synced to Wine-1.7.1 +reactos/dll/win32/atl # Synced to Wine-1.7.1 +reactos/dll/win32/atl100 # Synced to Wine-1.7.1 +reactos/dll/win32/atl80 # Synced to Wine-1.7.1 +reactos/dll/win32/avifil32 # Synced to Wine-1.7.17 +reactos/dll/win32/bcrypt # Synced to Wine-1.7.17 +reactos/dll/win32/browseui # Out of sync +reactos/dll/win32/cabinet # Synced to Wine-1.7.17 +reactos/dll/win32/clusapi # Synced to Wine-1.7.1 +reactos/dll/win32/comcat # Synced to Wine-1.7.1 +reactos/dll/win32/comctl32 # Synced to Wine 1.7.17 +reactos/dll/win32/comdlg32 # Synced to Wine 1.7.17 +reactos/dll/win32/compstui # Synced to Wine-1.7.1 +reactos/dll/win32/credui # Synced to Wine-1.7.1 +reactos/dll/win32/crypt32 # Synced to Wine-1.7.17 +reactos/dll/win32/cryptdlg # Synced to Wine-1.7.1 +reactos/dll/win32/cryptdll # Synced to Wine-1.7.1 +reactos/dll/win32/cryptnet # Synced to Wine-1.7.17 +reactos/dll/win32/cryptui # Synced to Wine-1.7.1 +reactos/dll/win32/dbghelp # Synced to Wine-1.7.1 +reactos/dll/win32/dciman32 # Synced to Wine-1.7.1 +reactos/dll/win32/dwmapi # Synced to Wine-1.7.17 +reactos/dll/win32/faultrep # Synced to Wine-1.7.1 +reactos/dll/win32/fusion # Synced to Wine-1.7.1 +reactos/dll/win32/gdiplus # Synced to Wine-1.7.17 +reactos/dll/win32/hhctrl.ocx # Synced to Wine-1.7.17 +reactos/dll/win32/hlink # Synced to Wine-1.7.17 +reactos/dll/win32/hnetcfg # Synced to Wine-1.7.1 +reactos/dll/win32/httpapi # Synced to Wine-1.7.1 +reactos/dll/win32/iccvid # Synced to Wine-1.7.1 +reactos/dll/win32/icmp # Out of sync +reactos/dll/win32/ieframe # Synced to Wine-1.7.1 +reactos/dll/win32/imaadp32.acm # Synced to Wine-1.7.1 +reactos/dll/win32/imagehlp # Synced to Wine-1.7.17 +reactos/dll/win32/imm32 # Synced to Wine-1.7.1 +reactos/dll/win32/inetcomm # Synced to Wine-1.7.17 +reactos/dll/win32/inetmib1 # Synced to Wine-1.7.1 +reactos/dll/win32/initpki # Synced to Wine-1.7.1 +reactos/dll/win32/inseng # Synced to Wine-1.7.1 +reactos/dll/win32/iphlpapi # Out of sync +reactos/dll/win32/itircl # Synced to Wine-1.7.1 +reactos/dll/win32/itss # Synced to Wine-1.7.17 +reactos/dll/win32/jscript # Synced to Wine-1.7.17 +reactos/dll/win32/loadperf # Synced to Wine-1.7.1 +reactos/dll/win32/localspl # Synced to Wine-1.7.17 +reactos/dll/win32/localui # Synced to Wine-1.7.1 +reactos/dll/win32/lz32 # Synced to Wine-1.7.1 +reactos/dll/win32/mapi32 # Synced to Wine-1.7.17 +reactos/dll/win32/mciavi32 # Synced to Wine-1.7.1 +reactos/dll/win32/mcicda # Synced to Wine-1.7.1 +reactos/dll/win32/mciqtz32 # Synced to Wine-1.7.17 +reactos/dll/win32/mciseq # Synced to Wine-1.7.1 +reactos/dll/win32/mciwave # Synced to Wine-1.7.1 +reactos/dll/win32/mlang # Synced to Wine-1.7.17 +reactos/dll/win32/mmdevapi # Synced to Wine-1.7.1 +reactos/dll/win32/mpr # Synced to Wine-1.7.1 +reactos/dll/win32/mprapi # Synced to Wine-1.7.1 +reactos/dll/win32/msacm32 # Synced to Wine-1.7.17 +reactos/dll/win32/msacm32/msacm32.drv # Synced to Wine-1.7.17 +reactos/dll/win32/msadp32.acm # Synced to Wine-1.7.17 +reactos/dll/win32/mscat32 # Synced to Wine-1.7.1 +reactos/dll/win32/mscms # Synced to Wine-1.7.17 +reactos/dll/win32/mscoree # Synced to Wine-1.5.4 +reactos/dll/win32/msctf # Synced to Wine-1.7.17 +reactos/dll/win32/msftedit # Synced to Wine-1.7.1 +reactos/dll/win32/msg711.acm # Synced to Wine-1.7.1 +reactos/dll/win32/msgsm32.acm # Synced to Wine-1.7.17 +reactos/dll/win32/mshtml # Synced to Wine-1.7.1 +reactos/dll/win32/mshtml.tlb # Synced to Wine-1.7.17 +reactos/dll/win32/msi # Synced to Wine-1.7.17 +reactos/dll/win32/msimg32 # Synced to Wine-1.7.1 +reactos/dll/win32/msimtf # Synced to Wine-1.7.1 +reactos/dll/win32/msisip # Synced to Wine-1.7.1 +reactos/dll/win32/msisys.ocx # Synced to Wine-1.7.1 +reactos/dll/win32/msnet32 # Synced to Wine-1.7.1 +reactos/dll/win32/msrle32 # Synced to Wine-1.7.1 +reactos/dll/win32/mssign32 # Synced to Wine-1.7.1 +reactos/dll/win32/mssip32 # Synced to Wine-1.7.1 +reactos/dll/win32/mstask # Synced to Wine-1.7.1 +reactos/dll/win32/msvcrt20 # Out of sync +reactos/dll/win32/msvcrt40 # Out of sync +reactos/dll/win32/msvfw32 # Synced to Wine-1.7.1 +reactos/dll/win32/msvidc32 # Synced to Wine-1.7.17 +reactos/dll/win32/msxml # Synced to Wine-1.7.1 +reactos/dll/win32/msxml2 # Synced to Wine-1.7.1 +reactos/dll/win32/msxml3 # Synced to Wine-1.7.17 +reactos/dll/win32/msxml4 # Synced to Wine-1.7.1 +reactos/dll/win32/msxml6 # Synced to Wine-1.7.1 +reactos/dll/win32/nddeapi # Synced to Wine-1.7.1 +reactos/dll/win32/netapi32 # Forked at Wine-1.3.34 +reactos/dll/win32/ntdsapi # Synced to Wine-1.7.1 +reactos/dll/win32/ntprint # Synced to Wine-1.7.1 +reactos/dll/win32/objsel # Synced to Wine-1.7.1 +reactos/dll/win32/odbc32 # Synced to Wine-1.7.17. Depends on port of Linux ODBC. +reactos/dll/win32/odbccp32 # Synced to Wine-1.7.1 +reactos/dll/win32/ole32 # Synced to Wine-1.7.17 +reactos/dll/win32/oleacc # Synced to Wine-1.7.17 +reactos/dll/win32/oleaut32 # Synced to Wine-1.7.17 +reactos/dll/win32/olecli32 # Synced to Wine-1.7.1 +reactos/dll/win32/oledlg # Synced to Wine-1.7.1 +reactos/dll/win32/olepro32 # Synced to Wine-1.7.1 +reactos/dll/win32/olesvr32 # Synced to Wine-1.7.1 +reactos/dll/win32/olethk32 # Synced to Wine-1.7.1 +reactos/dll/win32/pdh # Synced to Wine-1.7.1 +reactos/dll/win32/pidgen # Synced to Wine-1.7.1 +reactos/dll/win32/powrprof # Forked at Wine-1.0rc5 +reactos/dll/win32/printui # Synced to Wine-1.7.1 +reactos/dll/win32/propsys # Synced to Wine-1.7.1 +reactos/dll/win32/pstorec # Synced to Wine-1.7.1 +reactos/dll/win32/qmgr # Synced to Wine-1.7.1 +reactos/dll/win32/qmgrprxy # Synced to Wine-1.7.1 +reactos/dll/win32/query # Synced to Wine-1.7.1 +reactos/dll/win32/rasapi32 # Synced to Wine-1.7.1 +reactos/dll/win32/resutils # Synced to Wine-1.7.1 +reactos/dll/win32/riched20 # Synced to Wine-1.7.1 +reactos/dll/win32/riched32 # Synced to Wine-1.7.1 +reactos/dll/win32/rpcrt4 # Synced to Wine-1.7.1 +reactos/dll/win32/rsabase # Synced to Wine-1.7.1 +reactos/dll/win32/rsaenh # Synced to Wine-1.7.17 +reactos/dll/win32/sccbase # Synced to Wine-1.7.1 +reactos/dll/win32/schannel # Synced to Wine-1.7.1 +reactos/dll/win32/scrrun # Synced to Wine-1.7.17 +reactos/dll/win32/secur32 # Forked +reactos/dll/win32/security # Forked (different .spec) +reactos/dll/win32/sensapi # Synced to Wine-1.7.1 +reactos/dll/win32/setupapi # Forked at Wine-20050524 +reactos/dll/win32/shdoclc # Synced to Wine-1.7.1 +reactos/dll/win32/shdocvw # Synced to Wine-1.7.1 +reactos/dll/win32/shell32 # Forked at Wine-20071011 +reactos/dll/win32/shfolder # Synced to Wine-1.7.1 +reactos/dll/win32/shlwapi # Synced to Wine-1.7.17 +reactos/dll/win32/slbcsp # Synced to Wine-1.7.1 +reactos/dll/win32/snmpapi # Synced to Wine-1.7.1 +reactos/dll/win32/softpub # Synced to Wine-1.7.1 +reactos/dll/win32/spoolss # Synced to Wine-1.7.1 +reactos/dll/win32/stdole2.tlb # Synced to Wine-1.7.1 +reactos/dll/win32/stdole32.tlb # Synced to Wine-1.7.1 +reactos/dll/win32/sti # Synced to Wine-1.7.1 +reactos/dll/win32/sxs # Synced to Wine-1.7.1 +reactos/dll/win32/tapi32 # Synced to Wine-1.7.17 +reactos/dll/win32/traffic # Synced to Wine-1.7.1 +reactos/dll/win32/twain_32 # Synced to Wine-1.7.17 +reactos/dll/win32/unicows # Synced to Wine-1.3.32 (Win9x only, why do we need this?!) +reactos/dll/win32/updspapi # Synced to Wine-1.7.1 +reactos/dll/win32/url # Synced to Wine-1.7.17 +reactos/dll/win32/urlmon # Synced to Wine-1.7.17 +reactos/dll/win32/usp10 # Synced to Wine-1.7.17 +reactos/dll/win32/uxtheme # Forked +reactos/dll/win32/vbscript # Synced to Wine-1.7.17 +reactos/dll/win32/version # Synced to Wine-1.7.1 +reactos/dll/win32/wbemdisp # Synced to Wine-1.7.17 +reactos/dll/win32/wbemprox # Synced to Wine-1.7.2 +reactos/dll/win32/wer # Autosync +reactos/dll/win32/windowscodecs # Synced to Wine-1.7.17 +reactos/dll/win32/windowscodecsext # Synced to Wine-1.7.1 +reactos/dll/win32/winemp3.acm # Synced to Wine-1.7.1 +reactos/dll/win32/wing32 # Out of sync +reactos/dll/win32/winhttp # Synced to Wine-1.7.1 +reactos/dll/win32/wininet # Synced to Wine-1.7.1 +reactos/dll/win32/winmm # Forked at Wine-20050628 +reactos/dll/win32/winmm/midimap # Forked at Wine-20050628 +reactos/dll/win32/winmm/wavemap # Forked at Wine-20050628 +reactos/dll/win32/wintrust # Synced to Wine-1.7.17 +reactos/dll/win32/wldap32 # Synced to Wine-1.7.17 +reactos/dll/win32/wmi # Synced to Wine-1.7.17 +reactos/dll/win32/wtsapi32 # Synced to Wine-1.7.1 +reactos/dll/win32/wuapi # Synced to Wine-1.7.1 +reactos/dll/win32/xinput1_1 # Synced to Wine-1.7.1 +reactos/dll/win32/xinput1_2 # Synced to Wine-1.7.1 +reactos/dll/win32/xinput1_3 # Synced to Wine-1.7.1 +reactos/dll/win32/xinput9_1_0 # Synced to Wine-1.7.1 +reactos/dll/win32/xmllite # Synced to Wine-1.7.17 -reactos/dll/cpl/inetcpl # Synced to Wine-1.7.1 +reactos/dll/cpl/inetcpl # Synced to Wine-1.7.1 ReactOS shares the following programs with Winehq. @@ -246,7 +247,7 @@ In addition the following libs, dlls and source files are mostly based on code p from Winehq CVS. If you are looking to update something in these files check Wine current souces first as it may already be fixed. -reactos/lib/3rdparty/strmbase # Synced to Wine-1.7.1 +reactos/lib/3rdparty/strmbase # Synced to Wine-1.7.17 advapi32 - reactos/dll/win32/advapi32/crypt/*.c # Synced to Wine-1.7.1 diff --git a/media/inf/syssetup.inf b/media/inf/syssetup.inf index 51bd7101547..06328771038 100644 --- a/media/inf/syssetup.inf +++ b/media/inf/syssetup.inf @@ -42,6 +42,7 @@ AddReg=Classes 11,,comctl32.dll,2 11,,cryptdlg.dll,1 11,,cryptnet.dll,1 +11,,d3dxof.dll,1 11,,ddraw.dll,1 11,,devenum.dll,1 11,,dinput.dll,1 diff --git a/ntoskrnl/mm/ARM3/mmsup.c b/ntoskrnl/mm/ARM3/mmsup.c index b1e61323562..245acf1a844 100644 --- a/ntoskrnl/mm/ARM3/mmsup.c +++ b/ntoskrnl/mm/ARM3/mmsup.c @@ -89,7 +89,8 @@ MmAdjustWorkingSetSize(IN SIZE_T WorkingSetMinimumInBytes, /* Check if the new minimum exceeds the new maximum */ if (MinimumWorkingSetSize > MaximumWorkingSetSize) { - DPRINT1("MinimumWorkingSetSize > MaximumWorkingSetSize\n"); + DPRINT1("MinimumWorkingSetSize (%lu) > MaximumWorkingSetSize (%lu)\n", + MinimumWorkingSetSize, MaximumWorkingSetSize); Status = STATUS_BAD_WORKING_SET_LIMIT; goto Cleanup; } diff --git a/win32ss/gdi/eng/pdevobj.c b/win32ss/gdi/eng/pdevobj.c index 8e5a4d0bb26..a2feddc8897 100644 --- a/win32ss/gdi/eng/pdevobj.c +++ b/win32ss/gdi/eng/pdevobj.c @@ -94,8 +94,12 @@ PDEVOBJ_vRelease(PPDEVOBJ ppdev) PALETTE_ShareUnlockPalette(ppdev->ppalSurf); } - /* Disable PDEV */ - ppdev->pfn.DisablePDEV(ppdev->dhpdev); + /* Check if the PDEV was enabled */ + if (ppdev->dhpdev != NULL) + { + /* Disable the PDEV */ + ppdev->pfn.DisablePDEV(ppdev->dhpdev); + } /* Remove it from list */ if( ppdev == gppdevList ) @@ -155,6 +159,11 @@ PDEVOBJ_bEnablePDEV( (HDEV)ppdev, ppdev->pGraphicsDevice->pwszDescription, ppdev->pGraphicsDevice->DeviceObject); + if (ppdev->dhpdev == NULL) + { + DPRINT1("Failed to enable PDEV\n"); + return FALSE; + } /* Fix up some values */ if (ppdev->gdiinfo.ulLogPixelsX == 0) @@ -337,7 +346,8 @@ EngpCreatePDEV( if (!PDEVOBJ_bEnablePDEV(ppdev, pdm, NULL)) { DPRINT1("Failed to enable PDEV!\n"); - ASSERT(FALSE); + PDEVOBJ_vRelease(ppdev); + return NULL; } /* FIXME: this must be done in a better way */ diff --git a/win32ss/reactx/ntddraw/ddraw.c b/win32ss/reactx/ntddraw/ddraw.c index 9d8beb86756..7ce8adc19aa 100644 --- a/win32ss/reactx/ntddraw/ddraw.c +++ b/win32ss/reactx/ntddraw/ddraw.c @@ -20,7 +20,7 @@ extern ULONG gcEngFuncs; extern EDD_DIRECTDRAW_GLOBAL edd_DdirectDraw_Global; -DRVFN gpDxFuncs[DXG_INDEX_DxDdIoctl]; +DRVFN gpDxFuncs[DXG_INDEX_DxDdIoctl + 1]; HANDLE ghDxGraphics = NULL; ULONG gdwDirectDrawContext = 0; diff --git a/win32ss/user/ntuser/misc/copy.c b/win32ss/user/ntuser/misc/copy.c index 6a50d5562dd..392ed2d355a 100644 --- a/win32ss/user/ntuser/misc/copy.c +++ b/win32ss/user/ntuser/misc/copy.c @@ -1,12 +1,22 @@ #include "win32k.h" -NTSTATUS _MmCopyFromCaller( PVOID Target, PVOID Source, UINT Bytes ) { - NTSTATUS Status = STATUS_SUCCESS; +_IRQL_requires_max_(APC_LEVEL) +NTSTATUS +_MmCopyFromCaller( + _Out_writes_bytes_all_(Bytes) PVOID Target, + _In_reads_bytes_(Bytes) PVOID Source, + _In_ UINT Bytes) +{ + NTSTATUS Status; + PAGED_CODE(); + ASSERT(ExGetPreviousMode() == UserMode); + + Status = STATUS_SUCCESS; _SEH2_TRY { - ProbeForRead(Source,Bytes,1); - RtlCopyMemory(Target,Source,Bytes); + ProbeForRead(Source, Bytes, 1); + RtlCopyMemory(Target, Source, Bytes); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -17,13 +27,23 @@ NTSTATUS _MmCopyFromCaller( PVOID Target, PVOID Source, UINT Bytes ) { return Status; } -NTSTATUS _MmCopyToCaller( PVOID Target, PVOID Source, UINT Bytes ) { - NTSTATUS Status = STATUS_SUCCESS; +_IRQL_requires_max_(APC_LEVEL) +NTSTATUS +_MmCopyToCaller( + _Out_writes_bytes_all_(Bytes) PVOID Target, + _In_reads_bytes_(Bytes) PVOID Source, + _In_ UINT Bytes) +{ + NTSTATUS Status; + PAGED_CODE(); + ASSERT(ExGetPreviousMode() == UserMode); + + Status = STATUS_SUCCESS; _SEH2_TRY { - /* ProbeForWrite(Target,Bytes,1); */ - RtlCopyMemory(Target,Source,Bytes); + ProbeForWrite(Target, Bytes, 1); + RtlCopyMemory(Target, Source, Bytes); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { diff --git a/win32ss/user/ntuser/mmcopy.h b/win32ss/user/ntuser/mmcopy.h index 82d29c1eb97..69bfccb1cb3 100644 --- a/win32ss/user/ntuser/mmcopy.h +++ b/win32ss/user/ntuser/mmcopy.h @@ -1,8 +1,19 @@ #pragma once -NTSTATUS _MmCopyFromCaller( PVOID Target, PVOID Source, UINT Bytes ); -NTSTATUS _MmCopyToCaller( PVOID Target, PVOID Source, UINT Bytes ); +_IRQL_requires_max_(APC_LEVEL) +NTSTATUS +_MmCopyFromCaller( + _Out_writes_bytes_all_(Bytes) PVOID Target, + _In_reads_bytes_(Bytes) PVOID Source, + _In_ UINT Bytes); + +_IRQL_requires_max_(APC_LEVEL) +NTSTATUS +_MmCopyToCaller( + _Out_writes_bytes_all_(Bytes) PVOID Target, + _In_reads_bytes_(Bytes) PVOID Source, + _In_ UINT Bytes); #define MmCopyFromCaller(x,y,z) _MmCopyFromCaller((PCHAR)(x),(PCHAR)(y),(UINT)(z)) #define MmCopyToCaller(x,y,z) _MmCopyToCaller((PCHAR)(x),(PCHAR)(y),(UINT)(z)) diff --git a/win32ss/user/ntuser/win32kdebug.h b/win32ss/user/ntuser/win32kdebug.h index d26c4c18796..0d405c80e7a 100644 --- a/win32ss/user/ntuser/win32kdebug.h +++ b/win32ss/user/ntuser/win32kdebug.h @@ -29,6 +29,12 @@ #if DBG + #include + + #if !defined(__RELFILE__) + #define __RELFILE__ __FILE__ + #endif + typedef struct { PWCHAR Name; @@ -129,7 +135,7 @@ #define DBG_PRINT(ppi,ch,level,fmt, ...) do { \ if((level == ERR_LEVEL) || (ppi && DBG_IS_CHANNEL_ENABLED(ppi,ch,level))) \ - DbgPrint("(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ + DbgPrint("(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__); \ }while(0); #define ERR(fmt, ...) DBG_PRINT(DBG_GET_PPI, DbgDefaultChannel, ERR_LEVEL,"err: " fmt, ##__VA_ARGS__) @@ -147,7 +153,7 @@ #define WARN_PPI(ppi,ch,fmt, ...) DBG_PRINT(ppi, DbgCh##ch, WARN_LEVEL,"warn: " fmt, ##__VA_ARGS__) #define TRACE_PPI(ppi,ch,fmt, ...) DBG_PRINT(ppi, DbgCh##ch, TRACE_LEVEL,"trace: " fmt, ##__VA_ARGS__) - #define STUB DbgPrint("WARNING: %s at %s:%d is UNIMPLEMENTED!\n",__FUNCTION__,__FILE__,__LINE__); + #define STUB DbgPrint("WARNING: %s at %s:%d is UNIMPLEMENTED!\n",__FUNCTION__,__RELFILE__,__LINE__); #else #define DBG_GET_PPI diff --git a/win32ss/user/ntuser/winsta.c b/win32ss/user/ntuser/winsta.c index 57ee98a11e4..f4fe81a017e 100644 --- a/win32ss/user/ntuser/winsta.c +++ b/win32ss/user/ntuser/winsta.c @@ -641,6 +641,19 @@ NtUserGetObjectInformation( PVOID pvData = NULL; DWORD nDataSize = 0; + _SEH2_TRY + { + if (nLengthNeeded) + ProbeForWrite(nLengthNeeded, sizeof(*nLengthNeeded), 1); + ProbeForWrite(pvInformation, nLength, 1); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + SetLastNtError(_SEH2_GetExceptionCode()); + return FALSE; + } + _SEH2_END; + /* try windowstation */ TRACE("Trying to open window station %p\n", hObject); Status = ObReferenceObjectByHandle( @@ -665,8 +678,7 @@ NtUserGetObjectInformation( if (!NT_SUCCESS(Status)) { ERR("Failed: 0x%x\n", Status); - SetLastNtError(Status); - return FALSE; + goto Exit; } TRACE("WinSta or Desktop opened!!\n"); @@ -723,16 +735,27 @@ NtUserGetObjectInformation( break; } - /* try to copy data to caller */ - if (Status == STATUS_SUCCESS) +Exit: + if (Status == STATUS_SUCCESS && nLength < nDataSize) + Status = STATUS_BUFFER_TOO_SMALL; + + _SEH2_TRY { - TRACE("Trying to copy data to caller (len = %lu, len needed = %lu)\n", nLength, nDataSize); - *nLengthNeeded = nDataSize; - if (nLength >= nDataSize) - Status = MmCopyToCaller(pvInformation, pvData, nDataSize); - else - Status = STATUS_BUFFER_TOO_SMALL; + if (nLengthNeeded) + *nLengthNeeded = nDataSize; + + /* try to copy data to caller */ + if (Status == STATUS_SUCCESS) + { + TRACE("Trying to copy data to caller (len = %lu, len needed = %lu)\n", nLength, nDataSize); + RtlCopyMemory(pvInformation, pvData, nDataSize); + } } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; /* release objects */ if (WinStaObject != NULL) diff --git a/win32ss/user/user32/windows/nonclient.c b/win32ss/user/user32/windows/nonclient.c index 4dab2d0bfd1..234f1b9abe8 100644 --- a/win32ss/user/user32/windows/nonclient.c +++ b/win32ss/user/user32/windows/nonclient.c @@ -1133,10 +1133,10 @@ LRESULT NC_HandleNCRButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam ) if (hwnd != GetCapture()) return 0; } ReleaseCapture(); - if (hittest == HTCAPTION || hittest == HTSYSMENU) + if (hittest == HTCAPTION || hittest == HTSYSMENU || hittest == HTHSCROLL || hittest == HTVSCROLL) { - ERR("Msg pt %x and Msg.lParam %x and lParam %x\n",MAKELONG(msg.pt.x,msg.pt.y),msg.lParam,lParam); - SendMessageW( hwnd, WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU, msg.lParam ); + TRACE("Msg pt %x and Msg.lParam %x and lParam %x\n",MAKELONG(msg.pt.x,msg.pt.y),msg.lParam,lParam); + SendMessageW( hwnd, WM_CONTEXTMENU, (WPARAM)hwnd, MAKELONG(msg.pt.x,msg.pt.y)); } break; } diff --git a/win32ss/user/winsrv/consrv/condrv/coninput.c b/win32ss/user/winsrv/consrv/condrv/coninput.c index 3b4777c1468..27c6b3670c6 100644 --- a/win32ss/user/winsrv/consrv/condrv/coninput.c +++ b/win32ss/user/winsrv/consrv/condrv/coninput.c @@ -54,6 +54,19 @@ ConioInputEventToAnsi(PCONSOLE Console, PINPUT_RECORD InputEvent) } } +static VOID FASTCALL +ConioInputEventToUnicode(PCONSOLE Console, PINPUT_RECORD InputEvent) +{ + if (InputEvent->EventType == KEY_EVENT) + { + CHAR AsciiChar = InputEvent->Event.KeyEvent.uChar.AsciiChar; + InputEvent->Event.KeyEvent.uChar.AsciiChar = 0; + ConsoleInputAnsiCharToUnicodeChar(Console, + &InputEvent->Event.KeyEvent.uChar.UnicodeChar, + &AsciiChar); + } +} + NTSTATUS FASTCALL ConioAddInputEvent(PCONSOLE Console, PINPUT_RECORD InputEvent, @@ -465,12 +478,9 @@ ConDrvWriteConsoleInput(IN PCONSOLE Console, for (i = (NumEventsWritten ? *NumEventsWritten : 0); i < NumEventsToWrite && NT_SUCCESS(Status); ++i) { - if (InputRecord->EventType == KEY_EVENT && !Unicode) + if (!Unicode) { - CHAR AsciiChar = InputRecord->Event.KeyEvent.uChar.AsciiChar; - ConsoleInputAnsiCharToUnicodeChar(Console, - &InputRecord->Event.KeyEvent.uChar.UnicodeChar, - &AsciiChar); + ConioInputEventToUnicode(Console, InputRecord); } Status = ConioAddInputEvent(Console, InputRecord++, AppendToEnd); @@ -509,24 +519,24 @@ ConDrvFlushConsoleInputBuffer(IN PCONSOLE Console, NTSTATUS NTAPI ConDrvGetConsoleNumberOfInputEvents(IN PCONSOLE Console, IN PCONSOLE_INPUT_BUFFER InputBuffer, - OUT PULONG NumEvents) + OUT PULONG NumberOfEvents) { PLIST_ENTRY CurrentInput; - if (Console == NULL || InputBuffer == NULL || NumEvents == NULL) + if (Console == NULL || InputBuffer == NULL || NumberOfEvents == NULL) return STATUS_INVALID_PARAMETER; /* Validity check */ ASSERT(Console == InputBuffer->Header.Console); - *NumEvents = 0; + *NumberOfEvents = 0; /* If there are any events ... */ CurrentInput = InputBuffer->InputEvents.Flink; while (CurrentInput != &InputBuffer->InputEvents) { CurrentInput = CurrentInput->Flink; - (*NumEvents)++; + (*NumberOfEvents)++; } return STATUS_SUCCESS; diff --git a/win32ss/user/winsrv/consrv/condrv/console.c b/win32ss/user/winsrv/consrv/condrv/console.c index e756eb526cb..47c1e2aea9b 100644 --- a/win32ss/user/winsrv/consrv/condrv/console.c +++ b/win32ss/user/winsrv/consrv/condrv/console.c @@ -197,7 +197,7 @@ VOID ResetFrontEnd(IN PCONSOLE Console); /* PRIVATE FUNCTIONS **********************************************************/ static NTSTATUS -ConDrvConsoleCtrlEventTimeout(IN ULONG Event, +ConDrvConsoleCtrlEventTimeout(IN ULONG CtrlEvent, IN PCONSOLE_PROCESS_DATA ProcessData, IN ULONG Timeout) { @@ -215,7 +215,7 @@ ConDrvConsoleCtrlEventTimeout(IN ULONG Event, { Thread = CreateRemoteThread(ProcessData->Process->ProcessHandle, NULL, 0, ProcessData->CtrlDispatcher, - UlongToPtr(Event), 0, NULL); + UlongToPtr(CtrlEvent), 0, NULL); if (NULL == Thread) { Status = RtlGetLastNtStatus(); @@ -244,11 +244,11 @@ ConDrvConsoleCtrlEventTimeout(IN ULONG Event, return Status; } -static NTSTATUS -ConDrvConsoleCtrlEvent(IN ULONG Event, +NTSTATUS +ConDrvConsoleCtrlEvent(IN ULONG CtrlEvent, IN PCONSOLE_PROCESS_DATA ProcessData) { - return ConDrvConsoleCtrlEventTimeout(Event, ProcessData, 0); + return ConDrvConsoleCtrlEventTimeout(CtrlEvent, ProcessData, 0); } VOID FASTCALL @@ -535,6 +535,8 @@ ConDrvInitConsole(OUT PHANDLE NewConsoleHandle, Console->ReferenceCount = 0; InitializeCriticalSection(&Console->Lock); InitializeListHead(&Console->ProcessList); + Console->NotifiedLastCloseProcess = NULL; + Console->NotifyLastClose = FALSE; /* Initialize the frontend interface */ ResetFrontEnd(Console); @@ -573,11 +575,6 @@ ConDrvInitConsole(OUT PHANDLE NewConsoleHandle, Console->LineInsertToggle = Console->InsertMode; // LineWakeupMask - // FIXME: This is terminal-specific !! VV - RtlZeroMemory(&Console->Selection, sizeof(CONSOLE_SELECTION_INFO)); - Console->Selection.dwFlags = CONSOLE_NO_SELECTION; - // dwSelectionCursor - /* Set-up the code page */ Console->CodePage = Console->OutputCodePage = ConsoleInfo->CodePage; @@ -879,7 +876,8 @@ ConDrvSetConsoleMode(IN PCONSOLE Console, IN PCONSOLE_IO_OBJECT Object, IN ULONG ConsoleMode) { -#define CONSOLE_VALID_CONTROL_MODES ( ENABLE_EXTENDED_FLAGS | ENABLE_INSERT_MODE | ENABLE_QUICK_EDIT_MODE ) +#define CONSOLE_VALID_CONTROL_MODES ( ENABLE_EXTENDED_FLAGS | \ + ENABLE_INSERT_MODE | ENABLE_QUICK_EDIT_MODE ) #define CONSOLE_VALID_INPUT_MODES ( ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | \ ENABLE_ECHO_INPUT | ENABLE_WINDOW_INPUT | \ ENABLE_MOUSE_INPUT ) @@ -956,39 +954,80 @@ Quit: NTSTATUS NTAPI ConDrvGetConsoleTitle(IN PCONSOLE Console, - IN OUT PWCHAR Title, + IN BOOLEAN Unicode, + IN OUT PVOID TitleBuffer, IN OUT PULONG BufLength) { ULONG Length; - if (Console == NULL || Title == NULL || BufLength == NULL) + if (Console == NULL || TitleBuffer == NULL || BufLength == NULL) return STATUS_INVALID_PARAMETER; /* Copy title of the console to the user title buffer */ - if (*BufLength >= sizeof(WCHAR)) + if (Unicode) { - Length = min(*BufLength - sizeof(WCHAR), Console->Title.Length); - RtlCopyMemory(Title, Console->Title.Buffer, Length); - Title[Length / sizeof(WCHAR)] = L'\0'; + if (*BufLength >= sizeof(WCHAR)) + { + Length = min(*BufLength - sizeof(WCHAR), Console->Title.Length); + RtlCopyMemory(TitleBuffer, Console->Title.Buffer, Length); + ((PWCHAR)TitleBuffer)[Length / sizeof(WCHAR)] = L'\0'; + *BufLength = Length; + } + else + { + *BufLength = Console->Title.Length; + } + } + else + { + if (*BufLength >= sizeof(CHAR)) + { + Length = min(*BufLength - sizeof(CHAR), Console->Title.Length / sizeof(WCHAR)); + Length = WideCharToMultiByte(Console->CodePage, 0, + Console->Title.Buffer, Length, + TitleBuffer, Length, + NULL, NULL); + ((PCHAR)TitleBuffer)[Length] = '\0'; + *BufLength = Length; + } + else + { + *BufLength = Console->Title.Length / sizeof(WCHAR); + } } - - *BufLength = Console->Title.Length; return STATUS_SUCCESS; } NTSTATUS NTAPI ConDrvSetConsoleTitle(IN PCONSOLE Console, - IN PWCHAR Title, + IN BOOLEAN Unicode, + IN PVOID TitleBuffer, IN ULONG BufLength) { PWCHAR Buffer; + ULONG Length; - if (Console == NULL || Title == NULL) + if (Console == NULL || TitleBuffer == NULL) return STATUS_INVALID_PARAMETER; + if (Unicode) + { + /* Length is in bytes */ + Length = BufLength; + } + else + { + /* Use the console input CP for the conversion */ + Length = MultiByteToWideChar(Console->CodePage, 0, + TitleBuffer, BufLength, + NULL, 0); + /* The returned Length was in number of wchars, convert it in bytes */ + Length *= sizeof(WCHAR); + } + /* Allocate a new buffer to hold the new title (NULL-terminated) */ - Buffer = ConsoleAllocHeap(0, BufLength + sizeof(WCHAR)); + Buffer = ConsoleAllocHeap(HEAP_ZERO_MEMORY, Length + sizeof(WCHAR)); if (!Buffer) return STATUS_NO_MEMORY; /* Free the old title */ @@ -996,9 +1035,22 @@ ConDrvSetConsoleTitle(IN PCONSOLE Console, /* Copy title to console */ Console->Title.Buffer = Buffer; - Console->Title.Length = BufLength; + Console->Title.Length = Length; Console->Title.MaximumLength = Console->Title.Length + sizeof(WCHAR); - RtlCopyMemory(Console->Title.Buffer, Title, Console->Title.Length); + + if (Unicode) + { + RtlCopyMemory(Console->Title.Buffer, TitleBuffer, Console->Title.Length); + } + else + { + MultiByteToWideChar(Console->CodePage, 0, + TitleBuffer, BufLength, + Console->Title.Buffer, + Console->Title.Length / sizeof(WCHAR)); + } + + /* NULL-terminate */ Console->Title.Buffer[Console->Title.Length / sizeof(WCHAR)] = L'\0'; // TermChangeTitle(Console); @@ -1034,6 +1086,16 @@ ConDrvSetConsoleCP(IN PCONSOLE Console, return STATUS_SUCCESS; } +PCONSOLE_PROCESS_DATA NTAPI +ConDrvGetConsoleLeaderProcess(IN PCONSOLE Console) +{ + if (Console == NULL) return NULL; + + return CONTAINING_RECORD(Console->ProcessList.Blink, + CONSOLE_PROCESS_DATA, + ConsoleLink); +} + NTSTATUS NTAPI ConDrvGetConsoleProcessList(IN PCONSOLE Console, IN OUT PULONG ProcessIdsList, @@ -1066,7 +1128,7 @@ ConDrvGetConsoleProcessList(IN PCONSOLE Console, NTSTATUS NTAPI ConDrvConsoleProcessCtrlEvent(IN PCONSOLE Console, IN ULONG ProcessGroupId, - IN ULONG Event) + IN ULONG CtrlEvent) { NTSTATUS Status = STATUS_SUCCESS; PLIST_ENTRY current_entry; @@ -1094,7 +1156,7 @@ ConDrvConsoleProcessCtrlEvent(IN PCONSOLE Console, */ if (ProcessGroupId == 0 || current->Process->ProcessGroupId == ProcessGroupId) { - Status = ConDrvConsoleCtrlEvent(Event, current); + Status = ConDrvConsoleCtrlEvent(CtrlEvent, current); } } diff --git a/win32ss/user/winsrv/consrv/condrv/dummyfrontend.c b/win32ss/user/winsrv/consrv/condrv/dummyfrontend.c index 794aae2c5ff..c96cfe579ff 100644 --- a/win32ss/user/winsrv/consrv/condrv/dummyfrontend.c +++ b/win32ss/user/winsrv/consrv/condrv/dummyfrontend.c @@ -116,6 +116,13 @@ DummyGetLargestConsoleWindowSize(IN OUT PFRONTEND This, { } +static BOOL NTAPI +DummyGetSelectionInfo(IN OUT PFRONTEND This, + PCONSOLE_SELECTION_INFO pSelectionInfo) +{ + return TRUE; +} + static BOOL NTAPI DummySetPalette(IN OUT PFRONTEND This, HPALETTE PaletteHandle, @@ -183,6 +190,7 @@ static FRONTEND_VTBL DummyVtbl = DummyChangeIcon, DummyGetConsoleWindowHandle, DummyGetLargestConsoleWindowSize, + DummyGetSelectionInfo, DummySetPalette, DummyGetDisplayMode, DummySetDisplayMode, diff --git a/win32ss/user/winsrv/consrv/condrv/text.c b/win32ss/user/winsrv/consrv/condrv/text.c index fe99b38e67d..da6459d3e7c 100644 --- a/win32ss/user/winsrv/consrv/condrv/text.c +++ b/win32ss/user/winsrv/consrv/condrv/text.c @@ -1259,7 +1259,7 @@ ConDrvGetConsoleScreenBufferInfo(IN PCONSOLE Console, NTSTATUS NTAPI ConDrvSetConsoleTextAttribute(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, - IN WORD Attribute) + IN WORD Attributes) { if (Console == NULL || Buffer == NULL) return STATUS_INVALID_PARAMETER; @@ -1267,7 +1267,7 @@ ConDrvSetConsoleTextAttribute(IN PCONSOLE Console, /* Validity check */ ASSERT(Console == Buffer->Header.Console); - Buffer->ScreenDefaultAttrib = Attribute; + Buffer->ScreenDefaultAttrib = Attributes; return STATUS_SUCCESS; } diff --git a/win32ss/user/winsrv/consrv/coninput.c b/win32ss/user/winsrv/consrv/coninput.c index d0b01e25b1b..97e1ee560dc 100644 --- a/win32ss/user/winsrv/consrv/coninput.c +++ b/win32ss/user/winsrv/consrv/coninput.c @@ -444,7 +444,7 @@ CSR_API(SrvFlushConsoleInputBuffer) NTSTATUS NTAPI ConDrvGetConsoleNumberOfInputEvents(IN PCONSOLE Console, IN PCONSOLE_INPUT_BUFFER InputBuffer, - OUT PULONG NumEvents); + OUT PULONG NumberOfEvents); CSR_API(SrvGetConsoleNumberOfInputEvents) { NTSTATUS Status; @@ -460,7 +460,7 @@ CSR_API(SrvGetConsoleNumberOfInputEvents) Status = ConDrvGetConsoleNumberOfInputEvents(InputBuffer->Header.Console, InputBuffer, - &GetNumInputEventsRequest->NumInputEvents); + &GetNumInputEventsRequest->NumberOfEvents); ConSrvReleaseInputBuffer(InputBuffer, TRUE); return Status; diff --git a/win32ss/user/winsrv/consrv/conoutput.c b/win32ss/user/winsrv/consrv/conoutput.c index fe04b8bd5fc..f5dac648a2c 100644 --- a/win32ss/user/winsrv/consrv/conoutput.c +++ b/win32ss/user/winsrv/consrv/conoutput.c @@ -232,8 +232,8 @@ CSR_API(SrvCreateConsoleScreenBuffer) /* Get infos from the graphics buffer information structure */ if (!CsrValidateMessageBuffer(ApiMessage, (PVOID*)&CreateScreenBufferRequest->GraphicsBufferInfo.lpBitMapInfo, - 1, - CreateScreenBufferRequest->GraphicsBufferInfo.dwBitMapInfoLength)) + CreateScreenBufferRequest->GraphicsBufferInfo.dwBitMapInfoLength, + sizeof(BYTE))) { Status = STATUS_INVALID_PARAMETER; goto Quit; @@ -242,11 +242,13 @@ CSR_API(SrvCreateConsoleScreenBuffer) ScreenBufferInfo = &GraphicsInfo; /* Initialize shared variables */ - CreateScreenBufferRequest->GraphicsBufferInfo.hMutex = GraphicsInfo.Info.hMutex = INVALID_HANDLE_VALUE; - CreateScreenBufferRequest->GraphicsBufferInfo.lpBitMap = GraphicsInfo.Info.lpBitMap = NULL; + // CreateScreenBufferRequest->GraphicsBufferInfo.hMutex + CreateScreenBufferRequest->hMutex = GraphicsInfo.Info.hMutex = INVALID_HANDLE_VALUE; + // CreateScreenBufferRequest->GraphicsBufferInfo.lpBitMap + CreateScreenBufferRequest->lpBitMap = GraphicsInfo.Info.lpBitMap = NULL; /* A graphics screen buffer is never inheritable */ - CreateScreenBufferRequest->Inheritable = FALSE; + CreateScreenBufferRequest->InheritHandle = FALSE; } Status = ConDrvCreateScreenBuffer(&Buff, @@ -261,8 +263,8 @@ CSR_API(SrvCreateConsoleScreenBuffer) Status = ConSrvInsertObject(ProcessData, &CreateScreenBufferRequest->OutputHandle, &Buff->Header, - CreateScreenBufferRequest->Access, - CreateScreenBufferRequest->Inheritable, + CreateScreenBufferRequest->DesiredAccess, + CreateScreenBufferRequest->InheritHandle, CreateScreenBufferRequest->ShareMode); RtlLeaveCriticalSection(&ProcessData->HandleTableLock); @@ -276,8 +278,10 @@ CSR_API(SrvCreateConsoleScreenBuffer) * Initialize the graphics buffer information structure * and give it back to the client. */ - CreateScreenBufferRequest->GraphicsBufferInfo.hMutex = Buffer->ClientMutex; - CreateScreenBufferRequest->GraphicsBufferInfo.lpBitMap = Buffer->ClientBitMap; + // CreateScreenBufferRequest->GraphicsBufferInfo.hMutex + CreateScreenBufferRequest->hMutex = Buffer->ClientMutex; + // CreateScreenBufferRequest->GraphicsBufferInfo.lpBitMap + CreateScreenBufferRequest->lpBitMap = Buffer->ClientBitMap; } Quit: @@ -720,7 +724,7 @@ CSR_API(SrvGetConsoleScreenBufferInfo) NTSTATUS NTAPI ConDrvSetConsoleTextAttribute(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, - IN WORD Attribute); + IN WORD Attributes); CSR_API(SrvSetConsoleTextAttribute) { NTSTATUS Status; @@ -736,7 +740,7 @@ CSR_API(SrvSetConsoleTextAttribute) Status = ConDrvSetConsoleTextAttribute(Buffer->Header.Console, Buffer, - SetTextAttribRequest->Attrib); + SetTextAttribRequest->Attributes); ConSrvReleaseScreenBuffer(Buffer, TRUE); return Status; diff --git a/win32ss/user/winsrv/consrv/console.c b/win32ss/user/winsrv/consrv/console.c index 8cc401abe5b..441e07d74de 100644 --- a/win32ss/user/winsrv/consrv/console.c +++ b/win32ss/user/winsrv/consrv/console.c @@ -439,12 +439,12 @@ CSR_API(SrvGetConsoleMode) PCONSOLE_IO_OBJECT Object; Status = ConSrvGetObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process), - ConsoleModeRequest->ConsoleHandle, + ConsoleModeRequest->Handle, &Object, NULL, GENERIC_READ, TRUE, 0); if (!NT_SUCCESS(Status)) return Status; Status = ConDrvGetConsoleMode(Object->Console, Object, - &ConsoleModeRequest->ConsoleMode); + &ConsoleModeRequest->Mode); ConSrvReleaseObject(Object, TRUE); return Status; @@ -461,12 +461,12 @@ CSR_API(SrvSetConsoleMode) PCONSOLE_IO_OBJECT Object; Status = ConSrvGetObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process), - ConsoleModeRequest->ConsoleHandle, + ConsoleModeRequest->Handle, &Object, NULL, GENERIC_WRITE, TRUE, 0); if (!NT_SUCCESS(Status)) return Status; Status = ConDrvSetConsoleMode(Object->Console, Object, - ConsoleModeRequest->ConsoleMode); + ConsoleModeRequest->Mode); ConSrvReleaseObject(Object, TRUE); return Status; @@ -474,7 +474,8 @@ CSR_API(SrvSetConsoleMode) NTSTATUS NTAPI ConDrvGetConsoleTitle(IN PCONSOLE Console, - IN OUT PWCHAR Title, + IN BOOLEAN Unicode, + IN OUT PVOID TitleBuffer, IN OUT PULONG BufLength); CSR_API(SrvGetConsoleTitle) { @@ -498,6 +499,7 @@ CSR_API(SrvGetConsoleTitle) } Status = ConDrvGetConsoleTitle(Console, + TitleRequest->Unicode, TitleRequest->Title, &TitleRequest->Length); @@ -507,7 +509,8 @@ CSR_API(SrvGetConsoleTitle) NTSTATUS NTAPI ConDrvSetConsoleTitle(IN PCONSOLE Console, - IN PWCHAR Title, + IN BOOLEAN Unicode, + IN PVOID TitleBuffer, IN ULONG BufLength); CSR_API(SrvSetConsoleTitle) { @@ -531,9 +534,9 @@ CSR_API(SrvSetConsoleTitle) } Status = ConDrvSetConsoleTitle(Console, + TitleRequest->Unicode, TitleRequest->Title, TitleRequest->Length); - if (NT_SUCCESS(Status)) TermChangeTitle(Console); ConSrvReleaseConsole(Console, TRUE); @@ -629,8 +632,8 @@ CSR_API(SrvGenerateConsoleCtrlEvent) if (!NT_SUCCESS(Status)) return Status; Status = ConDrvConsoleProcessCtrlEvent(Console, - GenerateCtrlEventRequest->ProcessGroup, - GenerateCtrlEventRequest->Event); + GenerateCtrlEventRequest->ProcessGroupId, + GenerateCtrlEventRequest->CtrlEvent); ConSrvReleaseConsole(Console, TRUE); return Status; @@ -638,8 +641,27 @@ CSR_API(SrvGenerateConsoleCtrlEvent) CSR_API(SrvConsoleNotifyLastClose) { - DPRINT1("%s not yet implemented\n", __FUNCTION__); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS Status; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); + PCONSOLE Console; + + Status = ConSrvGetConsole(ProcessData, &Console, TRUE); + if (!NT_SUCCESS(Status)) return Status; + + /* Only one process is allowed to be registered for last close notification */ + if (!Console->NotifyLastClose) + { + Console->NotifyLastClose = TRUE; + Console->NotifiedLastCloseProcess = ProcessData; + Status = STATUS_SUCCESS; + } + else + { + Status = STATUS_ACCESS_DENIED; + } + + ConSrvReleaseConsole(Console, TRUE); + return Status; } diff --git a/win32ss/user/winsrv/consrv/frontendctl.c b/win32ss/user/winsrv/consrv/frontendctl.c index 7294fa74d1b..a4cf977b07e 100644 --- a/win32ss/user/winsrv/consrv/frontendctl.c +++ b/win32ss/user/winsrv/consrv/frontendctl.c @@ -308,14 +308,13 @@ CSR_API(SrvGetConsoleSelectionInfo) PCONSOLE Console; Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE); - if (NT_SUCCESS(Status)) - { - memset(&GetSelectionInfoRequest->Info, 0, sizeof(CONSOLE_SELECTION_INFO)); - if (Console->Selection.dwFlags != 0) - GetSelectionInfoRequest->Info = Console->Selection; - ConSrvReleaseConsole(Console, TRUE); - } + if (!NT_SUCCESS(Status)) return Status; + Status = (TermGetSelectionInfo(Console, &GetSelectionInfoRequest->Info) + ? STATUS_SUCCESS + : STATUS_UNSUCCESSFUL); + + ConSrvReleaseConsole(Console, TRUE); return Status; } diff --git a/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c b/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c index e83c024df97..c9243298ad2 100644 --- a/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c +++ b/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c @@ -48,9 +48,7 @@ SetConWndConsoleLeaderCID(IN PGUI_CONSOLE_DATA GuiData) PCONSOLE_PROCESS_DATA ProcessData; CLIENT_ID ConsoleLeaderCID; - ProcessData = CONTAINING_RECORD(GuiData->Console->ProcessList.Blink, - CONSOLE_PROCESS_DATA, - ConsoleLink); + ProcessData = ConDrvGetConsoleLeaderProcess(GuiData->Console); ConsoleLeaderCID = ProcessData->Process->ClientId; SetWindowLongPtrW(GuiData->hWindow, GWLP_CONSOLE_LEADER_PID, (LONG_PTR)(ConsoleLeaderCID.UniqueProcess)); @@ -200,8 +198,8 @@ GetScreenBufferSizeUnits(IN PCONSOLE_SCREEN_BUFFER Buffer, } static VOID -GuiConsoleAppendMenuItems(HMENU hMenu, - const GUICONSOLE_MENUITEM *Items) +AppendMenuItems(HMENU hMenu, + const GUICONSOLE_MENUITEM *Items) { UINT i = 0; WCHAR szMenuString[255]; @@ -221,8 +219,7 @@ GuiConsoleAppendMenuItems(HMENU hMenu, hSubMenu = CreatePopupMenu(); if (hSubMenu != NULL) { - GuiConsoleAppendMenuItems(hSubMenu, - Items[i].SubMenu); + AppendMenuItems(hSubMenu, Items[i].SubMenu); if (!AppendMenuW(hMenu, MF_STRING | MF_POPUP, @@ -254,50 +251,102 @@ GuiConsoleAppendMenuItems(HMENU hMenu, } static VOID -GuiConsoleCreateSysMenu(HWND hWnd) +CreateSysMenu(HWND hWnd) { HMENU hMenu = GetSystemMenu(hWnd, FALSE); if (hMenu != NULL) { - GuiConsoleAppendMenuItems(hMenu, GuiConsoleMainMenuItems); + AppendMenuItems(hMenu, GuiConsoleMainMenuItems); DrawMenuBar(hWnd); } } static VOID -GuiSendMenuEvent(PCONSOLE Console, UINT CmdId) +SendMenuEvent(PCONSOLE Console, UINT CmdId) { INPUT_RECORD er; + DPRINT1("Menu item ID: %d\n", CmdId); + + if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return; + er.EventType = MENU_EVENT; er.Event.MenuEvent.dwCommandId = CmdId; - - DPRINT("Menu item ID: %d\n", CmdId); ConioProcessInputEvent(Console, &er); + + LeaveCriticalSection(&Console->Lock); } static VOID -GuiConsoleCopy(PGUI_CONSOLE_DATA GuiData); +Copy(PGUI_CONSOLE_DATA GuiData); static VOID -GuiConsolePaste(PGUI_CONSOLE_DATA GuiData); +Paste(PGUI_CONSOLE_DATA GuiData); static VOID -GuiConsoleUpdateSelection(PCONSOLE Console, PCOORD coord); +UpdateSelection(PGUI_CONSOLE_DATA GuiData, PCOORD coord); + static VOID -GuiConsoleResizeWindow(PGUI_CONSOLE_DATA GuiData, DWORD WidthUnit, DWORD HeightUnit); +Mark(PGUI_CONSOLE_DATA GuiData) +{ + PCONSOLE_SCREEN_BUFFER ActiveBuffer = GuiData->ActiveBuffer; + + /* Clear the old selection */ + // UpdateSelection(GuiData, NULL); + GuiData->Selection.dwFlags = CONSOLE_NO_SELECTION; + + /* Restart a new selection */ + GuiData->dwSelectionCursor.X = ActiveBuffer->ViewOrigin.X; + GuiData->dwSelectionCursor.Y = ActiveBuffer->ViewOrigin.Y; + GuiData->Selection.dwSelectionAnchor = GuiData->dwSelectionCursor; + UpdateSelection(GuiData, &GuiData->Selection.dwSelectionAnchor); +} + +static VOID +SelectAll(PGUI_CONSOLE_DATA GuiData) +{ + PCONSOLE_SCREEN_BUFFER ActiveBuffer = GuiData->ActiveBuffer; + + /* Clear the old selection */ + // UpdateSelection(GuiData, NULL); + GuiData->Selection.dwFlags = CONSOLE_NO_SELECTION; + + /* + * The selection area extends to the whole screen buffer's width. + */ + GuiData->Selection.dwSelectionAnchor.X = 0; + GuiData->Selection.dwSelectionAnchor.Y = 0; + GuiData->dwSelectionCursor.X = ActiveBuffer->ScreenBufferSize.X - 1; + + /* + * Determine whether the selection must extend to just some part + * (for text-mode screen buffers) or to all of the screen buffer's + * height (for graphics ones). + */ + if (GetType(ActiveBuffer) == TEXTMODE_BUFFER) + { + /* + * We select all the characters from the first line + * to the line where the cursor is positioned. + */ + GuiData->dwSelectionCursor.Y = ActiveBuffer->CursorPosition.Y; + } + else /* if (GetType(ActiveBuffer) == GRAPHICS_BUFFER) */ + { + /* + * We select all the screen buffer area. + */ + GuiData->dwSelectionCursor.Y = ActiveBuffer->ScreenBufferSize.Y - 1; + } + + /* Restart a new selection */ + GuiData->Selection.dwFlags |= CONSOLE_MOUSE_SELECTION; + UpdateSelection(GuiData, &GuiData->dwSelectionCursor); +} static LRESULT -GuiConsoleHandleSysMenuCommand(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM lParam) +OnCommand(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM lParam) { LRESULT Ret = TRUE; PCONSOLE Console = GuiData->Console; - PCONSOLE_SCREEN_BUFFER ActiveBuffer; - - if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) - { - Ret = FALSE; - goto Quit; - } - ActiveBuffer = GuiData->ActiveBuffer; /* * In case the selected menu item belongs to the user-reserved menu id range, @@ -306,76 +355,28 @@ GuiConsoleHandleSysMenuCommand(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM */ if (GuiData->CmdIdLow <= (UINT)wParam && (UINT)wParam <= GuiData->CmdIdHigh) { - GuiSendMenuEvent(Console, (UINT)wParam); - goto Unlock_Quit; + SendMenuEvent(Console, (UINT)wParam); + goto Quit; } /* ... otherwise, perform actions. */ switch (wParam) { case ID_SYSTEM_EDIT_MARK: - { - /* Clear the old selection */ - // GuiConsoleUpdateSelection(Console, NULL); - Console->Selection.dwFlags = CONSOLE_NO_SELECTION; - - /* Restart a new selection */ - Console->dwSelectionCursor.X = ActiveBuffer->ViewOrigin.X; - Console->dwSelectionCursor.Y = ActiveBuffer->ViewOrigin.Y; - Console->Selection.dwSelectionAnchor = Console->dwSelectionCursor; - GuiConsoleUpdateSelection(Console, &Console->Selection.dwSelectionAnchor); - + Mark(GuiData); break; - } case ID_SYSTEM_EDIT_COPY: - GuiConsoleCopy(GuiData); + Copy(GuiData); break; case ID_SYSTEM_EDIT_PASTE: - GuiConsolePaste(GuiData); + Paste(GuiData); break; case ID_SYSTEM_EDIT_SELECTALL: - { - /* Clear the old selection */ - // GuiConsoleUpdateSelection(Console, NULL); - Console->Selection.dwFlags = CONSOLE_NO_SELECTION; - - /* - * The selection area extends to the whole screen buffer's width. - */ - Console->Selection.dwSelectionAnchor.X = 0; - Console->Selection.dwSelectionAnchor.Y = 0; - Console->dwSelectionCursor.X = ActiveBuffer->ScreenBufferSize.X - 1; - - /* - * Determine whether the selection must extend to just some part - * (for text-mode screen buffers) or to all of the screen buffer's - * height (for graphics ones). - */ - if (GetType(ActiveBuffer) == TEXTMODE_BUFFER) - { - /* - * We select all the characters from the first line - * to the line where the cursor is positioned. - */ - Console->dwSelectionCursor.Y = ActiveBuffer->CursorPosition.Y; - } - else /* if (GetType(ActiveBuffer) == GRAPHICS_BUFFER) */ - { - /* - * We select all the screen buffer area. - */ - Console->dwSelectionCursor.Y = ActiveBuffer->ScreenBufferSize.Y - 1; - } - - /* Restart a new selection */ - Console->Selection.dwFlags |= CONSOLE_MOUSE_SELECTION; - GuiConsoleUpdateSelection(Console, &Console->dwSelectionCursor); - + SelectAll(GuiData); break; - } case ID_SYSTEM_EDIT_SCROLL: DPRINT1("Scrolling is not handled yet\n"); @@ -398,8 +399,6 @@ GuiConsoleHandleSysMenuCommand(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM break; } -Unlock_Quit: - LeaveCriticalSection(&Console->Lock); Quit: if (!Ret) Ret = DefWindowProcW(GuiData->hWindow, WM_SYSCOMMAND, wParam, lParam); @@ -416,7 +415,7 @@ GuiGetGuiData(HWND hWnd) } static VOID -GuiConsoleResizeWindow(PGUI_CONSOLE_DATA GuiData, DWORD WidthUnit, DWORD HeightUnit) +ResizeConWnd(PGUI_CONSOLE_DATA GuiData, DWORD WidthUnit, DWORD HeightUnit) { PCONSOLE_SCREEN_BUFFER Buff = GuiData->ActiveBuffer; SCROLLINFO sInfo; @@ -468,7 +467,7 @@ GuiConsoleResizeWindow(PGUI_CONSOLE_DATA GuiData, DWORD WidthUnit, DWORD HeightU } static BOOL -GuiConsoleHandleNcCreate(HWND hWnd, LPCREATESTRUCTW Create) +OnNcCreate(HWND hWnd, LPCREATESTRUCTW Create) { PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA)Create->lpCreateParams; PCONSOLE Console; @@ -477,8 +476,6 @@ GuiConsoleHandleNcCreate(HWND hWnd, LPCREATESTRUCTW Create) TEXTMETRICW Metrics; SIZE CharSize; - DPRINT("GuiConsoleHandleNcCreate\n"); - if (NULL == GuiData) { DPRINT1("GuiConsoleNcCreate: No GUI data\n"); @@ -556,6 +553,13 @@ GuiConsoleHandleNcCreate(HWND hWnd, LPCREATESTRUCTW Create) GuiData->hBitmap = NULL; GuiData->hSysPalette = NULL; /* Original system palette */ + /* Update the icons of the window */ + if (GuiData->hIcon != ghDefaultIcon) + { + DefWindowProcW(GuiData->hWindow, WM_SETICON, ICON_BIG , (LPARAM)GuiData->hIcon ); + DefWindowProcW(GuiData->hWindow, WM_SETICON, ICON_SMALL, (LPARAM)GuiData->hIconSm); + } + // FIXME: Keep these instructions here ? /////////////////////////////////// Console->ActiveBuffer->CursorBlinkOn = TRUE; Console->ActiveBuffer->ForceCursorOff = FALSE; @@ -564,14 +568,83 @@ GuiConsoleHandleNcCreate(HWND hWnd, LPCREATESTRUCTW Create) SetWindowLongPtrW(GuiData->hWindow, GWLP_USERDATA, (DWORD_PTR)GuiData); SetTimer(GuiData->hWindow, CONGUI_UPDATE_TIMER, CONGUI_UPDATE_TIME, NULL); - GuiConsoleCreateSysMenu(GuiData->hWindow); + CreateSysMenu(GuiData->hWindow); - DPRINT("GuiConsoleHandleNcCreate - setting start event\n"); + DPRINT("OnNcCreate - setting start event\n"); SetEvent(GuiData->hGuiInitEvent); return (BOOL)DefWindowProcW(GuiData->hWindow, WM_NCCREATE, 0, (LPARAM)Create); } + +BOOL +EnterFullScreen(PGUI_CONSOLE_DATA GuiData); +VOID +LeaveFullScreen(PGUI_CONSOLE_DATA GuiData); +VOID +SwitchFullScreen(PGUI_CONSOLE_DATA GuiData, BOOL FullScreen); +VOID +GuiConsoleSwitchFullScreen(PGUI_CONSOLE_DATA GuiData); + +static VOID +OnActivate(PGUI_CONSOLE_DATA GuiData, WPARAM wParam) +{ + PCONSOLE Console = GuiData->Console; + WORD ActivationState = LOWORD(wParam); + + DPRINT1("WM_ACTIVATE - ActivationState = %d\n"); + + if ( ActivationState == WA_ACTIVE || + ActivationState == WA_CLICKACTIVE ) + { + if (GuiData->GuiInfo.FullScreen) + { + EnterFullScreen(GuiData); + // // PostMessageW(GuiData->hWindow, WM_SYSCOMMAND, SC_RESTORE, 0); + // SendMessageW(GuiData->hWindow, WM_SYSCOMMAND, SC_RESTORE, 0); + } + } + else // if (ActivationState == WA_INACTIVE) + { + if (GuiData->GuiInfo.FullScreen) + { + SendMessageW(GuiData->hWindow, WM_SYSCOMMAND, SC_MINIMIZE, 0); + LeaveFullScreen(GuiData); + // // PostMessageW(GuiData->hWindow, WM_SYSCOMMAND, SC_MINIMIZE, 0); + // SendMessageW(GuiData->hWindow, WM_SYSCOMMAND, SC_MINIMIZE, 0); + } + } + + /* + * When we are in QuickEdit mode, ignore the next mouse signal + * when we are going to be enabled again via the mouse, in order + * to prevent e.g. an erroneous right-click from the user which + * would have as an effect to paste some unwanted text... + */ + if (Console->QuickEdit && (ActivationState == WA_CLICKACTIVE)) + GuiData->IgnoreNextMouseSignal = TRUE; +} + +static VOID +OnFocus(PGUI_CONSOLE_DATA GuiData, BOOL SetFocus) +{ + PCONSOLE Console = GuiData->Console; + INPUT_RECORD er; + + if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return; + + er.EventType = FOCUS_EVENT; + er.Event.FocusEvent.bSetFocus = SetFocus; + ConioProcessInputEvent(Console, &er); + + LeaveCriticalSection(&Console->Lock); + + if (SetFocus) + DPRINT1("TODO: Create console caret\n"); + else + DPRINT1("TODO: Destroy console caret\n"); +} + static VOID SmallRectToRect(PGUI_CONSOLE_DATA GuiData, PRECT Rect, PSMALL_RECT SmallRect) { @@ -587,12 +660,12 @@ SmallRectToRect(PGUI_CONSOLE_DATA GuiData, PRECT Rect, PSMALL_RECT SmallRect) } static VOID -GuiConsoleUpdateSelection(PCONSOLE Console, PCOORD coord) +UpdateSelection(PGUI_CONSOLE_DATA GuiData, PCOORD coord) { - PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data; + PCONSOLE Console = GuiData->Console; RECT oldRect; - SmallRectToRect(GuiData, &oldRect, &Console->Selection.srSelection); + SmallRectToRect(GuiData, &oldRect, &GuiData->Selection.srSelection); if (coord != NULL) { @@ -600,16 +673,16 @@ GuiConsoleUpdateSelection(PCONSOLE Console, PCOORD coord) SMALL_RECT rc; /* Exchange left/top with right/bottom if required */ - rc.Left = min(Console->Selection.dwSelectionAnchor.X, coord->X); - rc.Top = min(Console->Selection.dwSelectionAnchor.Y, coord->Y); - rc.Right = max(Console->Selection.dwSelectionAnchor.X, coord->X); - rc.Bottom = max(Console->Selection.dwSelectionAnchor.Y, coord->Y); + rc.Left = min(GuiData->Selection.dwSelectionAnchor.X, coord->X); + rc.Top = min(GuiData->Selection.dwSelectionAnchor.Y, coord->Y); + rc.Right = max(GuiData->Selection.dwSelectionAnchor.X, coord->X); + rc.Bottom = max(GuiData->Selection.dwSelectionAnchor.Y, coord->Y); SmallRectToRect(GuiData, &newRect, &rc); - if (Console->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY) + if (GuiData->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY) { - if (memcmp(&rc, &Console->Selection.srSelection, sizeof(SMALL_RECT)) != 0) + if (memcmp(&rc, &GuiData->Selection.srSelection, sizeof(SMALL_RECT)) != 0) { HRGN rgn1, rgn2; @@ -633,22 +706,22 @@ GuiConsoleUpdateSelection(PCONSOLE Console, PCOORD coord) InvalidateRect(GuiData->hWindow, &newRect, FALSE); } - Console->Selection.dwFlags |= CONSOLE_SELECTION_NOT_EMPTY; - Console->Selection.srSelection = rc; - Console->dwSelectionCursor = *coord; + GuiData->Selection.dwFlags |= CONSOLE_SELECTION_NOT_EMPTY; + GuiData->Selection.srSelection = rc; + GuiData->dwSelectionCursor = *coord; - if ((Console->Selection.dwFlags & CONSOLE_SELECTION_IN_PROGRESS) == 0) + if ((GuiData->Selection.dwFlags & CONSOLE_SELECTION_IN_PROGRESS) == 0) { LPWSTR SelectionType, WindowTitle = NULL; SIZE_T Length = 0; /* Clear the old selection */ - if (Console->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY) + if (GuiData->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY) { InvalidateRect(GuiData->hWindow, &oldRect, FALSE); } - if (Console->Selection.dwFlags & CONSOLE_MOUSE_SELECTION) + if (GuiData->Selection.dwFlags & CONSOLE_MOUSE_SELECTION) { SelectionType = L"Selection - "; } @@ -664,19 +737,19 @@ GuiConsoleUpdateSelection(PCONSOLE Console, PCOORD coord) SetWindowText(GuiData->hWindow, WindowTitle); ConsoleFreeHeap(WindowTitle); - Console->Selection.dwFlags |= CONSOLE_SELECTION_IN_PROGRESS; + GuiData->Selection.dwFlags |= CONSOLE_SELECTION_IN_PROGRESS; ConioPause(Console, PAUSED_FROM_SELECTION); } } else { /* Clear the selection */ - if (Console->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY) + if (GuiData->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY) { InvalidateRect(GuiData->hWindow, &oldRect, FALSE); } - Console->Selection.dwFlags = CONSOLE_NO_SELECTION; + GuiData->Selection.dwFlags = CONSOLE_NO_SELECTION; ConioUnpause(Console, PAUSED_FROM_SELECTION); SetWindowText(GuiData->hWindow, Console->Title.Buffer); @@ -696,19 +769,12 @@ GuiPaintGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer, PRECT rcFramebuffer); static VOID -GuiConsoleHandlePaint(PGUI_CONSOLE_DATA GuiData) +OnPaint(PGUI_CONSOLE_DATA GuiData) { - BOOL Success = TRUE; - PCONSOLE Console = GuiData->Console; PCONSOLE_SCREEN_BUFFER ActiveBuffer; PAINTSTRUCT ps; RECT rcPaint; - if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) - { - Success = FALSE; - goto Quit; - } ActiveBuffer = GuiData->ActiveBuffer; BeginPaint(GuiData->hWindow, &ps); @@ -741,9 +807,9 @@ GuiConsoleHandlePaint(PGUI_CONSOLE_DATA GuiData) rcPaint.top, SRCCOPY); - if (Console->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY) + if (GuiData->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY) { - SmallRectToRect(GuiData, &rcPaint, &Console->Selection.srSelection); + SmallRectToRect(GuiData, &rcPaint, &GuiData->Selection.srSelection); /* Invert the selection */ if (IntersectRect(&rcPaint, &ps.rcPaint, &rcPaint)) @@ -756,15 +822,30 @@ GuiConsoleHandlePaint(PGUI_CONSOLE_DATA GuiData) } EndPaint(GuiData->hWindow, &ps); -Quit: - if (Success) - LeaveCriticalSection(&Console->Lock); - else - DefWindowProcW(GuiData->hWindow, WM_PAINT, 0, 0); - return; } +static VOID +OnPaletteChanged(PGUI_CONSOLE_DATA GuiData) +{ + PCONSOLE_SCREEN_BUFFER ActiveBuffer = GuiData->ActiveBuffer; + + // See WM_PALETTECHANGED message + // if ((HWND)wParam == hWnd) break; + + // if (GetType(ActiveBuffer) == GRAPHICS_BUFFER) + if (ActiveBuffer->PaletteHandle) + { + DPRINT("WM_PALETTECHANGED changing palette\n"); + + /* Specify the use of the system palette for the framebuffer */ + SetSystemPaletteUse(GuiData->hMemDC, ActiveBuffer->PaletteUsage); + + /* Realize the (logical) palette */ + RealizePalette(GuiData->hMemDC); + } +} + static BOOL IsSystemKey(WORD VirtualKeyCode) { @@ -789,7 +870,7 @@ IsSystemKey(WORD VirtualKeyCode) } static VOID -GuiConsoleHandleKey(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM lParam) +OnKey(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM lParam) { PCONSOLE Console = GuiData->Console; PCONSOLE_SCREEN_BUFFER ActiveBuffer; @@ -798,7 +879,7 @@ GuiConsoleHandleKey(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM l ActiveBuffer = GuiData->ActiveBuffer; - if (Console->Selection.dwFlags & CONSOLE_SELECTION_IN_PROGRESS) + if (GuiData->Selection.dwFlags & CONSOLE_SELECTION_IN_PROGRESS) { WORD VirtualKeyCode = LOWORD(wParam); @@ -807,18 +888,18 @@ GuiConsoleHandleKey(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM l if (VirtualKeyCode == VK_RETURN) { /* Copy (and clear) selection if ENTER is pressed */ - GuiConsoleCopy(GuiData); + Copy(GuiData); goto Quit; } else if ( VirtualKeyCode == VK_ESCAPE || (VirtualKeyCode == 'C' && GetKeyState(VK_CONTROL) & 0x8000) ) { /* Cancel selection if ESC or Ctrl-C are pressed */ - GuiConsoleUpdateSelection(Console, NULL); + UpdateSelection(GuiData, NULL); goto Quit; } - if ((Console->Selection.dwFlags & CONSOLE_MOUSE_SELECTION) == 0) + if ((GuiData->Selection.dwFlags & CONSOLE_MOUSE_SELECTION) == 0) { /* Keyboard selection mode */ BOOL Interpreted = FALSE; @@ -829,8 +910,8 @@ GuiConsoleHandleKey(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM l case VK_LEFT: { Interpreted = TRUE; - if (Console->dwSelectionCursor.X > 0) - Console->dwSelectionCursor.X--; + if (GuiData->dwSelectionCursor.X > 0) + GuiData->dwSelectionCursor.X--; break; } @@ -838,8 +919,8 @@ GuiConsoleHandleKey(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM l case VK_RIGHT: { Interpreted = TRUE; - if (Console->dwSelectionCursor.X < ActiveBuffer->ScreenBufferSize.X - 1) - Console->dwSelectionCursor.X++; + if (GuiData->dwSelectionCursor.X < ActiveBuffer->ScreenBufferSize.X - 1) + GuiData->dwSelectionCursor.X++; break; } @@ -847,8 +928,8 @@ GuiConsoleHandleKey(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM l case VK_UP: { Interpreted = TRUE; - if (Console->dwSelectionCursor.Y > 0) - Console->dwSelectionCursor.Y--; + if (GuiData->dwSelectionCursor.Y > 0) + GuiData->dwSelectionCursor.Y--; break; } @@ -856,8 +937,8 @@ GuiConsoleHandleKey(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM l case VK_DOWN: { Interpreted = TRUE; - if (Console->dwSelectionCursor.Y < ActiveBuffer->ScreenBufferSize.Y - 1) - Console->dwSelectionCursor.Y++; + if (GuiData->dwSelectionCursor.Y < ActiveBuffer->ScreenBufferSize.Y - 1) + GuiData->dwSelectionCursor.Y++; break; } @@ -865,24 +946,24 @@ GuiConsoleHandleKey(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM l case VK_HOME: { Interpreted = TRUE; - Console->dwSelectionCursor.X = 0; - Console->dwSelectionCursor.Y = 0; + GuiData->dwSelectionCursor.X = 0; + GuiData->dwSelectionCursor.Y = 0; break; } case VK_END: { Interpreted = TRUE; - Console->dwSelectionCursor.Y = ActiveBuffer->ScreenBufferSize.Y - 1; + GuiData->dwSelectionCursor.Y = ActiveBuffer->ScreenBufferSize.Y - 1; break; } case VK_PRIOR: { Interpreted = TRUE; - Console->dwSelectionCursor.Y -= ActiveBuffer->ViewSize.Y; - if (Console->dwSelectionCursor.Y < 0) - Console->dwSelectionCursor.Y = 0; + GuiData->dwSelectionCursor.Y -= ActiveBuffer->ViewSize.Y; + if (GuiData->dwSelectionCursor.Y < 0) + GuiData->dwSelectionCursor.Y = 0; break; } @@ -890,9 +971,9 @@ GuiConsoleHandleKey(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM l case VK_NEXT: { Interpreted = TRUE; - Console->dwSelectionCursor.Y += ActiveBuffer->ViewSize.Y; - if (Console->dwSelectionCursor.Y >= ActiveBuffer->ScreenBufferSize.Y) - Console->dwSelectionCursor.Y = ActiveBuffer->ScreenBufferSize.Y - 1; + GuiData->dwSelectionCursor.Y += ActiveBuffer->ViewSize.Y; + if (GuiData->dwSelectionCursor.Y >= ActiveBuffer->ScreenBufferSize.Y) + GuiData->dwSelectionCursor.Y = ActiveBuffer->ScreenBufferSize.Y - 1; break; } @@ -904,9 +985,9 @@ GuiConsoleHandleKey(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM l if (Interpreted) { if (!MajPressed) - Console->Selection.dwSelectionAnchor = Console->dwSelectionCursor; + GuiData->Selection.dwSelectionAnchor = GuiData->dwSelectionCursor; - GuiConsoleUpdateSelection(Console, &Console->dwSelectionCursor); + UpdateSelection(GuiData, &GuiData->dwSelectionCursor); } else if (!IsSystemKey(VirtualKeyCode)) { @@ -923,7 +1004,7 @@ GuiConsoleHandleKey(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM l if (!IsSystemKey(VirtualKeyCode)) { /* Clear the selection and send the key into the input buffer */ - GuiConsoleUpdateSelection(Console, NULL); + UpdateSelection(GuiData, NULL); } else { @@ -932,7 +1013,7 @@ GuiConsoleHandleKey(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM l } } - if ((Console->Selection.dwFlags & CONSOLE_SELECTION_IN_PROGRESS) == 0) + if ((GuiData->Selection.dwFlags & CONSOLE_SELECTION_IN_PROGRESS) == 0) { MSG Message; @@ -949,12 +1030,13 @@ Quit: } -// FIXME: Remove after fixing GuiConsoleHandleTimer +// FIXME: Remove after fixing OnTimer VOID -GuiInvalidateCell(IN OUT PFRONTEND This, SHORT x, SHORT y); +InvalidateCell(PGUI_CONSOLE_DATA GuiData, + SHORT x, SHORT y); static VOID -GuiConsoleHandleTimer(PGUI_CONSOLE_DATA GuiData) +OnTimer(PGUI_CONSOLE_DATA GuiData) { PCONSOLE Console = GuiData->Console; PCONSOLE_SCREEN_BUFFER Buff; @@ -967,7 +1049,7 @@ GuiConsoleHandleTimer(PGUI_CONSOLE_DATA GuiData) if (GetType(Buff) == TEXTMODE_BUFFER) { - GuiInvalidateCell(&Console->TermIFace, Buff->CursorPosition.X, Buff->CursorPosition.Y); + InvalidateCell(GuiData, Buff->CursorPosition.X, Buff->CursorPosition.Y); Buff->CursorBlinkOn = !Buff->CursorBlinkOn; if ((GuiData->OldCursor.x != Buff->CursorPosition.X) || @@ -1059,7 +1141,7 @@ GuiConsoleHandleTimer(PGUI_CONSOLE_DATA GuiData) } static BOOL -GuiConsoleHandleClose(PGUI_CONSOLE_DATA GuiData) +OnClose(PGUI_CONSOLE_DATA GuiData) { PCONSOLE Console = GuiData->Console; @@ -1080,7 +1162,7 @@ GuiConsoleHandleClose(PGUI_CONSOLE_DATA GuiData) } static LRESULT -GuiConsoleHandleNcDestroy(HWND hWnd) +OnNcDestroy(HWND hWnd) { PGUI_CONSOLE_DATA GuiData = GuiGetGuiData(hWnd); @@ -1129,7 +1211,7 @@ PointToCoord(PGUI_CONSOLE_DATA GuiData, LPARAM lParam) } static LRESULT -GuiConsoleHandleMouse(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM lParam) +OnMouse(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM lParam) { BOOL Err = FALSE; PCONSOLE Console = GuiData->Console; @@ -1164,7 +1246,7 @@ GuiConsoleHandleMouse(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM goto Quit; } - if ( (Console->Selection.dwFlags & CONSOLE_SELECTION_IN_PROGRESS) || + if ( (GuiData->Selection.dwFlags & CONSOLE_SELECTION_IN_PROGRESS) || (Console->QuickEdit) ) { switch (msg) @@ -1172,14 +1254,14 @@ GuiConsoleHandleMouse(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM case WM_LBUTTONDOWN: { /* Clear the old selection */ - // GuiConsoleUpdateSelection(Console, NULL); - Console->Selection.dwFlags = CONSOLE_NO_SELECTION; + // UpdateSelection(GuiData, NULL); + GuiData->Selection.dwFlags = CONSOLE_NO_SELECTION; /* Restart a new selection */ - Console->Selection.dwSelectionAnchor = PointToCoord(GuiData, lParam); + GuiData->Selection.dwSelectionAnchor = PointToCoord(GuiData, lParam); SetCapture(GuiData->hWindow); - Console->Selection.dwFlags |= CONSOLE_MOUSE_SELECTION | CONSOLE_MOUSE_DOWN; - GuiConsoleUpdateSelection(Console, &Console->Selection.dwSelectionAnchor); + GuiData->Selection.dwFlags |= CONSOLE_MOUSE_SELECTION | CONSOLE_MOUSE_DOWN; + UpdateSelection(GuiData, &GuiData->Selection.dwSelectionAnchor); break; } @@ -1188,11 +1270,11 @@ GuiConsoleHandleMouse(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM { // COORD c; - if (!(Console->Selection.dwFlags & CONSOLE_MOUSE_DOWN)) break; + if (!(GuiData->Selection.dwFlags & CONSOLE_MOUSE_DOWN)) break; // c = PointToCoord(GuiData, lParam); - Console->Selection.dwFlags &= ~CONSOLE_MOUSE_DOWN; - // GuiConsoleUpdateSelection(Console, &c); + GuiData->Selection.dwFlags &= ~CONSOLE_MOUSE_DOWN; + // UpdateSelection(GuiData, &c); ReleaseCapture(); break; @@ -1237,11 +1319,11 @@ GuiConsoleHandleMouse(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM * Update the selection started with the single * left-click that preceded this double-click. */ - Console->Selection.dwSelectionAnchor = cL; - Console->dwSelectionCursor = cR; + GuiData->Selection.dwSelectionAnchor = cL; + GuiData->dwSelectionCursor = cR; - Console->Selection.dwFlags |= CONSOLE_MOUSE_SELECTION | CONSOLE_MOUSE_DOWN; - GuiConsoleUpdateSelection(Console, &Console->dwSelectionCursor); + GuiData->Selection.dwFlags |= CONSOLE_MOUSE_SELECTION | CONSOLE_MOUSE_DOWN; + UpdateSelection(GuiData, &GuiData->dwSelectionCursor); /* Ignore the next mouse move signal */ GuiData->IgnoreNextMouseSignal = TRUE; @@ -1253,13 +1335,13 @@ GuiConsoleHandleMouse(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK: { - if (!(Console->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY)) + if (!(GuiData->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY)) { - GuiConsolePaste(GuiData); + Paste(GuiData); } else { - GuiConsoleCopy(GuiData); + Copy(GuiData); } /* Ignore the next mouse move signal */ @@ -1272,10 +1354,10 @@ GuiConsoleHandleMouse(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM COORD c; if (!(wParam & MK_LBUTTON)) break; - if (!(Console->Selection.dwFlags & CONSOLE_MOUSE_DOWN)) break; + if (!(GuiData->Selection.dwFlags & CONSOLE_MOUSE_DOWN)) break; c = PointToCoord(GuiData, lParam); /* TODO: Scroll buffer to bring c into view */ - GuiConsoleUpdateSelection(Console, &c); + UpdateSelection(GuiData, &c); break; } @@ -1426,10 +1508,8 @@ GuiCopyFromGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer, PGUI_CONSOLE_DATA GuiData); static VOID -GuiConsoleCopy(PGUI_CONSOLE_DATA GuiData) +Copy(PGUI_CONSOLE_DATA GuiData) { - PCONSOLE Console = GuiData->Console; - if (OpenClipboard(GuiData->hWindow) == TRUE) { PCONSOLE_SCREEN_BUFFER Buffer = GuiData->ActiveBuffer; @@ -1447,7 +1527,7 @@ GuiConsoleCopy(PGUI_CONSOLE_DATA GuiData) } /* Clear the selection */ - GuiConsoleUpdateSelection(Console, NULL); + UpdateSelection(GuiData, NULL); } VOID @@ -1458,7 +1538,7 @@ GuiPasteToGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer, PGUI_CONSOLE_DATA GuiData); static VOID -GuiConsolePaste(PGUI_CONSOLE_DATA GuiData) +Paste(PGUI_CONSOLE_DATA GuiData) { if (OpenClipboard(GuiData->hWindow) == TRUE) { @@ -1478,7 +1558,7 @@ GuiConsolePaste(PGUI_CONSOLE_DATA GuiData) } static VOID -GuiConsoleGetMinMaxInfo(PGUI_CONSOLE_DATA GuiData, PMINMAXINFO minMaxInfo) +OnGetMinMaxInfo(PGUI_CONSOLE_DATA GuiData, PMINMAXINFO minMaxInfo) { PCONSOLE Console = GuiData->Console; PCONSOLE_SCREEN_BUFFER ActiveBuffer; @@ -1510,7 +1590,7 @@ GuiConsoleGetMinMaxInfo(PGUI_CONSOLE_DATA GuiData, PMINMAXINFO minMaxInfo) } static VOID -GuiConsoleResize(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM lParam) +OnSize(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM lParam) { PCONSOLE Console = GuiData->Console; @@ -1559,7 +1639,7 @@ GuiConsoleResize(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM lParam) Buff->ViewSize.Y = (chary <= Buff->ScreenBufferSize.Y) ? chary : Buff->ScreenBufferSize.Y; } - GuiConsoleResizeWindow(GuiData, WidthUnit, HeightUnit); + ResizeConWnd(GuiData, WidthUnit, HeightUnit); // Adjust the start of the visible area if we are attempting to show nonexistent areas if ((Buff->ScreenBufferSize.X - Buff->ViewOrigin.X) < Buff->ViewSize.X) Buff->ViewOrigin.X = Buff->ScreenBufferSize.X - Buff->ViewSize.X; @@ -1572,6 +1652,20 @@ GuiConsoleResize(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM lParam) LeaveCriticalSection(&Console->Lock); } +static VOID +OnMove(PGUI_CONSOLE_DATA GuiData) +{ + RECT rcWnd; + + // TODO: Simplify the code. + // See: GuiConsoleNotifyWndProc() PM_CREATE_CONSOLE. + + /* Retrieve our real position */ + GetWindowRect(GuiData->hWindow, &rcWnd); + GuiData->GuiInfo.WindowOrigin.x = rcWnd.left; + GuiData->GuiInfo.WindowOrigin.y = rcWnd.top; +} + /* // HACK: This functionality is standard for general scrollbars. Don't add it by hand. @@ -1602,7 +1696,7 @@ GuiConsoleHandleScrollbarMenu(VOID) */ static LRESULT -GuiConsoleHandleScroll(PGUI_CONSOLE_DATA GuiData, UINT uMsg, WPARAM wParam) +OnScroll(PGUI_CONSOLE_DATA GuiData, UINT uMsg, WPARAM wParam) { PCONSOLE Console = GuiData->Console; PCONSOLE_SCREEN_BUFFER Buff; @@ -1710,15 +1804,6 @@ Quit: } -BOOL -EnterFullScreen(PGUI_CONSOLE_DATA GuiData); -VOID -LeaveFullScreen(PGUI_CONSOLE_DATA GuiData); -VOID -SwitchFullScreen(PGUI_CONSOLE_DATA GuiData, BOOL FullScreen); -VOID -GuiConsoleSwitchFullScreen(PGUI_CONSOLE_DATA GuiData); - static LRESULT CALLBACK ConWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -1734,11 +1819,11 @@ ConWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) */ if (msg == WM_NCCREATE) { - return (LRESULT)GuiConsoleHandleNcCreate(hWnd, (LPCREATESTRUCTW)lParam); + return (LRESULT)OnNcCreate(hWnd, (LPCREATESTRUCTW)lParam); } else if (msg == WM_NCDESTROY) { - return GuiConsoleHandleNcDestroy(hWnd); + return OnNcDestroy(hWnd); } /* @@ -1763,60 +1848,23 @@ ConWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) switch (msg) { case WM_ACTIVATE: - { - WORD ActivationState = LOWORD(wParam); - - DPRINT1("WM_ACTIVATE - ActivationState = %d\n"); - - if ( ActivationState == WA_ACTIVE || - ActivationState == WA_CLICKACTIVE ) - { - if (GuiData->GuiInfo.FullScreen) - { - EnterFullScreen(GuiData); - // // PostMessageW(GuiData->hWindow, WM_SYSCOMMAND, SC_RESTORE, 0); - // SendMessageW(GuiData->hWindow, WM_SYSCOMMAND, SC_RESTORE, 0); - } - } - else // if (ActivationState == WA_INACTIVE) - { - if (GuiData->GuiInfo.FullScreen) - { - SendMessageW(GuiData->hWindow, WM_SYSCOMMAND, SC_MINIMIZE, 0); - LeaveFullScreen(GuiData); - // // PostMessageW(GuiData->hWindow, WM_SYSCOMMAND, SC_MINIMIZE, 0); - // SendMessageW(GuiData->hWindow, WM_SYSCOMMAND, SC_MINIMIZE, 0); - } - } - - /* - * When we are in QuickEdit mode, ignore the next mouse signal - * when we are going to be enabled again via the mouse, in order - * to prevent e.g. an erroneous right-click from the user which - * would have as an effect to paste some unwanted text... - */ - if (Console->QuickEdit && (ActivationState == WA_CLICKACTIVE)) - GuiData->IgnoreNextMouseSignal = TRUE; - + OnActivate(GuiData, wParam); break; - } case WM_CLOSE: - if (GuiConsoleHandleClose(GuiData)) goto Default; + if (OnClose(GuiData)) goto Default; break; case WM_PAINT: - GuiConsoleHandlePaint(GuiData); + OnPaint(GuiData); break; case WM_TIMER: - GuiConsoleHandleTimer(GuiData); + OnTimer(GuiData); break; case WM_PALETTECHANGED: { - PCONSOLE_SCREEN_BUFFER ActiveBuffer = GuiData->ActiveBuffer; - DPRINT("WM_PALETTECHANGED called\n"); /* @@ -1835,21 +1883,8 @@ ConWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) if ((HWND)wParam == hWnd) break; DPRINT("WM_PALETTECHANGED ok\n"); - - // if (GetType(ActiveBuffer) == GRAPHICS_BUFFER) - if (ActiveBuffer->PaletteHandle) - { - DPRINT("WM_PALETTECHANGED changing palette\n"); - - /* Specify the use of the system palette for the framebuffer */ - SetSystemPaletteUse(GuiData->hMemDC, ActiveBuffer->PaletteUsage); - - /* Realize the (logical) palette */ - RealizePalette(GuiData->hMemDC); - } - + OnPaletteChanged(GuiData); DPRINT("WM_PALETTECHANGED quit\n"); - break; } @@ -1872,7 +1907,7 @@ ConWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) break; } - GuiConsoleHandleKey(GuiData, msg, wParam, lParam); + OnKey(GuiData, msg, wParam, lParam); break; } @@ -1937,41 +1972,17 @@ ConWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_MOUSEWHEEL: case WM_MOUSEHWHEEL: { - Result = GuiConsoleHandleMouse(GuiData, msg, wParam, lParam); + Result = OnMouse(GuiData, msg, wParam, lParam); break; } case WM_HSCROLL: case WM_VSCROLL: { - Result = GuiConsoleHandleScroll(GuiData, msg, wParam); + Result = OnScroll(GuiData, msg, wParam); break; } - case WM_NCRBUTTONDOWN: - { - DPRINT1("WM_NCRBUTTONDOWN\n"); - /* - * HACK: !! Because, when we deal with WM_RBUTTON* and we do not - * call after that DefWindowProc, on ReactOS, right-clicks on the - * (non-client) application title-bar does not display the system - * menu and does not trigger a WM_NCRBUTTONUP message too. - * See: http://git.reactos.org/?p=reactos.git;a=blob;f=reactos/win32ss/user/user32/windows/defwnd.c;hb=332bc8f482f40fd05ab510f78276576719fbfba8#l1103 - * and line 1135 too. - */ -#if 0 - if (DefWindowProcW(hWnd, WM_NCHITTEST, 0, lParam) == HTCAPTION) - { - /* Call DefWindowProcW with the WM_CONTEXTMENU message */ - msg = WM_CONTEXTMENU; - } -#endif - goto Default; - } - // case WM_NCRBUTTONUP: - // DPRINT1("WM_NCRBUTTONUP\n"); - // goto Default; - case WM_CONTEXTMENU: { if (DefWindowProcW(hWnd /*GuiData->hWindow*/, WM_NCHITTEST, 0, lParam) == HTCLIENT) @@ -1979,7 +1990,7 @@ ConWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) HMENU hMenu = CreatePopupMenu(); if (hMenu != NULL) { - GuiConsoleAppendMenuItems(hMenu, GuiConsoleEditMenuItems); + AppendMenuItems(hMenu, GuiConsoleEditMenuItems); TrackPopupMenuEx(hMenu, TPM_RIGHTBUTTON, GET_X_LPARAM(lParam), @@ -2007,20 +2018,16 @@ ConWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) /* Enable or disable the Copy and Paste items */ EnableMenuItem(hMenu, ID_SYSTEM_EDIT_COPY , MF_BYCOMMAND | - ((Console->Selection.dwFlags & CONSOLE_SELECTION_IN_PROGRESS) && - (Console->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY) ? MF_ENABLED : MF_GRAYED)); + ((GuiData->Selection.dwFlags & CONSOLE_SELECTION_IN_PROGRESS) && + (GuiData->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY) ? MF_ENABLED : MF_GRAYED)); // FIXME: Following whether the active screen buffer is text-mode // or graphics-mode, search for CF_UNICODETEXT or CF_BITMAP formats. EnableMenuItem(hMenu, ID_SYSTEM_EDIT_PASTE, MF_BYCOMMAND | - (!(Console->Selection.dwFlags & CONSOLE_SELECTION_IN_PROGRESS) && + (!(GuiData->Selection.dwFlags & CONSOLE_SELECTION_IN_PROGRESS) && IsClipboardFormatAvailable(CF_UNICODETEXT) ? MF_ENABLED : MF_GRAYED)); } - if (ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) - { - GuiSendMenuEvent(Console, WM_INITMENU); - LeaveCriticalSection(&Console->Lock); - } + SendMenuEvent(Console, WM_INITMENU); break; } @@ -2028,11 +2035,7 @@ ConWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { if (HIWORD(wParam) == 0xFFFF) // Allow all the menu flags { - if (ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) - { - GuiSendMenuEvent(Console, WM_MENUSELECT); - LeaveCriticalSection(&Console->Lock); - } + SendMenuEvent(Console, WM_MENUSELECT); } break; } @@ -2040,57 +2043,65 @@ ConWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_COMMAND: case WM_SYSCOMMAND: { - Result = GuiConsoleHandleSysMenuCommand(GuiData, wParam, lParam); + Result = OnCommand(GuiData, wParam, lParam); break; } case WM_SETFOCUS: case WM_KILLFOCUS: - { - if (ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) - { - BOOL SetFocus = (msg == WM_SETFOCUS); - INPUT_RECORD er; - - er.EventType = FOCUS_EVENT; - er.Event.FocusEvent.bSetFocus = SetFocus; - ConioProcessInputEvent(Console, &er); - - if (SetFocus) - DPRINT1("TODO: Create console caret\n"); - else - DPRINT1("TODO: Destroy console caret\n"); - - LeaveCriticalSection(&Console->Lock); - } + OnFocus(GuiData, (msg == WM_SETFOCUS)); break; - } case WM_GETMINMAXINFO: - GuiConsoleGetMinMaxInfo(GuiData, (PMINMAXINFO)lParam); + OnGetMinMaxInfo(GuiData, (PMINMAXINFO)lParam); break; case WM_MOVE: + OnMove(GuiData); + break; + +#if 0 // This code is here to prepare & control dynamic console SB resizing. + case WM_SIZING: { - if (ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) + PRECT dragRect = (PRECT)lParam; + switch (wParam) { - // TODO: Simplify the code. - // See: GuiConsoleNotifyWndProc() PM_CREATE_CONSOLE. - - RECT rcWnd; - - /* Retrieve our real position */ - GetWindowRect(GuiData->hWindow, &rcWnd); - GuiData->GuiInfo.WindowOrigin.x = rcWnd.left; - GuiData->GuiInfo.WindowOrigin.y = rcWnd.top; - - LeaveCriticalSection(&Console->Lock); + case WMSZ_LEFT: + DPRINT1("WMSZ_LEFT\n"); + break; + case WMSZ_RIGHT: + DPRINT1("WMSZ_RIGHT\n"); + break; + case WMSZ_TOP: + DPRINT1("WMSZ_TOP\n"); + break; + case WMSZ_TOPLEFT: + DPRINT1("WMSZ_TOPLEFT\n"); + break; + case WMSZ_TOPRIGHT: + DPRINT1("WMSZ_TOPRIGHT\n"); + break; + case WMSZ_BOTTOM: + DPRINT1("WMSZ_BOTTOM\n"); + break; + case WMSZ_BOTTOMLEFT: + DPRINT1("WMSZ_BOTTOMLEFT\n"); + break; + case WMSZ_BOTTOMRIGHT: + DPRINT1("WMSZ_BOTTOMRIGHT\n"); + break; + default: + DPRINT1("wParam = %d\n", wParam); + break; } + DPRINT1("dragRect = {.left = %d ; .top = %d ; .right = %d ; .bottom = %d}\n", + dragRect->left, dragRect->top, dragRect->right, dragRect->bottom); break; } +#endif case WM_SIZE: - GuiConsoleResize(GuiData, wParam, lParam); + OnSize(GuiData, wParam, lParam); break; case PM_RESIZE_TERMINAL: @@ -2120,18 +2131,14 @@ ConWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) /* Resize the window to the user's values */ GuiData->WindowSizeLock = TRUE; - GuiConsoleResizeWindow(GuiData, WidthUnit, HeightUnit); + ResizeConWnd(GuiData, WidthUnit, HeightUnit); GuiData->WindowSizeLock = FALSE; break; } case PM_APPLY_CONSOLE_INFO: { - if (ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) - { - GuiApplyUserSettings(GuiData, (HANDLE)wParam, (BOOL)lParam); - LeaveCriticalSection(&Console->Lock); - } + GuiApplyUserSettings(GuiData, (HANDLE)wParam, (BOOL)lParam); break; } diff --git a/win32ss/user/winsrv/consrv/frontends/gui/conwnd.h b/win32ss/user/winsrv/consrv/frontends/gui/conwnd.h index 87097384eb7..a6be0cf1146 100644 --- a/win32ss/user/winsrv/consrv/frontends/gui/conwnd.h +++ b/win32ss/user/winsrv/consrv/frontends/gui/conwnd.h @@ -63,6 +63,8 @@ typedef struct _GUI_CONSOLE_DATA PCONSOLE Console; /* Pointer to the owned console */ PCONSOLE_SCREEN_BUFFER ActiveBuffer; /* Pointer to the active screen buffer (then maybe the previous Console member is redundant?? Or not...) */ + CONSOLE_SELECTION_INFO Selection; /* Contains information about the selection */ + COORD dwSelectionCursor; /* Selection cursor position, most of the time different from Selection.dwSelectionAnchor */ GUI_CONSOLE_INFO GuiInfo; /* GUI terminal settings */ } GUI_CONSOLE_DATA, *PGUI_CONSOLE_DATA; diff --git a/win32ss/user/winsrv/consrv/frontends/gui/graphics.c b/win32ss/user/winsrv/consrv/frontends/gui/graphics.c index 8b2135fb24c..730ed130cb6 100644 --- a/win32ss/user/winsrv/consrv/frontends/gui/graphics.c +++ b/win32ss/user/winsrv/consrv/frontends/gui/graphics.c @@ -25,8 +25,6 @@ GuiCopyFromGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer, * This function supposes that the system clipboard was opened. */ - PCONSOLE Console = Buffer->Header.Console; - HDC hMemDC; HBITMAP hBitmapTarget, hBitmapOld; HPALETTE hPalette, hPaletteOld; @@ -34,13 +32,13 @@ GuiCopyFromGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer, if (Buffer->BitMap == NULL) return; - selWidth = Console->Selection.srSelection.Right - Console->Selection.srSelection.Left + 1; - selHeight = Console->Selection.srSelection.Bottom - Console->Selection.srSelection.Top + 1; + selWidth = GuiData->Selection.srSelection.Right - GuiData->Selection.srSelection.Left + 1; + selHeight = GuiData->Selection.srSelection.Bottom - GuiData->Selection.srSelection.Top + 1; DPRINT1("Selection is (%d|%d) to (%d|%d)\n", - Console->Selection.srSelection.Left, - Console->Selection.srSelection.Top, - Console->Selection.srSelection.Right, - Console->Selection.srSelection.Bottom); + GuiData->Selection.srSelection.Left, + GuiData->Selection.srSelection.Top, + GuiData->Selection.srSelection.Right, + GuiData->Selection.srSelection.Bottom); hMemDC = CreateCompatibleDC(GuiData->hMemDC); if (hMemDC == NULL) return; @@ -74,8 +72,8 @@ GuiCopyFromGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer, StretchDIBits(hMemDC, 0, 0, selWidth, selHeight, - Console->Selection.srSelection.Left, - Console->Selection.srSelection.Top, + GuiData->Selection.srSelection.Left, + GuiData->Selection.srSelection.Top, selWidth, selHeight, Buffer->BitMap, Buffer->BitMapInfo, @@ -87,8 +85,8 @@ GuiCopyFromGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer, 0, 0, selWidth, selHeight, /* Coordinates / size of the corresponding image portion, in the graphics screen-buffer's frame */ - Console->Selection.srSelection.Left, - Console->Selection.srSelection.Top, + GuiData->Selection.srSelection.Left, + GuiData->Selection.srSelection.Top, 0, Buffer->ScreenBufferSize.Y, // == Buffer->BitMapInfo->bmiHeader.biHeight Buffer->BitMap, @@ -128,8 +126,13 @@ GuiPaintGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer, PRECT rcView, PRECT rcFramebuffer) { + PCONSOLE Console = Buffer->Header.Console; + // ASSERT(Console == GuiData->Console); + if (Buffer->BitMap == NULL) return; + if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return; + rcFramebuffer->left = Buffer->ViewOrigin.X * 1 + rcView->left; rcFramebuffer->top = Buffer->ViewOrigin.Y * 1 + rcView->top; rcFramebuffer->right = Buffer->ViewOrigin.X * 1 + rcView->right; @@ -160,6 +163,8 @@ GuiPaintGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer, /* Release the mutex */ NtReleaseMutant(Buffer->Mutex, NULL); + + LeaveCriticalSection(&Console->Lock); } /* EOF */ diff --git a/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c b/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c index 0d64f83e604..457a6c496c6 100644 --- a/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c +++ b/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c @@ -238,6 +238,8 @@ GuiConsoleShowConsoleProperties(PGUI_CONSOLE_DATA GuiData, DPRINT("GuiConsoleShowConsoleProperties entered\n"); + if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return; + /* * Create a memory section to share with the applet, and map it. */ @@ -253,7 +255,7 @@ GuiConsoleShowConsoleProperties(PGUI_CONSOLE_DATA GuiData, if (!NT_SUCCESS(Status)) { DPRINT1("Error: Impossible to create a shared section ; Status = %lu\n", Status); - return; + goto Quit; } Status = NtMapViewOfSection(hSection, @@ -269,8 +271,7 @@ GuiConsoleShowConsoleProperties(PGUI_CONSOLE_DATA GuiData, if (!NT_SUCCESS(Status)) { DPRINT1("Error: Impossible to map the shared section ; Status = %lu\n", Status); - NtClose(hSection); - return; + goto Quit; } @@ -356,9 +357,7 @@ GuiConsoleShowConsoleProperties(PGUI_CONSOLE_DATA GuiData, NtUnmapViewOfSection(NtCurrentProcess(), pSharedInfo); /* Get the console leader process, our client */ - ProcessData = CONTAINING_RECORD(Console->ProcessList.Blink, - CONSOLE_PROCESS_DATA, - ConsoleLink); + ProcessData = ConDrvGetConsoleLeaderProcess(Console); /* Duplicate the section handle for the client */ Status = NtDuplicateObject(NtCurrentProcess(), @@ -410,11 +409,13 @@ GuiConsoleShowConsoleProperties(PGUI_CONSOLE_DATA GuiData, Quit: /* We have finished, close the section handle */ - NtClose(hSection); + if (hSection) NtClose(hSection); + + LeaveCriticalSection(&Console->Lock); return; } -NTSTATUS +VOID GuiApplyUserSettings(PGUI_CONSOLE_DATA GuiData, HANDLE hClientSection, BOOL SaveSettings) @@ -429,10 +430,10 @@ GuiApplyUserSettings(PGUI_CONSOLE_DATA GuiData, PTERMINAL_INFO TermInfo = NULL; PGUI_CONSOLE_INFO GuiInfo = NULL; + if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return; + /* Get the console leader process, our client */ - ProcessData = CONTAINING_RECORD(Console->ProcessList.Blink, - CONSOLE_PROCESS_DATA, - ConsoleLink); + ProcessData = ConDrvGetConsoleLeaderProcess(Console); /* Duplicate the section handle for ourselves */ Status = NtDuplicateObject(ProcessData->Process->ProcessHandle, @@ -443,7 +444,7 @@ GuiApplyUserSettings(PGUI_CONSOLE_DATA GuiData, if (!NT_SUCCESS(Status)) { DPRINT1("Error when mapping client handle, Status = %lu\n", Status); - return Status; + goto Quit; } /* Get a view of the shared section */ @@ -460,8 +461,7 @@ GuiApplyUserSettings(PGUI_CONSOLE_DATA GuiData, if (!NT_SUCCESS(Status)) { DPRINT1("Error when mapping view of file, Status = %lu\n", Status); - NtClose(hSection); - return Status; + goto Quit; } _SEH2_TRY @@ -534,9 +534,14 @@ GuiApplyUserSettings(PGUI_CONSOLE_DATA GuiData, Quit: /* Finally, close the section and return */ - NtUnmapViewOfSection(NtCurrentProcess(), pConInfo); - NtClose(hSection); - return Status; + if (hSection) + { + NtUnmapViewOfSection(NtCurrentProcess(), pConInfo); + NtClose(hSection); + } + + LeaveCriticalSection(&Console->Lock); + return; } /* EOF */ diff --git a/win32ss/user/winsrv/consrv/frontends/gui/guisettings.h b/win32ss/user/winsrv/consrv/frontends/gui/guisettings.h index efc8f0dd273..6681425205f 100644 --- a/win32ss/user/winsrv/consrv/frontends/gui/guisettings.h +++ b/win32ss/user/winsrv/consrv/frontends/gui/guisettings.h @@ -55,7 +55,7 @@ GuiConsoleGetDefaultSettings(IN OUT PGUI_CONSOLE_INFO TermInfo, VOID GuiConsoleShowConsoleProperties(PGUI_CONSOLE_DATA GuiData, BOOL Defaults); -NTSTATUS +VOID GuiApplyUserSettings(PGUI_CONSOLE_DATA GuiData, HANDLE hClientSection, BOOL SaveSettings); diff --git a/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c b/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c index b68ec12e55d..a38875d2618 100644 --- a/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c +++ b/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c @@ -113,14 +113,24 @@ SmallRectToRect(PGUI_CONSOLE_DATA GuiData, PRECT Rect, PSMALL_RECT SmallRect) Rect->bottom = (SmallRect->Bottom + 1 - Buffer->ViewOrigin.Y) * HeightUnit; } -static VOID NTAPI -GuiDrawRegion(IN OUT PFRONTEND This, - SMALL_RECT* Region); +static VOID +DrawRegion(PGUI_CONSOLE_DATA GuiData, + SMALL_RECT* Region) +{ + RECT RegionRect; + + SmallRectToRect(GuiData, &RegionRect, Region); + /* Do not erase the background: it speeds up redrawing and reduce flickering */ + InvalidateRect(GuiData->hWindow, &RegionRect, FALSE); + /**UpdateWindow(GuiData->hWindow);**/ +} + VOID -GuiInvalidateCell(IN OUT PFRONTEND This, SHORT x, SHORT y) +InvalidateCell(PGUI_CONSOLE_DATA GuiData, + SHORT x, SHORT y) { SMALL_RECT CellRect = { x, y, x, y }; - GuiDrawRegion(This, &CellRect); + DrawRegion(GuiData, &CellRect); } @@ -152,6 +162,8 @@ GuiConsoleNotifyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) PCONSOLE Console = GuiData->Console; RECT rcWnd; + DPRINT("PM_CREATE_CONSOLE -- creating window\n"); + NewWindow = CreateWindowExW(WS_EX_CLIENTEDGE, GUI_CONWND_CLASS, Console->Title.Buffer, @@ -172,33 +184,26 @@ GuiConsoleNotifyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) WindowCount++; SetWindowLongW(hWnd, GWL_USERDATA, WindowCount); - DPRINT("Set icons via PM_CREATE_CONSOLE\n"); - if (GuiData->hIcon == NULL) - { - DPRINT("Not really /o\\...\n"); - GuiData->hIcon = ghDefaultIcon; - GuiData->hIconSm = ghDefaultIconSm; - } - else if (GuiData->hIcon != ghDefaultIcon) - { - DPRINT("Yes \\o/\n"); - SendMessageW(GuiData->hWindow, WM_SETICON, ICON_BIG, (LPARAM)GuiData->hIcon); - SendMessageW(GuiData->hWindow, WM_SETICON, ICON_SMALL, (LPARAM)GuiData->hIconSm); - } + // + // FIXME: TODO: Move everything there into conwnd.c!OnNcCreate() + // /* Retrieve our real position */ + // See conwnd.c!OnMove() GetWindowRect(GuiData->hWindow, &rcWnd); GuiData->GuiInfo.WindowOrigin.x = rcWnd.left; GuiData->GuiInfo.WindowOrigin.y = rcWnd.top; /* Move and resize the window to the user's values */ /* CAN WE DEADLOCK ?? */ - GuiConsoleMoveWindow(GuiData); + GuiConsoleMoveWindow(GuiData); // FIXME: This MUST be done via the CreateWindowExW call. SendMessageW(GuiData->hWindow, PM_RESIZE_TERMINAL, 0, 0); /* Switch to full-screen mode if necessary */ + // FIXME: Move elsewhere, it cause misdrawings of the window. if (GuiData->GuiInfo.FullScreen) SwitchFullScreen(GuiData, TRUE); + DPRINT("PM_CREATE_CONSOLE -- showing window\n"); // ShowWindow(NewWindow, (int)wParam); ShowWindowAsync(NewWindow, (int)wParam); DPRINT("Window showed\n"); @@ -424,7 +429,7 @@ GuiInitFrontEnd(IN OUT PFRONTEND This, DPRINT1("CONSRV: Failed to create GUI_CONSOLE_DATA\n"); return STATUS_UNSUCCESSFUL; } - /* HACK */ Console->TermIFace.Data = (PVOID)GuiData; /* HACK */ + ///// /* HACK */ Console->TermIFace.Data = (PVOID)GuiData; /* HACK */ GuiData->Console = Console; GuiData->ActiveBuffer = Console->ActiveBuffer; GuiData->hWindow = NULL; @@ -509,13 +514,10 @@ GuiInitFrontEnd(IN OUT PFRONTEND This, &hIconSm, 1); DPRINT("hIcon = 0x%p ; hIconSm = 0x%p\n", hIcon, hIconSm); - if (hIcon != NULL) - { - DPRINT("Effectively set the icons\n"); - GuiData->hIcon = hIcon; - GuiData->hIconSm = hIconSm; - } + if (hIcon != NULL) GuiData->hIcon = hIcon; + if (hIconSm != NULL) GuiData->hIconSm = hIconSm; } + ASSERT(GuiData->hIcon && GuiData->hIconSm); /* Mouse is shown by default with its default cursor shape */ GuiData->hCursor = ghDefaultCursor; @@ -530,6 +532,10 @@ GuiInitFrontEnd(IN OUT PFRONTEND This, /* There is no user-reserved menu id range by default */ GuiData->CmdIdLow = GuiData->CmdIdHigh = 0; + /* Initialize the selection */ + RtlZeroMemory(&GuiData->Selection, sizeof(CONSOLE_SELECTION_INFO)); + GuiData->Selection.dwFlags = CONSOLE_NO_SELECTION; + /* * We need to wait until the GUI has been fully initialized * to retrieve custom settings i.e. WindowSize etc... @@ -597,12 +603,7 @@ GuiDrawRegion(IN OUT PFRONTEND This, SMALL_RECT* Region) { PGUI_CONSOLE_DATA GuiData = This->Data; - RECT RegionRect; - - SmallRectToRect(GuiData, &RegionRect, Region); - /* Do not erase the background: it speeds up redrawing and reduce flickering */ - InvalidateRect(GuiData->hWindow, &RegionRect, FALSE); - /**UpdateWindow(GuiData->hWindow);**/ + DrawRegion(GuiData, Region); } static VOID NTAPI @@ -641,12 +642,12 @@ GuiWriteStream(IN OUT PFRONTEND This, SW_INVALIDATE); } - GuiDrawRegion(This, Region); + DrawRegion(GuiData, Region); if (CursorStartX < Region->Left || Region->Right < CursorStartX || CursorStartY < Region->Top || Region->Bottom < CursorStartY) { - GuiInvalidateCell(This, CursorStartX, CursorStartY); + InvalidateCell(GuiData, CursorStartX, CursorStartY); } CursorEndX = Buff->CursorPosition.X; @@ -655,7 +656,7 @@ GuiWriteStream(IN OUT PFRONTEND This, || CursorEndY < Region->Top || Region->Bottom < CursorEndY) && (CursorEndX != CursorStartX || CursorEndY != CursorStartY)) { - GuiInvalidateCell(This, CursorEndX, CursorEndY); + InvalidateCell(GuiData, CursorEndX, CursorEndY); } // HACK!! @@ -673,7 +674,7 @@ GuiSetCursorInfo(IN OUT PFRONTEND This, if (GuiData->ActiveBuffer == Buff) { - GuiInvalidateCell(This, Buff->CursorPosition.X, Buff->CursorPosition.Y); + InvalidateCell(GuiData, Buff->CursorPosition.X, Buff->CursorPosition.Y); } return TRUE; @@ -690,9 +691,9 @@ GuiSetScreenInfo(IN OUT PFRONTEND This, if (GuiData->ActiveBuffer == Buff) { /* Redraw char at old position (remove cursor) */ - GuiInvalidateCell(This, OldCursorX, OldCursorY); + InvalidateCell(GuiData, OldCursorX, OldCursorY); /* Redraw char at new position (show cursor) */ - GuiInvalidateCell(This, Buff->CursorPosition.X, Buff->CursorPosition.Y); + InvalidateCell(GuiData, Buff->CursorPosition.X, Buff->CursorPosition.Y); } return TRUE; @@ -884,7 +885,7 @@ GuiChangeIcon(IN OUT PFRONTEND This, GuiData->hIconSm = hIconSm; DPRINT("Set icons in GuiChangeIcon\n"); - PostMessageW(GuiData->hWindow, WM_SETICON, ICON_BIG, (LPARAM)GuiData->hIcon); + PostMessageW(GuiData->hWindow, WM_SETICON, ICON_BIG , (LPARAM)GuiData->hIcon ); PostMessageW(GuiData->hWindow, WM_SETICON, ICON_SMALL, (LPARAM)GuiData->hIconSm); } @@ -941,6 +942,21 @@ GuiGetLargestConsoleWindowSize(IN OUT PFRONTEND This, pSize->Y = (SHORT)(height / (int)HeightUnit) /* HACK */ + 1; } +static BOOL NTAPI +GuiGetSelectionInfo(IN OUT PFRONTEND This, + PCONSOLE_SELECTION_INFO pSelectionInfo) +{ + PGUI_CONSOLE_DATA GuiData = This->Data; + + if (pSelectionInfo == NULL) return FALSE; + + ZeroMemory(pSelectionInfo, sizeof(CONSOLE_SELECTION_INFO)); + if (GuiData->Selection.dwFlags != CONSOLE_NO_SELECTION) + RtlCopyMemory(pSelectionInfo, &GuiData->Selection, sizeof(CONSOLE_SELECTION_INFO)); + + return TRUE; +} + static BOOL NTAPI GuiSetPalette(IN OUT PFRONTEND This, HPALETTE PaletteHandle, @@ -1087,6 +1103,7 @@ static FRONTEND_VTBL GuiVtbl = GuiChangeIcon, GuiGetConsoleWindowHandle, GuiGetLargestConsoleWindowSize, + GuiGetSelectionInfo, GuiSetPalette, GuiGetDisplayMode, GuiSetDisplayMode, diff --git a/win32ss/user/winsrv/consrv/frontends/gui/text.c b/win32ss/user/winsrv/consrv/frontends/gui/text.c index 4ac21b0325a..84d0101d8af 100644 --- a/win32ss/user/winsrv/consrv/frontends/gui/text.c +++ b/win32ss/user/winsrv/consrv/frontends/gui/text.c @@ -20,7 +20,7 @@ /* FUNCTIONS ******************************************************************/ -COLORREF RGBFromAttrib2(PCONSOLE Console, WORD Attribute) +COLORREF PaletteRGBFromAttrib(PCONSOLE Console, WORD Attribute) { HPALETTE hPalette = Console->ActiveBuffer->PaletteHandle; PALETTEENTRY pe; @@ -39,8 +39,6 @@ GuiCopyFromTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer, * This function supposes that the system clipboard was opened. */ - PCONSOLE Console = Buffer->Header.Console; - /* * Pressing the Shift key while copying text, allows us to copy * text without newline characters (inline-text copy mode). @@ -53,13 +51,13 @@ GuiCopyFromTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer, ULONG selWidth, selHeight; ULONG xPos, yPos, size; - selWidth = Console->Selection.srSelection.Right - Console->Selection.srSelection.Left + 1; - selHeight = Console->Selection.srSelection.Bottom - Console->Selection.srSelection.Top + 1; + selWidth = GuiData->Selection.srSelection.Right - GuiData->Selection.srSelection.Left + 1; + selHeight = GuiData->Selection.srSelection.Bottom - GuiData->Selection.srSelection.Top + 1; DPRINT("Selection is (%d|%d) to (%d|%d)\n", - Console->Selection.srSelection.Left, - Console->Selection.srSelection.Top, - Console->Selection.srSelection.Right, - Console->Selection.srSelection.Bottom); + GuiData->Selection.srSelection.Left, + GuiData->Selection.srSelection.Top, + GuiData->Selection.srSelection.Right, + GuiData->Selection.srSelection.Bottom); #ifdef IS_WHITESPACE #undef IS_WHITESPACE @@ -99,8 +97,8 @@ GuiCopyFromTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer, ULONG length = selWidth; ptr = ConioCoordToPointer(Buffer, - Console->Selection.srSelection.Left, - Console->Selection.srSelection.Top + yPos); + GuiData->Selection.srSelection.Left, + GuiData->Selection.srSelection.Top + yPos); /* Trim whitespace from the right */ while (length > 0) @@ -230,6 +228,8 @@ GuiPaintTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer, if (Buffer->Buffer == NULL) return; + if (!ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) return; + rcFramebuffer->left = Buffer->ViewOrigin.X * GuiData->CharWidth + rcView->left; rcFramebuffer->top = Buffer->ViewOrigin.Y * GuiData->CharHeight + rcView->top; rcFramebuffer->right = Buffer->ViewOrigin.X * GuiData->CharWidth + rcView->right; @@ -245,8 +245,8 @@ GuiPaintTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer, LastAttribute = ConioCoordToPointer(Buffer, LeftChar, TopLine)->Attributes; - SetTextColor(GuiData->hMemDC, RGBFromAttrib2(Console, TextAttribFromAttrib(LastAttribute))); - SetBkColor(GuiData->hMemDC, RGBFromAttrib2(Console, BkgdAttribFromAttrib(LastAttribute))); + SetTextColor(GuiData->hMemDC, PaletteRGBFromAttrib(Console, TextAttribFromAttrib(LastAttribute))); + SetBkColor(GuiData->hMemDC, PaletteRGBFromAttrib(Console, BkgdAttribFromAttrib(LastAttribute))); OldFont = SelectObject(GuiData->hMemDC, GuiData->Font); @@ -275,8 +275,8 @@ GuiPaintTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer, Attribute = From->Attributes; if (Attribute != LastAttribute) { - SetTextColor(GuiData->hMemDC, RGBFromAttrib2(Console, TextAttribFromAttrib(Attribute))); - SetBkColor(GuiData->hMemDC, RGBFromAttrib2(Console, BkgdAttribFromAttrib(Attribute))); + SetTextColor(GuiData->hMemDC, PaletteRGBFromAttrib(Console, TextAttribFromAttrib(Attribute))); + SetBkColor(GuiData->hMemDC, PaletteRGBFromAttrib(Console, BkgdAttribFromAttrib(Attribute))); LastAttribute = Attribute; } } @@ -308,7 +308,7 @@ GuiPaintTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer, Attribute = ConioCoordToPointer(Buffer, Buffer->CursorPosition.X, Buffer->CursorPosition.Y)->Attributes; if (Attribute == DEFAULT_SCREEN_ATTRIB) Attribute = Buffer->ScreenDefaultAttrib; - CursorBrush = CreateSolidBrush(RGBFromAttrib2(Console, TextAttribFromAttrib(Attribute))); + CursorBrush = CreateSolidBrush(PaletteRGBFromAttrib(Console, TextAttribFromAttrib(Attribute))); OldBrush = SelectObject(GuiData->hMemDC, CursorBrush); PatBlt(GuiData->hMemDC, @@ -323,6 +323,8 @@ GuiPaintTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer, } SelectObject(GuiData->hMemDC, OldFont); + + LeaveCriticalSection(&Console->Lock); } /* EOF */ diff --git a/win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c b/win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c index 0f3a8dad47d..51fbd842506 100644 --- a/win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c +++ b/win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c @@ -746,6 +746,13 @@ TuiGetLargestConsoleWindowSize(IN OUT PFRONTEND This, *pSize = PhysicalConsoleSize; } +static BOOL NTAPI +TuiGetSelectionInfo(IN OUT PFRONTEND This, + PCONSOLE_SELECTION_INFO pSelectionInfo) +{ + return TRUE; +} + static BOOL NTAPI TuiSetPalette(IN OUT PFRONTEND This, HPALETTE PaletteHandle, @@ -813,6 +820,7 @@ static FRONTEND_VTBL TuiVtbl = TuiChangeIcon, TuiGetConsoleWindowHandle, TuiGetLargestConsoleWindowSize, + TuiGetSelectionInfo, TuiSetPalette, TuiGetDisplayMode, TuiSetDisplayMode, diff --git a/win32ss/user/winsrv/consrv/handle.c b/win32ss/user/winsrv/consrv/handle.c index 9f268d2513c..98b7ff0c0db 100644 --- a/win32ss/user/winsrv/consrv/handle.c +++ b/win32ss/user/winsrv/consrv/handle.c @@ -377,7 +377,6 @@ ConSrvRemoveObject(PCONSOLE_PROCESS_DATA ProcessData, HANDLE Handle) { ULONG Index = HandleToULong(Handle) >> 2; - PCONSOLE_IO_OBJECT Object; RtlEnterCriticalSection(&ProcessData->HandleTableLock); @@ -386,7 +385,7 @@ ConSrvRemoveObject(PCONSOLE_PROCESS_DATA ProcessData, // (ProcessData->HandleTable != NULL && ProcessData->HandleTableSize != 0) ); if (Index >= ProcessData->HandleTableSize || - (Object = ProcessData->HandleTable[Index].Object) == NULL) + ProcessData->HandleTable[Index].Object == NULL) { RtlLeaveCriticalSection(&ProcessData->HandleTableLock); return STATUS_INVALID_HANDLE; @@ -649,6 +648,9 @@ ConSrvRemoveConsole(PCONSOLE_PROCESS_DATA ProcessData) ProcessData->ConsoleHandle, CONSOLE_RUNNING, TRUE)) { + /* Retrieve the console leader process */ + PCONSOLE_PROCESS_DATA ConsoleLeaderProcess = ConDrvGetConsoleLeaderProcess(Console); + DPRINT("ConSrvRemoveConsole - Locking OK\n"); /* Close all console handles and free the handles table */ @@ -657,9 +659,38 @@ ConSrvRemoveConsole(PCONSOLE_PROCESS_DATA ProcessData) /* Detach the process from the console */ ProcessData->ConsoleHandle = NULL; - /* Remove ourselves from the console's list of processes */ + /* Remove the process from the console's list of processes */ RemoveEntryList(&ProcessData->ConsoleLink); + /* Check whether the console should send a last close notification */ + if (Console->NotifyLastClose) + { + /* If we are removing the process which wants the last close notification... */ + if (ProcessData == Console->NotifiedLastCloseProcess) + { + /* ... just reset the flag and the pointer... */ + Console->NotifyLastClose = FALSE; + Console->NotifiedLastCloseProcess = NULL; + } + /* + * ... otherwise, if we are removing the console leader process + * (that cannot be the process wanting the notification, because + * the previous case already dealt with it)... + */ + else if (ProcessData == ConsoleLeaderProcess) + { + /* + * ... reset the flag first (so that we avoid multiple notifications) + * and then send the last close notification. + */ + Console->NotifyLastClose = FALSE; + ConDrvConsoleCtrlEvent(CTRL_LAST_CLOSE_EVENT, Console->NotifiedLastCloseProcess); + + /* Only now, reset the pointer */ + Console->NotifiedLastCloseProcess = NULL; + } + } + /* Update the internal info of the terminal */ TermRefreshInternalInfo(Console); @@ -688,11 +719,11 @@ CSR_API(SrvOpenConsole) PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); PCONSOLE Console; - DWORD DesiredAccess = OpenConsoleRequest->Access; + DWORD DesiredAccess = OpenConsoleRequest->DesiredAccess; DWORD ShareMode = OpenConsoleRequest->ShareMode; PCONSOLE_IO_OBJECT Object; - OpenConsoleRequest->ConsoleHandle = INVALID_HANDLE_VALUE; + OpenConsoleRequest->Handle = INVALID_HANDLE_VALUE; Status = ConSrvGetConsole(ProcessData, &Console, TRUE); if (!NT_SUCCESS(Status)) @@ -726,10 +757,10 @@ CSR_API(SrvOpenConsole) else { Status = ConSrvInsertObject(ProcessData, - &OpenConsoleRequest->ConsoleHandle, + &OpenConsoleRequest->Handle, Object, DesiredAccess, - OpenConsoleRequest->Inheritable, + OpenConsoleRequest->InheritHandle, ShareMode); } @@ -746,11 +777,13 @@ CSR_API(SrvDuplicateHandle) PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); PCONSOLE Console; - HANDLE ConsoleHandle = DuplicateHandleRequest->ConsoleHandle; - ULONG Index = HandleToULong(ConsoleHandle) >> 2; + HANDLE SourceHandle = DuplicateHandleRequest->SourceHandle; + ULONG Index = HandleToULong(SourceHandle) >> 2; PCONSOLE_IO_HANDLE Entry; DWORD DesiredAccess; + DuplicateHandleRequest->TargetHandle = INVALID_HANDLE_VALUE; + Status = ConSrvGetConsole(ProcessData, &Console, TRUE); if (!NT_SUCCESS(Status)) { @@ -763,11 +796,11 @@ CSR_API(SrvDuplicateHandle) // ASSERT( (ProcessData->HandleTable == NULL && ProcessData->HandleTableSize == 0) || // (ProcessData->HandleTable != NULL && ProcessData->HandleTableSize != 0) ); - if ( /** !IsConsoleHandle(ConsoleHandle) || **/ + if ( /** !IsConsoleHandle(SourceHandle) || **/ Index >= ProcessData->HandleTableSize || (Entry = &ProcessData->HandleTable[Index])->Object == NULL) { - DPRINT1("Couldn't duplicate invalid handle %p\n", ConsoleHandle); + DPRINT1("Couldn't duplicate invalid handle 0x%p\n", SourceHandle); Status = STATUS_INVALID_HANDLE; goto Quit; } @@ -778,12 +811,12 @@ CSR_API(SrvDuplicateHandle) } else { - DesiredAccess = DuplicateHandleRequest->Access; + DesiredAccess = DuplicateHandleRequest->DesiredAccess; /* Make sure the source handle has all the desired flags */ if ((Entry->Access & DesiredAccess) == 0) { - DPRINT1("Handle %p only has access %X; requested %X\n", - ConsoleHandle, Entry->Access, DesiredAccess); + DPRINT1("Handle 0x%p only has access %X; requested %X\n", + SourceHandle, Entry->Access, DesiredAccess); Status = STATUS_INVALID_PARAMETER; goto Quit; } @@ -791,10 +824,10 @@ CSR_API(SrvDuplicateHandle) /* Insert the new handle inside the process handles table */ Status = ConSrvInsertObject(ProcessData, - &DuplicateHandleRequest->ConsoleHandle, // Use the new handle value! + &DuplicateHandleRequest->TargetHandle, Entry->Object, DesiredAccess, - DuplicateHandleRequest->Inheritable, + DuplicateHandleRequest->InheritHandle, Entry->ShareMode); if (NT_SUCCESS(Status) && (DuplicateHandleRequest->Options & DUPLICATE_CLOSE_SOURCE)) @@ -812,14 +845,100 @@ Quit: CSR_API(SrvGetHandleInformation) { - DPRINT1("%s not yet implemented\n", __FUNCTION__); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS Status; + PCONSOLE_GETHANDLEINFO GetHandleInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetHandleInfoRequest; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); + PCONSOLE Console; + + HANDLE Handle = GetHandleInfoRequest->Handle; + ULONG Index = HandleToULong(Handle) >> 2; + PCONSOLE_IO_HANDLE Entry; + + Status = ConSrvGetConsole(ProcessData, &Console, TRUE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Can't get console\n"); + return Status; + } + + RtlEnterCriticalSection(&ProcessData->HandleTableLock); + + ASSERT(ProcessData->HandleTable); + // ASSERT( (ProcessData->HandleTable == NULL && ProcessData->HandleTableSize == 0) || + // (ProcessData->HandleTable != NULL && ProcessData->HandleTableSize != 0) ); + + if (!IsConsoleHandle(Handle) || + Index >= ProcessData->HandleTableSize || + (Entry = &ProcessData->HandleTable[Index])->Object == NULL) + { + Status = STATUS_INVALID_HANDLE; + goto Quit; + } + + /* + * Retrieve the handle information flags. The console server + * doesn't support HANDLE_FLAG_PROTECT_FROM_CLOSE. + */ + GetHandleInfoRequest->Flags = 0; + if (Entry->Inheritable) GetHandleInfoRequest->Flags |= HANDLE_FLAG_INHERIT; + + Status = STATUS_SUCCESS; + +Quit: + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + + ConSrvReleaseConsole(Console, TRUE); + return Status; } CSR_API(SrvSetHandleInformation) { - DPRINT1("%s not yet implemented\n", __FUNCTION__); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS Status; + PCONSOLE_SETHANDLEINFO SetHandleInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetHandleInfoRequest; + PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); + PCONSOLE Console; + + HANDLE Handle = SetHandleInfoRequest->Handle; + ULONG Index = HandleToULong(Handle) >> 2; + PCONSOLE_IO_HANDLE Entry; + + Status = ConSrvGetConsole(ProcessData, &Console, TRUE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Can't get console\n"); + return Status; + } + + RtlEnterCriticalSection(&ProcessData->HandleTableLock); + + ASSERT(ProcessData->HandleTable); + // ASSERT( (ProcessData->HandleTable == NULL && ProcessData->HandleTableSize == 0) || + // (ProcessData->HandleTable != NULL && ProcessData->HandleTableSize != 0) ); + + if (!IsConsoleHandle(Handle) || + Index >= ProcessData->HandleTableSize || + (Entry = &ProcessData->HandleTable[Index])->Object == NULL) + { + Status = STATUS_INVALID_HANDLE; + goto Quit; + } + + /* + * Modify the handle information flags. The console server + * doesn't support HANDLE_FLAG_PROTECT_FROM_CLOSE. + */ + if (SetHandleInfoRequest->Mask & HANDLE_FLAG_INHERIT) + { + Entry->Inheritable = ((SetHandleInfoRequest->Flags & HANDLE_FLAG_INHERIT) != 0); + } + + Status = STATUS_SUCCESS; + +Quit: + RtlLeaveCriticalSection(&ProcessData->HandleTableLock); + + ConSrvReleaseConsole(Console, TRUE); + return Status; } CSR_API(SrvCloseHandle) diff --git a/win32ss/user/winsrv/consrv/include/conio.h b/win32ss/user/winsrv/consrv/include/conio.h index a60e95f8ca6..26b460cc63f 100644 --- a/win32ss/user/winsrv/consrv/include/conio.h +++ b/win32ss/user/winsrv/consrv/include/conio.h @@ -228,6 +228,8 @@ typedef struct _FRONTEND_VTBL HWND (NTAPI *GetConsoleWindowHandle)(IN OUT PFRONTEND This); VOID (NTAPI *GetLargestConsoleWindowSize)(IN OUT PFRONTEND This, PCOORD pSize); + BOOL (NTAPI *GetSelectionInfo)(IN OUT PFRONTEND This, + PCONSOLE_SELECTION_INFO pSelectionInfo); BOOL (NTAPI *SetPalette)(IN OUT PFRONTEND This, HPALETTE PaletteHandle, UINT PaletteUsage); @@ -282,6 +284,8 @@ typedef struct _CONSOLE CONSOLE_STATE State; /* State of the console */ LIST_ENTRY ProcessList; /* List of processes owning the console. The first one is the so-called "Console Leader Process" */ + PCONSOLE_PROCESS_DATA NotifiedLastCloseProcess; /* Pointer to the unique process that needs to be notified when the console leader process is killed */ + BOOLEAN NotifyLastClose; /* TRUE if the console should send a control event when the console leader process is killed */ FRONTEND TermIFace; /* Frontend-specific interface */ @@ -303,9 +307,6 @@ typedef struct _CONSOLE BOOLEAN InsertMode; UINT CodePage; - CONSOLE_SELECTION_INFO Selection; /* Contains information about the selection */ - COORD dwSelectionCursor; /* Selection cursor position, most of the time different from Selection.dwSelectionAnchor */ - /******************************* Screen buffers *******************************/ LIST_ENTRY BufferList; /* List of all screen buffers for this console */ PCONSOLE_SCREEN_BUFFER ActiveBuffer; /* Pointer to currently active screen buffer */ @@ -341,10 +342,15 @@ typedef struct _CONSOLE VOID FASTCALL ConioPause(PCONSOLE Console, UINT Flags); VOID FASTCALL ConioUnpause(PCONSOLE Console, UINT Flags); +PCONSOLE_PROCESS_DATA NTAPI +ConDrvGetConsoleLeaderProcess(IN PCONSOLE Console); +NTSTATUS +ConDrvConsoleCtrlEvent(IN ULONG CtrlEvent, + IN PCONSOLE_PROCESS_DATA ProcessData); NTSTATUS NTAPI ConDrvConsoleProcessCtrlEvent(IN PCONSOLE Console, IN ULONG ProcessGroupId, - IN ULONG Event); + IN ULONG CtrlEvent); /* coninput.c */ VOID NTAPI ConioProcessKey(PCONSOLE Console, MSG* msg); diff --git a/win32ss/user/winsrv/consrv/include/term.h b/win32ss/user/winsrv/consrv/include/term.h index c8c68ae82a9..b8cc5523e2f 100644 --- a/win32ss/user/winsrv/consrv/include/term.h +++ b/win32ss/user/winsrv/consrv/include/term.h @@ -38,6 +38,8 @@ (Console)->TermIFace.Vtbl->GetConsoleWindowHandle(&(Console)->TermIFace) #define TermGetLargestConsoleWindowSize(Console, pSize) \ (Console)->TermIFace.Vtbl->GetLargestConsoleWindowSize(&(Console)->TermIFace, (pSize)) +#define TermGetSelectionInfo(Console, pSelectionInfo) \ + (Console)->TermIFace.Vtbl->GetSelectionInfo(&(Console)->TermIFace, (pSelectionInfo)) #define TermSetPalette(Console, PaletteHandle, PaletteUsage) \ (Console)->TermIFace.Vtbl->SetPalette(&(Console)->TermIFace, (PaletteHandle), (PaletteUsage)) #define TermGetDisplayMode(Console) \