if (obj_get_parent(obj) == NULL)
{
module = obj_get_name(obj_get_module(info->old_parent));
- strcpy(full_name, module);
- strcat(full_name, " :: ");
- strcat(full_name, obj_get_name(obj));
+ snprintf(full_name, sizeof(full_name), "%s :: %s", module, obj_get_name(obj));
name = full_name;
}
else
user_file_name = init_info->argv[1];
}
- strcpy(file_name, user_file_name);
+ snprintf(file_name, sizeof(file_name), "%s", user_file_name);
if (!util_file_exists(file_name))
{
*file_name = 0;
/* store off original clipboard menu name and temporarily
* set it to a dummy string.
*/
- strcpy(namebuf, obj_get_name(pms->clipboard_menu));
+ snprintf(namebuf, sizeof(namebuf), "%s", obj_get_name(pms->clipboard_menu));
obj_set_name(pms->clipboard_menu, "MENU_DUMMY");
/* duplicate clipboard menu & menu-items */
/* Use the name of the module as the string
* for the dynamic menu.
*/
- strcpy(name, obj_get_name(module));
- strcat(name, "...");
+ snprintf(name, sizeof(name), "%s...", obj_get_name(module));
label = XmStringCreateLocalized(name);
mpb = XtVaCreateManagedWidget(name,
xmPushButtonWidgetClass,
XtFree(title);
textf = XmFileSelectionBoxGetChild(AB_generic_chooser,
XmDIALOG_TEXT);
- strcpy(init_name, (char *)obj_get_name(obj));
- strcat(init_name, ".bil");
+ snprintf(init_name, sizeof(init_name), "%s.bil", (char *)obj_get_name(obj));
XmTextFieldSetString(textf, init_name);
XtManageChild(AB_generic_chooser);
ui_win_front(AB_generic_chooser);
XtFree(title);
textf = XmFileSelectionBoxGetChild(AB_generic_chooser,
XmDIALOG_TEXT);
- strcpy(init_name, (char *)obj_get_name(proj_get_project()));
- strcat(init_name, ".bip");
+ snprintf(init_name, sizeof(init_name), "%s.bip", (char *)obj_get_name(proj_get_project()));
XmTextFieldSetString(textf, init_name);
XtManageChild(AB_generic_chooser);
ui_win_front(AB_generic_chooser);
/* Save the old project directory before chdir'ing
* to the new one.
*/
- strcpy(old_proj_dir, ab_get_cur_dir());
+ snprintf(old_proj_dir, sizeof(old_proj_dir), "%s", ab_get_cur_dir());
/*
* Compose the project file name.
*/
- strcpy(new_filename, file);
+ snprintf(new_filename, sizeof(new_filename), "%s", file);
abio_expand_bil_proj_path(new_filename);
/*
XtFree(title);
textf = XmFileSelectionBoxGetChild(AB_generic_chooser,
XmDIALOG_TEXT);
- strcpy(init_name, (char *)obj_get_name(obj));
- strcat(init_name, ".bil");
+ snprintf(init_name, sizeof(init_name), "%s.bil", (char *)obj_get_name(obj));
XmTextFieldSetString(textf, init_name);
XtManageChild(AB_generic_chooser);
ui_win_front(AB_generic_chooser);
*/
if ((obj_get_file(module) == NULL) || encap_file)
{
- strcpy(tmp_path, obj_get_name(module));
+ snprintf(tmp_path, sizeof(tmp_path), "%s", obj_get_name(module));
abio_expand_file(tmp_path, mod_exp_file);
if ( !util_file_exists(mod_exp_file) )
{
filename = XmTextFieldGetString(textf);
if (util_strempty(filename))
- strcpy(init_name, (char *)obj_get_name(proj_get_project()));
+ snprintf(init_name, sizeof(init_name), "%s", (char *)obj_get_name(proj_get_project()));
else
util_check_name(filename, init_name);
** exported. If a filename is specified, it might be either .bil or .uil.
*/
if (util_strempty(filename))
- strcpy(init_name, (char *)obj_get_name(module_obj));
+ snprintf(init_name, sizeof(init_name), "%s", (char *)obj_get_name(module_obj));
else
proj_get_file_basename(filename, init_name);
ab_set_busy_cursor(TRUE);
*bix_file = 0;
- strcpy(bix_file, file);
+ snprintf(bix_file, sizeof(bix_file), "%s", file);
if( abio_expand_bil_encapsulated_path(bix_file) != -1 )
{
if( !util_file_exists(bix_file) )
/* Determine whether this is a foreground or background color field
* and store the corresponding color-default in user-data.
*/
- strcpy(swatch_name, XtName(swatch));
+ snprintf(swatch_name, sizeof(swatch_name), "%s", XtName(swatch));
if (strstr(swatch_name, "bg"))
default_pix = WhitePixelOfScreen(XtScreen(swatch));
else
XmNrecomputeSize, (XtArgVal)False,
NULL);
- strcpy(swatch_name, XtName(swatch));
+ snprintf(swatch_name, sizeof(swatch_name), "%s", XtName(swatch));
/* Setup Prop Sheet changebar mechanism */
propP_changebar_init(changebar, menubutton);
}
else
{
- strcpy(filebase, filename);
+ snprintf(filebase, sizeof(filebase), "%s", filename);
/* Look to see if user typed in the full filename for the Graphic.
* If so, strip off the extension and mark stripped to be True.
*/
switch(iobj->label_type)
{
case AB_LABEL_SEPARATOR:
- strcpy(namebuf, obj_get_name(iobj));
+ snprintf(namebuf, sizeof(namebuf), "%s", obj_get_name(iobj));
starts = strstr(namebuf, SeparatorNamebase);
namebase = strtok(starts, "_");
break;
new_xmitem_array[0] = NULL;
}
}
+
+ return OK;
}
else
{
char fileName[MAX_PATH_SIZE];
- strcpy(fileName, arg);
- strcat(fileName, ".bil");
+ snprintf(fileName, sizeof(fileName), "%s.bil", arg);
newFile = istr_create(fileName);
}
if (obj_get_file(module) != NULL)
{
- strcpy(fileName, obj_get_file(module));
+ snprintf(fileName, sizeof(fileName), "%s", obj_get_file(module));
}
else
{
- strcpy(fileName, obj_get_name(module));
+ snprintf(fileName, sizeof(fileName), "%s", obj_get_name(module));
if (!util_file_name_has_ab_extension(fileName))
{
strcat(fileName, ".bil");
cvt_to_obj(STRING fileName)
{
static char buf[MAXPATHLEN] = "";
- strcpy(buf, fileName);
+ snprintf(buf, sizeof(buf), "%s", fileName);
buf[strlen(buf)-1] = 'o';
return buf;
}
char *project_name = obj_get_name(obj);
char proj_suffixed_name[BUFSIZ];
- strcpy(proj_suffixed_name, project_name);
- strcat(proj_suffixed_name, "_project");
+ snprintf(proj_suffixed_name, sizeof(proj_suffixed_name), "%s_project", project_name);
msg_set = MsgFile_sure_find_msg_set(msg_file, proj_suffixed_name);
prev_msg_set = msg_set;
ret_val = (MsgFile)NULL;
}
- strcpy(proj_name_suffixed, project_name);
- strcat(proj_name_suffixed, "_project");
+ snprintf(proj_name_suffixed, sizeof(proj_name_suffixed), "%s_project", project_name);
if (MsgFile_sure_find_msg_set(new_msg_file, strdup(proj_name_suffixed))
== (MsgSet)NULL)
goto epilogue;
}
- strcpy(fieldNameBuf, obj_get_name(obj));
+ snprintf(fieldNameBuf, sizeof(fieldNameBuf), "%s", obj_get_name(obj));
abmfP_uncapitalize_first_char(fieldNameBuf);
if (substructObj != NULL)
{
return NULL;
}
- strcpy(name, abmfP_get_c_struct_ptr_type_name(obj));
- strcat(name, "Rec");
+ snprintf(name, sizeof(name), "%sRec", abmfP_get_c_struct_ptr_type_name(obj));
return_c_ident(name);
}
{
return NULL;
}
- strcpy(name, typePrefixString);
- strcat(name, abmfP_capitalize_first_char(varName));
- strcat(name, "Info");
+ snprintf(name, sizeof(name), "%s%sInfo", typePrefixString, abmfP_capitalize_first_char(varName));
cvt_ident_to_type(name);
return_c_ident(name);
abmfP_get_c_substruct_field_name(ABObj obj)
{
static char fieldName[MAX_NAME_SIZE];
- strcpy(fieldName, abmfP_uncapitalize_first_char(obj_get_name(obj)));
- strcat(fieldName, "_items");
+ snprintf(fieldName, sizeof(fieldName), "%s_items", abmfP_uncapitalize_first_char(obj_get_name(obj)));
return_c_ident(fieldName);
}
{
return NULL;
}
- strcpy(typeName, ptrTypeName);
- strcat(typeName, "Rec");
+ snprintf(typeName, sizeof(typeName), "%sRec", ptrTypeName);
return_c_ident(typeName);
}
{
strcpy(ptrTypeName, typePrefixString);
strcat(ptrTypeName,
- abmfP_capitalize_first_char(obj_get_name(module)));
+ abmfP_capitalize_first_char(obj_get_name(module)));
strcat(ptrTypeName, abmfP_capitalize_first_char(varName));
strcat(ptrTypeName, "Items");
cvt_ident_to_type(ptrTypeName);
{
return NULL;
}
- strcpy(name, ptrTypeName);
- strcat(name, "_");
- strcat(name, "clear");
+ snprintf(name, sizeof(name), "%s_clear", ptrTypeName);
return_c_ident(abmfP_uncapitalize_first_char(name));
}
name =abmfP_get_widget_name(objectObj);
if ((name != NULL) && (name != nameBuf))
{
- strcpy(nameBuf, name);
+ snprintf(nameBuf, sizeof(nameBuf), "%s", name);
}
if ((*nameBuf) != 0)
{
abmfP_get_widget_name_for_res_file(ABObj obj)
{
static char name[MAX_NAME_SIZE];
+ char nameTemp[sizeof(MAX_NAME_SIZE)];
*name = 0;
assert(abmfP_parent(obj) != NULL);
/* we can't use abmfP_get_widget_name twice in the same printf,
* because of the static string buffer.
*/
- strcpy(name, abmfP_get_app_class_name(obj));
- strcat(name, "*");
- strcat(name, abmfP_get_widget_name(container));
- strcat(name, "*");
- strcat(name, abmfP_get_widget_name(obj));
+ snprintf(nameTemp, sizeof(nameTemp), "%s*%s*",
+ abmfP_get_app_class_name(obj),
+ abmfP_get_widget_name(container));
+ snprintf(name, sizeof(name), "%s%s",
+ nameTemp,
+ abmfP_get_widget_name(obj));
}
return name;
}
abmfP_build_instance_prefix(ABObj obj, STRING prefixBuf, int prefixBufSize)
{
char tmpBuf[1024] = "";
+ char tmpBuf2[1024] = "";
ABObj module= obj_get_module(obj);
if (module == NULL)
}
else
{
- strcpy(tmpBuf, identPrefixString);
- strcat(tmpBuf, obj_get_name(module));
- strcat(tmpBuf, "_");
- strcat(tmpBuf, obj_get_name(obj));
+ /* Warning: Due to obj_get_name() returning a pointer to
+ * static data this cannot be one snprintf() */
+ snprintf(tmpBuf2, sizeof(tmpBuf2), "%s%s_",
+ identPrefixString, obj_get_name(module));
+ snprintf(tmpBuf, sizeof(tmpBuf), "%s%s",
+ tmpBuf2, obj_get_name(obj));
cvt_type_to_ident(tmpBuf, prefixBuf, prefixBufSize);
}
ABObj root_window= abmfP_get_root_window(project);
*root_widget_name = 0;
- strcpy(root_widget_name, abmfP_lib_get_toplevel_widget->name);
- strcat(root_widget_name, "()");
+ snprintf(root_widget_name, sizeof(root_widget_name), "%s()", abmfP_lib_get_toplevel_widget->name);
return root_widget_name;
}
{
static char name[MAX_NAME_SIZE];
- strcpy(name, abmfP_get_c_struct_global_name(msgObj));
- strcat(name, "_initialize");
+ snprintf(name, sizeof(name), "%s_initialize", abmfP_get_c_struct_global_name(msgObj));
return_c_ident(name);
}
}
else
{
- strcpy(winParentName, abmfP_get_c_name(genCodeInfo, winParent));
+ snprintf(winParentName, sizeof(winParentName), "%s", abmfP_get_c_name(genCodeInfo, winParent));
}
abio_printf(codeFile, "%s(%s, %s);\n",
abmfP_get_init_proc_name(window),
}
else
{
- strcpy(winParentName, abmfP_get_c_name(genCodeInfo, winParent));
+ snprintf(winParentName, sizeof(winParentName), "%s", abmfP_get_c_name(genCodeInfo, winParent));
}
/*
static char new_name[MAXPATHLEN];
char *p;
- strcpy(new_name, mname);
+ snprintf(new_name, sizeof(new_name), "%s", mname);
p = (char *) strrchr(new_name, '.');
if (p)
p = (char *) strrchr(p, '.');
if (targetObj == NULL)
{
- strcpy(targetStructPtrName, abmfP_str_null);
+ snprintf(targetStructPtrName, sizeof(targetStructPtrName), "%s", abmfP_str_null);
}
else
{
if (str != name) /* if we get called w/our own buffer, don't copy */
{
- strcpy(name, str);
+ snprintf(name, sizeof(name), "%s", str);
}
name[0] = toupper(str[0]);
if (str != name) /* if we get called w/our own buffer, don't copy */
{
- strcpy(name, str);
+ snprintf(name, sizeof(name), "%s", str);
}
name[0] = tolower(str[0]);
if ((left_attach_type == AB_ATTACH_CENTER_GRIDLINE) &&
(top_attach_type == AB_ATTACH_CENTER_GRIDLINE))
return("DTB_CENTER_POSITION_BOTH");
+
+ return("DTB_CENTER_NONE");
}
BOOL
case AB_GROUP_ROWSCOLUMNS:
return("DTB_GROUP_ROWSCOLUMNS");
}
+
+ return("DTB_GROUP_NONE");
}
STRING
}
-
+int
abmfP_write_clear_proc_begin(
GenCodeInfo genCodeInfo,
ABObj obj
}
+int
abmfP_write_init_proc_decl(
GenCodeInfo genCodeInfo,
ABObj obj
NULL /* Argument name */
);
}
+ return 0;
}
-
+int
abmfP_write_init_proc_begin(
GenCodeInfo genCodeInfo,
ABObj obj
obj_set_name(ab_widget, ab_name);
- strcpy(class_name, ab_map_entry->widget_name);
+ snprintf(class_name, sizeof(class_name), "%s", ab_map_entry->widget_name);
class_name[0] = tolower(class_name[0]);
strcat(class_name, CLASS_SUFFIX);
obj_set_class_name(ab_widget, class_name);
if (widget_instance_name == NULL)
return(util_strsafe(widget_instance_name));
- strcpy(buf, widget_instance_name);
- strcat(buf, INSTANCE_SUFFIX);
+ snprintf(buf, sizeof(buf), "%s%s", widget_instance_name, INSTANCE_SUFFIX);
return(buf);
}
char filename[512];
STRING ext;
- strcpy(filename, istr_string(value));
+ snprintf(filename, sizeof(filename), "%s", istr_string(value));
if (util_file_name_has_extension(filename, "pm") ||
util_file_name_has_extension(filename, "xpm") ||
util_file_name_has_extension(filename, "bm") ||
* Assume: indent char is tab
*/
assert(abio_get_indent_char(outFile) == '\t');
- strcpy(attrbuf, bilP_token_to_string(attr));
+ snprintf(attrbuf, sizeof(attrbuf), "%s", bilP_token_to_string(attr));
attrLen = strlen(attrbuf);
attrWidth = (abio_get_indent(outFile) * 8) + attrLen;
firstWidthIter = TRUE; /* go through at least once */
{
obj_set_max_length(obj, tmp_int);
}
+
+ return 0;
}
/*
abil_print_load_err(int errmsg)
{
static BOOL errmsg_tbl_init = FALSE;
- char msg[1024];
+ char msg[1024] = "";
int msgLen = 0;
- *msg = 0;
- *msg = 0;
/*
** Load up the error message table if this is the first time we've
** needed to output an error message.
if (!abil_loadmsg_err_printed())
{
if(Errormsg[errmsg].msg_id < 0) {
- strcat(msg, catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET, 33,
+ snprintf(msg, sizeof(msg), "%s", catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET, 33,
"syntax error"));
}
else {
- strcat(msg,
+ snprintf(msg, sizeof(msg), "%s",
catgets(ABIL_MESSAGE_CATD, ABIL_MESSAGE_SET,
Errormsg[errmsg].msg_id,
Errormsg[errmsg].def_str));
return (obj->info.container.pane_min);
if (obj_is_layers(obj))
return (obj->info.layer.pane_min);
+
+ return -1;
}
int
return (obj->info.container.pane_max);
if (obj_is_layers(obj))
return (obj->info.layer.pane_max);
+
+ return -1;
}
int
if (filename != NULL)
{
if (p = (char *) strrchr(filename, '/'))
- strcpy(buf, p + 1);
+ snprintf(buf, sizeof(buf), "%s", p + 1);
else
- strcpy(buf, filename);
+ snprintf(buf, sizeof(buf), "%s", filename);
if (p = (char *) strrchr(buf, '.'))
*p = '\0';
while(XmStringGetNextSegment(context, &seg,
&char_set_tag, &dir, &sep))
{
- p += (strlen(strcpy(p, seg)));
+ snprintf(p, sizeof(buf), "%s", seg);
+ p += (strlen(p));
if (sep == TRUE)
{
*p++ = '\n';
/*
* Expand the file name and store to it.
*/
- strcpy(Buf, file);
+ snprintf(Buf, sizeof(Buf), "%s", file);
if (abio_expand_bil_module_path(Buf) == -1)
return -1;