Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/objects/valkyrie_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,8 @@ int Valkyrie::checkOptArg( int optid, QString& argval )

// check the version
QString cmd_qstr = argval + " --version 2>&1";
const char* cmd = cmd_qstr.toLatin1().constData();
QByteArray cmd_bytes = cmd_qstr.toLatin1();
const char* cmd = cmd_bytes.constData();
FILE* fp = popen( cmd, "r" );
if ( !fp ) {
return PERROR_BADFILE;
Expand Down
3 changes: 2 additions & 1 deletion src/options/vk_parse_cmdline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ bool parseCmdArgs( int argc, char** argv, Valkyrie* vk,
while ( true ) {
const vkPoptOption* opt = NULL;
bool done_vk_flags = false;
rc = vkPoptGetNextOpt( optCon, argVal, &opt, done_vk_flags );
rc = vkPoptGetNextOpt( optCon, argVal, sizeof( argVal ),
&opt, done_vk_flags );

if ( rc != PARSED_OK ) {
// an error occurred during option processing
Expand Down
6 changes: 3 additions & 3 deletions src/options/vk_popt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ static const char* vkExpandNextArg( const char* s )
returns 0 on success, PERROR_* on error
*/
int vkPoptGetNextOpt( vkPoptContext con,
char* arg_val/*OUT*/,
char* arg_val/*OUT*/, size_t arg_val_size,
const vkPoptOption** opt_ret/*OUT*/,
bool& done_vk_flags/*OUT*/ )
{
Expand Down Expand Up @@ -359,8 +359,8 @@ int vkPoptGetNextOpt( vkPoptContext con,
longArg = NULL;

// store the argument value for checking
if ( con->os->nextArg ) {
sprintf( arg_val, "%s", con->os->nextArg );
if ( con->os->nextArg && arg_val != NULL && arg_val_size > 0 ) {
snprintf( arg_val, arg_val_size, "%s", con->os->nextArg );
}
} // end of "if ! VkOPT::ARG_NONE"

Expand Down
2 changes: 1 addition & 1 deletion src/options/vk_popt.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ extern "C" {

/* get next option opt_ret
returns 0 on success, PERROR_* on error */
int vkPoptGetNextOpt( vkPoptContext con, char* arg_val,
int vkPoptGetNextOpt( vkPoptContext con, char* arg_val, size_t arg_val_size,
const vkPoptOption** opt/*OUT*/,
bool& done_vk_flags/*OUT*/ );

Expand Down
8 changes: 4 additions & 4 deletions src/toolview/vglogview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,8 @@ void ErrorItem::showFullSrcPath( bool show )
StackItem* stack = (StackItem*)child( i );
if ( stack->elemType() == VG_ELEM::STACK ) {
// multiple frames
for ( int i=0; i<stack->childCount(); ++i ) {
VgOutputItem* item = (VgOutputItem*)stack->child( i );
for ( int j=0; j<stack->childCount(); ++j ) {
VgOutputItem* item = (VgOutputItem*)stack->child( j );
if ( item->elemType() == VG_ELEM::FRAME ) {
QString text = ((FrameItem*)item)->describe_IP( show );
item->setText( text );
Expand Down Expand Up @@ -1213,8 +1213,8 @@ void VgLogView::updateErrorItems( QDomElement ec )

// search errorcount pairs for err_unique
QDomNodeList pairs = ec.childNodes();
for ( int i = 0; i < pairs.count(); i++ ) {
QDomNode pair = pairs.item( i );
for ( int j = 0; j < pairs.count(); j++ ) {
QDomNode pair = pairs.item( j );
QDomNodeList pair_details = pair.childNodes();
QString unique = pair_details.item( 1 ).toElement().text();

Expand Down
4 changes: 2 additions & 2 deletions src/utils/vk_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,12 @@ QString vk_mkstemp( QString filepath, QString ext/*=QString()*/ )
/* something went wrong */
VK_DEBUG( "failed to create unique filename from '%s'.",
qPrintable( filepath ) );
vk_str_free( tmpname );
return QString();
}

unique = QString( tmpname );
tmpname = vk_str_free( tmpname );
vk_str_free( tmpname );
}

return unique;
Expand Down Expand Up @@ -670,4 +671,3 @@ QString vkDirCfgDialog( QWidget* parent,
}
#endif