diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-02-14 15:03:26 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-02-14 15:03:26 (GMT) |
commit | d315baab70f48cdc5618152774cecd5ac3b5fa50 (patch) | |
tree | f16fd9a5c6af0e8ef08974d24917c4cf74c4e52b /win/tkWinGDI.c | |
parent | 535f5f5059e888e034ce33f8419a16b64da97e40 (diff) | |
download | tk-d315baab70f48cdc5618152774cecd5ac3b5fa50.zip tk-d315baab70f48cdc5618152774cecd5ac3b5fa50.tar.gz tk-d315baab70f48cdc5618152774cecd5ac3b5fa50.tar.bz2 |
Tcl_Alloc -> ckalloc. Remove unnecessary type-casts.
Diffstat (limited to 'win/tkWinGDI.c')
-rw-r--r-- | win/tkWinGDI.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/win/tkWinGDI.c b/win/tkWinGDI.c index 4cb63b1..33cfc5a 100644 --- a/win/tkWinGDI.c +++ b/win/tkWinGDI.c @@ -85,22 +85,22 @@ static void GetDisplaySize(LONG *width, LONG *height); static int GdiWordToWeight(const char *str); static int GdiParseFontWords(Tcl_Interp *interp, LOGFONTW *lf, const char *str[], int numargs); -static int PrintSelectPrinter(ClientData clientData, +static int PrintSelectPrinter(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int PrintOpenPrinter(ClientData clientData, +static int PrintOpenPrinter(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int PrintClosePrinter(ClientData clientData, +static int PrintClosePrinter(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int PrintOpenDoc(ClientData clientData, Tcl_Interp *interp, +static int PrintOpenDoc(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int PrintCloseDoc(ClientData clientData, Tcl_Interp *interp, +static int PrintCloseDoc(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int PrintOpenPage(ClientData clientData, Tcl_Interp *interp, +static int PrintOpenPage(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int PrintClosePage(ClientData clientData, +static int PrintClosePage(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -481,7 +481,7 @@ static int GdiPhoto( * recoverable. */ - pbuf = (char *) Tcl_AttemptAlloc(sll * ny * sizeof(char)); + pbuf = (char *)attemptckalloc(sll * ny * sizeof(char)); if (pbuf == 0) { /* Memory allocation failure. */ Tcl_AppendResult(interp, "::tk::print::_gdi photo failed--out of memory", NULL); @@ -546,7 +546,7 @@ static int GdiPhoto( SetBrushOrgEx(dst, pt.x, pt.y, &pt); } - Tcl_Free(pbuf); + ckfree(pbuf); if (retval == TCL_OK) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -582,7 +582,7 @@ static int Bezierize( int nbpoints = 0; POINT* bpoints; - inPointList = (double *) Tcl_AttemptAlloc(2 * sizeof(double) * npoly); + inPointList = (double *)attemptckalloc(2 * sizeof(double) * npoly); if (inPointList == 0) { /* TODO: unreachable */ return nbpoints; /* 0. */ @@ -594,21 +594,21 @@ static int Bezierize( } nbpoints = 1 + npoly * nStep; /* this is the upper limit. */ - outPointList = (double *) Tcl_AttemptAlloc(2 * sizeof(double) * nbpoints); + outPointList = (double *)attemptckalloc(2 * sizeof(double) * nbpoints); if (outPointList == 0) { /* TODO: unreachable */ - Tcl_Free((void *) inPointList); + ckfree((void *) inPointList); return 0; } nbpoints = TkMakeBezierCurve(NULL, inPointList, npoly, nStep, NULL, outPointList); - Tcl_Free((void *) inPointList); - bpoints = (POINT *) Tcl_AttemptAlloc(sizeof(POINT)*nbpoints); + ckfree((void *) inPointList); + bpoints = (POINT *)attemptckalloc(sizeof(POINT)*nbpoints); if (bpoints == 0) { /* TODO: unreachable */ - Tcl_Free((void *) outPointList); + ckfree((void *) outPointList); return 0; } @@ -616,7 +616,7 @@ static int Bezierize( bpoints[n].x = (long) outPointList[2*n]; bpoints[n].y = (long) outPointList[2*n + 1]; } - Tcl_Free((void *) outPointList); + ckfree((void *) outPointList); *bpointptr = *bpoints; return nbpoints; } @@ -681,7 +681,7 @@ static int GdiLine( hDC = printDC; - polypoints = (POINT *) Tcl_AttemptAlloc((argc - 1) * sizeof(POINT)); + polypoints = (POINT *)attemptckalloc((argc - 1) * sizeof(POINT)); if (polypoints == 0) { Tcl_AppendResult(interp, "Out of memory in GdiLine", NULL); return TCL_ERROR; @@ -712,7 +712,7 @@ static int GdiLine( objv += 2; } else { /* Only one number... Assume a usage error. */ - Tcl_Free((void *)polypoints); + ckfree((void *)polypoints); Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } @@ -826,7 +826,7 @@ static int GdiLine( Polyline(hDC, polypoints, npoly); /* Out of memory? Just draw a regular line. */ } if (bpoints != 0) { - Tcl_Free((void *)bpoints); + ckfree((void *)bpoints); } } else { Polyline(hDC, polypoints, npoly); @@ -918,7 +918,7 @@ static int GdiLine( GdiFreeBrush(interp, hDC, hBrush); } - Tcl_Free((void *)polypoints); + ckfree((void *)polypoints); return TCL_OK; } @@ -1091,7 +1091,7 @@ static int GdiPolygon( hDC = printDC; - polypoints = (POINT *) Tcl_AttemptAlloc((argc - 1) * sizeof(POINT)); + polypoints = (POINT *)attemptckalloc((argc - 1) * sizeof(POINT)); if (polypoints == 0) { /* TODO: unreachable */ Tcl_AppendResult(interp, "Out of memory in GdiLine", NULL); @@ -1122,7 +1122,7 @@ static int GdiPolygon( objv += 2; } else { /* Only one number... Assume a usage error. */ - Tcl_Free((void *) polypoints); + ckfree((void *) polypoints); Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } @@ -1198,7 +1198,7 @@ static int GdiPolygon( Polygon(hDC, polypoints, npoly); } if (bpoints != 0) { - Tcl_Free((void *)bpoints); + ckfree((void *)bpoints); } } else { Polygon(hDC, polypoints, npoly); @@ -1213,7 +1213,7 @@ static int GdiPolygon( SelectObject(hDC, oldobj); } - Tcl_Free((void *)polypoints); + ckfree((void *)polypoints); return TCL_OK; } @@ -2642,7 +2642,7 @@ static int GdiMakeLogFont( GdiParseFontWords(interp, lf, list+2, count-2); } - Tcl_Free((char *)list); + ckfree(list); return 1; } @@ -2706,7 +2706,7 @@ static int GdiMakePen( if (dashstyle != 0 && dashstyledata != 0) { const char *cp; size_t i; - char *dup = (char *) Tcl_Alloc(strlen(dashstyledata) + 1); + char *dup = (char *) ckalloc(strlen(dashstyledata) + 1); strcpy(dup, dashstyledata); /* DEBUG. */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -2749,7 +2749,7 @@ static int GdiMakePen( dashstyle = 0; } if (dup) { - Tcl_Free(dup); + ckfree(dup); } } @@ -3654,8 +3654,8 @@ static int PrintSelectPrinter( * script level. */ if (localPrinterName != NULL) { - char* varlink1 = (char*)Tcl_Alloc(100 * sizeof(char)); - char** varlink2 = (char**)Tcl_Alloc(sizeof(char*)); + char* varlink1 = (char*)ckalloc(100 * sizeof(char)); + char** varlink2 = (char**)ckalloc(sizeof(char*)); *varlink2 = varlink1; WideCharToMultiByte(CP_UTF8, 0, localPrinterName, -1, varlink1, 0, NULL, NULL); |