summaryrefslogtreecommitdiff
path: root/pjlib/src/pjlib-test
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2005-11-21 16:57:02 +0000
committerBenny Prijono <bennylp@teluu.com>2005-11-21 16:57:02 +0000
commit5d8ed312c380f76e442ca170f0f791273c914bfa (patch)
tree552b3ccb4a8bb0b9144fac237822a147c6d48a24 /pjlib/src/pjlib-test
parent54349030a3b401a96f1dc24dd351fe19110ddbb9 (diff)
Changed syntax to support Windows SEH
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@68 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pjlib-test')
-rw-r--r--pjlib/src/pjlib-test/exception.c52
1 files changed, 27 insertions, 25 deletions
diff --git a/pjlib/src/pjlib-test/exception.c b/pjlib/src/pjlib-test/exception.c
index ef4bf4a2..5e9ef2b6 100644
--- a/pjlib/src/pjlib-test/exception.c
+++ b/pjlib/src/pjlib-test/exception.c
@@ -65,8 +65,8 @@ static int throw_id_2(void)
static int test(void)
{
- PJ_USE_EXCEPTION;
int rc = 0;
+ PJ_USE_EXCEPTION;
/*
* No exception situation.
@@ -74,10 +74,7 @@ static int test(void)
PJ_TRY {
rc = rc;
}
- PJ_CATCH( ID_1 ) {
- rc = -2;
- }
- PJ_DEFAULT {
+ PJ_CATCH_ANY {
rc = -3;
}
PJ_END;
@@ -95,14 +92,13 @@ static int test(void)
// should not reach here.
rc = -10;
}
- PJ_CATCH( ID_1 ) {
- if (!rc) rc = 0;
- }
- PJ_DEFAULT {
+ PJ_CATCH_ANY {
int id = PJ_GET_EXCEPTION();
- PJ_LOG(3,("", "...error: got unexpected exception %d (%s)",
- id, pj_exception_id_name(id)));
- if (!rc) rc = -20;
+ if (id != ID_1) {
+ PJ_LOG(3,("", "...error: got unexpected exception %d (%s)",
+ id, pj_exception_id_name(id)));
+ if (!rc) rc = -20;
+ }
}
PJ_END;
@@ -117,14 +113,16 @@ static int test(void)
// should not reach here.
rc = -25;
}
- PJ_CATCH( ID_1 ) {
- if (!rc) rc = -30;
- }
- PJ_CATCH( ID_2 ) {
- if (!rc) rc = 0;
- }
- PJ_DEFAULT {
- if (!rc) rc = -40;
+ PJ_CATCH_ANY {
+ switch (PJ_GET_EXCEPTION()) {
+ case ID_1:
+ if (!rc) rc = -30; break;
+ case ID_2:
+ if (!rc) rc = 0; break;
+ default:
+ if (!rc) rc = -40;
+ break;
+ }
}
PJ_END;
@@ -139,11 +137,15 @@ static int test(void)
// should not reach here
rc = -50;
}
- PJ_CATCH( ID_2 ) {
- if (!rc) rc = -60;
- }
- PJ_DEFAULT {
- if (!rc) rc = 0;
+ PJ_CATCH_ANY {
+ switch (PJ_GET_EXCEPTION()) {
+ case ID_1:
+ if (!rc) rc = 0;
+ break;
+ default:
+ if (!rc) rc = -60;
+ break;
+ }
}
PJ_END;