From 64eacd3665306283d126d0df7cf63a071e576c38 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 14 Oct 2011 21:22:26 -0700 Subject: Constify filename string handling Signed-off-by: Alan Coopersmith --- Bitmap.c | 20 +++++++++++--------- Bitmap.h | 10 +++++----- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Bitmap.c b/Bitmap.c index 48bc976..e8db7be 100644 --- a/Bitmap.c +++ b/Bitmap.c @@ -644,10 +644,11 @@ BWPutImage(BitmapWidget w, Display *display, Drawable drawable, GC gc, #endif static String -StripFilename(String filename) +StripFilename(_Xconst _XtString filename) { - char *begin = strrchr(filename, '/'); - char *end, *result; + const char *begin = strrchr(filename, '/'); + const char *end; + char *result; int length; if (filename) { @@ -664,7 +665,8 @@ StripFilename(String filename) } static int -XmuWriteBitmapDataToFile(String filename, String basename, +XmuWriteBitmapDataToFile(_Xconst _XtString filename, + _Xconst _XtString basename, int width, int height, char *datap, int x_hot, int y_hot) { @@ -993,7 +995,7 @@ FixMark(BitmapWidget BW) /* ARGSUSED */ int -BWStoreFile(Widget w, String filename, String *basename) +BWStoreFile(Widget w, _Xconst _XtString filename, _Xconst _XtString *basename) { BitmapWidget BW = (BitmapWidget) w; int status; @@ -1032,7 +1034,7 @@ BWUnparseStatus(Widget w) } void -BWChangeFilename(Widget w, String str) +BWChangeFilename(Widget w, _Xconst _XtString str) { BitmapWidget BW = (BitmapWidget) w; @@ -1043,7 +1045,7 @@ BWChangeFilename(Widget w, String str) } void -BWChangeBasename(Widget w, String str) +BWChangeBasename(Widget w, _Xconst _XtString str) { BitmapWidget BW = (BitmapWidget) w; @@ -1055,7 +1057,7 @@ BWChangeBasename(Widget w, String str) int -BWReadFile(Widget w, String filename, String basename) /* ARGSUSED */ +BWReadFile(Widget w, _Xconst _XtString filename, _Xconst _XtString basename) /* ARGSUSED */ { BitmapWidget BW = (BitmapWidget) w; int status; @@ -1152,7 +1154,7 @@ BWSetImage(Widget w, XImage *image) #endif int -BWWriteFile(Widget w, String filename, String basename) +BWWriteFile(Widget w, _Xconst _XtString filename, _Xconst _XtString basename) { BitmapWidget BW = (BitmapWidget) w; char *data; diff --git a/Bitmap.h b/Bitmap.h index 5f706dc..73c3939 100644 --- a/Bitmap.h +++ b/Bitmap.h @@ -224,12 +224,12 @@ extern void BWGrabSelection ( Widget w, Time btime ); extern void BWRequestSelection ( Widget w, Time btime, Boolean wait ); extern void BWSetChanged ( Widget w ); extern Boolean BWQueryChanged ( Widget w ); -extern int BWReadFile ( Widget w, String filename, String basename ); -extern int BWWriteFile ( Widget w, String filename, String basename ); +extern int BWReadFile ( Widget w, _Xconst _XtString filename, _Xconst _XtString basename ); +extern int BWWriteFile ( Widget w, _Xconst _XtString filename, _Xconst _XtString basename ); extern String BWUnparseStatus ( Widget w ); extern String BWGetFilename ( Widget w, String *str ); extern String BWGetBasename ( Widget w, String *str ); -extern void BWChangeBasename ( Widget w, String str ); +extern void BWChangeBasename ( Widget w, _Xconst _XtString str ); extern void BWRemoveAllRequests ( Widget w ); extern void BWClearHotSpot ( Widget w ); extern Boolean BWQueryMarked ( Widget w ); @@ -264,10 +264,10 @@ extern Boolean BWQueryDashed ( Widget w ); extern Boolean BWQueryProportional ( Widget w ); extern void BWSwitchProportional ( Widget w ); extern void BWDrawGrid ( Widget w, Position from_x, Position from_y, Position to_x, Position to_y ); -extern void BWChangeFilename ( Widget w, String str ); +extern void BWChangeFilename ( Widget w, _Xconst _XtString str ); extern Boolean BWParseSize ( String size, Dimension *width, Dimension *height ); extern Boolean BWQuerySelection ( Widget w, Time btime ); -extern int BWStoreFile ( Widget w, String filename, String *basename ); +extern int BWStoreFile ( Widget w, _Xconst _XtString filename, _Xconst _XtString *basename ); extern void BWNotify ( Widget w, XtActionProc proc ); extern void BWTMark ( Widget w, XEvent *event, String *params, Cardinal *num_params ); extern void BWTMarkAll ( Widget w, XEvent *event, String *params, Cardinal *num_params ); -- cgit v1.2.3