From: Billy G. A. <bal...@us...> - 2001-10-05 08:22:21
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv10598 Modified Files: libpqmodule.c libpqmodule.h pgconnection.c pgint2object.c pgint8object.c Log Message: 05OCT2001 bga Changed new C++ style comments to old-style comment to allow the code to compile on a larger range of compilers. Index: libpqmodule.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/libpqmodule.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** libpqmodule.c 2001/09/30 22:44:13 1.18 --- libpqmodule.c 2001/10/05 08:22:18 1.19 *************** *** 32,35 **** --- 32,36 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 01OCT2001 bga Changed all new style comments to original style. | | 30SEP2001 bga Change PgQuoteString and PgQuoteByta so that unsigned | | char pointers are used instead of signed char pointers. | *************** *** 125,139 **** | Exception Objects for this module. | \***************************************/ ! // StandardError ! PyObject *PqErr_Warning; // |--Warning ! PyObject *PqErr_Error; // +--Error ! PyObject *PqErr_InterfaceError; // |--InterfaceError ! PyObject *PqErr_DatabaseError; // +--DatabaseError ! PyObject *PqErr_DataError; // |--DataError ! PyObject *PqErr_OperationalError; // |--OperationaError ! PyObject *PqErr_IntegrityError; // |--IntegrityError ! PyObject *PqErr_InternalError; // |--InternalError ! PyObject *PqErr_ProgrammingError; // |--ProgrammingError ! PyObject *PqErr_NotSupportedError; // +--NotSupportedError /***********************************************************************\ --- 126,140 ---- | Exception Objects for this module. | \***************************************/ ! /* StandardError */ ! PyObject *PqErr_Warning; /* |--Warning */ ! PyObject *PqErr_Error; /* +--Error */ ! PyObject *PqErr_InterfaceError; /* |--InterfaceError */ ! PyObject *PqErr_DatabaseError; /* +--DatabaseError */ ! PyObject *PqErr_DataError; /* |--DataError */ ! PyObject *PqErr_OperationalError; /* |--OperationaError */ ! PyObject *PqErr_IntegrityError; /* |--IntegrityError */ ! PyObject *PqErr_InternalError; /* |--InternalError */ ! PyObject *PqErr_ProgrammingError; /* |--ProgrammingError */ ! PyObject *PqErr_NotSupportedError; /* +--NotSupportedError */ /***********************************************************************\ *************** *** 191,199 **** return NULL; ! // Calculate the size for the new memory string. slen = strlen((char *)sin); i = (slen * (forArray ? 7 : 4)) + 3; ! sout = (unsigned char *)PyMem_Malloc(i); // Assume every char will be quoted if (sout == (unsigned char *)NULL) return PyErr_NoMemory(); --- 192,200 ---- return NULL; ! /* Calculate the size for the new memory string. */ slen = strlen((char *)sin); i = (slen * (forArray ? 7 : 4)) + 3; ! sout = (unsigned char *)PyMem_Malloc(i); /* Assume every char is quoted */ if (sout == (unsigned char *)NULL) return PyErr_NoMemory(); *************** *** 257,261 **** if (sin[i] < 32) { ! // escape any control character not already escaped. byte = (unsigned char)sin[i]; sout[j++] = '\\'; --- 258,262 ---- if (sin[i] < 32) { ! /* escape any control character not already escaped. */ byte = (unsigned char)sin[i]; sout[j++] = '\\'; *************** *** 327,335 **** return NULL; ! // Calculate the size for the new memory string. slen = strlen((char *)sin); i = (slen * (forArray ? 8 : 4)) + 3; ! sout = (unsigned char *)PyMem_Malloc(i); // Assume every char will be quoted if (sout == (unsigned char *)NULL) return PyErr_NoMemory(); --- 328,336 ---- return NULL; ! /* Calculate the size for the new memory string. */ slen = strlen((char *)sin); i = (slen * (forArray ? 8 : 4)) + 3; ! sout = (unsigned char *)PyMem_Malloc(i); /* Assume every char is quoted */ if (sout == (unsigned char *)NULL) return PyErr_NoMemory(); *************** *** 385,389 **** if (!isprint(sin[i])) { ! // escape any control character not already escaped. byte = (unsigned char)sin[i]; sout[j++] = '\\'; --- 386,390 ---- if (!isprint(sin[i])) { ! /* escape any control character not already escaped. */ byte = (unsigned char)sin[i]; sout[j++] = '\\'; Index: libpqmodule.h =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/libpqmodule.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** libpqmodule.h 2001/09/16 17:54:52 1.6 --- libpqmodule.h 2001/10/05 08:22:18 1.7 *************** *** 88,102 **** | Exception Objects for this module. | \***************************************/ ! // StandardError ! extern PyObject *PqErr_Warning; // |--Warning ! extern PyObject *PqErr_Error; // +--Error ! extern PyObject *PqErr_InterfaceError; // |--InterfaceError ! extern PyObject *PqErr_DatabaseError; // +--DatabaseError ! extern PyObject *PqErr_DataError; // |--DataError ! extern PyObject *PqErr_OperationalError; // |--OperationaError ! extern PyObject *PqErr_IntegrityError; // |--IntegrityError ! extern PyObject *PqErr_InternalError; // |--InternalError ! extern PyObject *PqErr_ProgrammingError; // |--ProgrammingError ! extern PyObject *PqErr_NotSupportedError; // +--NotSupportedError void *PyMem_Strdup(void *); --- 88,102 ---- | Exception Objects for this module. | \***************************************/ ! /* StandardError */ ! extern PyObject *PqErr_Warning; /* |--Warning */ ! extern PyObject *PqErr_Error; /* +--Error */ ! extern PyObject *PqErr_InterfaceError; /* |--InterfaceError */ ! extern PyObject *PqErr_DatabaseError; /* +--DatabaseError */ ! extern PyObject *PqErr_DataError; /* |--DataError */ ! extern PyObject *PqErr_OperationalError; /* |--OperationaError */ ! extern PyObject *PqErr_IntegrityError; /* |--IntegrityError */ ! extern PyObject *PqErr_InternalError; /* |--InternalError */ ! extern PyObject *PqErr_ProgrammingError; /* |--ProgrammingError */ ! extern PyObject *PqErr_NotSupportedError; /* +--NotSupportedError */ void *PyMem_Strdup(void *); Index: pgconnection.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgconnection.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pgconnection.c 2001/10/01 01:24:57 1.12 --- pgconnection.c 2001/10/05 08:22:18 1.13 *************** *** 29,32 **** --- 29,33 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 01OCT2001 bga Changed all new style comments to original style. | | 30SEP2001 bga Added some brakets to clarify ambiguous else clauses. | | 29SEP2001 bga Fixed numerous bugs found during the development of the | *************** *** 140,145 **** } ! // We have a connection, use it to get the version of the ! // PostgreSQL backend that we are connected to. Py_BEGIN_ALLOW_THREADS --- 141,146 ---- } ! /* We have a connection, use it to get the version of the */ ! /* PostgreSQL backend that we are connected to. */ Py_BEGIN_ALLOW_THREADS *************** *** 157,162 **** } ! // Setup a notice processor that will store notices in the notice ! // list for this connection. PQsetNoticeProcessor(conn, queueNotices, (void *)self->notices); --- 158,163 ---- } ! /* Setup a notice processor that will store notices in the */ ! /* notice list for this connection */ PQsetNoticeProcessor(conn, queueNotices, (void *)self->notices); *************** *** 717,721 **** case -1: leave = 1; ! result = Py_BuildValue("s", "\\."); // return EOD indicator break; --- 718,722 ---- case -1: leave = 1; ! result = Py_BuildValue("s", "\\."); /* return EOD indicator */ break; *************** *** 915,919 **** } ! // Make sure that INV_BIN is not set. mode &= (INV_READ | INV_WRITE); --- 916,920 ---- } ! /* Make sure that INV_BIN is not set. */ mode &= (INV_READ | INV_WRITE); *************** *** 1018,1022 **** { "notices", T_OBJECT, CoOFF(notices), RO }, { "version", T_OBJECT, CoOFF(version), RO }, ! // The remaining attributes are handles directly in PgConnection_getattr() { "status", T_INT, 0, RO }, { "errorMessage", T_STRING, 0, RO }, --- 1019,1023 ---- { "notices", T_OBJECT, CoOFF(notices), RO }, { "version", T_OBJECT, CoOFF(version), RO }, ! /* The remaining attributes are handles directly in PgConnection_getattr() */ { "status", T_INT, 0, RO }, { "errorMessage", T_STRING, 0, RO }, Index: pgint2object.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgint2object.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pgint2object.c 2001/09/26 05:45:30 1.9 --- pgint2object.c 2001/10/05 08:22:18 1.10 *************** *** 33,36 **** --- 33,37 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 01OCT2001 bga Changed all new style comments to original style. | | 26SEP2001 bga Change the constructors so that they return PyObject * | | instead of PgInt2Object *. | *************** *** 152,156 **** x = strtol(s, &end, base); ! xs = (short)x; // Used later for the overflow check. if (end == s || !isalnum(Py_CHARMASK((unsigned int)(end[-1])))) --- 153,157 ---- x = strtol(s, &end, base); ! xs = (short)x; /* Used later for the overflow check. */ if (end == s || !isalnum(Py_CHARMASK((unsigned int)(end[-1])))) *************** *** 389,394 **** if (!(PgInt2_Check(v) && PgInt2_Check(w))) { ! // Ok, we are adding mixed mode numbers, first we coerce the ! // numbers to the same type. if (int2_coerce(&v1, &w1)) --- 390,395 ---- if (!(PgInt2_Check(v) && PgInt2_Check(w))) { ! /* Ok, we are adding mixed mode numbers, first we coerce the */ ! /* numbers to the same type. */ if (int2_coerce(&v1, &w1)) *************** *** 397,403 **** } ! // Now that the numbers are the same type, we check to see if ! // they are PgInt2s. If not, we call the add method of the type ! // that they were coerced into. if (!PgInt2_Check(v1)) --- 398,404 ---- } ! /* Now that the numbers are the same type, we check to see if */ ! /* they are PgInt2s. If not, we call the add method of the */ ! /* type that they were coerced into. */ if (!PgInt2_Check(v1)) *************** *** 415,419 **** } ! // We are adding two PgInt2s. CONVERT_BINOP(v1, w1, &a, &b); --- 416,420 ---- } ! /* We are adding two PgInt2s. */ CONVERT_BINOP(v1, w1, &a, &b); *************** *** 435,440 **** if (!(PgInt2_Check(v) && PgInt2_Check(w))) { ! // Ok, we are subtracting mixed mode numbers, first we coerce the ! // numbers to the same type. if (int2_coerce(&v1, &w1)) --- 436,441 ---- if (!(PgInt2_Check(v) && PgInt2_Check(w))) { ! /* Ok, we are subtracting mixed mode numbers, first we coerce */ ! /* the numbers to the same type. */ if (int2_coerce(&v1, &w1)) *************** *** 443,449 **** } ! // Now that the numbers are the same type, we check to see if ! // they are PgInt2s. If not, we call the sub method of the type ! // that they were coerced into. if (!PgInt2_Check(v1)) --- 444,450 ---- } ! /* Now that the numbers are the same type, we check to see if */ ! /* they are PgInt2s. If not, we call the subtract method of */ ! /* the type that they were coerced into. */ if (!PgInt2_Check(v1)) *************** *** 461,465 **** } ! // We are subtracting two PgInt2s. CONVERT_BINOP(v1, w1, &a, &b); --- 462,466 ---- } ! /* We are subtracting two PgInt2s. */ CONVERT_BINOP(v1, w1, &a, &b); *************** *** 530,535 **** if (!(PgInt2_Check(v) && PgInt2_Check(w))) { ! // Ok, we are subtracting mixed mode numbers, first we coerce the ! // numbers to the same type. if (int2_coerce(&v1, &w1)) --- 531,536 ---- if (!(PgInt2_Check(v) && PgInt2_Check(w))) { ! /* Ok, we are subtracting mixed mode numbers, first we coerce */ ! /* the numbers to the same type. */ if (int2_coerce(&v1, &w1)) *************** *** 538,544 **** } ! // Now that the numbers are the same type, we check to see if ! // they are PgInt2s. If not, we call the sub method of the type ! // that they were coerced into. if (!PgInt2_Check(v1)) --- 539,545 ---- } ! /* Now that the numbers are the same type, we check to see if */ ! /* they are PgInt2s. If not, we call the multiply method of */ ! /* the type that they were coerced into. */ if (!PgInt2_Check(v1)) *************** *** 612,617 **** if (!(PgInt2_Check(x) && PgInt2_Check(y))) { ! // Ok, we are subtracting mixed mode numbers, first we coerce the ! // numbers to the same type. if (int2_coerce(&v1, &w1)) --- 613,618 ---- if (!(PgInt2_Check(x) && PgInt2_Check(y))) { ! /* Ok, we are subtracting mixed mode numbers, first we coerce */ ! /* the numbers to the same type. */ if (int2_coerce(&v1, &w1)) *************** *** 620,626 **** } ! // Now that the numbers are the same type, we check to see if ! // they are PgInt2s. If not, we call the sub method of the type ! // that they were coerced into. if (!PgInt2_Check(v1)) --- 621,627 ---- } ! /* Now that the numbers are the same type, we check to see if */ ! /* they are PgInt2s. If not, we call the divide method of the */ ! /* type that they were coerced into. */ if (!PgInt2_Check(v1)) *************** *** 654,659 **** if (!(PgInt2_Check(x) && PgInt2_Check(y))) { ! // Ok, we are subtracting mixed mode numbers, first we coerce the ! // numbers to the same type. if (int2_coerce(&v1, &w1)) --- 655,660 ---- if (!(PgInt2_Check(x) && PgInt2_Check(y))) { ! /* Ok, we are subtracting mixed mode numbers, first we coerce */ ! /* the numbers to the same type. */ if (int2_coerce(&v1, &w1)) *************** *** 662,668 **** } ! // Now that the numbers are the same type, we check to see if ! // they are PgInt2s. If not, we call the sub method of the type ! // that they were coerced into. if (!PgInt2_Check(v1)) --- 663,669 ---- } ! /* Now that the numbers are the same type, we check to see if */ ! /* they are PgInt2s. If not, we call the remainder method of */ ! /* the type that they were coerced into. */ if (!PgInt2_Check(v1)) *************** *** 696,701 **** if (!(PgInt2_Check(x) && PgInt2_Check(y))) { ! // Ok, we are subtracting mixed mode numbers, first we coerce the ! // numbers to the same type. if (int2_coerce(&v1, &w1)) --- 697,702 ---- if (!(PgInt2_Check(x) && PgInt2_Check(y))) { ! /* Ok, we are subtracting mixed mode numbers, first we coerce */ ! /* the numbers to the same type. */ if (int2_coerce(&v1, &w1)) *************** *** 704,710 **** } ! // Now that the numbers are the same type, we check to see if ! // they are PgInt2s. If not, we call the sub method of the type ! // that they were coerced into. if (!PgInt2_Check(v1)) --- 705,711 ---- } ! /* Now that the numbers are the same type, we check to see if */ ! /* they are PgInt2s. If not, we call the divmod method of the */ ! /* type that they were coerced into. */ if (!PgInt2_Check(v1)) *************** *** 739,744 **** if (!(PgInt2_Check(v) && PgInt2_Check(w))) { ! // Ok, we are adding mixed mode numbers, first we coerce the ! // numbers to the same type. if (int2_coerce(&v1, &w1)) --- 740,745 ---- if (!(PgInt2_Check(v) && PgInt2_Check(w))) { ! /* Ok, we are subtracting mixed mode numbers, first we coerce */ ! /* the numbers to the same type. */ if (int2_coerce(&v1, &w1)) *************** *** 747,753 **** } ! // Now that the numbers are the same type, we check to see if ! // they are PgInt2s. If not, we call the add method of the type ! // that they were coerced into. if (!PgInt2_Check(v1)) --- 748,754 ---- } ! /* Now that the numbers are the same type, we check to see if */ ! /* they are PgInt2s. If not, we call the power method of the */ ! /* type that they were coerced into. */ if (!PgInt2_Check(v1)) Index: pgint8object.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgint8object.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pgint8object.c 2001/09/26 05:45:30 1.10 --- pgint8object.c 2001/10/05 08:22:18 1.11 *************** *** 40,43 **** --- 40,44 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 01OCT2001 bga Changed all new style comments to original style. | | 26SEP2001 bga Change the constructors so that they return PyObject * | | instead of PgInt8Object *. | *************** *** 393,398 **** if (!(PgInt8_Check(v) && PgInt8_Check(w))) { ! // Ok, we are adding mixed mode numbers, first we coerce the ! // numbers to the same type. if (int8_coerce(&v1, &w1)) --- 394,399 ---- if (!(PgInt8_Check(v) && PgInt8_Check(w))) { ! /* Ok, we are subtracting mixed mode numbers, first we coerce */ ! /* the numbers to the same type. */ if (int8_coerce(&v1, &w1)) *************** *** 401,407 **** } ! // Now that the numbers are the same type, we check to see if ! // they are PgInt8s. If not, we call the add method of the type ! // that they were coerced into. if (!PgInt8_Check(v1)) --- 402,408 ---- } ! /* Now that the numbers are the same type, we check to see if */ ! /* they are PgInt8s. If not, we call the add method of the */ ! /* type that they were coerced into. */ if (!PgInt8_Check(v1)) *************** *** 419,423 **** } ! // We are adding two PgInt8s. CONVERT_BINOP(v1, w1, &a, &b); --- 420,424 ---- } ! /* We are adding two PgInt8s. */ CONVERT_BINOP(v1, w1, &a, &b); *************** *** 439,444 **** if (!(PgInt8_Check(v) && PgInt8_Check(w))) { ! // Ok, we are subtracting mixed mode numbers, first we coerce the ! // numbers to the same type. if (int8_coerce(&v1, &w1)) --- 440,445 ---- if (!(PgInt8_Check(v) && PgInt8_Check(w))) { ! /* Ok, we are subtracting mixed mode numbers, first we coerce */ ! /* the numbers to the same type. */ if (int8_coerce(&v1, &w1)) *************** *** 447,453 **** } ! // Now that the numbers are the same type, we check to see if ! // they are PgInt8s. If not, we call the sub method of the type ! // that they were coerced into. if (!PgInt8_Check(v1)) --- 448,454 ---- } ! /* Now that the numbers are the same type, we check to see if */ ! /* they are PgInt8s. If not, we call the subtract method of */ ! /* the type that they were coerced into. */ if (!PgInt8_Check(v1)) *************** *** 465,469 **** } ! // We are subtracting two PgInt8s. CONVERT_BINOP(v1, w1, &a, &b); --- 466,470 ---- } ! /* We are subtracting two PgInt8s. */ CONVERT_BINOP(v1, w1, &a, &b); *************** *** 535,540 **** if (!(PgInt8_Check(v) && PgInt8_Check(w))) { ! // Ok, we are multiplying mixed mode numbers, first we coerce the ! // numbers to the same type. if (int8_coerce(&v1, &w1)) --- 536,541 ---- if (!(PgInt8_Check(v) && PgInt8_Check(w))) { ! /* Ok, we are subtracting mixed mode numbers, first we coerce */ ! /* the numbers to the same type. */ if (int8_coerce(&v1, &w1)) *************** *** 543,549 **** } ! // Now that the numbers are the same type, we check to see if ! // they are PgInt8s. If not, we call the sub method of the type ! // that they were coerced into. if (!PgInt8_Check(v1)) --- 544,550 ---- } ! /* Now that the numbers are the same type, we check to see if */ ! /* they are PgInt8s. If not, we call the multiply method of */ ! /* the type that they were coerced into. */ if (!PgInt8_Check(v1)) *************** *** 708,713 **** if (!(PgInt8_Check(x) && PgInt8_Check(y))) { ! // Ok, we are subtracting mixed mode numbers, first we coerce the ! // numbers to the same type. if (int8_coerce(&v1, &w1)) --- 709,714 ---- if (!(PgInt8_Check(x) && PgInt8_Check(y))) { ! /* Ok, we are subtracting mixed mode numbers, first we coerce */ ! /* the numbers to the same type. */ if (int8_coerce(&v1, &w1)) *************** *** 716,722 **** } ! // Now that the numbers are the same type, we check to see if ! // they are PgInt8s. If not, we call the sub method of the type ! // that they were coerced into. if (!PgInt8_Check(v1)) --- 717,723 ---- } ! /* Now that the numbers are the same type, we check to see if */ ! /* they are PgInt8s. If not, we call the divide method of the */ ! /* type that they were coerced into. */ if (!PgInt8_Check(v1)) *************** *** 750,755 **** if (!(PgInt8_Check(x) && PgInt8_Check(y))) { ! // Ok, we are subtracting mixed mode numbers, first we coerce the ! // numbers to the same type. if (int8_coerce(&v1, &w1)) --- 751,756 ---- if (!(PgInt8_Check(x) && PgInt8_Check(y))) { ! /* Ok, we are subtracting mixed mode numbers, first we coerce */ ! /* the numbers to the same type. */ if (int8_coerce(&v1, &w1)) *************** *** 758,764 **** } ! // Now that the numbers are the same type, we check to see if ! // they are PgInt8s. If not, we call the sub method of the type ! // that they were coerced into. if (!PgInt8_Check(v1)) --- 759,765 ---- } ! /* Now that the numbers are the same type, we check to see if */ ! /* they are PgInt8s. If not, we call the remainder method of */ ! /* the type that they were coerced into. */ if (!PgInt8_Check(v1)) *************** *** 792,797 **** if (!(PgInt8_Check(x) && PgInt8_Check(y))) { ! // Ok, we are subtracting mixed mode numbers, first we coerce the ! // numbers to the same type. if (int8_coerce(&v1, &w1)) --- 793,798 ---- if (!(PgInt8_Check(x) && PgInt8_Check(y))) { ! /* Ok, we are subtracting mixed mode numbers, first we coerce */ ! /* the numbers to the same type. */ if (int8_coerce(&v1, &w1)) *************** *** 800,806 **** } ! // Now that the numbers are the same type, we check to see if ! // they are PgInt8s. If not, we call the sub method of the type ! // that they were coerced into. if (!PgInt8_Check(v1)) --- 801,807 ---- } ! /* Now that the numbers are the same type, we check to see if */ ! /* they are PgInt8s. If not, we call the divmod method of the */ ! /* type that they were coerced into. */ if (!PgInt8_Check(v1)) *************** *** 835,840 **** if (!(PgInt8_Check(v) && PgInt8_Check(w))) { ! // Ok, we are adding mixed mode numbers, first we coerce the ! // numbers to the same type. if (int8_coerce(&v1, &w1)) --- 836,841 ---- if (!(PgInt8_Check(v) && PgInt8_Check(w))) { ! /* Ok, we are subtracting mixed mode numbers, first we coerce */ ! /* the numbers to the same type. */ if (int8_coerce(&v1, &w1)) *************** *** 843,849 **** } ! // Now that the numbers are the same type, we check to see if ! // they are PgInt8s. If not, we call the add method of the type ! // that they were coerced into. if (!PgInt8_Check(v1)) --- 844,850 ---- } ! /* Now that the numbers are the same type, we check to see if */ ! /* they are PgInt8s. If not, we call the power method of the */ ! /* type that they were coerced into. */ if (!PgInt8_Check(v1)) |